paymentSettleDetailsPage.vue 27 KB

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