import Api from '~/service/Api'; import commonFunctions from '~/mixin/commonFunctions.js'; import buildFn from './buildCommons.js'; import moment from 'moment'; import BigNumber from "bignumber.js"; export default { mixins: [commonFunctions], methods: { // 业务信息=》基本信息=》托收业务编号-----获取托收业务编号 async getBodgrpOwnRef() { let params = { ownref: this.model.bodgrp.rec.ownref, ptainr: this.model.bodgrp.drr.pts.ptainr, }; const loading = this.loading(); let res = await Api.post('/Collection/botdav/getOwnRef', params); if (res.respCode == SUCCESS) { loading.close(); this.model.bodgrp.rec.ownref = res.data; } else { loading.close(); this.$message.error(res.respMsg); } }, // 点击获取按钮拉取当前key字段下的表单数据 queryFormData(key) { console.log(key); }, // 获取botdav弹框表格数据 async queryGridEtyPromptDialogData(type, ptytyp) { let params = { userId: window.sessionStorage.userId || 'ZL', ptytyp: ptytyp, extkey: this.model.bodgrp[type.toLowerCase()].pts.extkey, }; let res = await Api.post('/service/ptspta/list', params); if (res.respCode == SUCCESS) { this.root.$refs['etyDialog'].show = true; this.root.promptData.data = res.data.ptaInfos; this.root.promptData.type = type; } }, // 选中botdav弹框表格的行数据 async selectGridEtyPromptData(row) { let params = { ...row, }; let res = await Api.post('/service/ptspta/fetch', params); if (res.respCode == SUCCESS) { this.$set(this.model.bodgrp, row.role.toLowerCase(), res.data); } }, // 业务信息=》基本信息=》支出目的 purposChange(key, value) { this.handleChangeForm(key, value); }, // 初始化保函开立类型码表下拉列表 async queryHndtypCodeTableList(trnName) { let params = { botp: { swiftflg: this.model.botp.swiftflg, }, gidgrp: { rec: { purpos: this.model.gidgrp.rec.purpos, }, }, transName: trnName.toUpperCase(), }; let res = await Api.post('/service/botame/initHndtyp', params); if (res.respCode == SUCCESS) { this.$set(this.codes, 'voHndtyp', res.data); } }, // 是否SWIFT格式修改--联动保函开立类型 handleChangeSwiftflg() { this.queryHndtypCodeTableList(this.root.trnName); }, // 支出目的修改--联动保函开立类型 handleChangePurpos() { this.queryHndtypCodeTableList(this.root.trnName); }, buildLiaccv () { let params = { ...buildFn.buildCommonData(this.model, this.trnName), liaccvg: this.model.liaccv.liaccvg, oldamt: this.model.liaccv.oldamt, chgamt: this.model.liaccv.chgamt, concur: this.model.liaccv.concur, }; return params }, // 公共组件setmod处理方式改变触发联动 changeSetmodModel (emitParams) { let reqParams = {} switch (emitParams.code) { case 'processMethods': reqParams = buildFn.buildSetglg(this.model, this.trnName); this.calcPayDetail(reqParams) break case 'changeDsp': let index = emitParams.index; let setglgRequest = buildFn.buildSetglg(this.model, this.trnName); setglgRequest.setglg = {setgll: emitParams.list}; this.setgllAccts(setglgRequest, index); break default: return } }, changeMaxCur() { this.model.bodgrp.cbs.opn1.cur = this.model.bodgrp.cbs.max.cur; this.changeDrr(); }, changeMaxAmt() { this.model.bodgrp.cbs.opn1.amt = this.model.bodgrp.cbs.max.amt; }, changeRcvdat() { this.model.bodgrp.rec.opndat=this.model.bodgrp.rec.rcvdat; }, async changeDoctypcod() { let modifyList = this.model.bodgrp.blk.modifySet; if (this.model.bodgrp.rec.doctypcod === 'P') { this.model.bodgrp.rec.matdat = ""; this.model.bodgrp.rec.matpertyp = ""; this.model.bodgrp.rec.matperbeg = ""; this.model.bodgrp.rec.matpercnt = "0"; if (!modifyList || !modifyList.includes("bcgdet")) { this.model.bodgrp.blk.bcgdet = "Sight"; } } else { if (!modifyList || !modifyList.includes("bcgdet")) { this.model.bodgrp.blk.bcgdet = ""; } this.model.bodgrp.rec.matpertyp = "D"; } let res = await Api.post('/Collection/botdav/getColins', this.model); if (res.respCode == SUCCESS) { this.$set(this.model.bodgrp.blk, "colins", res.data); } }, async changeCol() { let params = { bod: this.model.bodgrp.rec, ptainr: this.model.bodgrp.col.pts.ptainr, }; let res = await Api.post('/Collection/botdav/defalutStacty', params); if (res.respCode == SUCCESS) { this.$set(this.model.bodgrp.rec, 'stacty', res.data.stacty); } }, async changeDrr() { if (!this.model.bodgrp.drr.pts.ptainr) { this.$set(this.model.bodgrp.blk, 'setinsbo', ""); } else { let params = { ptainr: this.model.bodgrp.drr.pts.ptainr, maxCur: this.model.bodgrp.cbs.max.cur, blk: this.model.bodgrp.blk, } let res = await Api.post('/Collection/botdav/defaultSetinsbo', params); if (res.respCode == SUCCESS) { this.$set(this.model.bodgrp.blk, 'setinsbo', res.data); } } }, changeShipdate() { if (!!this.model.bodgrp.srm.djutyp && this.model.bodgrp.srm.djutyp != 'D') { this.model.bodgrp.srm.djudat = this.model.bodgrp.rec.shpdat } if (this.model.bodgrp.rec.matperbeg !== 'TD' && this.model.bodgrp.rec.matperbeg !== 'AH') { return; } let modifyList = this.model.bodgrp.rec.modifySet; let matper = this.model.bodgrp.rec.matpercnt ? this.model.bodgrp.rec.matpercnt : 0; if ((!modifyList || !modifyList.includes("matdat")) && this.model.bodgrp.rec.shpdat) { this.model.bodgrp.rec.matdat = moment(this.model.bodgrp.rec.shpdat).add(matper, 'days').format("YYYY-MM-DD"); } }, changeMatperbeg() { this.changeShipdate() }, matpercntValidator(rule, value, callback) { if (new BigNumber(this.model.bodgrp.rec.matpercnt) <= new BigNumber(0) && this.model.bodgrp.rec.doctypcod !== 'P') { callback(new Error('必输项')); } callback(); }, changeDjutyp() { if (this.model.bodgrp.srm.djutyp == 'D' || !!!this.model.bodgrp.srm.djutyp) { this.model.bodgrp.srm.djuusr = ''; this.model.bodgrp.srm.djudat = ''; this.model.bodgrp.srm.djuref = ''; } else { this.model.bodgrp.srm.djudat = this.model.bodgrp.rec.shpdat } }, changeInvref() { if (this.model.bodgrp.rec.invref) { if (this.model.bodgrp.rec.invref.length > 16) { this.$notify.info("参考号最大16位,请核对发票号与参考号!") this.model.bodgrp.drr.pts.ref = this.model.bodgrp.rec.invref.substring(0, 16) } else { this.model.bodgrp.drr.pts.ref = this.model.bodgrp.rec.invref } } else { this.model.bodgrp.drr.pts.ref = this.model.bodgrp.rec.invref } }, changeRef() { this.model.bodgrp.rec.invref = this.model.bodgrp.drr.pts.ref }, changeissdat() { // this.model.bodgrp.rec.shpdat = this.model.bodgrp.srm.djudat }, }, };