receiptSettleDetailsPage.vue 30 KB

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