diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue index 7c15e889..de262619 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue @@ -148,12 +148,21 @@ const feeList = feeField.value.validate() values['details'] = feeList values['condition'] = feeField.value.condition + values['customerName'] = props.customerName + values['customerName'] = props.customerName + values['customerId'] = props.customerId loading.value = true setModalProps({ confirmLoading: true, loading: true }) const res: API.DataResult = await ApiEdit(values) loading.value = false if (res.succeeded) { createMessage.success(res.message) + isUpdate.value = true + rowId.value = res.data + setFieldsValue({ + id: res.data, + }) + emit('success') } else { createMessage.error(res.message) diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue index d1d35d57..bb02e91c 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue @@ -199,9 +199,29 @@ const validate = () => { return list.value } - const SetData = (data) => { + const SetData = async (data) => { list.value.splice(0) + const customerTypeList: any = await getDictOption('djy_cust_prop') + const unitList: any = await feeUnitDict() + const unitList2: any = await getDictOption('fee_unit') + console.log(unitList, unitList2) + data.forEach((item) => { + customerTypeList.forEach((e) => { + if (e.value == item.customerType) { + item.customerTypeText = e.name + } + }) + unitList.forEach((e) => { + if (e.name == item.unit) { + item.unitText = e.name + } + }) + unitList2.forEach((e) => { + if (e.value == item.unit) { + item.unitText = e.name + } + }) list.value.push(item) }) } diff --git a/src/views/fee/FeeCustTemplate/TenantAuditStepModal.vue b/src/views/fee/FeeCustTemplate/TenantAuditStepModal.vue index b2f633a5..c409830a 100644 --- a/src/views/fee/FeeCustTemplate/TenantAuditStepModal.vue +++ b/src/views/fee/FeeCustTemplate/TenantAuditStepModal.vue @@ -167,8 +167,18 @@ const feeField = ref() async function handleSave(exit) { try { - const values = await validate() const feeList = feeField.value.validate() + let type = true + feeList.forEach((item) => { + if (!item.taxUnitPrice) { + type = false + } + }) + if (!type) { + createMessage.warning('费用明细列表含税单价为必填项!') + throw new Error('费用明细列表含税单价为必填项!') + } + const values = await validate() values['details'] = feeList values['condition'] = feeField.value.condition values['isShared'] = true @@ -178,6 +188,11 @@ loading.value = false if (res.succeeded) { createMessage.success(res.message) + isUpdate.value = true + rowId.value = res.data + setFieldsValue({ + id: res.data, + }) emit('success') } else { createMessage.error(res.message) diff --git a/src/views/fee/FeeCustTemplate/feeField.vue b/src/views/fee/FeeCustTemplate/feeField.vue index f20366b7..ed72b970 100644 --- a/src/views/fee/FeeCustTemplate/feeField.vue +++ b/src/views/fee/FeeCustTemplate/feeField.vue @@ -199,9 +199,29 @@ const validate = () => { return list.value } - const SetData = (data) => { + const SetData = async (data) => { list.value.splice(0) + const customerTypeList: any = await getDictOption('djy_cust_prop') + const unitList: any = await feeUnitDict() + const unitList2: any = await getDictOption('fee_unit') + console.log(unitList, unitList2) + data.forEach((item) => { + customerTypeList.forEach((e) => { + if (e.value == item.customerType) { + item.customerTypeText = e.name + } + }) + unitList.forEach((e) => { + if (e.name == item.unit) { + item.unitText = e.name + } + }) + unitList2.forEach((e) => { + if (e.value == item.unit) { + item.unitText = e.name + } + }) list.value.push(item) }) } @@ -225,29 +245,6 @@ className: 'htCenter', readOnly: false, }, - // { - // title: '结算对象', - // width: 130, - // data: 'customerName', - // type: 'dropdown', - // source: async (query, process) => { - // // 获取当前选中行 - // const rowIndex = hotTb.value.hotInstance.getActiveEditor().row - // const code = list.value[rowIndex]?.customerType || null - // GetClientListByCode({ code }).then((res) => { - // const { data } = res - // data.forEach((item) => { - // item['label'] = item.shortName - // item['value'] = item.codeName - // }) - // companyDict.value = data - // const dict = data.map((item) => { - // return item.codeName + '-' + item.shortName - // }) - // process(dict) - // }) - // }, - // }, { title: '费用名称', width: 130, @@ -270,7 +267,6 @@ type: 'dropdown', source: async (query, process) => { const results = await getDictOption('djy_cust_prop') - console.log(results) const dict = results.map((item) => { return item.value + '-' + item.name }) @@ -285,7 +281,6 @@ source: async (query, process) => { if (unitDict.value && unitDict.value.length) { const dict = unitDict.value.map((item) => { - console.log(item, 11111111111111) return item.name }) process(dict) @@ -293,7 +288,6 @@ const results = await feeUnitDict() unitDict.value = results const dict = results.map((item) => { - console.log(item, 11111111111111) return item.name }) process(dict) @@ -393,161 +387,6 @@ data: 'isAdvancedPay', type: 'checkbox', }, - // { - // title: '费用英文名称', - // width: 130, - // data: 'feeEnName', - // type: 'dropdown', - // source: async (query, process) => { - // const res = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data - // if (!feeDict.value.length) feeDict.value = res - // const dict = res.map((res) => { - // return res.enName - // }) - // process(dict) - // }, - // }, - // { - // title: '客户类别', - // width: 130, - // data: 'customerTypeText', - // type: 'dropdown', - // source: async (query, process) => { - // const results = await getDictOption('djy_cust_prop') - // const dict = results.map((item) => { - // return item.value + '-' + item.name - // }) - // process(dict) - // }, - // }, - - // { - // title: '数量', - // width: 120, - // data: 'quantity', - // type: 'numeric', - // format: '0', - // }, - // { - // title: '不含税单价', - // width: 120, - // data: 'noTaxPrice', - // type: 'numeric', - // readOnly: true, - // }, - // { - // title: '不含税金额', - // width: 120, - // data: 'noTaxAmount', - // type: 'numeric', - // format: '0.00', - // readOnly: true, - // }, - // { - // title: '金额', - // width: 120, - // data: 'amount', - // type: 'numeric', - // }, - - // { - // title: '备注', - // width: 120, - // data: 'note', - // }, - - // { - // title: '销项税额', - // width: 100, - // data: 'accTaxAmount', - // readOnly: true, - // }, - // { - // title: '销项金额', - // width: 100, - // data: 'accAmount', - // readOnly: true, - // }, - // { - // title: '是否机密', - // width: 100, - // data: 'isOpen', - // type: 'checkbox', - // }, - - // { - // title: 'FRT', - // width: 120, - // data: 'feeFrt', - // type: 'dropdown', - // source: ['PP', 'CC'], - // }, - // { - // title: '录入人', - // width: 100, - // data: 'createByName', - // readOnly: true, - // }, - // { - // title: '录入日期', - // width: 100, - // data: 'createTime', - // readOnly: true, - // }, - // { - // title: '结算金额', - // width: 100, - // data: 'settlementAmount', - // readOnly: true, - // }, - // { - // title: '已开票金额', - // width: 100, - // data: 'invoiceAmount', - // readOnly: true, - // }, - // { - // title: '对账编号', - // width: 100, - // data: 'debitNo', - // readOnly: true, - // }, - // { - // title: '修改人', - // width: 100, - // data: 'updateByName', - // readOnly: true, - // }, - // { - // title: '修改日期', - // width: 100, - // data: 'updateTime', - // readOnly: true, - // }, - // { - // title: '发票申请金额', - // width: 100, - // data: 'orderInvoiceAmount', - // readOnly: true, - // }, - // { - // title: '未开票金额', - // width: 100, - // data: 'debitNo', - // readOnly: true, - // }, - // { - // title: '审核人', - // width: 100, - // data: 'auditOperator', - // readOnly: true, - // }, - // { - // title: '审核日期', - // width: 100, - // data: 'auditDate', - // readOnly: true, - // }, ] // 表格配置项 const settings = { @@ -586,19 +425,6 @@ if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') { let dict = {} changes.forEach((res) => { - // // 费用类型 - // if (changes[0][1] === 'feeTypeName') { - // const res = [ - // { label: '应收', value: 1 }, - // { label: '应付', value: 2 }, - // ] - // const item = res.filter((item) => { - // return item.label === changes[0][3] - // }) - // if (item) dict = item[0] - // list.value[changes[0][0]]['feeType'] = dict?.value - // list.value[changes[0][0]]['feeTypeName'] = dict?.label - // } // 修改费用对象 if (changes[0][1] === 'customerName') { const item = companyDict.value.filter((item) => { @@ -624,13 +450,6 @@ list.value[res[0]]['taxRate'] = dict['taxRate'] list.value[res[0]]['isInvoice'] = dict['isInvoice'] list.value[res[0]]['isAdvancedPay'] = dict['isAdvancedPay'] - // list.value[res[0]]['feeEnName'] = dict['enName'] - // list.value[res[0]]['unitText'] = dict['defaultUnitName'] - // list.value[res[0]]['customerTypeText'] = dict['defaultDebitName'] - // list.value[res[0]]['customerType'] = dict['defaultDebit'] - // list.value[res[0]]['isOpen'] = dict['isOpen'] - - // list.value[res[0]]['feeFrt'] = dict['feeFrt'] } }) // 修改单位 @@ -641,37 +460,7 @@ if (item) dict = item[0] list.value[changes[0][0]]['unit'] = dict?.value list.value[changes[0][0]]['unitText'] = dict?.label - // list.value[changes[0][0]]['unitText'] = changes[0][3].split('-')[1] - // 业务数据有件数,修改单位,带出件数 - // const text = list.value[changes[0][0]]['unitText'] - // if (text == '单票') { - // list.value[changes[0][0]]['quantity'] = 1 - // } else if (text == '件数') { - // list.value[changes[0][0]]['quantity'] = props.details.pkgs - // } else if (text == '重量') { - // list.value[changes[0][0]]['quantity'] = props.details.kgs - // } else if (text == '尺码') { - // list.value[changes[0][0]]['quantity'] = props.details.cbm - // } else if (text == '计费吨') { - // let r = props.details.kgs - // const k = (props.details.pkgs || 0) / 1000 - // if (k > r) { - // r = k - // } - // list.value[changes[0][0]]['quantity'] = r } - // // 修改币别 - // if (changes[0][1] === 'currencyName') { - // const item = currencyDict.value.filter((item) => { - // return item.name === changes[0][3] - // }) - // if (item) dict = item[0] - // list.value[changes[0][0]]['currency'] = dict?.codeName - // } - // ============================ - // // 修改费用英文名称 - // if (changes[0][1] === 'feeEnName') { - // } // 修改客户类别 if (changes[0][1] === 'customerTypeText') { @@ -684,61 +473,6 @@ list.value[changes[0][0]]['customerTypeText'] = changes[0][3].split('-')[1] }) } - - // // 当前操作的行 - // const index = changes[0][0] - // // 修改不含税单价计算 - // if (changes[0][1] === 'noTaxPrice') { - // // 单价 - // list.value[index].unitPrice = Number( - // (changes[0][3] || 0) * ((list.value[index].taxRate || 0) / 100 + 1), - // ).toFixed(6) - // // 金额 - // list.value[index].amount = Number( - // (list.value[index].unitPrice || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (changes[0][3] || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // } - // // 修改单价计算 - // if (changes[0][1] === 'unitPrice') { - // // 不含税单价 - // list.value[index].noTaxPrice = Number( - // (changes[0][3] || 0) / ((list.value[index].taxRate || 0) / 100 + 1), - // ).toFixed(6) - // // 金额 - // list.value[index].amount = Number( - // (changes[0][3] || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // } - // // 修改数量 - // if (changes[0][1] === 'quantity') { - // // 金额 - // list.value[index].amount = Number( - // (changes[0][3] || 0) * (list.value[index].unitPrice || 0), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (changes[0][3] || 0) * (list.value[index].noTaxPrice || 0), - // ).toFixed(6) - // } - // // 修改税率 - // if (changes[0][1] === 'taxRate') { - // // 不含税单价 - // list.value[index].noTaxPrice = Number( - // (list.value[index].unitPrice || 0) / ((changes[0][3] || 0) / 100 + 1), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // } } }, } diff --git a/src/views/operation/invoiceIssue/detail/applyInvoice.vue b/src/views/operation/invoiceIssue/detail/applyInvoice.vue index 3dd2c0a5..907e331a 100644 --- a/src/views/operation/invoiceIssue/detail/applyInvoice.vue +++ b/src/views/operation/invoiceIssue/detail/applyInvoice.vue @@ -41,6 +41,19 @@ + + + @@ -206,6 +219,11 @@ const freeDetailList = ref([]) as any const [registerTable, { getForm, setSelectedRowKeys, getSelectRows, setProps, getRawDataSource, setLoading }] = useTable({ api: async (p) => { const res: API.DataResult = await GetApplicationList(p) + res.data.forEach(item => { + item.amountUSDTotal = item.amountUSD + item.amountOtherTotal = item.amountOther + item.amountRMBTotal = item.amountRMB + }) return new Promise((resolve) => { resolve({ data: [...res.data], total: res.count }) }) @@ -440,10 +458,13 @@ function handleSureExhange() { }) const resultMap = new Map(); applications.value.forEach(item => { - const { applicationId, currency, exchangeRate } = item; + const { applicationId, currency, exchangeRate, amountUSD, amountOther, amountRMB } = item; if (!resultMap.has(applicationId)) { resultMap.set(applicationId, { applicationId, + amountUSD, + amountOther, + amountRMB, exchangeRates: [] }); } @@ -594,14 +615,24 @@ const exchangarr = ref([]) as any // 添加发票明细 function addDetailed() { const arrRight = getSelectRows() ? getSelectRows() : [] + const arr0 = [] + arrRight.forEach(item => { + if (item.amountUSD == 0 || item.amountRMB == 0 || item.amountOther == 0) { + arr0.push(1) + } + }) + if (arr0.length > 0) { + createMessage.error('开票金额不能等于0') + return false + } const arr1 = [] exchangarr.value = [] applications.value = [] - const firstCustomerId = arrRight[0].customerId; if (arrRight.length == 0) { createMessage.error('请选择一条数据') return false } + const firstCustomerId = arrRight[0].customerId; for (let i = 1; i < arrRight.length; i++) { if (arrRight[i].customerId !== firstCustomerId) { createMessage.error('请选择同一客户') @@ -616,9 +647,9 @@ function addDetailed() { const arr = item.currency.split(' ') arr.forEach(ite => { applications.value.push({ - amountOther:item.amountOther, - amountRMB:item.amountRMB, - amountUSD:item.amountUSD, + amountOther: item.amountOther, + amountRMB: item.amountRMB, + amountUSD: item.amountUSD, applicationId: item.id, currency: ite, exchangeRate: 0 @@ -633,41 +664,45 @@ function addDetailed() { arr.push(item) } }) - const uniqueData = arr.filter(item => { - if (!currencySet.has(item.currency)) { - currencySet.add(item.currency); - return true; - } - return false; - }); - const promises = uniqueData.map(item => { - return new Promise((resolve) => { - const data = { - currencyFrom: 'RMB', - currencyTo: item.currency, + if (arr.length > 0) { + const uniqueData = arr.filter(item => { + if (!currencySet.has(item.currency)) { + currencySet.add(item.currency); + return true; } - GetExchangeRate(data).then(res => { - exchangarr.value.push(res.data) - resolve(true); - }) + return false; }); - }); - return Promise.all(promises).then(() => { - applications.value.forEach(item => { - exchangarr.value.forEach(ite => { - if (item.currency == ite.currencyTo) { - item.exchangeRate = ite.reverseRate + const promises = uniqueData.map(item => { + return new Promise((resolve) => { + const data = { + currencyFrom: 'RMB', + currencyTo: item.currency, } + GetExchangeRate(data).then(res => { + exchangarr.value.push(res.data) + resolve(true); + }) + }); + }); + return Promise.all(promises).then(() => { + applications.value.forEach(item => { + exchangarr.value.forEach(ite => { + if (item.currency == ite.currencyTo) { + item.exchangeRate = ite.reverseRate + } + }) }) - }) - exchangeFlag.value = true - }); + exchangeFlag.value = true + }); + } else { + emits('updateList', applications.value) + open.value = false + exchangeFlag.value = false + } } const customerIdP = ref('') - - defineExpose({ init, customerIdP })