index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. <template>
  2. <trade-card title="费用信息">
  3. <el-tabs v-model="activeNameTwo" @tab-click="handleClick">
  4. <el-tab-pane label="应收" name="first" :key="'first'" v-if="tabShow == 1 || tabShow == 2">
  5. </el-tab-pane>
  6. <el-tab-pane label="应付" name="second" :key="'second'" v-if="tabShow == 1 || tabShow == 3">
  7. </el-tab-pane>
  8. </el-tabs>
  9. <avue-crud
  10. :option="option"
  11. :data="dataList"
  12. v-model="form"
  13. @row-save="rowSave"
  14. ref="crud"
  15. :key="key"
  16. :search.sync="search"
  17. :page.sync="page"
  18. @on-load="onLoad"
  19. @search-change="searchChange"
  20. @selection-change="selectionChange"
  21. @row-update="rowUpdate"
  22. @resetColumn="resetColumn('crud','option','optionBack',codeValue)"
  23. @saveColumn="saveColumn('crud','option','optionBack',codeValue)">
  24. <template slot-scope="{type,size,row,index}" slot="menu">
  25. <el-button icon="el-icon-edit" :size="size" :type="type" :disabled="row.settlementAmount > 0 || row.submitPay > 0"
  26. @click="$refs.crud.rowEdit(row,index)">编辑
  27. </el-button>
  28. <el-button icon="el-icon-delete" :size="size" :type="type" :disabled="row.settlementAmount > 0 || row.submitPay > 0"
  29. @click="rowDel(row,index)">删除
  30. </el-button>
  31. </template>
  32. <template slot="menuLeft">
  33. <el-button
  34. class="el-icon-download"
  35. type="info"
  36. size="small"
  37. :disabled="!id || listData.length === 0"
  38. @click="openReport">打印
  39. </el-button>
  40. <el-button
  41. class="el-icon-download"
  42. type="warning"
  43. size="small"
  44. v-if="type !== 'BG'"
  45. :disabled="(selectionList.length === 0 || !(selectionList.findIndex(item => item.submitPay == '1') == -1))"
  46. @click="generateBill">生成账单
  47. </el-button>
  48. <el-button
  49. class="el-icon-download"
  50. type="danger"
  51. size="small"
  52. v-if="type !== 'BG'"
  53. :disabled="(selectionList.length === 0 || !(selectionList.findIndex(item => item.submitPay == '0') == -1))"
  54. @click="revokeBill">撤销账单
  55. </el-button>
  56. </template>
  57. <template slot="itemNameForm">
  58. <breakdown-select v-model="form.itemId" @selectValue="selectValue"
  59. :configuration="breakConfiguration"></breakdown-select>
  60. </template>
  61. <template slot="corpNameForm">
  62. <crop-select v-model="form.corpId" @getCorpData="getGSDataTwo" corpType="KH"/>
  63. </template>
  64. </avue-crud>
  65. <report-dialog
  66. :switchDialog="switchDialog"
  67. :reportId="id"
  68. :reportName="reportName"
  69. @onClose="onClose()"
  70. />
  71. </trade-card>
  72. </template>
  73. <script>
  74. import {
  75. tradingBoxFees,
  76. generateBill,
  77. revokeBill,
  78. tradingBoxFeesList,
  79. transportItemFeesListdata,
  80. tradingBoxFeesSubmit,
  81. transportItemFeesSubmitdata
  82. } from "@/api/boxManagement";
  83. import reportDialog from "@/components/report-dialog/main.vue";
  84. import {getParities} from "@/api/basicData/customerInquiry";
  85. import {dateFormat} from "@/util/date";
  86. export default {
  87. name: "index",
  88. components: {reportDialog},
  89. data() {
  90. return {
  91. code: '',
  92. switchDialog: false,
  93. reportName: '',
  94. option: {},
  95. optionBack: {},
  96. page: {
  97. pageSize: 20,
  98. currentPage: 1,
  99. total: 0,
  100. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  101. },
  102. search:{},
  103. leaseIn: {
  104. align: 'center',
  105. index: true,
  106. height: 500,
  107. addBtnText: "录入明细",
  108. refreshBtn: false,
  109. addBtn: true,
  110. selection: true,
  111. span: 6,
  112. searchMenuSpan: 18,
  113. dialogTop: "25%",
  114. addRowBtn: false,
  115. cellBtn: false,
  116. editBtn: false,
  117. delBtn: false,
  118. menuWidth: 140,
  119. dialogDrag: true,
  120. dialogWidth: "80%",
  121. showSummary: true,
  122. sumColumnList: [{
  123. name: 'quantity',
  124. type: 'sum',
  125. decimals: 0
  126. }, {
  127. name: 'amount',
  128. type: 'sum',
  129. decimals: 2
  130. }, {
  131. name: 'settlementAmount',
  132. type: 'sum',
  133. decimals: 2
  134. }],
  135. column: [{
  136. label: '账单状态',
  137. prop: 'submitPay',
  138. width: 100,
  139. overHidden: true,
  140. filterable: true,
  141. display:false,
  142. dataType: 'number',
  143. type: "select",
  144. dicUrl: "/api/blade-system/dict-biz/dictionary?code=billing_status",
  145. props: {
  146. label: "dictValue",
  147. value: "dictKey"
  148. }
  149. }, {
  150. label: '收款对象',
  151. prop: 'corpName',
  152. overHidden: true,
  153. width: 160,
  154. rules: [{
  155. required: true,
  156. message: "请选择收款对象",
  157. trigger: "blur"
  158. }]
  159. }, {
  160. label: '箱号',
  161. prop: 'code',
  162. width: 140,
  163. search:true,
  164. overHidden: true,
  165. filterable: true,
  166. type: "select",
  167. dicUrl: `/api/blade-box-tube/archives/selectArchivesByCodeList?code=${this.code}`,
  168. props: {
  169. label: "code",
  170. value: "code"
  171. },
  172. }, {
  173. label: '费用名称',
  174. prop: 'itemName',
  175. overHidden: true,
  176. width: 120
  177. }, {
  178. label: '币别',
  179. prop: 'currency',
  180. width: 100,
  181. overHidden: true,
  182. filterable: true,
  183. type: "select",
  184. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  185. props: {
  186. label: "dictValue",
  187. value: "dictKey"
  188. },
  189. }, {
  190. label: '汇率',
  191. prop: 'exchangeRate',
  192. width: 100,
  193. type: 'number',
  194. disabled: true,
  195. overHidden: true,
  196. controls: false,
  197. precision: 4
  198. }, {
  199. label: '单价',
  200. prop: 'price',
  201. type: 'number',
  202. overHidden: true,
  203. precision: 2,
  204. controls: false,
  205. width: 140
  206. }, {
  207. label: '数量',
  208. prop: 'quantity',
  209. type: 'number',
  210. precision: 0,
  211. value: 1,
  212. controls: false,
  213. overHidden: true,
  214. width: 100
  215. }, {
  216. label: '金额',
  217. prop: 'amount',
  218. type: 'number',
  219. precision: 2,
  220. disabled: true,
  221. controls: false,
  222. overHidden: true,
  223. width: 140
  224. }, {
  225. label: '日期起',
  226. prop: 'rentStartDate',
  227. width: 100,
  228. overHidden: true,
  229. type: "date",
  230. disabled: true,
  231. format: "yyyy-MM-dd",
  232. valueFormat: "yyyy-MM-dd HH:mm:ss"
  233. }, {
  234. label: '日期止',
  235. prop: 'rentEndDate',
  236. width: 100,
  237. disabled: true,
  238. overHidden: true,
  239. type: "date",
  240. format: "yyyy-MM-dd",
  241. valueFormat: "yyyy-MM-dd HH:mm:ss"
  242. }, {
  243. label: '结算金额',
  244. prop: 'settlementAmount',
  245. type: 'number',
  246. precision: 2,
  247. disabled: true,
  248. controls: false,
  249. overHidden: true,
  250. width: 140
  251. }, {
  252. label: '结算时间',
  253. prop: 'settlementDate',
  254. width: 100,
  255. disabled: true,
  256. overHidden: true,
  257. type: "date",
  258. format: "yyyy-MM-dd",
  259. valueFormat: "yyyy-MM-dd HH:mm:ss"
  260. }, {
  261. label: '业务类型',
  262. prop: 'billType',
  263. display: false,
  264. width: 100
  265. }, {
  266. label: '生成账单日期',
  267. prop: 'expenseGenerationTime',
  268. width: 100,
  269. overHidden: true,
  270. type: "date",
  271. display: false,
  272. format: "yyyy-MM-dd",
  273. valueFormat: "yyyy-MM-dd HH:mm:ss"
  274. }, {
  275. label: '备注',
  276. prop: 'remarks',
  277. type: 'textarea',
  278. overHidden: true,
  279. minRows: 3,
  280. span: 24,
  281. width: 200
  282. }]
  283. },
  284. boxTube: {
  285. align: 'center',
  286. index: true,
  287. selection: true,
  288. height: 500,
  289. addBtnText: "录入明细",
  290. refreshBtn: false,
  291. addBtn: true,
  292. span: 6,
  293. searchMenuSpan: 18,
  294. dialogTop: "25%",
  295. addRowBtn: false,
  296. cellBtn: false,
  297. editBtn: false,
  298. delBtn: false,
  299. menuWidth: 140,
  300. dialogDrag: true,
  301. dialogWidth: "80%",
  302. showSummary: true,
  303. sumColumnList: [{
  304. name: 'quantity',
  305. type: 'sum',
  306. decimals: 0
  307. }, {
  308. name: 'amount',
  309. type: 'sum',
  310. decimals: 2
  311. }, {
  312. name: 'settlementAmount',
  313. type: 'sum',
  314. decimals: 2
  315. }],
  316. column: [{
  317. label: '账单状态',
  318. prop: 'submitPay',
  319. width: 100,
  320. overHidden: true,
  321. filterable: true,
  322. display: false,
  323. dataType: 'number',
  324. type: "select",
  325. dicUrl: "/api/blade-system/dict-biz/dictionary?code=billing_status",
  326. props: {
  327. label: "dictValue",
  328. value: "dictKey"
  329. }
  330. }, {
  331. label: '收款对象',
  332. prop: 'corpName',
  333. overHidden: true,
  334. width: 160,
  335. rules: [{
  336. required: true,
  337. message: "请选择收款对象",
  338. trigger: "blur"
  339. }]
  340. }, {
  341. label: '箱号',
  342. prop: 'code',
  343. width: 140,
  344. search:true,
  345. overHidden: true,
  346. filterable: true,
  347. type: "select",
  348. dicUrl: `/api/blade-box-tube/archives/selectArchivesByCodeList?code=${this.code}`,
  349. props: {
  350. label: "code",
  351. value: "code"
  352. },
  353. }, {
  354. label: '费用名称',
  355. prop: 'itemName',
  356. overHidden: true,
  357. width: 120
  358. }, {
  359. label: '币别',
  360. prop: 'currency',
  361. width: 100,
  362. overHidden: true,
  363. filterable: true,
  364. type: "select",
  365. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  366. props: {
  367. label: "dictValue",
  368. value: "dictKey"
  369. },
  370. }, {
  371. label: '汇率',
  372. prop: 'exchangeRate',
  373. width: 100,
  374. type: 'number',
  375. disabled: true,
  376. overHidden: true,
  377. controls: false,
  378. precision: 4
  379. }, {
  380. label: '单价',
  381. prop: 'price',
  382. type: 'number',
  383. overHidden: true,
  384. precision: 2,
  385. controls: false,
  386. width: 140
  387. }, {
  388. label: '数量',
  389. prop: 'quantity',
  390. type: 'number',
  391. precision: 0,
  392. value: 1,
  393. controls: false,
  394. overHidden: true,
  395. width: 100
  396. }, {
  397. label: '金额',
  398. prop: 'amount',
  399. type: 'number',
  400. precision: 2,
  401. disabled: true,
  402. controls: false,
  403. overHidden: true,
  404. width: 140
  405. }, {
  406. label: '结算金额',
  407. prop: 'settlementAmount',
  408. type: 'number',
  409. precision: 2,
  410. disabled: true,
  411. controls: false,
  412. overHidden: true,
  413. width: 140
  414. }, {
  415. label: '结算时间',
  416. prop: 'settlementDate',
  417. width: 100,
  418. disabled: true,
  419. overHidden: true,
  420. type: "date",
  421. format: "yyyy-MM-dd",
  422. valueFormat: "yyyy-MM-dd HH:mm:ss"
  423. }, {
  424. label: '对账金额',
  425. prop: 'reconciliationAmount',
  426. type: 'number',
  427. precision: 2,
  428. disabled: true,
  429. controls: false,
  430. overHidden: true,
  431. width: 140
  432. }, {
  433. label: '对账时间',
  434. prop: 'reconciliationDate',
  435. width: 100,
  436. disabled: true,
  437. overHidden: true,
  438. type: "date",
  439. format: "yyyy-MM-dd",
  440. valueFormat: "yyyy-MM-dd HH:mm:ss"
  441. }, {
  442. label: '业务类型',
  443. prop: 'billType',
  444. display: false,
  445. width: 100
  446. }, {
  447. label: '生成账单日期',
  448. prop: 'expenseGenerationTime',
  449. width: 100,
  450. overHidden: true,
  451. type: "date",
  452. display: false,
  453. format: "yyyy-MM-dd",
  454. valueFormat: "yyyy-MM-dd HH:mm:ss"
  455. }, {
  456. label: '备注',
  457. prop: 'remarks',
  458. type: 'textarea',
  459. overHidden: true,
  460. minRows: 3,
  461. span: 24,
  462. width: 200
  463. }]
  464. },
  465. customsList: {
  466. align: 'center',
  467. index: true,
  468. selection: true,
  469. height: 500,
  470. addBtnText: "录入明细",
  471. refreshBtn: false,
  472. addBtn: true,
  473. span: 6,
  474. searchMenuSpan: 18,
  475. dialogTop: "25%",
  476. addRowBtn: false,
  477. cellBtn: false,
  478. editBtn: false,
  479. delBtn: false,
  480. menuWidth: 140,
  481. dialogDrag: true,
  482. dialogWidth: "80%",
  483. showSummary: true,
  484. sumColumnList: [{
  485. name: 'quantity',
  486. type: 'sum',
  487. decimals: 0
  488. },{
  489. name: 'amount',
  490. type: 'sum',
  491. decimals: 2
  492. },{
  493. name: 'settlementAmount',
  494. type: 'sum',
  495. decimals: 2
  496. }],
  497. column: [{
  498. label: '账单状态',
  499. prop: 'submitPay',
  500. width: 100,
  501. overHidden: true,
  502. filterable: true,
  503. display: false,
  504. dataType: 'number',
  505. type: "select",
  506. dicUrl: "/api/blade-system/dict-biz/dictionary?code=billing_status",
  507. props: {
  508. label: "dictValue",
  509. value: "dictKey"
  510. }
  511. }, {
  512. label: '收款对象',
  513. prop: 'corpName',
  514. overHidden: true,
  515. width: 160,
  516. rules: [{
  517. required: true,
  518. message: "请选择收款对象",
  519. trigger: "blur"
  520. }]
  521. }, {
  522. label: '费用名称',
  523. prop: 'itemName',
  524. overHidden: true,
  525. width: 120
  526. }, {
  527. label: '币别',
  528. prop: 'currency',
  529. width: 100,
  530. overHidden: true,
  531. filterable: true,
  532. type: "select",
  533. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  534. props: {
  535. label: "dictValue",
  536. value: "dictKey"
  537. },
  538. }, {
  539. label: '汇率',
  540. prop: 'exchangeRate',
  541. width: 100,
  542. type: 'number',
  543. disabled: true,
  544. overHidden: true,
  545. controls: false,
  546. precision: 4
  547. }, {
  548. label: '单价',
  549. prop: 'price',
  550. type: 'number',
  551. overHidden: true,
  552. precision: 2,
  553. controls: false,
  554. width: 140
  555. }, {
  556. label: '数量',
  557. prop: 'quantity',
  558. type: 'number',
  559. precision: 0,
  560. value: 1,
  561. controls: false,
  562. overHidden: true,
  563. width: 100
  564. }, {
  565. label: '金额',
  566. prop: 'amount',
  567. type: 'number',
  568. precision: 2,
  569. disabled: true,
  570. controls: false,
  571. overHidden: true,
  572. width: 140
  573. },
  574. // {
  575. // label: '结算金额',
  576. // prop: 'settlementAmount',
  577. // type: 'number',
  578. // precision: 2,
  579. // disabled: true,
  580. // controls: false,
  581. // overHidden: true,
  582. // width: 140
  583. // }, {
  584. // label: '结算时间',
  585. // prop: 'settlementDate',
  586. // width: 100,
  587. // disabled: true,
  588. // overHidden: true,
  589. // type: "date",
  590. // format: "yyyy-MM-dd",
  591. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  592. // }, {
  593. // label: '业务类型',
  594. // prop: 'billType',
  595. // display:false,
  596. // width: 100
  597. // },
  598. {
  599. label: '生成账单日期',
  600. prop: 'expenseGenerationTime',
  601. width: 100,
  602. overHidden: true,
  603. type: "date",
  604. display: false,
  605. format: "yyyy-MM-dd",
  606. valueFormat: "yyyy-MM-dd HH:mm:ss"
  607. },
  608. {
  609. label: '备注',
  610. prop: 'remark',
  611. type: 'textarea',
  612. overHidden: true,
  613. minRows: 3,
  614. span: 24
  615. }]
  616. },
  617. dataList: [],
  618. form: {},
  619. key: 0,
  620. data_one: [],
  621. data_two: [],
  622. selectionList: [],
  623. breakConfiguration: {
  624. multipleChoices: false,
  625. multiple: false,
  626. disabled: false,
  627. searchShow: true,
  628. collapseTags: false,
  629. clearable: true,
  630. placeholder: "请点击右边按钮选择",
  631. dicData: []
  632. },
  633. onetotal:0,
  634. twototal:0,
  635. activeNameTwo: "first"
  636. }
  637. },
  638. watch: {
  639. listData(newVla, oldVal) {
  640. console.log(this.listData,625)
  641. if(this.type == 'CK' || this.type == 'JK') {
  642. console.log('出口')
  643. this.transportItemFeesListdatafun(1)
  644. this.transportItemFeesListdatafun(2)
  645. }else if (this.type == 'ZR' || this.type == 'ZC' || this.type == 'SELL' || this.type == 'BUY' || this.type == 'DCF') {
  646. console.log('4ge')
  647. this.tradingBoxFeesListfun(1)
  648. this.tradingBoxFeesListfun(2)
  649. }else {
  650. this.data_one = newVla.filter(item => item.feesType === 1); //应收
  651. this.data_two = newVla.filter(item => item.feesType === 2); //应付
  652. if (this.activeNameTwo === "first") {
  653. this.dataList = this.data_one;
  654. } else {
  655. this.dataList = this.data_two;
  656. }
  657. this.key++
  658. }
  659. },
  660. // 分页
  661. "page.currentPage":{
  662. handler(newVla,oldVal) {
  663. if(this.type == 'CK' || this.type == 'JK') {
  664. this.transportItemFeesListdatafun(1)
  665. this.transportItemFeesListdatafun(2)
  666. }else if (this.type == 'ZR' || this.type == 'ZC' || this.type == 'SELL' || this.type == 'BUY' || this.type == 'DCF') {
  667. this.tradingBoxFeesListfun(1)
  668. this.tradingBoxFeesListfun(2)
  669. }
  670. },
  671. },
  672. "page.pageSize":{
  673. handler(newVla,oldVal) {
  674. if(this.type == 'CK' || this.type == 'JK') {
  675. this.transportItemFeesListdatafun(1)
  676. this.transportItemFeesListdatafun(2)
  677. }else if (this.type == 'ZR' || this.type == 'ZC' || this.type == 'SELL' || this.type == 'BUY' || this.type == 'DCF') {
  678. this.tradingBoxFeesListfun(1)
  679. this.tradingBoxFeesListfun(2)
  680. }
  681. },
  682. },
  683. "option.menu":{
  684. handler(newVla,oldVal) {
  685. if (newVla !== oldVal) {
  686. this.key++
  687. }
  688. },
  689. },
  690. code(newVla, oldVal) {
  691. if (this.code){
  692. this.findObject(this.option.column, "code").dicUrl = `/api/blade-box-tube/archives/selectArchivesByCodeList?code=${this.code}`
  693. }
  694. this.key++
  695. },
  696. activeNameTwo(newVla, oldVal) {
  697. if (newVla !== oldVal) {
  698. if (newVla === "first") {
  699. this.data_two = this.dataList;
  700. this.dataList = this.data_one;
  701. } else {
  702. this.data_one = this.dataList;
  703. this.dataList = this.data_two;
  704. }
  705. }
  706. }
  707. },
  708. model: {
  709. prop: "listData",
  710. event: "callBack"
  711. },
  712. props: {
  713. listData: {
  714. type: Array,
  715. default: function () {
  716. return [];
  717. }
  718. },
  719. codeValue: {
  720. type: String
  721. },
  722. type:{
  723. type: String
  724. },
  725. url: {
  726. type: String
  727. },
  728. // 1.显示全部 2.收费 3.付费
  729. tabShow: {
  730. type: Number,
  731. default: 1
  732. },
  733. activeName: {
  734. type: String,
  735. default: 'first'
  736. },
  737. id: {
  738. type: String
  739. }
  740. },
  741. async created() {
  742. if (this.type === 'BG'){
  743. this.optionBack = this.customsList
  744. }else if (this.type === 'ZR' || this.type === 'ZC' || this.type === 'DCF'){
  745. this.optionBack = this.leaseIn
  746. }else {
  747. this.optionBack = this.boxTube
  748. }
  749. if (!this.codeValue) this.codeValue = 235.2
  750. // 判断activeNameTwo默认的显示
  751. this.activeNameTwo = this.activeName
  752. this.option = await this.getColumnData(this.getColumnName(this.codeValue), this.optionBack);
  753. if (this.activeNameTwo === "first") {
  754. this.findObject(this.option.column, "corpName").label = "收款对象"
  755. } else {
  756. this.findObject(this.option.column, "corpName").label = "付款对象"
  757. }
  758. this.findObject(this.option.column, "price").change = ({value, column}) => {
  759. console.log(value,this.form.quantity,this.form.exchangeRate,702)
  760. if (value && this.form.quantity) {
  761. if (this.form.exchangeRate) {
  762. // 之前的金额要乘汇率
  763. // this.form.amount = value * this.form.quantity * this.form.exchangeRate
  764. // 现在的金额计算不需要乘汇率
  765. this.form.amount = value * this.form.quantity
  766. } else {
  767. this.form.amount = value * this.form.quantity
  768. }
  769. }
  770. }
  771. this.findObject(this.option.column, "currency").change = ({value, column}) => {
  772. for (let item of this.$refs.crud.DIC.currency) {
  773. if (item.dictValue == value) {
  774. getParities({
  775. currency: value,
  776. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00"
  777. }).then(res => {
  778. this.form.exchangeRate = res.data.data.receiptsParities
  779. })
  780. if (this.form.price && this.form.quantity) {
  781. this.form.amount = this.form.price * this.form.quantity * item.remark
  782. }
  783. }
  784. }
  785. }
  786. this.findObject(this.option.column, "quantity").change = ({value, column}) => {
  787. if (this.form.price && value) {
  788. if (this.form.exchangeRate) {
  789. this.form.amount = this.form.price * value * this.form.exchangeRate
  790. } else {
  791. this.form.amount = this.form.price * value
  792. }
  793. }
  794. }
  795. this.key++
  796. this.option.selectable = (row, index) => {
  797. return row.id;
  798. }
  799. },
  800. methods: {
  801. onLoad(page, params = {}){
  802. this.page.currentPage = page.currentPage
  803. this.page.pageSize = page.pageSize
  804. },
  805. // 搜索
  806. searchChange(form,dome){
  807. console.log(form,809)
  808. this.page.currentPage = 1
  809. this.page.pageSize = 20
  810. let feesType = null
  811. if (this.activeNameTwo === "first"){
  812. feesType = 1
  813. }else {
  814. feesType = 2
  815. }
  816. if(this.type == 'CK' || this.type == 'JK') {
  817. this.transportItemFeesListdatafun(feesType,form)
  818. }else if (this.type == 'ZR' || this.type == 'ZC' || this.type == 'SELL' || this.type == 'BUY' || this.type == 'DCF') {
  819. this.tradingBoxFeesListfun(feesType,form)
  820. }
  821. dome()
  822. },
  823. // 租出,租入,卖箱,买箱的接口
  824. tradingBoxFeesListfun(feesType,params = {}){
  825. if (!this.id) {
  826. return
  827. }
  828. tradingBoxFeesList({
  829. ...params,
  830. current: this.page.currentPage,
  831. size: this.page.pageSize,
  832. pid:this.id,
  833. feesType:feesType
  834. }).then(res=>{
  835. if (feesType == 1) {
  836. // this.page.total = res.data.data.total
  837. this.onetotal = res.data.data.total
  838. this.data_one = res.data.data.records
  839. }else {
  840. // this.page.total = res.data.data.total
  841. this.twototal = res.data.data.total
  842. this.data_two = res.data.data.records
  843. }
  844. if (this.activeNameTwo === "first") {
  845. this.page.total = this.onetotal
  846. this.dataList = this.data_one;
  847. } else {
  848. this.page.total = this.twototal
  849. this.dataList = this.data_two;
  850. }
  851. this.key++
  852. })
  853. },
  854. // 出口进口的费用接口
  855. transportItemFeesListdatafun(feesType,params = {}){
  856. if (!this.id) {
  857. return
  858. }
  859. transportItemFeesListdata({
  860. ...params,
  861. current: this.page.currentPage,
  862. size: this.page.pageSize,
  863. pid:this.id,
  864. feesType:feesType
  865. }).then(res=>{
  866. if (feesType == 1) {
  867. // this.page.total = res.data.data.total
  868. this.onetotal = res.data.data.total
  869. this.data_one = res.data.data.records
  870. }else {
  871. // this.page.total = res.data.data.total
  872. this.twototal = res.data.data.total
  873. this.data_two = res.data.data.records
  874. }
  875. if (this.activeNameTwo === "first") {
  876. this.page.total = this.onetotal
  877. this.dataList = this.data_one;
  878. } else {
  879. this.page.total = this.twototal
  880. this.dataList = this.data_two;
  881. }
  882. this.key++
  883. })
  884. },
  885. //生成账单
  886. generateBill(){
  887. this.$confirm("您确定要生成账单吗?", {
  888. confirmButtonText: "确定",
  889. cancelButtonText: "取消",
  890. type: "warning"
  891. }).then(() => {
  892. const loading = this.$loading({
  893. lock: true,
  894. text: '加载中',
  895. spinner: 'el-icon-loading',
  896. background: 'rgba(255,255,255,0.7)'
  897. });
  898. const data = {
  899. id: this.id,
  900. type:this.type,
  901. transportItemFeesList:this.selectionList,
  902. tradingBoxFeesList:this.selectionList
  903. }
  904. generateBill(data).then(rest => {
  905. loading.close();
  906. this.$message.success('生成成功')
  907. this.$parent.refresh(this.id)
  908. this.selectionList = []
  909. this.$emit("generateBill")
  910. }).catch(() => {
  911. loading.close();
  912. })
  913. })
  914. },
  915. //撤销账单
  916. revokeBill(){
  917. this.$confirm("您确定要撤销账单吗?", {
  918. confirmButtonText: "确定",
  919. cancelButtonText: "取消",
  920. type: "warning"
  921. }).then(() => {
  922. const loading = this.$loading({
  923. lock: true,
  924. text: '加载中',
  925. spinner: 'el-icon-loading',
  926. background: 'rgba(255,255,255,0.7)'
  927. });
  928. const data = {
  929. id: this.id,
  930. type:this.type,
  931. transportItemFeesList:this.selectionList,
  932. tradingBoxFeesList:this.selectionList
  933. }
  934. revokeBill(data).then(rest => {
  935. loading.close();
  936. this.$message.success('撤销成功')
  937. this.$parent.refresh(this.id)
  938. this.selectionList = []
  939. this.$emit("generateBill")
  940. }).catch(() => {
  941. loading.close();
  942. })
  943. })
  944. },
  945. // 选中表格的时候触发 反的是选中的数组
  946. selectionChange(list) {
  947. this.selectionList = list
  948. },
  949. // 打印
  950. openReport() {
  951. for (let item of this.listData) {
  952. if (!item.id) {
  953. this.$confirm("有未保存的费用,是否继续打印?", {
  954. confirmButtonText: "确定",
  955. cancelButtonText: "取消",
  956. type: "warning"
  957. }).then(() => {
  958. if (this.type === "CK" || this.type === "JK") {
  959. if (this.activeNameTwo === "first") {
  960. this.reportName = "收款费用详情(进出口)"
  961. }else {
  962. this.reportName = "付款费用详情(进出口)"
  963. }
  964. }else {
  965. if (this.activeNameTwo === "first"){
  966. this.reportName = "收款费用详情(箱管)"
  967. }else {
  968. this.reportName = "付款费用详情(箱管)"
  969. }
  970. }
  971. this.switchDialog = true
  972. })
  973. }
  974. }
  975. if (this.type === "CK" || this.type === "JK"){
  976. if (this.activeNameTwo === "first"){
  977. this.reportName = "收款费用详情(进出口)"
  978. }else {
  979. this.reportName = "付款费用详情(进出口)"
  980. }
  981. }else {
  982. if (this.activeNameTwo === "first"){
  983. this.reportName = "收款费用详情(箱管)"
  984. }else {
  985. this.reportName = "付款费用详情(箱管)"
  986. }
  987. }
  988. this.switchDialog = true
  989. },
  990. // 报表关闭
  991. onClose(val) {
  992. this.switchDialog = val;
  993. },
  994. handleClick(tab, event) {
  995. this.activeNameTwo = tab.name
  996. if (tab.name === "first") {
  997. this.findObject(this.option.column, "corpName").label = "收款对象"
  998. this.page.total = this.onetotal
  999. } else {
  1000. this.findObject(this.option.column, "corpName").label = "付款对象"
  1001. this.page.total = this.twototal
  1002. }
  1003. },
  1004. // 新增按钮事件
  1005. rowSave(form, done, loading) {
  1006. done({
  1007. ...form,
  1008. feesType: this.activeNameTwo === "first" ? 1 : 2,
  1009. sort: this.dataList.length
  1010. })
  1011. console.log(form,976)
  1012. if(this.type == 'CK' || this.type == 'JK') {
  1013. this.transportItemFeesSubmitdatafun(form)
  1014. }else if (this.type == 'ZR' || this.type == 'ZC' || this.type == 'SELL' || this.type == 'BUY' || this.type == 'DCF') {
  1015. this.tradingBoxFeesSubmitfun(form)
  1016. }
  1017. // if (this.activeNameTwo === "first") {
  1018. // this.dataList = this.dataList.concat(this.data_two)
  1019. // this.$emit("callBack", this.dataList);
  1020. // } else {
  1021. // this.dataList = this.dataList.concat(this.data_one)
  1022. // this.$emit("callBack", this.dataList);
  1023. // }
  1024. },
  1025. // 买箱,卖箱,租入,租出,堆存管理 添加和保存
  1026. tradingBoxFeesSubmitfun(form){
  1027. let feesType = null
  1028. if (this.activeNameTwo === "first") {
  1029. feesType = 1
  1030. } else {
  1031. feesType = 2
  1032. }
  1033. tradingBoxFeesSubmit({
  1034. ...form,
  1035. pid:this.id,
  1036. feesType:feesType
  1037. }).then(res=>{
  1038. if (res.data.code == 200) {
  1039. this.$message.success("操作成功!");
  1040. this.tradingBoxFeesListfun(feesType)
  1041. }
  1042. })
  1043. },
  1044. // 出口装运,进口装运的接口
  1045. transportItemFeesSubmitdatafun(form){
  1046. let feesType = null
  1047. if (this.activeNameTwo === "first") {
  1048. feesType = 1
  1049. } else {
  1050. feesType = 2
  1051. }
  1052. transportItemFeesSubmitdata({
  1053. ...form,
  1054. pid:this.id,
  1055. feesType:feesType
  1056. }).then(res=>{
  1057. if (res.data.code == 200) {
  1058. this.$message.success("操作成功!");
  1059. this.transportItemFeesListdatafun(feesType)
  1060. }
  1061. })
  1062. },
  1063. // 费用信息编辑
  1064. rowUpdate(form, index, done, loading) {
  1065. done(form)
  1066. if(this.type == 'CK' || this.type == 'JK') {
  1067. this.transportItemFeesSubmitdatafun(form)
  1068. }else if (this.type == 'ZR' || this.type == 'ZC' || this.type == 'SELL' || this.type == 'BUY' || this.type == 'DCF') {
  1069. this.tradingBoxFeesSubmitfun(form)
  1070. }
  1071. // if (this.activeNameTwo === "first") {
  1072. // this.$emit("callBack", this.dataList.concat(this.data_two));
  1073. // } else {
  1074. // this.$emit("callBack", this.data_one.concat(this.dataList));
  1075. // }
  1076. },
  1077. // 明细删除
  1078. rowDel(row, index) {
  1079. this.$confirm("确定将选择数据删除?", {
  1080. confirmButtonText: "确定",
  1081. cancelButtonText: "取消",
  1082. type: "warning"
  1083. }).then(() => {
  1084. if (row.id) {
  1085. tradingBoxFees(row.id, this.url ? this.url : "/api/blade-box-tube/tradingBoxFees/remove").then(res => {
  1086. if (res.data.success) {
  1087. this.dataList.splice(index, 1);
  1088. this.$message.success("操作成功!");
  1089. if (this.activeNameTwo === "first") {
  1090. this.$emit("callBack", this.dataList.concat(this.data_two));
  1091. } else {
  1092. this.$emit("callBack", this.data_one.concat(this.dataList));
  1093. }
  1094. }
  1095. });
  1096. } else {
  1097. this.dataList.splice(index, 1);
  1098. this.$message.success("操作成功!");
  1099. if (this.activeNameTwo === "first") {
  1100. this.$emit("callBack", this.dataList.concat(this.data_two));
  1101. } else {
  1102. this.$emit("callBack", this.data_one.concat(this.dataList));
  1103. }
  1104. }
  1105. });
  1106. },
  1107. //选择费用名称
  1108. selectValue(value) {
  1109. this.form.itemName = value.cname
  1110. },
  1111. getGSDataTwo(row) {
  1112. this.form.corpName = row.cname
  1113. },
  1114. //自定义列保存
  1115. async saveColumn(ref, option, optionBack, code) {
  1116. /**
  1117. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1118. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1119. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1120. */
  1121. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1122. if (inSave) {
  1123. this.$message.success("保存成功");
  1124. this.option.selectable = (row, index) => {
  1125. return row.id;
  1126. }
  1127. //关闭窗口
  1128. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1129. }
  1130. },
  1131. //自定义列重置
  1132. async resetColumn(ref, option, optionBack, code) {
  1133. this[option] = this[optionBack];
  1134. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1135. this.$emit("resetTrigger")
  1136. if (inSave) {
  1137. this.findObject(this.option.column, "price").change = ({value, column}) => {
  1138. if (value && this.form.quantity) {
  1139. if (this.form.exchangeRate) {
  1140. this.form.amount = value * this.form.quantity * this.form.exchangeRate
  1141. } else {
  1142. this.form.amount = value * this.form.quantity
  1143. }
  1144. }
  1145. }
  1146. this.findObject(this.option.column, "currency").change = ({value, column}) => {
  1147. for (let item of this.$refs.crud.DIC.currency) {
  1148. if (item.dictValue == value) {
  1149. getParities({
  1150. currency: value,
  1151. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00"
  1152. }).then(res => {
  1153. this.form.exchangeRate = res.data.data.receiptsParities
  1154. })
  1155. if (this.form.price && this.form.quantity) {
  1156. this.form.amount = this.form.price * this.form.quantity * item.remark
  1157. }
  1158. }
  1159. }
  1160. }
  1161. this.findObject(this.option.column, "quantity").change = ({value, column}) => {
  1162. if (this.form.price && value) {
  1163. if (this.form.exchangeRate) {
  1164. this.form.amount = this.form.price * value * this.form.exchangeRate
  1165. } else {
  1166. this.form.amount = this.form.price * value
  1167. }
  1168. }
  1169. }
  1170. if (this.activeNameTwo === "first") {
  1171. this.findObject(this.option.column, "corpName").label = "收款对象"
  1172. } else {
  1173. this.findObject(this.option.column, "corpName").label = "付款对象"
  1174. }
  1175. this.option.selectable = (row, index) => {
  1176. return row.id;
  1177. }
  1178. this.$message.success("重置成功");
  1179. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1180. }
  1181. }
  1182. }
  1183. }
  1184. </script>
  1185. <style scoped>
  1186. </style>