index.vue 28 KB

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