detailOrder.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. // 计费详单
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <el-form :inline="true" style="margin-top :5px">
  6. <el-form-item>
  7. <el-select
  8. v-model="screen"
  9. placeholder="请选择需筛选的内容"
  10. clearable
  11. class="elSelect"
  12. >
  13. <el-option
  14. v-for="item in options"
  15. :key="item.value"
  16. :label="item.label"
  17. :value="item.value"
  18. >
  19. </el-option>
  20. </el-select>
  21. <el-input
  22. style="width:200px"
  23. v-model="input"
  24. placeholder="请输入查询条件"
  25. clearable
  26. ></el-input>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-select
  30. v-model="screen1"
  31. placeholder="请选择需筛选的内容"
  32. clearable
  33. class="elSelect"
  34. >
  35. <el-option
  36. v-for="item in optionsF"
  37. :key="item.value"
  38. :label="item.label"
  39. :value="item.value"
  40. >
  41. </el-option>
  42. </el-select>
  43. <el-input
  44. style="width:200px"
  45. v-model="input1"
  46. placeholder="请输入查询条件"
  47. clearable
  48. ></el-input>
  49. </el-form-item>
  50. <span>净重时间:</span>
  51. <el-date-picker
  52. v-model="startTime"
  53. type="datetime"
  54. placeholder="选择日期"
  55. style="width:200px"
  56. >
  57. </el-date-picker>
  58. <span>至</span>
  59. <el-date-picker
  60. v-model="endTime"
  61. type="datetime"
  62. placeholder="选择日期"
  63. style="width:200px"
  64. >
  65. </el-date-picker>
  66. <el-button type="primary" class="btn" @click="onclick">
  67. <i class="el-icon-search"></i>
  68. </el-button>
  69. <el-button type="primary" @click="exportAllExcel"
  70. ><i class="el-icon-download"></i>Excel</el-button
  71. >
  72. <el-button type="primary" @click="newSettle">生成详单</el-button>
  73. </el-form>
  74. </div>
  75. <div class="table">
  76. <el-tabs v-model="activeName" tab-click="handClick">
  77. <!-- 未结算 -->
  78. <el-tab-pane label="未结算" name="first">
  79. <dilTable
  80. v-bind.sync="options1"
  81. ref="excelDom"
  82. @func="func"
  83. ></dilTable>
  84. </el-tab-pane>
  85. <!-- 已结算 -->
  86. <el-tab-pane label="已结算" name="second">
  87. <dilTable v-bind.sync="options2" @func="func2"> </dilTable>
  88. </el-tab-pane>
  89. <el-tab-pane label="未生成详单" name="third" v-if="isShow">
  90. <dilTable v-bind.sync="options3" @func="func3"> </dilTable>
  91. </el-tab-pane>
  92. </el-tabs>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import { getCookie } from '@/utils/util.js'
  98. import { sjTime } from '@/utils/sharedJsFile'
  99. export default {
  100. data() {
  101. return {
  102. options: [
  103. {
  104. value: '用车单位',
  105. label: '用车单位'
  106. },
  107. {
  108. value: '货物名称',
  109. label: '货物名称'
  110. },
  111. {
  112. value: '车牌号',
  113. label: '车牌号'
  114. },
  115. {
  116. value: '承运起止范围',
  117. label: '承运起止范围'
  118. }
  119. ],
  120. optionsF: [
  121. {
  122. value: '用车单位',
  123. label: '用车单位'
  124. },
  125. {
  126. value: '货物名称',
  127. label: '货物名称'
  128. },
  129. {
  130. value: '车牌号',
  131. label: '车牌号'
  132. },
  133. {
  134. value: '承运起止范围',
  135. label: '承运起止范围'
  136. }
  137. ],
  138. screen: null,
  139. screen1: null,
  140. startTime: null,
  141. endTime: null,
  142. //合计净重
  143. totalNetWeight: null,
  144. //合计金额
  145. totalMoney: null,
  146. //单价
  147. Fee: null,
  148. //加载
  149. selectLineLoading: false,
  150. input: null,
  151. input1: null,
  152. activeName: 'first',
  153. ssoId: null,
  154. //详单Id
  155. detailsId: null,
  156. options1: {
  157. // first请求数据的地址
  158. requestUrl: ''
  159. },
  160. options2: {
  161. // second请求数据的地址
  162. requestUrl: ''
  163. },
  164. options3: {
  165. requestUrl: ''
  166. },
  167. //是否打开修改详单地址弹出框
  168. dialogFormVisible: false,
  169. //原详单单价
  170. originalPriceValue: null,
  171. //新详单单价
  172. newPriceValue: null,
  173. //原详单地址
  174. originalAddress: null,
  175. //新详单地址
  176. newAddress: null,
  177. //新单价Id
  178. priceId: null,
  179. //运输单价的表格
  180. Address: {
  181. requestUrl: '/api/v1/ams/getAddressDeliveryAddress?apiId=255',
  182. selectionType: 'radio'
  183. },
  184. // addressText:null,
  185. //缓存当前选中的运输单价
  186. priceMap: {},
  187. formLabelWidth: '125px',
  188. tableTitle: '内转计重详单',
  189. exportAllList: [],
  190. noSettleDetailsColumn: [],
  191. settleDetailsColumn: [],
  192. noDetailsColumn: [],
  193. orderList1: [],
  194. orderList2: [],
  195. orderList3: [],
  196. loginName: ''
  197. }
  198. },
  199. created() {
  200. this.loginName = this.loginNames()
  201. this.options1GetRequestUrl()
  202. this.options2GetRequestUrl()
  203. this.options3GetRequestUrl()
  204. },
  205. methods: {
  206. loginNames() {
  207. return getCookie('loginName')
  208. },
  209. handClick() {
  210. if (this.activeName == 'first') {
  211. this.options1GetRequestUrl()
  212. } else if (this.activeName == 'second') {
  213. this.options2GetRequestUrl()
  214. } else {
  215. this.options3GetRequestUrl()
  216. }
  217. },
  218. func(res) {
  219. console.log(res)
  220. this.noSettleDetailsColumn = res.columnData
  221. var totalWeight = 0
  222. var totalAllMoney = 0
  223. res.list.forEach(e => {
  224. totalWeight = totalWeight + e.resultNetWeight
  225. totalAllMoney = totalAllMoney + e.detailsAmount
  226. })
  227. this.totalNetWeight = totalWeight.toFixed(2) + 't'
  228. this.totalMoney = totalAllMoney.toFixed(2) + '元'
  229. this.orderList1 = []
  230. res.list.forEach(e => {
  231. let map = {
  232. orderLineSeq: e.orderLineSeq,
  233. orderId: e.orderId
  234. }
  235. this.orderList1.push(map)
  236. })
  237. },
  238. func2(res) {
  239. this.settleDetailsColumn = res.columnData
  240. },
  241. func3(res) {
  242. console.log(res.list)
  243. console.log('res')
  244. this.orderList3 = []
  245. res.list.forEach(e => {
  246. let map = {
  247. orderLineSeq: e.orderLineSeq,
  248. orderId: e.orderId
  249. }
  250. this.orderList3.push(map)
  251. })
  252. this.noDetailsColumn = res.columnData
  253. },
  254. newSettle() {
  255. console.log(this.orderList)
  256. let orderList = []
  257. if (this.activeName == 'third') {
  258. orderList = this.orderList3
  259. } else {
  260. orderList = this.orderList1
  261. }
  262. this.axios
  263. .post('/api/v1/bms/newInwardSettle', { orderIds: orderList })
  264. .then(res => {
  265. console.log(res)
  266. this.$message.success('生成成功')
  267. this.options3GetRequestUrl()
  268. })
  269. },
  270. exportAllExcel() {
  271. let startTime = null
  272. let endTime = null
  273. let orgCode = null
  274. let materialTypeNames = null
  275. let transRangeValues = null
  276. let shipperNames = null
  277. let capacityNo = null
  278. let carrierSsoId = null
  279. if (this.startTime && this.endTime) {
  280. startTime = sjTime(this.startTime)
  281. endTime = sjTime(this.endTime)
  282. }
  283. if (getCookie('orgCode') == 'chengyunshang') {
  284. carrierSsoId = getCookie('userId')
  285. }
  286. if (
  287. getCookie('orgCode') == 'dagangadmin' ||
  288. getCookie('orgCode') == 'zidonghuabu' ||
  289. getCookie('orgCode') == 'wuliuchuyunzhongxin'
  290. ) {
  291. orgCode = null
  292. } else {
  293. orgCode = getCookie('orgCode')
  294. }
  295. if (this.screen == '车牌号') {
  296. capacityNo = this.input
  297. }
  298. if (this.screen == '承运起止范围') {
  299. transRangeValues = this.input
  300. }
  301. if (this.screen == '货物名称') {
  302. materialTypeNames = this.input
  303. }
  304. if (this.screen == '用车单位') {
  305. shipperNames = this.input
  306. }
  307. if (this.screen1 == '车牌号') {
  308. capacityNo = this.input1
  309. }
  310. if (this.screen1 == '承运起止范围') {
  311. transRangeValues = this.input1
  312. }
  313. if (this.screen1 == '货物名称') {
  314. materialTypeNames = this.input1
  315. }
  316. if (this.screen1 == '用车单位') {
  317. shipperNames = this.input1
  318. }
  319. if (this.activeName == 'first') {
  320. this.tableTitle = '未结算计费详单'
  321. this.axios
  322. .post(
  323. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0' +
  324. '&startTime=' +
  325. startTime +
  326. '&endTime=' +
  327. endTime +
  328. '&shipperNames=' +
  329. shipperNames +
  330. '&materialTypeNames=' +
  331. materialTypeNames +
  332. '&transRangeValues=' +
  333. transRangeValues +
  334. '&capacityNo=' +
  335. capacityNo +
  336. '&i' +
  337. new Date() +
  338. '&isPage=yes'
  339. )
  340. .then(res => {
  341. console.log(res.data.data)
  342. this.exportAllList = res.data.data
  343. this.exportAllReportToExcel(
  344. this.tableTitle,
  345. this.exportAllList,
  346. this.noSettleDetailsColumn
  347. )
  348. })
  349. } else if (this.activeName == 'second') {
  350. this.tableTitle = '已结算计费详单'
  351. this.axios
  352. .post(
  353. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1' +
  354. '&startTime=' +
  355. startTime +
  356. '&endTime=' +
  357. endTime +
  358. '&shipperNames=' +
  359. shipperNames +
  360. '&materialTypeNames=' +
  361. materialTypeNames +
  362. '&transRangeValues=' +
  363. transRangeValues +
  364. '&capacityNo=' +
  365. capacityNo +
  366. '&i' +
  367. new Date() +
  368. '&isPage=yes' +
  369. '&userId=' +
  370. orgCode
  371. )
  372. .then(res => {
  373. this.exportAllList = res.data.data
  374. this.exportAllReportToExcel(
  375. this.tableTitle,
  376. this.exportAllList,
  377. this.settleDetailsColumn
  378. )
  379. })
  380. } else if (this.activeName == 'third') {
  381. this.tableTitle = '未生成计费详单数据'
  382. this.axios
  383. .post(
  384. '/api/v1/bms/getNoInwardDetails?apiId=490' +
  385. '&startTime=' +
  386. startTime +
  387. '&endTime=' +
  388. endTime +
  389. '&shipperNames=' +
  390. shipperNames +
  391. '&materialTypeNames=' +
  392. materialTypeNames +
  393. '&transRangeValues=' +
  394. transRangeValues +
  395. '&capacityNo=' +
  396. capacityNo +
  397. '&i' +
  398. new Date() +
  399. '&userId=' +
  400. orgCode +
  401. '&isPage=yes'
  402. )
  403. .then(res => {
  404. this.exportAllList = res.data.data
  405. this.exportAllReportToExcel(
  406. this.tableTitle,
  407. this.exportAllList,
  408. this.noDetailsColumn
  409. )
  410. })
  411. }
  412. },
  413. //导出excel
  414. exportAllReportToExcel(tableTitle, dataArr, columnData) {
  415. var title = tableTitle
  416. let tHeader = []
  417. let filterVal = []
  418. columnData.forEach(e1 => {
  419. if (tHeader.indexOf(e1.label) === -1) {
  420. tHeader.push(e1.label)
  421. }
  422. if (filterVal.indexOf(e1.prop) === -1) {
  423. filterVal.push(e1.prop)
  424. }
  425. })
  426. //导出为excel
  427. this.downloadLoading = true
  428. require.ensure([], () => {
  429. const {
  430. export_json_to_excel
  431. } = require('@/assets/excel/Export2Excel.js') //这里必须使用绝对路径,使用@/+存放export2Excel的路径
  432. // let list = this.$refs.excelDom.dataTabel;
  433. let data = dataArr.map(v => filterVal.map(j => v[j])) //3.formatJson格式转换
  434. export_json_to_excel(tHeader, data, title) // (title)导出的表格名称
  435. })
  436. },
  437. //未结算数据
  438. options1GetRequestUrl() {
  439. if (getCookie('orgCode') == 'chengyunshang') {
  440. this.ssoId = getCookie('userId')
  441. this.options1.requestUrl =
  442. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0&carrierSsoId=' +
  443. getCookie('userId') +
  444. '&startTime=null&endTime=null&i=' +
  445. new Date()
  446. } else if (
  447. getCookie('orgCode') == 'dagangadmin' ||
  448. getCookie('orgCode') == 'zidonghuabu' ||
  449. getCookie('orgCode') == 'wuliuchuyunzhongxin'
  450. ) {
  451. this.options1.requestUrl =
  452. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0&startTime=null&endTime=null&i=' +
  453. new Date()
  454. } else {
  455. this.options1.requestUrl =
  456. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0&userId=' +
  457. getCookie('orgCode') +
  458. '&startTime=null&endTime=null&i=' +
  459. new Date()
  460. }
  461. },
  462. //已结算数据
  463. options2GetRequestUrl() {
  464. if (getCookie('orgCode') == 'chengyunshang') {
  465. this.ssoId = getCookie('userId')
  466. this.options2.requestUrl =
  467. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1&carrierSsoId=' +
  468. getCookie('userId') +
  469. '&startTime=null&endTime=null&i=' +
  470. new Date()
  471. } else if (
  472. getCookie('orgCode') == 'dagangadmin' ||
  473. getCookie('orgCode') == 'zidonghuabu' ||
  474. getCookie('orgCode') == 'wuliuchuyunzhongxin'
  475. ) {
  476. this.options2.requestUrl =
  477. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1' +
  478. '&startTime=null&endTime=null&i=' +
  479. new Date()
  480. } else {
  481. this.options2.requestUrl =
  482. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1&userId=' +
  483. getCookie('orgCode') +
  484. '&startTime=null&endTime=null&i=' +
  485. new Date()
  486. }
  487. },
  488. options3GetRequestUrl() {
  489. this.options3.requestUrl =
  490. '/api/v1/bms/getNoInwardDetails?apiId=490&i=' + new Date()
  491. },
  492. toInsert() {
  493. this.$router.push('/insertCheckInventory')
  494. },
  495. onclick() {
  496. let startTime = null
  497. let endTime = null
  498. let orgCode = null
  499. let materialTypeNames = null
  500. let transRangeValues = null
  501. let shipperNames = null
  502. let capacityNo = null
  503. let carrierSsoId = null
  504. if (this.startTime && this.endTime) {
  505. startTime = sjTime(this.startTime)
  506. endTime = sjTime(this.endTime)
  507. }
  508. if (getCookie('orgCode') == 'chengyunshang') {
  509. carrierSsoId = getCookie('userId')
  510. }
  511. if (
  512. getCookie('orgCode') == 'dagangadmin' ||
  513. getCookie('orgCode') == 'zidonghuabu' ||
  514. getCookie('orgCode') == 'wuliuchuyunzhongxin'
  515. ) {
  516. orgCode = null
  517. } else {
  518. orgCode = getCookie('orgCode')
  519. }
  520. if (this.screen == '车牌号') {
  521. capacityNo = this.input
  522. }
  523. if (this.screen == '承运起止范围') {
  524. transRangeValues = this.input
  525. }
  526. if (this.screen == '货物名称') {
  527. materialTypeNames = this.input
  528. }
  529. if (this.screen == '用车单位') {
  530. shipperNames = this.input
  531. }
  532. if (this.screen1 == '车牌号') {
  533. capacityNo = this.input1
  534. }
  535. if (this.screen1 == '承运起止范围') {
  536. transRangeValues = this.input1
  537. }
  538. if (this.screen1 == '货物名称') {
  539. materialTypeNames = this.input1
  540. }
  541. if (this.screen1 == '用车单位') {
  542. shipperNames = this.input1
  543. }
  544. if (this.activeName == 'first') {
  545. this.options1.requestUrl =
  546. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0' +
  547. '&startTime=' +
  548. startTime +
  549. '&endTime=' +
  550. endTime +
  551. '&shipperNames=' +
  552. shipperNames +
  553. '&materialTypeNames=' +
  554. materialTypeNames +
  555. '&transRangeValues=' +
  556. transRangeValues +
  557. '&capacityNo=' +
  558. capacityNo +
  559. '&i' +
  560. new Date() +
  561. '&userId=' +
  562. orgCode
  563. }
  564. if (this.activeName == 'second') {
  565. this.options2.requestUrl =
  566. '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1' +
  567. '&startTime=' +
  568. startTime +
  569. '&endTime=' +
  570. endTime +
  571. '&shipperNames=' +
  572. shipperNames +
  573. '&materialTypeNames=' +
  574. materialTypeNames +
  575. '&transRangeValues=' +
  576. transRangeValues +
  577. '&capacityNo=' +
  578. capacityNo +
  579. '&i' +
  580. new Date() +
  581. '&userId=' +
  582. orgCode
  583. }
  584. if (this.activeName == 'third') {
  585. this.options3.requestUrl =
  586. '/api/v1/bms/getNoInwardDetails?apiId=490' +
  587. '&startTime=' +
  588. startTime +
  589. '&endTime=' +
  590. endTime +
  591. '&shipperNames=' +
  592. shipperNames +
  593. '&materialTypeNames=' +
  594. materialTypeNames +
  595. '&transRangeValues=' +
  596. transRangeValues +
  597. '&capacityNo=' +
  598. capacityNo +
  599. '&i' +
  600. new Date() +
  601. '&userId=' +
  602. orgCode
  603. }
  604. },
  605. //运输订单点击浏览的事件
  606. select() {
  607. this.addressDrawer = true
  608. },
  609. //运输单价模态窗口的框计算
  610. selectAddressClick() {
  611. this.Price.requestUrl =
  612. '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
  613. this.addressText
  614. }
  615. }
  616. }
  617. </script>
  618. <style lang="scss" scoped>
  619. .steel_inbound {
  620. .sache {
  621. margin-left: 20px;
  622. margin-top: 20px;
  623. .elSelect /deep/ {
  624. .el-input--suffix .el-input__inner {
  625. width: 120px !important;
  626. }
  627. }
  628. }
  629. .table {
  630. margin-left: 20px;
  631. margin-top: 20px;
  632. }
  633. }
  634. </style>