From b497a0b35c09e6b53324c14b7697c1e9e0ed36a9 Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期三, 04 六月 2025 09:39:13 +0800 Subject: [PATCH] 销售台账/采购台账计算重写 --- src/views/procurementManagement/procurementLedger/index.vue | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue index b9762c0..31e8753 100644 --- a/src/views/procurementManagement/procurementLedger/index.vue +++ b/src/views/procurementManagement/procurementLedger/index.vue @@ -213,19 +213,19 @@ </el-col> <el-col :span="12"> <el-form-item label="鏁伴噺锛�" prop="quantity"> - <el-input v-model="productForm.quantity" placeholder="璇疯緭鍏�" clearable/> + <el-input v-model="productForm.quantity" placeholder="璇疯緭鍏�" clearable @change="mathNum"/> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice"> - <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" clearable style="width: 100%"/> + <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" clearable style="width: 100%" @change="mathNum"/> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="绋庣巼(%)锛�" prop="taxRate"> - <el-select v-model="productForm.taxRate" placeholder="璇烽�夋嫨" clearable> + <el-select v-model="productForm.taxRate" placeholder="璇烽�夋嫨" clearable @change="mathNum"> <el-option label="1" value="1"/> <el-option label="6" value="6"/> <el-option label="13" value="13"/> @@ -236,7 +236,7 @@ <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice"> - <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" clearable style="width: 100%" @change="mathNum"/> + <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" clearable style="width: 100%" disabled/> </el-form-item> </el-col> <el-col :span="12"> @@ -378,6 +378,13 @@ page.current = 1 getList() } +// 瀛愯〃鍚堣鏂规硶 +const summarizeChildrenTable = (param) => { + return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], { + ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁� + futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁� + }); +}; const paginationChange = ({ current, limit }) => { page.current = current; page.size = limit; @@ -413,7 +420,7 @@ productList({salesLedgerId: row.id, type: 2}).then(res => { const index = tableData.value.findIndex(item => item.id === row.id); if (index > -1) { - tableData.value[index].children = res.rows; + tableData.value[index].children = res; } expandedRowKeys.value.push(row.id) }) @@ -584,7 +591,7 @@ if (children && children.length > 0) { newItem.children = convertIdToValue(children); } - + return newItem; }); } @@ -653,7 +660,7 @@ }).catch(() => { proxy.$modal.msg("宸插彇娑�") }) - + } } // 鍏抽棴浜у搧寮规 @@ -709,12 +716,24 @@ const day = String(today.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } -const mathNum = (val) => { - productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(val, productForm.value.taxRate) +const mathNum = () => { + console.log('productForm.value',productForm.value) + if(!productForm.value.taxInclusiveUnitPrice){ + return + } + if(!productForm.value.quantity){ + return + } + // 鍚◣鎬讳环璁$畻 + productForm.value.taxInclusiveTotalPrice = proxy.calculateTaxIncludeTotalPrice(productForm.value.taxInclusiveUnitPrice, productForm.value.quantity) + if(productForm.value.taxRate){ + // 涓嶅惈绋庢�讳环璁$畻 + productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate) + } } getList() </script> <style scoped lang="scss"> -</style> \ No newline at end of file +</style> -- Gitblit v1.9.3