receiptSettleDetailsPage.vue 32 KB

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