paymentSettleDetailsPage.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. <div class="upper_right_button">
  9. <el-button type="primary" size="small" @click="editHandle" v-if="editDisable">编 辑</el-button>
  10. <el-button type="warning" class="el-button--small-yh" size="small" :loading="buttonLoading" v-if="form.id"
  11. :disabled="!form.id || editDisable" @click.stop="confirmSettlement">{{ financeDisabled ? "付费" : "撤销付费" }}
  12. </el-button>
  13. <el-button class="el-button--small-yh" type="primary" size="small" :loading="buttonLoading"
  14. @click.stop="saveSettlement" :disabled="editDisable">保存数据
  15. </el-button>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="customer-main">
  20. <containerTitle title="基础信息"></containerTitle>
  21. <basic-container>
  22. <avue-form class="trading-form" ref="form" v-model="form" :option="option">
  23. <template slot="caseOverPayment">
  24. <el-input placeholder="请输入" clearable v-model="form.caseOverPayment" @change="caseOverPaymentChange"
  25. v-input-limit="2" :disabled="dataList.length == 0 || (!financeDisabled && form.id) || editDisable">
  26. </el-input>
  27. </template>
  28. <template slot="corpId">
  29. <crop-select v-model="form.corpId" corpType="KC" :disabled="(!financeDisabled && form.id) || editDisable || dataList.length>0"
  30. @getCorpData="returnBack" style="width: 100%"></crop-select>
  31. </template>
  32. <template slot="salesCompany">
  33. <crop-select v-model="form.salesCompany" corpType="GS"
  34. :disabled="(!financeDisabled && form.id) || editDisable" @getCorpData="getGSName" style="width: 100%">
  35. </crop-select>
  36. </template>
  37. <template slot="accountNo">
  38. <el-select v-model="form.accountNo" placeholder="请选择"
  39. :disabled="(!financeDisabled && form.id) || editDisable" @change="accountNoChange" clearable filterable>
  40. <el-option v-for="(item, index) in form.bankList" :key="index" :label="item.accountNo"
  41. :value="item.accountNo">
  42. </el-option>
  43. </el-select>
  44. </template>
  45. <template slot="remark">
  46. <el-input type="textarea" v-model="form.remark" size="small" rows="2" autocomplete="off" placeholder="">
  47. </el-input>
  48. </template>
  49. </avue-form>
  50. </basic-container>
  51. <containerTitle title="明细列表"></containerTitle>
  52. <basic-container>
  53. <avue-crud :option="itemsOption" :data="dataList" ref="crud" v-model="itemsForm" :page.sync="page"
  54. :cell-style="cellStyle" @search-reset="searchReset" @row-update="rowUpdate"
  55. @selection-change="selectionChange">
  56. <template slot="menuLeft">
  57. <el-button type="primary" size="small" :loading="buttonLoading" icon="el-icon-shopping-cart-2"
  58. :disabled="!financeButton || editDisable" @click="selectPurchase(0)">选择应付
  59. </el-button>
  60. <el-button class="el-icon-download" type="info" size="small" :disabled="!form.id" @click="openReport">报表打印</el-button>
  61. <el-button type="primary" size="small" :loading="buttonLoading" icon="el-icon-shopping-cart-2"
  62. :disabled="!financeButton || editDisable" @click="selectPurchase(1)">选择应收
  63. </el-button>
  64. </template>
  65. <template slot-scope="{ row,index }" slot="menu">
  66. <el-button type="text" size="small" icon="el-icon-edit" :disabled="!financeButton || editDisable"
  67. @click.stop="rowCell(row,index)"> {{row.$cellEdit ? '修改完成' : '修改' }}
  68. </el-button>
  69. <el-button type="text" size="small" icon="el-icon-delete" :disabled="!financeButton || editDisable"
  70. @click.stop="rowDel(row,index)">删除
  71. </el-button>
  72. </template>
  73. <template slot="srcOrderno" slot-scope="scope">
  74. <span style="color: #409EFF;cursor: pointer"
  75. @click="jumpPage(scope.row, scope.index)">{{ scope.row.srcOrderno }}</span>
  76. </template>
  77. <template slot-scope="{ row }" slot="currency">
  78. <el-select v-if="row.$cellEdit" v-model="row.currency" size="small" placeholder="请选择 币别" clearable
  79. filterable>
  80. <el-option v-for="(item, index) in currencyDic" :key="index" :label="item.dictValue"
  81. :value="item.dictValue"></el-option>
  82. </el-select>
  83. <span v-else>{{ row.currency }}</span>
  84. </template>
  85. <template slot="thisAmount" slot-scope="{ row }">
  86. <span v-if="row.$cellEdit" class="required_fields">*</span>
  87. <el-input v-if="row.$cellEdit" v-model="row.thisAmount" style="width: 90%" placeholder="请输入" size="small"
  88. @input="thisAmountVerify(row)"
  89. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'></el-input>
  90. <span v-else>{{ row.thisAmount }}</span>
  91. </template>
  92. </avue-crud>
  93. </basic-container>
  94. <el-dialog :title="title" append-to-body class="el-dialogDeep" :visible.sync="billDetailDialog" v-if="billDetailDialog" width="60%"
  95. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" top="10vh" v-dialog-drag>
  96. <bill-detail :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail"
  97. @importProMent="importProMent">
  98. </bill-detail>
  99. </el-dialog>
  100. <!-- 报表-->
  101. <report-dialog
  102. :switchDialog="switchDialog"
  103. :reportId="form.id"
  104. reportName="付款"
  105. @onClose="onClose()"
  106. />
  107. </div>
  108. </div>
  109. </template>
  110. <script>
  111. import option from "./configuration/detailsPage.json";
  112. import { getDetail} from "@/api/financialManagement/financialManagement"
  113. import { getDetails, modify, cancelModify, saveOrEdit, deleteDetail } from "@/api/financialManagement/paymentRequest";
  114. import { contrastObj, contrastList } from "@/util/contrastData";
  115. import billDetail from "@/components/bill/billDetails";
  116. import { getlistBankBy } from "@/api/financialManagement/paymentRequest";
  117. import { getlistBankBy as GYSGetBank } from "@/api/basicData/configuration"
  118. import _ from "lodash";
  119. import { getUserInfo } from "@/api/system/user";
  120. import { getCorpDetail } from "@/api/maintenance/overpayment";
  121. import reportDialog from "@/components/report-dialog/main.vue";
  122. export default {
  123. name: "paymentDetailsPage",
  124. props: {
  125. detailData: {
  126. type: Object
  127. }
  128. },
  129. data() {
  130. return {
  131. form: {},
  132. title:'',
  133. switchDialog:false,
  134. itemsForm: {},
  135. itemsOption: option,
  136. billDetailDialog: false,
  137. buttonLoading: false,
  138. financeDisabled: false,
  139. financeButton: true,
  140. billType: "申请",
  141. params: {},
  142. id: "",
  143. dataList: [],
  144. currencyDic: [],
  145. page: {
  146. pageSize: 10,
  147. pagerCount: 5,
  148. total: 0,
  149. },
  150. query: {},
  151. option: {
  152. menuBtn: false,
  153. labelWidth: 100,
  154. column: [
  155. {
  156. label: '所属公司',
  157. prop: 'salesCompany',
  158. sort: true,
  159. span: 8,
  160. rules: [
  161. {
  162. required: true,
  163. message: ' ',
  164. trigger: 'blur'
  165. }
  166. ]
  167. },
  168. {
  169. label: '合同号',
  170. prop: 'srcOrderno',
  171. span: 8,
  172. rules: [
  173. {
  174. required: false,
  175. message: ' ',
  176. trigger: 'blur'
  177. }
  178. ]
  179. },
  180. {
  181. label: '系统号',
  182. prop: 'sysNo',
  183. span: 8,
  184. disabled: true
  185. },
  186. {
  187. label: '银行账号',
  188. prop: 'accountNo',
  189. span: 8,
  190. rules: [
  191. {
  192. required: false,
  193. message: ' ',
  194. trigger: 'blur'
  195. }
  196. ]
  197. },
  198. {
  199. label: '开户银行',
  200. prop: 'accountBank',
  201. span: 8,
  202. rules: [
  203. {
  204. required: false,
  205. message: ' ',
  206. trigger: 'blur'
  207. }
  208. ]
  209. }, {
  210. label: '银行户头',
  211. prop: 'accountName',
  212. span: 8,
  213. rules: [
  214. {
  215. required: false,
  216. message: ' ',
  217. trigger: 'blur'
  218. }
  219. ]
  220. }, {
  221. label: '科目编码',
  222. prop: 'subjectNumber',
  223. span: 8,
  224. rules: [
  225. {
  226. required: false,
  227. message: ' ',
  228. trigger: 'blur'
  229. }
  230. ]
  231. },
  232. {
  233. label: '结算单位',
  234. prop: 'corpId',
  235. sort: true,
  236. span: 8,
  237. rules: [
  238. {
  239. required: true,
  240. message: ' ',
  241. trigger: 'blur'
  242. }
  243. ]
  244. },
  245. {
  246. label: '付款日期',
  247. prop: 'settlementDate',
  248. format: "yyyy-MM-dd",
  249. valueFormat: "yyyy-MM-dd 00:00:00",
  250. span: 8,
  251. type: "date",
  252. rules: [
  253. {
  254. required: true,
  255. message: ' ',
  256. trigger: 'blur'
  257. }
  258. ]
  259. },
  260. {
  261. label: '制单人',
  262. prop: 'createUserName',
  263. span: 8,
  264. disabled: true,
  265. rules: [
  266. {
  267. required: false,
  268. message: ' ',
  269. trigger: 'blur'
  270. }
  271. ]
  272. },
  273. {
  274. label: '人民币金额',
  275. prop: 'amount',
  276. span: 8,
  277. rules: [
  278. {
  279. pattern: /^[+-]?((\d*(\.\d{1,})$)|(\d+$))/,
  280. message: ' ',
  281. trigger: 'blur'
  282. },
  283. {
  284. required: false,
  285. message: ' ',
  286. trigger: 'blur'
  287. }
  288. ]
  289. },
  290. {
  291. label: '应付金额合计',
  292. prop: 'payAmount',
  293. span: 8,
  294. rules: [
  295. {
  296. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  297. message: ' ',
  298. trigger: 'blur'
  299. },
  300. {
  301. required: false,
  302. message: ' ',
  303. trigger: 'blur'
  304. }
  305. ]
  306. },
  307. {
  308. label: '应收金额合计',
  309. prop: 'receivableAmount',
  310. span: 8,
  311. rules: [
  312. {
  313. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  314. message: ' ',
  315. trigger: 'blur'
  316. },
  317. {
  318. required: false,
  319. message: ' ',
  320. trigger: 'blur'
  321. }
  322. ]
  323. },
  324. {
  325. label: '外币金额',
  326. prop: 'foreignAmount',
  327. span: 8,
  328. rules: [
  329. {
  330. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  331. message: ' ',
  332. trigger: 'blur'
  333. }
  334. ]
  335. },
  336. {
  337. label: '使用溢付款',
  338. prop: 'caseOverPayment',
  339. display: false,
  340. span: 8,
  341. rules: [
  342. {
  343. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  344. message: ' ',
  345. trigger: 'blur'
  346. }
  347. ]
  348. },
  349. {
  350. label: '溢付款余额',
  351. prop: 'overPayment',
  352. display: false,
  353. disabled: true,
  354. span: 8,
  355. rules: [
  356. {
  357. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  358. message: ' ',
  359. trigger: 'blur'
  360. }
  361. ]
  362. },
  363. {
  364. label: '制单日期',
  365. prop: 'createTime',
  366. span: 8,
  367. type: "date",
  368. disabled: true,
  369. rules: [
  370. {
  371. required: false,
  372. message: ' ',
  373. trigger: 'blur'
  374. }
  375. ]
  376. },
  377. {
  378. label: '备注',
  379. prop: 'remark',
  380. span: 24,
  381. minRows: 2,
  382. rules: [
  383. {
  384. required: false,
  385. message: ' ',
  386. trigger: 'blur'
  387. }
  388. ]
  389. },
  390. ],
  391. },
  392. financeStatusDic: [{
  393. label: '正常',
  394. value: 0
  395. }, {
  396. label: '停用',
  397. value: 1
  398. }],
  399. //顶部from数据
  400. oldForm: {},
  401. oldDataList: [],
  402. category: '',
  403. allAmount: 0,
  404. editDisable: false,
  405. }
  406. },
  407. components: {
  408. billDetail,reportDialog
  409. },
  410. created() {
  411. // 人民币金额默认为0
  412. this.$set(this.form, "amount", 0)
  413. getUserInfo().then(res => {
  414. this.category = res.data.data.billType
  415. if (this.category == 2) {
  416. this.$set(this.form, "overPayment", 0)
  417. this.$set(this.form, "caseOverPayment", 0)
  418. this.option.column.forEach(item => {
  419. if (item.prop == 'caseOverPayment' || item.prop == 'overPayment') {
  420. item.display = true
  421. }
  422. if (item.prop == 'foreignAmount') {
  423. item.display = false
  424. }
  425. })
  426. }
  427. })
  428. //币别
  429. this.getWorkDicts("currency").then(res => {
  430. this.currencyDic = res.data.data
  431. })
  432. this.detailData.disabled && (this.editDisable = true)
  433. if (this.detailData.id) {
  434. this.buttonLoading = true
  435. this.id = this.detailData.id;//字符串转数字 超长用BigInt
  436. getDetail(this.id).then(res => {
  437. this.afterEcho(res.data.data)
  438. }).finally(() => {
  439. this.buttonLoading = false
  440. })
  441. } else {
  442. this.form.financeStatus = "待结算"
  443. this.oldForm.financeStatus = "待结算"
  444. }
  445. if (this.detailData.params) {
  446. this.buttonLoading = true
  447. getDetails(this.detailData.params).then(res => {
  448. delete res.data.data.id;
  449. delete res.data.data.sysNo;
  450. delete res.data.data.billType;
  451. res.data.data.itemsList.map((items) => {
  452. delete items.id;
  453. items.thisAmount = items.amount
  454. })
  455. this.afterEcho(res.data.data)
  456. }).finally(() => {
  457. this.buttonLoading = false
  458. })
  459. }
  460. },
  461. mounted() {
  462. },
  463. methods: {
  464. // 报表
  465. openReport() {
  466. this.switchDialog = !this.switchDialog;
  467. },
  468. // 报表关闭
  469. onClose(val) {
  470. this.switchDialog = val;
  471. },
  472. //选择客户
  473. returnBack(corpValue) {
  474. this.corpId = corpValue.id
  475. if (this.category != 2) {
  476. getlistBankBy(corpValue.id).then(res => {
  477. this.$set(this.form, "bankList", res.data)
  478. })
  479. }
  480. // 溢付款余额获取
  481. if (this.category == 2) {
  482. getCorpDetail({ corpId: corpValue.id }).then(res => {
  483. this.form.overPayment = res.data.data ? res.data.data.balanceOverpaymen : 0
  484. })
  485. }
  486. },
  487. //选择卡号
  488. accountNoChange(value) {
  489. let isTrue = false
  490. this.form.bankList.forEach(item => {
  491. if (item.accountNo == value) {
  492. this.$set(this.form, "accountBank", item.accountBank)
  493. this.$set(this.form, "accountName", item.accountName)
  494. this.$set(this.form, "subjectNumber", item.subjectNumber)
  495. isTrue = true
  496. }
  497. })
  498. this.$nextTick(() => {
  499. if (!isTrue) {
  500. this.$set(this.form, 'accountBank', null)
  501. this.$set(this.form, 'accountName', null)
  502. this.$set(this.form, "subjectNumber", null)
  503. }
  504. })
  505. },
  506. //本次金额验证
  507. thisAmountVerify(row) {
  508. if (parseFloat(row.thisAmount) > parseFloat(row.amount)) {
  509. this.$message.warning('本次金额不得大于金额!')
  510. this.$set(row, 'thisAmount', '')
  511. }
  512. this.calculation(this.dataList)
  513. },
  514. selectPurchase(val) {
  515. if (!this.form.corpId) {
  516. this.$message.warning("请先选择客户!")
  517. return
  518. }
  519. this.params = {
  520. corpId: this.form.corpId
  521. }
  522. if (val === 0){
  523. this.title = '导入运费'
  524. this.billType = '付费'
  525. }else {
  526. this.title = '导入销售'
  527. this.billType = '收费'
  528. }
  529. this.billDetailDialog = true;
  530. },
  531. closeBillDetail() {
  532. this.billDetailDialog = false;
  533. },
  534. importProMent(list) {
  535. list.forEach((item, index) => {
  536. item.accId = item.id;
  537. item.fleetName = item.fleetName?item.fleetName:item.corpName
  538. item.srcOrderno = item.accSysNo;
  539. item.billNo = item.srcBillNo;
  540. item.thisAmount = item.amount;
  541. delete item.id;
  542. this.$refs.crud.rowCellAdd(item);
  543. })
  544. this.$set(this.form, 'srcOrderno', Array.from(new Set(this.dataList.map(item => { if (item.srcOrderno) { return item.srcOrderno } }))).join(','))
  545. this.billDetailDialog = false;
  546. this.calculation(this.dataList)
  547. },
  548. calculation(data){
  549. let d = 0
  550. let c = 0
  551. data.forEach(item =>{
  552. if (item.dc === "c"){
  553. c += Number(item.thisAmount)
  554. }else if (item.dc === "D"){
  555. d += Number(item.thisAmount)
  556. }
  557. })
  558. //应付金额合计
  559. this.form.payAmount = c
  560. this.form.receivableAmount = d
  561. //应收金额合计
  562. this.form.amount = c-d
  563. },
  564. rowUpdate(row, index, done) {
  565. done(row);
  566. },
  567. rowCell(row, index) {
  568. if (row.$cellEdit == true) {
  569. this.$set(row, "$cellEdit", false);
  570. } else {
  571. this.$set(row, "$cellEdit", true);
  572. }
  573. // row.$cellEdit = !row.$cellEdit
  574. },
  575. rowDel(row, index) {
  576. if (row.id) {
  577. deleteDetail({ids: row.id}).then(res => {
  578. this.$message({
  579. type: "success",
  580. message: "操作成功!"
  581. });
  582. this.dataList.splice(index, 1);
  583. this.calculation(this.dataList)
  584. })
  585. } else {
  586. this.dataList.splice(index, 1);
  587. this.calculation(this.dataList)
  588. }
  589. },
  590. searchReset() {
  591. console.log('1')
  592. },
  593. selectionChange() {
  594. console.log('1')
  595. },
  596. confirmSettlement(status) {
  597. this.$refs["form"].validate((valid, done) => {
  598. done();
  599. if (valid && this.verificationData('付费')) {
  600. this.$confirm("是否确认" + (this.financeDisabled ? '付费' : '撤销付费'), "提示", {
  601. confirmButtonText: "确认",
  602. cancelButtonText: "取消",
  603. type: "warning",
  604. }).then(() => {
  605. for (let i = 0; i < this.dataList.length; i++) {
  606. if (this.dataList[i].thisAmount == null || this.dataList[i].thisAmount == 0) {
  607. return this.$message.error(`第${i + 1}行的本次金额不能为空`);
  608. }
  609. }
  610. this.form.billNo = this.dataList.map(item => { return item.billNo }).join(",")
  611. if (this.category == 2 && this.financeDisabled) {
  612. this.allAmount = 0;
  613. this.form.amount = this.form.amount ? this.form.amount : 0
  614. this.dataList.forEach(e => {
  615. this.allAmount = Number(this.allAmount) + Number(e.thisAmount)
  616. })
  617. if (this.allAmount == 0 && this.form.amount == 0) {
  618. return this.$message.error('人民币金额不能为空')
  619. } else if (Number(this.allAmount) > 0 && (Number(this.form.amount) > Number(this.allAmount))) {
  620. this.form.caseOverPayment = 0;
  621. } else if (Number(this.allAmount) > 0 && (Number(this.form.amount) < Number(this.allAmount))) {
  622. this.form.caseOverPayment = Number(this.allAmount) - Number(this.form.amount)
  623. if (Number(this.form.caseOverPayment) > Number(this.form.overPayment)) {
  624. return this.$message.error('溢付款余额不足,无法付费')
  625. }
  626. }
  627. }
  628. const params = {
  629. ...this.form,
  630. billType: "付费",
  631. itemsList: this.dataList
  632. }
  633. this.buttonLoading = true
  634. if (this.financeButton) {
  635. modify(params).then(res => {
  636. this.$message.success("操作成功!")
  637. this.afterEcho(res.data.data)
  638. }).finally(() => {
  639. this.buttonLoading = false
  640. })
  641. } else {
  642. cancelModify(params).then(res => {
  643. this.$message.success("操作成功!")
  644. this.afterEcho(res.data.data)
  645. }).finally(() => {
  646. this.buttonLoading = false
  647. })
  648. }
  649. })
  650. if (status === true) {
  651. this.$emit("goBack");
  652. this.leaveDetailsKey(this.$route.name)
  653. }
  654. }
  655. })
  656. },
  657. saveSettlement(type) {
  658. this.$refs["form"].validate((valid, done) => {
  659. if (valid) {
  660. for (let i = 0; i < this.dataList.length; i++) {
  661. if (this.dataList[i].thisAmount == (null || "")) {
  662. return this.$message.error(`第输入${i + 1}行的本次金额`);
  663. }
  664. }
  665. this.buttonLoading = true
  666. this.form.billNo = this.dataList.map(item => { return item.billNo }).join(",")
  667. const params = {
  668. ...this.form,
  669. billType: "付费",
  670. itemsList: this.dataList,
  671. settlementType: 1
  672. }
  673. // 如果有id解锁,没有跳过
  674. // this.form.id && this.unLock({moduleName: 'ff',tableName: 'finance_settlement', billId: this.form.id})
  675. saveOrEdit(params).then(res => {
  676. this.$message.success("操作成功!")
  677. // this.detailData.disabled = true
  678. // this.editDisable = true
  679. this.afterEcho(res.data.data, type)
  680. done();
  681. }).finally(() => {
  682. this.buttonLoading = false
  683. })
  684. }
  685. })
  686. },
  687. async afterEcho(data, type) {
  688. this.form = data;
  689. this.financeDisabled = this.form.financeStatus == "待结算" ? true : false;
  690. if (this.category == 2) {
  691. await getCorpDetail({ corpId: this.form.corpId }).then(res => {
  692. if (Number(this.form.overPayment) != (res.data.data ? res.data.data.balanceOverpaymen : '0.00')) {
  693. this.form.overPayment = res.data.data ? res.data.data.balanceOverpaymen : '0.00'
  694. }
  695. })
  696. }
  697. this.oldForm = Object.assign({}, this.form);
  698. //审核状态为空时 说明为新单进来
  699. if (this.financeDisabled || !this.editDisable) {
  700. this.financeButton = true
  701. this.option.column.forEach(item => {
  702. if (item.prop === "remark" || item.prop === "settlementDate") {
  703. this.$set(item, "disabled", false)
  704. } else if (item.prop === "createUserName" || item.prop === "createTime" || item.prop === "sysNo") {
  705. this.$set(item, "disabled", true)
  706. } else {
  707. this.$set(item, "disabled", false)
  708. }
  709. })
  710. }
  711. if (!this.financeDisabled || this.editDisable) {
  712. this.financeButton = false
  713. this.option.column.forEach(item => {
  714. if (item.prop === "remark") {
  715. this.$set(item, "disabled", false)
  716. } else if (item.prop === "createUserName" || item.prop === "createTime" || item.prop === "sysNo") {
  717. this.$set(item, "disabled", true)
  718. } else {
  719. this.$set(item, "disabled", true)
  720. }
  721. })
  722. }
  723. if (data.itemsList) {
  724. this.dataList = data.itemsList
  725. this.oldDataList = this.deepClone(data.itemsList)
  726. }
  727. if (type == '付费') {
  728. this.confirmSettlement()
  729. }
  730. },
  731. verificationData(type) {
  732. if (contrastObj(this.form, this.oldForm) || contrastList(this.dataList, this.oldDataList)
  733. ) {
  734. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  735. confirmButtonText: "保存",
  736. cancelButtonText: "取消",
  737. type: "warning",
  738. }).then(() => {
  739. this.saveSettlement(type)
  740. }).catch(() => {
  741. return false
  742. })
  743. } else {
  744. return true
  745. }
  746. },
  747. backToList() {
  748. if (contrastObj(this.form, this.oldForm) || contrastList(this.dataList, this.oldDataList)
  749. ) {
  750. this.$confirm("是否保存当前页面?", "提示", {
  751. confirmButtonText: "保存",
  752. cancelButtonText: "取消",
  753. type: "warning",
  754. }).then(() => {
  755. this.saveSettlement()
  756. }).catch(() => {
  757. !this.editDisable && this.form.id && this.unLock({ moduleName: 'ff', tableName: 'finance_settlement', billId: this.form.id })
  758. this.$emit("goBack");
  759. this.leaveDetailsKey(this.$route.name)
  760. })
  761. } else {
  762. !this.editDisable && this.form.id && this.unLock({ moduleName: 'ff', tableName: 'finance_settlement', billId: this.form.id })
  763. this.$emit("goBack");
  764. this.leaveDetailsKey(this.$route.name)
  765. }
  766. },
  767. // 溢付款更改时
  768. caseOverPaymentChange() {
  769. if (!this.form.caseOverPayment) this.form.caseOverPayment = 0;
  770. if (Number(this.form.caseOverPayment) > Number(this.form.overPayment)) {
  771. this.form.caseOverPayment = 0;
  772. return this.$message.error('本次使用的溢付款不能超过总溢付款')
  773. }
  774. },
  775. editHandle() {
  776. const data = {
  777. moduleName: 'ff',
  778. tableName: 'finance_settlement',
  779. billId: this.form.id,
  780. no: localStorage.getItem('browserID'),
  781. billNo: this.form.srcOrderno
  782. }
  783. this.checkLock(data).then(res => {
  784. if (res.data.code == 200) {
  785. this.onLock(data).then(response => {
  786. })
  787. this.inDetailsKey(this.$route.name, {
  788. moduleName: 'ff',
  789. tableName: 'finance_settlement',
  790. billId: this.form.id,
  791. })
  792. this.detailData.disabled = false;
  793. this.editDisable = false;
  794. this.buttonLoading = true
  795. getDetail(this.form.id).then(data => {
  796. this.afterEcho(data.data.data)
  797. }).finally(() => {
  798. this.buttonLoading = false
  799. })
  800. }
  801. }).catch(error => {
  802. }).finally(() => {
  803. this.buttonLoading = false
  804. })
  805. },
  806. getGSName(row) {
  807. this.form.belongCompany = row.cname
  808. if (this.category == 2) {
  809. GYSGetBank(row.id).then(res => {
  810. this.$set(this.form, "bankList", res.data)
  811. console.log(res.data)
  812. if (this.form.bankList.length > 0) {
  813. this.form.accountNo = this.form.bankList[0].accountNo
  814. this.form.accountName = this.form.bankList[0].accountName
  815. this.form.accountBank = this.form.bankList[0].accountBank
  816. this.form.subjectNumber = this.form.bankList[0].subjectNumber
  817. }
  818. })
  819. }
  820. },
  821. cellStyle() {
  822. return "padding:0;height:40px;";
  823. },
  824. // 跳转页面
  825. jumpPage(row, index) {
  826. if (this.category == 2) {
  827. this.$router.$avueRouter.closeTag("/businessManagement/purchaseOrder/index");
  828. this.$router.push({
  829. path: "/businessManagement/purchaseOrder/index",
  830. query: {
  831. params: row.srcParentId
  832. },
  833. });
  834. } else if (this.category == 3) {
  835. this.$router.$avueRouter.closeTag("/purchase/contract/index");
  836. this.$router.push({
  837. path: "/purchase/contract/index",
  838. query: {
  839. params: row.srcParentId
  840. },
  841. });
  842. } else if (this.category == 4) {
  843. this.$router.$avueRouter.closeTag("/exportTrade/purchaseContract/index");
  844. this.$router.push({
  845. path: "/exportTrade/purchaseContract/index",
  846. query: {
  847. params: row.srcParentId
  848. },
  849. });
  850. }
  851. },
  852. }
  853. }
  854. </script>
  855. <style lang="scss" scoped>
  856. ::v-deep .el-form-item {
  857. margin-bottom: 0;
  858. }
  859. .trading-form ::v-deep .el-form-item {
  860. margin-bottom: 8px !important;
  861. }
  862. .required_fields {
  863. color: #F56C6C;
  864. display: inline-block;
  865. width: 7%
  866. }
  867. .upper_right_button {
  868. display: flex;
  869. position: fixed;
  870. right: 12px;
  871. top: 47px;
  872. }
  873. </style>