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 | 20 ++++++++++++++++---- src/views/login.vue | 1 + src/main.js | 3 ++- src/views/salesManagement/salesLedger/index.vue | 21 +++++++++++++++++---- src/utils/summarizeTable.js | 7 ++++++- 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/main.js b/src/main.js index 12c1e3a..71df0f5 100644 --- a/src/main.js +++ b/src/main.js @@ -46,7 +46,7 @@ import PIMTable from "@/components/PIMTable/PIMTable.vue"; import { getToken } from "@/utils/auth"; -import {calculateTaxExclusiveTotalPrice, summarizeTable} from "@/utils/summarizeTable.js"; +import {calculateTaxExclusiveTotalPrice, summarizeTable,calculateTaxIncludeTotalPrice} from "@/utils/summarizeTable.js"; const app = createApp(App) @@ -57,6 +57,7 @@ app.config.globalProperties.resetForm = resetForm app.config.globalProperties.summarizeTable = summarizeTable app.config.globalProperties.calculateTaxExclusiveTotalPrice = calculateTaxExclusiveTotalPrice +app.config.globalProperties.calculateTaxIncludeTotalPrice = calculateTaxIncludeTotalPrice app.config.globalProperties.handleTree = handleTree app.config.globalProperties.addDateRange = addDateRange app.config.globalProperties.selectDictLabel = selectDictLabel diff --git a/src/utils/summarizeTable.js b/src/utils/summarizeTable.js index ae6e975..e24d99f 100644 --- a/src/utils/summarizeTable.js +++ b/src/utils/summarizeTable.js @@ -35,9 +35,14 @@ }); return sums; } +// 涓嶅惈绋庢�讳环璁$畻 const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => { const taxRateDecimal = taxRate / 100; return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2); } +// 鍚◣鎬讳环璁$畻 +const calculateTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => { + return (taxInclusiveUnitPrice * quantity).toFixed(2); +} // 瀵煎嚭鍑芥暟渚涘叾浠栨枃浠朵娇鐢� -export { summarizeTable, calculateTaxExclusiveTotalPrice }; \ No newline at end of file +export { summarizeTable, calculateTaxExclusiveTotalPrice ,calculateTaxIncludeTotalPrice}; diff --git a/src/views/login.vue b/src/views/login.vue index a6173d0..cc98f6b 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -183,6 +183,7 @@ getCode() getCookie() +deptListSearch() </script> <style lang='scss' scoped> diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue index 46add75..31e8753 100644 --- a/src/views/procurementManagement/procurementLedger/index.vue +++ b/src/views/procurementManagement/procurementLedger/index.vue @@ -213,14 +213,14 @@ </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"> @@ -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"> @@ -717,7 +717,19 @@ return `${year}-${month}-${day}`; } const mathNum = () => { - productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate) + 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> diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue index dd4c84a..7fb3b61 100644 --- a/src/views/salesManagement/salesLedger/index.vue +++ b/src/views/salesManagement/salesLedger/index.vue @@ -231,14 +231,14 @@ </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 v-model="productForm.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable/> + <el-input v-model="productForm.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable @change="mathNum" /> </el-form-item> </el-col> <el-col :span="12"> @@ -254,7 +254,7 @@ <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice"> - <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable @change="mathNum" /> + <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable disabled /> </el-form-item> </el-col> <el-col :span="12"> @@ -733,8 +733,21 @@ const day = String(today.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } + const mathNum = () => { - productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate) + 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> -- Gitblit v1.9.3