import Api from '~/service/Api'; import commonFunctions from "~/mixin/commonFunctions.js"; import commonDepend from "~/mixin/commonDepend.js"; export default { mixins: [commonFunctions, commonDepend], methods: { initData() { this.model.seatyp = "BAOD"; }, async onSearch() { this.root.$refs['modelForm'].validate(async (validStatic) => { if (validStatic) { if (this.model.operate === '0' && this.model.seatyp === 'XYCY') { if(this.isArrayEmpty()){ this.$notify({ title: "错误", message: "请添加发票信息", type: "error", }); return } } const loading = this.loading('正在调用接口'); let rtnmsg = await Api.post('/Financing/infssr/query', this.model); if (rtnmsg.respCode == SUCCESS) { loading.close(); this.model.info = rtnmsg.data; this.model.rettxt = rtnmsg.respMsg; this.$alert('查询成功!', '提示', { confirmButtonText: "确认", callback: action => { if (action == 'confirm') { this.showInfo() } } }) } else { loading.close(); this.$notify.error({ title: '错误', message: '查询失败,失败原因:' + rtnmsg.respMsg, }); this.model.info = null; this.model.rettxt = '查询失败,失败原因:' + rtnmsg.respMsg; } loading.close(); return } }) }, showInfo() { let seatyp = this.model.seatyp; switch (seatyp) { case "BAOD": this.model.baodvisible = true; break; case "XYCY": this.model.xycyvisible = true; break; case "MFXE": this.model.mfxevisible = true; break; case "KSXX": this.model.ksxxvisible = true; break; case "SPXX": this.model.spxxvisible = true; break; case "QYLS": this.model.qylsvisible = true; break; default: } }, isArrayEmpty() { let arr = this.model.inelst; for(let i = 0; i < arr.length; i++){ if(arr[i].invoiceNo!==null && arr[i].invoiceNo!==undefined && arr[i].invoiceNo!=="" && !(arr[i].invoiceNo && Object.keys(arr[i].invoiceNo).length === 0)){ return false; } } return true; }, //退出 exit() { this.$confirm("确认退出?", "提示", { confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" }).then(() => { this.$store.commit('delTagsArry', this.$route.path) this.$router.back() }) }, }, };