From e9f19a3d7e8bdcfdac118b9279f8417ebe4d98b8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 12 十月 2026 18:19:36 +0800
Subject: [PATCH] fix(erp): 单据明细单价口径由「不含税单价」改为「含税单价」(前端)
---
src/views/erp/purchase/in/modules/item-form.vue | 30 ++
src/views/erp/purchase/in/data.ts | 26 +-
src/views/erp/purchase/order/components/select.vue | 2
src/views/erp/sale/out/modules/item-form.vue | 30 ++
src/views/erp/sale/order/modules/item-form.vue | 30 ++
src/views/erp/purchase/return/data.ts | 26 +-
src/views/erp/purchase/order/detail/index.vue | 2
src/views/erp/sale/order/detail/index.vue | 2
src/views/erp/sale/order/data.ts | 28 +-
src/views/erp/purchase/request/modules/item-form.vue | 48 +++-
src/views/erp/purchase/order/data.ts | 28 +-
src/views/erp/sale/order/components/select.vue | 2
src/views/erp/purchase/request/detail/index.vue | 29 ++
src/views/erp/purchase/order/modules/item-form.vue | 30 ++
src/views/erp/purchase/request/data.ts | 31 ++-
src/views/erp/sale/return/modules/item-form.vue | 30 ++
src/views/erp/purchase/return/modules/item-form.vue | 30 ++
src/views/erp/sale/out/data.ts | 26 +-
src/views/erp/sale/return/data.ts | 26 +-
src/api/erp/purchase/request/index.ts | 6
src/views/erp/sale/order/components/select-dialog.vue | 2
src/views/erp/purchase/order/components/select-dialog.vue | 2
src/views/erp/sale/order/modules/print.vue | 38 ++--
23 files changed, 326 insertions(+), 178 deletions(-)
diff --git a/src/api/erp/purchase/request/index.ts b/src/api/erp/purchase/request/index.ts
index 3553382..128bdd0 100644
--- a/src/api/erp/purchase/request/index.ts
+++ b/src/api/erp/purchase/request/index.ts
@@ -38,11 +38,15 @@
productUnitId?: number; // 浜у搧鍗曚綅缂栧彿
productUnitName?: string; // 浜у搧鍗曚綅鍚嶇О
productBarCode?: string; // 浜у搧鏉$爜
- productPrice?: number; // 浜у搧鍗曚环锛堝弬鑰冧环锛�
+ productPrice?: number; // 鍚◣鍗曚环锛堝弬鑰冧环锛�
count: number; // 鏁伴噺
taxPercent?: number; // 绋庣巼
+ totalPrice?: number; // 涓嶅惈绋庨噾棰�
+ taxPrice?: number; // 绋庨
demandTime?: string; // 闇�姹傛棩鏈�
remark?: string; // 澶囨敞
+ qcCheckFlag?: boolean; // 鏄惁璐ㄦ
+ inCount?: number; // 鍏ュ簱鏁伴噺
}
}
diff --git a/src/views/erp/purchase/in/data.ts b/src/views/erp/purchase/in/data.ts
index d7ee380..f3e87ec 100644
--- a/src/views/erp/purchase/in/data.ts
+++ b/src/views/erp/purchase/in/data.ts
@@ -134,11 +134,11 @@
},
{
fieldName: 'discountedPrice',
- label: '浼樻儬鍚庨噾棰�',
+ label: '浼樻儬鍚庡惈绋庨噾棰�',
component: 'InputNumber',
componentProps: {
class: '!w-full',
- placeholder: '浼樻儬鍚庨噾棰�',
+ placeholder: '浼樻儬鍚庡惈绋庨噾棰�',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
@@ -258,17 +258,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环(鍏�)',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- fixed: 'right',
- title: '浜у搧閲戦',
- minWidth: 120,
- formatter: 'formatAmount2',
},
{
fixed: 'right',
@@ -278,16 +271,23 @@
slots: { default: 'taxPercent' },
},
{
+ field: 'totalProductPrice',
+ fixed: 'right',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ {
fixed: 'right',
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
- title: '鍚堣閲戦',
+ title: '鍚◣鍚堣(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
@@ -595,7 +595,7 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '涓嶅惈绋庨噾棰濆悎璁�',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/in/modules/item-form.vue b/src/views/erp/purchase/in/modules/item-form.vue
index fd7a153..6811119 100644
--- a/src/views/erp/purchase/in/modules/item-form.vue
+++ b/src/views/erp/purchase/in/modules/item-form.vue
@@ -150,6 +150,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
// TODO 鑺嬭壙
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -159,13 +160,28 @@
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
-function initRow(row: ErpPurchaseInApi.PurchaseInItem) {
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpPurchaseInApi.PurchaseInItem) {
if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalProductPrice = taxInclusivePrice - row.taxPrice;
+ row.totalPrice = taxInclusivePrice;
+ }
+}
+
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
+function initRow(row: ErpPurchaseInApi.PurchaseInItem) {
+ if (!row.id) {
+ recalcRow(row);
}
}
@@ -269,11 +285,11 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
</span>
<span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 鍚◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/purchase/order/components/select-dialog.vue b/src/views/erp/purchase/order/components/select-dialog.vue
index d2dace1..5a67384 100644
--- a/src/views/erp/purchase/order/components/select-dialog.vue
+++ b/src/views/erp/purchase/order/components/select-dialog.vue
@@ -93,7 +93,7 @@
{ field: 'supplierName', title: '渚涘簲鍟�', minWidth: 120 },
{ field: 'orderTime', title: '璁㈠崟鏃堕棿', width: 120, formatter: 'formatDate' },
{ field: 'totalCount', title: '鍚堣鏁伴噺', width: 100 },
- { field: 'totalPrice', title: '鍚堣閲戦', width: 100 },
+ { field: 'totalPrice', title: '鍚◣鍚堣', width: 100 },
];
}
diff --git a/src/views/erp/purchase/order/components/select.vue b/src/views/erp/purchase/order/components/select.vue
index c59437e..6fce08c 100644
--- a/src/views/erp/purchase/order/components/select.vue
+++ b/src/views/erp/purchase/order/components/select.vue
@@ -116,7 +116,7 @@
<div>璁㈠崟鍙凤細{{ selectedItem.no || '-' }}</div>
<div>渚涘簲鍟嗭細{{ selectedItem.supplierName || '-' }}</div>
<div>璁㈠崟鏃堕棿锛歿{ selectedItem.orderTime || '-' }}</div>
- <div>鍚堣閲戦锛歿{ selectedItem.totalPrice || '-' }} 鍏�</div>
+ <div>鍚◣鍚堣锛歿{ selectedItem.totalPrice || '-' }} 鍏�</div>
</div>
</template>
<Input
diff --git a/src/views/erp/purchase/order/data.ts b/src/views/erp/purchase/order/data.ts
index 12f349a..7853e68 100644
--- a/src/views/erp/purchase/order/data.ts
+++ b/src/views/erp/purchase/order/data.ts
@@ -86,7 +86,7 @@
return z
.number()
.min(0, '璁㈤噾涓嶈兘灏忎簬0')
- .max(values.totalPrice, '璁㈤噾涓嶈兘澶т簬浼樻儬鍚庨噾棰�');
+ .max(values.totalPrice, '璁㈤噾涓嶈兘澶т簬浼樻儬鍚庡惈绋庨噾棰�');
}
return z.number().min(0, '璁㈤噾涓嶈兘灏忎簬0');
},
@@ -150,11 +150,11 @@
},
{
fieldName: 'totalPrice',
- label: '浼樻儬鍚庨噾棰�',
+ label: '浼樻儬鍚庡惈绋庨噾棰�',
component: 'InputNumber',
componentProps: {
class: '!w-full',
- placeholder: '浼樻儬鍚庨噾棰�',
+ placeholder: '浼樻儬鍚庡惈绋庨噾棰�',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
@@ -215,17 +215,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环(鍏�)',
minWidth: 120,
fixed: 'right',
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- title: '閲戦',
- minWidth: 120,
- fixed: 'right',
- formatter: 'formatAmount2',
},
{
field: 'taxPercent',
@@ -235,15 +228,22 @@
slots: { default: 'taxPercent' },
},
{
+ field: 'totalProductPrice',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ fixed: 'right',
+ formatter: 'formatAmount2',
+ },
+ {
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨(鍏�)',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
- title: '绋庨鍚堣',
+ title: '鍚◣鍚堣(鍏�)',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
@@ -409,7 +409,7 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '涓嶅惈绋庨噾棰濆悎璁�',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/order/detail/index.vue b/src/views/erp/purchase/order/detail/index.vue
index fadc835..7b7948a 100644
--- a/src/views/erp/purchase/order/detail/index.vue
+++ b/src/views/erp/purchase/order/detail/index.vue
@@ -60,7 +60,7 @@
render: (val) => erpCountInputFormatter(val) || '-',
},
{
- label: '鍚堣閲戦',
+ label: '鍚◣鍚堣閲戦',
field: 'totalPrice',
render: (val) => erpPriceInputFormatter(val) || '-',
},
diff --git a/src/views/erp/purchase/order/modules/item-form.vue b/src/views/erp/purchase/order/modules/item-form.vue
index 7ba1dc1..54fdadb 100644
--- a/src/views/erp/purchase/order/modules/item-form.vue
+++ b/src/views/erp/purchase/order/modules/item-form.vue
@@ -164,6 +164,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -173,13 +174,28 @@
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
-function initRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalProductPrice = taxInclusivePrice - row.taxPrice;
+ row.totalPrice = taxInclusivePrice;
+ }
+}
+
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
+function initRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
+ if (!row.id) {
+ recalcRow(row);
}
}
@@ -294,11 +310,11 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
</span>
<span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 鍚◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/purchase/request/data.ts b/src/views/erp/purchase/request/data.ts
index 095b80c..b712a17 100644
--- a/src/views/erp/purchase/request/data.ts
+++ b/src/views/erp/purchase/request/data.ts
@@ -172,17 +172,10 @@
},
{
field: 'productPrice',
- title: '鍗曚环锛堝弬鑰冧环锛�',
+ title: '鍚◣鍗曚环(鍏�)',
minWidth: 120,
fixed: 'right',
slots: { default: 'productPrice' },
- },
- {
- field: 'totalPrice',
- title: '棰勪及閲戦',
- minWidth: 120,
- fixed: 'right',
- formatter: 'formatAmount2',
},
{
field: 'taxPercent',
@@ -190,6 +183,26 @@
minWidth: 100,
fixed: 'right',
slots: { default: 'taxPercent' },
+ },
+ {
+ field: 'totalPrice',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ fixed: 'right',
+ formatter: 'formatAmount2',
+ },
+ {
+ field: 'taxPrice',
+ title: '绋庨(鍏�)',
+ minWidth: 120,
+ fixed: 'right',
+ formatter: 'formatAmount2',
+ },
+ {
+ title: '鍚◣鍚堣(鍏�)',
+ minWidth: 120,
+ fixed: 'right',
+ slots: { default: 'totalTaxInclusivePrice' },
},
{
field: 'demandTime',
@@ -344,7 +357,7 @@
},
{
field: 'totalPrice',
- title: '棰勪及閲戦',
+ title: '鍚◣閲戦',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/request/detail/index.vue b/src/views/erp/purchase/request/detail/index.vue
index 62c383e..6c471ca 100644
--- a/src/views/erp/purchase/request/detail/index.vue
+++ b/src/views/erp/purchase/request/detail/index.vue
@@ -46,13 +46,7 @@
},
{
field: 'productPrice',
- title: '鍗曚环锛堝弬鑰冧环锛�',
- minWidth: 120,
- formatter: ({ cellValue }) => erpPriceInputFormatter(cellValue) || '-',
- },
- {
- field: 'totalPrice',
- title: '棰勪及閲戦',
+ title: '鍚◣鍗曚环(鍏�)',
minWidth: 120,
formatter: ({ cellValue }) => erpPriceInputFormatter(cellValue) || '-',
},
@@ -61,6 +55,25 @@
title: '绋庣巼(%)',
minWidth: 90,
formatter: ({ cellValue }) => (cellValue ? `${cellValue}%` : '-'),
+ },
+ {
+ field: 'totalPrice',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ formatter: ({ cellValue }) => erpPriceInputFormatter(cellValue) || '-',
+ },
+ {
+ field: 'taxPrice',
+ title: '绋庨(鍏�)',
+ minWidth: 120,
+ formatter: ({ cellValue }) => erpPriceInputFormatter(cellValue) || '-',
+ },
+ {
+ field: 'totalTaxInclusivePrice',
+ title: '鍚◣鍚堣(鍏�)',
+ minWidth: 120,
+ formatter: ({ row }) =>
+ erpPriceInputFormatter((row.totalPrice || 0) + (row.taxPrice || 0)) || '-',
},
{ field: 'demandTime', title: '闇�姹傛棩鏈�', minWidth: 110 },
{
@@ -123,7 +136,7 @@
render: (val) => erpCountInputFormatter(val) || '-',
},
{
- label: '鍚堣閲戦',
+ label: '鍚◣鍚堣閲戦',
field: 'totalPrice',
render: (val) => erpPriceInputFormatter(val) || '-',
},
diff --git a/src/views/erp/purchase/request/modules/item-form.vue b/src/views/erp/purchase/request/modules/item-form.vue
index 7cd972a..0f4af30 100644
--- a/src/views/erp/purchase/request/modules/item-form.vue
+++ b/src/views/erp/purchase/request/modules/item-form.vue
@@ -30,19 +30,22 @@
const tableData = ref<ErpPurchaseRequestApi.PurchaseRequestItem[]>([]);
-/** 鑾峰彇琛ㄦ牸鍚堣鏁版嵁 */
+/** 鑾峰彇琛ㄦ牸鍚堣鏁版嵁锛堣涓� totalPrice 涓轰笉鍚◣閲戦锛屽惈绋庡悎璁¢渶鍔犱笂绋庨锛� */
const summaries = computed(() => {
return {
count: tableData.value.reduce((sum, item) => sum + (item.count || 0), 0),
totalPrice: tableData.value.reduce(
- (sum, item) => {
- const price = erpPriceMultiply(item.productPrice || 0, item.count || 0) ?? 0;
- return sum + price;
- },
+ (sum, item) => sum + (item.totalPrice || 0),
0,
),
+ taxPrice: tableData.value.reduce((sum, item) => sum + (item.taxPrice || 0), 0),
};
});
+
+/** 鍚◣鍚堣 = 涓嶅惈绋庨噾棰� + 绋庨 */
+const totalTaxInclusivePrice = computed(
+ () => summaries.value.totalPrice + summaries.value.taxPrice,
+);
/** 琛ㄦ牸閰嶇疆 */
const [Grid, gridApi] = useVbenVxeGrid({
@@ -126,25 +129,39 @@
handleRowChange(row);
}
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpPurchaseRequestApi.PurchaseRequestItem) {
+ if (row.productPrice && row.count) {
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ row.taxPrice =
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalPrice = taxInclusivePrice - row.taxPrice;
+ }
+}
+
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
} else {
tableData.value[index] = row;
}
- // 璁$畻棰勪及閲戦
- if (row.productPrice && row.count) {
- row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
- }
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
function initRow(row: ErpPurchaseRequestApi.PurchaseRequestItem) {
- if (row.productPrice && row.count) {
- row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ if (!row.id) {
+ recalcRow(row);
}
}
@@ -218,6 +235,9 @@
/>
<span v-else>{{ row.taxPercent ? `${row.taxPercent}%` : '-' }}</span>
</template>
+ <template #totalTaxInclusivePrice="{ row }">
+ <span>{{ erpPriceInputFormatter((row.totalPrice || 0) + (row.taxPrice || 0)) }}</span>
+ </template>
<template #demandTime="{ row }">
<DatePicker
v-if="!disabled"
@@ -264,7 +284,9 @@
<span class="font-medium text-foreground">鍚堣锛�</span>
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
- <span>棰勪及閲戦锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}</span>
+ <span>涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalPrice) }}</span>
+ <span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
+ <span>鍚◣鍚堣锛歿{ erpPriceInputFormatter(totalTaxInclusivePrice) }}</span>
</div>
</div>
</div>
diff --git a/src/views/erp/purchase/return/data.ts b/src/views/erp/purchase/return/data.ts
index d640187..6e50443 100644
--- a/src/views/erp/purchase/return/data.ts
+++ b/src/views/erp/purchase/return/data.ts
@@ -133,11 +133,11 @@
},
{
fieldName: 'discountedPrice',
- label: '浼樻儬鍚庨噾棰�',
+ label: '浼樻儬鍚庡惈绋庨噾棰�',
component: 'InputNumber',
componentProps: {
class: '!w-full',
- placeholder: '浼樻儬鍚庨噾棰�',
+ placeholder: '浼樻儬鍚庡惈绋庨噾棰�',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
@@ -258,17 +258,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环(鍏�)',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- fixed: 'right',
- title: '浜у搧閲戦',
- minWidth: 120,
- formatter: 'formatAmount2',
},
{
fixed: 'right',
@@ -278,16 +271,23 @@
slots: { default: 'taxPercent' },
},
{
+ field: 'totalProductPrice',
+ fixed: 'right',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ {
fixed: 'right',
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
- title: '鍚堣閲戦',
+ title: '鍚◣鍚堣(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
@@ -582,7 +582,7 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '涓嶅惈绋庨噾棰濆悎璁�',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/return/modules/item-form.vue b/src/views/erp/purchase/return/modules/item-form.vue
index a63e606..38c08b9 100644
--- a/src/views/erp/purchase/return/modules/item-form.vue
+++ b/src/views/erp/purchase/return/modules/item-form.vue
@@ -153,6 +153,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
// TODO 鑺嬭壙
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -162,13 +163,28 @@
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
-function initRow(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalProductPrice = taxInclusivePrice - row.taxPrice;
+ row.totalPrice = taxInclusivePrice;
+ }
+}
+
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
+function initRow(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
+ if (!row.id) {
+ recalcRow(row);
}
}
@@ -272,11 +288,11 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
</span>
<span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 鍚◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/sale/order/components/select-dialog.vue b/src/views/erp/sale/order/components/select-dialog.vue
index 8c8980e..3994402 100644
--- a/src/views/erp/sale/order/components/select-dialog.vue
+++ b/src/views/erp/sale/order/components/select-dialog.vue
@@ -95,7 +95,7 @@
{ field: 'customerName', title: '瀹㈡埛', minWidth: 120 },
{ field: 'orderTime', title: '璁㈠崟鏃堕棿', width: 120, formatter: 'formatDate' },
{ field: 'totalCount', title: '鍚堣鏁伴噺', width: 100 },
- { field: 'totalPrice', title: '鍚堣閲戦', width: 100 },
+ { field: 'totalPrice', title: '鍚◣鍚堣', width: 100 },
];
}
diff --git a/src/views/erp/sale/order/components/select.vue b/src/views/erp/sale/order/components/select.vue
index a81843d..401664c 100644
--- a/src/views/erp/sale/order/components/select.vue
+++ b/src/views/erp/sale/order/components/select.vue
@@ -119,7 +119,7 @@
<div>璁㈠崟鍙凤細{{ selectedItem.no || '-' }}</div>
<div>瀹㈡埛锛歿{ selectedItem.customerName || '-' }}</div>
<div>璁㈠崟鏃堕棿锛歿{ selectedItem.orderTime || '-' }}</div>
- <div>鍚堣閲戦锛歿{ selectedItem.totalPrice || '-' }} 鍏�</div>
+ <div>鍚◣鍚堣锛歿{ selectedItem.totalPrice || '-' }} 鍏�</div>
</div>
</template>
<Input
diff --git a/src/views/erp/sale/order/data.ts b/src/views/erp/sale/order/data.ts
index 9c1c953..0fafea2 100644
--- a/src/views/erp/sale/order/data.ts
+++ b/src/views/erp/sale/order/data.ts
@@ -161,11 +161,11 @@
},
{
fieldName: 'totalPrice',
- label: '浼樻儬鍚庨噾棰�',
+ label: '浼樻儬鍚庡惈绋庨噾棰�',
component: 'InputNumber',
componentProps: {
class: '!w-full',
- placeholder: '浼樻儬鍚庨噾棰�',
+ placeholder: '浼樻儬鍚庡惈绋庨噾棰�',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
@@ -202,7 +202,7 @@
return z
.number()
.min(0, '璁㈤噾涓嶈兘灏忎簬0')
- .max(values.totalPrice, '鏀跺彇璁㈤噾涓嶈兘澶т簬浼樻儬鍚庨噾棰�');
+ .max(values.totalPrice, '鏀跺彇璁㈤噾涓嶈兘澶т簬浼樻儬鍚庡惈绋庨噾棰�');
}
return z.number().min(0, '璁㈤噾涓嶈兘灏忎簬0').optional();
},
@@ -275,17 +275,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环(鍏�)',
minWidth: 120,
fixed: 'right',
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- title: '閲戦',
- minWidth: 120,
- fixed: 'right',
- formatter: 'formatAmount2',
},
{
field: 'taxPercent',
@@ -295,15 +288,22 @@
slots: { default: 'taxPercent' },
},
{
+ field: 'totalProductPrice',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ fixed: 'right',
+ formatter: 'formatAmount2',
+ },
+ {
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨(鍏�)',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
- title: '绋庨鍚堣',
+ title: '鍚◣鍚堣(鍏�)',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
@@ -479,7 +479,7 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '涓嶅惈绋庨噾棰濆悎璁�',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/sale/order/detail/index.vue b/src/views/erp/sale/order/detail/index.vue
index 673f4a4..6eb8b86 100644
--- a/src/views/erp/sale/order/detail/index.vue
+++ b/src/views/erp/sale/order/detail/index.vue
@@ -75,7 +75,7 @@
render: (val) => erpCountInputFormatter(val) || '-',
},
{
- label: '鍚堣閲戦',
+ label: '鍚◣鍚堣閲戦',
field: 'totalPrice',
render: (val) => erpPriceInputFormatter(val) || '-',
},
diff --git a/src/views/erp/sale/order/modules/item-form.vue b/src/views/erp/sale/order/modules/item-form.vue
index eea4f3c..9c26059 100644
--- a/src/views/erp/sale/order/modules/item-form.vue
+++ b/src/views/erp/sale/order/modules/item-form.vue
@@ -172,6 +172,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -181,13 +182,28 @@
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
-function initRow(row: ErpSaleOrderApi.SaleOrderItem) {
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpSaleOrderApi.SaleOrderItem) {
if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalProductPrice = taxInclusivePrice - row.taxPrice;
+ row.totalPrice = taxInclusivePrice;
+ }
+}
+
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
+function initRow(row: ErpSaleOrderApi.SaleOrderItem) {
+ if (!row.id) {
+ recalcRow(row);
}
// 榛樿闇�瑕佺敓浜�
if (row.needProduction === undefined) {
@@ -311,11 +327,11 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
</span>
<span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 鍚◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/sale/order/modules/print.vue b/src/views/erp/sale/order/modules/print.vue
index 12e3cc5..3bca712 100644
--- a/src/views/erp/sale/order/modules/print.vue
+++ b/src/views/erp/sale/order/modules/print.vue
@@ -99,21 +99,21 @@
}
/**
- * 鏄庣粏琛岋紙鍚庣涓嶈繑鍥炴槑缁嗚鐨� totalProductPrice/totalPrice锛岄渶鎸夊崟浠访楁暟閲忚绠楋細
- * 閲戦 = 鍗曚环 脳 鏁伴噺锛涚◣棰� = 閲戦 脳 绋庣巼锛涘惈绋庨噾棰� = 閲戦 + 绋庨锛�
+ * 鏄庣粏琛岋紙浼樺厛鐢ㄥ悗绔繑鍥炲�硷紱缂虹渷鏃舵寜銆屽崟浠蜂负鍚◣鍗曚环銆嶈绠楋細
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨锛�
*/
const printRows = computed(() =>
(printData.value.items || []).map((item) => {
- const totalProductPrice =
- item.totalProductPrice ?? multiplyPrice(item.productPrice, item.count) ?? 0;
+ const taxInclusivePrice = multiplyPrice(item.productPrice, item.count);
const taxPrice =
- item.taxPrice ?? multiplyPrice(totalProductPrice, (item.taxPercent ?? 0) / 100) ?? 0;
- const totalPrice = item.totalPrice ?? totalProductPrice + taxPrice;
+ item.taxPrice ?? multiplyPrice(taxInclusivePrice, (item.taxPercent ?? 0) / 100) ?? 0;
+ const totalPrice = item.totalPrice ?? taxInclusivePrice ?? 0;
+ const totalProductPrice = item.totalProductPrice ?? totalPrice - taxPrice;
return { ...item, totalProductPrice, taxPrice, totalPrice };
}),
);
-/** 鏄庣粏鍚堣锛氭暟閲�/閲戦浼樺厛鍙栬鍗曞ご锛堝悗绔潈濞佸�硷級锛岀◣棰濅笌鍚◣閲戦鎸夋槑缁嗙疮鍔狅紙璁㈠崟澶� totalPrice 涓轰紭鎯犲悗閲戦锛屽彟鍦ㄩ噾棰濅俊鎭尯灞曠ず锛� */
+/** 鏄庣粏鍚堣锛氭暟閲�/閲戦浼樺厛鍙栬鍗曞ご锛堝悗绔潈濞佸�硷級锛岀◣棰濅笌鍚◣閲戦鎸夋槑缁嗙疮鍔狅紙璁㈠崟澶� totalPrice 涓轰紭鎯犲悗鍚◣閲戦锛屽彟鍦ㄩ噾棰濅俊鎭尯灞曠ず锛� */
const summaries = computed(() => {
const rows = printRows.value;
const count = rows.reduce((sum, item) => sum + (item.count || 0), 0);
@@ -262,17 +262,17 @@
<th
class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold"
>
- 浜у搧鍗曚环(鍏�)
- </th>
- <th
- class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold"
- >
- 閲戦(鍏�)
+ 鍚◣鍗曚环(鍏�)
</th>
<th
class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold"
>
绋庣巼(%)
+ </th>
+ <th
+ class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold"
+ >
+ 涓嶅惈绋庨噾棰�(鍏�)
</th>
<th
class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold"
@@ -312,10 +312,10 @@
{{ formatPrice(item.productPrice) }}
</td>
<td class="border border-solid border-[#dcdfe6] p-2 text-right">
- {{ formatPrice(item.totalProductPrice) }}
+ {{ formatPrice(item.taxPercent) }}
</td>
<td class="border border-solid border-[#dcdfe6] p-2 text-right">
- {{ formatPrice(item.taxPercent) }}
+ {{ formatPrice(item.totalProductPrice) }}
</td>
<td class="border border-solid border-[#dcdfe6] p-2 text-right">
{{ formatPrice(item.taxPrice) }}
@@ -348,13 +348,13 @@
class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2"
></td>
<td
+ class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2"
+ ></td>
+ <td
class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right"
>
{{ formatPrice(summaries.totalProductPrice) }}
</td>
- <td
- class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2"
- ></td>
<td
class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right"
>
@@ -386,7 +386,7 @@
>
<div>浼樻儬鐜�(%)锛歿{ formatPrice(printData.discountPercent) }}</div>
<div>浠樻浼樻儬(鍏�)锛歿{ formatPrice(printData.discountPrice) }}</div>
- <div>浼樻儬鍚庨噾棰�(鍏�)锛歿{ formatPrice(printData.totalPrice) }}</div>
+ <div>浼樻儬鍚庡惈绋庨噾棰�(鍏�)锛歿{ formatPrice(printData.totalPrice) }}</div>
<div>鏀跺彇璁㈤噾(鍏�)锛歿{ formatPrice(printData.depositPrice) }}</div>
</div>
diff --git a/src/views/erp/sale/out/data.ts b/src/views/erp/sale/out/data.ts
index f79df7d..56bd2f3 100644
--- a/src/views/erp/sale/out/data.ts
+++ b/src/views/erp/sale/out/data.ts
@@ -151,11 +151,11 @@
},
{
fieldName: 'discountedPrice',
- label: '浼樻儬鍚庨噾棰�',
+ label: '浼樻儬鍚庡惈绋庨噾棰�',
component: 'InputNumber',
componentProps: {
class: '!w-full',
- placeholder: '浼樻儬鍚庨噾棰�',
+ placeholder: '浼樻儬鍚庡惈绋庨噾棰�',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
@@ -279,17 +279,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环(鍏�)',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- fixed: 'right',
- title: '浜у搧閲戦',
- minWidth: 120,
- formatter: 'formatAmount2',
},
{
fixed: 'right',
@@ -299,16 +292,23 @@
slots: { default: 'taxPercent' },
},
{
+ field: 'totalProductPrice',
+ fixed: 'right',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ {
fixed: 'right',
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
- title: '鍚堣閲戦',
+ title: '鍚◣鍚堣(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
@@ -603,7 +603,7 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '涓嶅惈绋庨噾棰濆悎璁�',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/sale/out/modules/item-form.vue b/src/views/erp/sale/out/modules/item-form.vue
index 0067dad..4c48ba7 100644
--- a/src/views/erp/sale/out/modules/item-form.vue
+++ b/src/views/erp/sale/out/modules/item-form.vue
@@ -150,6 +150,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -159,13 +160,28 @@
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
-function initRow(row: ErpSaleOutApi.SaleOutItem) {
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpSaleOutApi.SaleOutItem) {
if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalProductPrice = taxInclusivePrice - row.taxPrice;
+ row.totalPrice = taxInclusivePrice;
+ }
+}
+
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
+function initRow(row: ErpSaleOutApi.SaleOutItem) {
+ if (!row.id) {
+ recalcRow(row);
}
}
@@ -269,11 +285,11 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
</span>
<span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 鍚◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/sale/return/data.ts b/src/views/erp/sale/return/data.ts
index 402c46a..2d591a4 100644
--- a/src/views/erp/sale/return/data.ts
+++ b/src/views/erp/sale/return/data.ts
@@ -146,11 +146,11 @@
},
{
fieldName: 'discountedPrice',
- label: '浼樻儬鍚庨噾棰�',
+ label: '浼樻儬鍚庡惈绋庨噾棰�',
component: 'InputNumber',
componentProps: {
class: '!w-full',
- placeholder: '浼樻儬鍚庨噾棰�',
+ placeholder: '浼樻儬鍚庡惈绋庨噾棰�',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
@@ -272,17 +272,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环(鍏�)',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- fixed: 'right',
- title: '浜у搧閲戦',
- minWidth: 120,
- formatter: 'formatAmount2',
},
{
fixed: 'right',
@@ -292,16 +285,23 @@
slots: { default: 'taxPercent' },
},
{
+ field: 'totalProductPrice',
+ fixed: 'right',
+ title: '涓嶅惈绋庨噾棰�(鍏�)',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ {
fixed: 'right',
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
- title: '鍚堣閲戦',
+ title: '鍚◣鍚堣(鍏�)',
minWidth: 120,
formatter: 'formatAmount2',
},
@@ -590,7 +590,7 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '涓嶅惈绋庨噾棰濆悎璁�',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/sale/return/modules/item-form.vue b/src/views/erp/sale/return/modules/item-form.vue
index 1664f09..384b1d0 100644
--- a/src/views/erp/sale/return/modules/item-form.vue
+++ b/src/views/erp/sale/return/modules/item-form.vue
@@ -207,6 +207,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
+ recalcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -216,13 +217,28 @@
emit('update:items', [...tableData.value]);
}
-/** 鍒濆鍖栬鏁版嵁 */
-function initRow(row: ErpSaleReturnApi.SaleReturnItem) {
+/**
+ * 閲嶇畻琛岄噾棰濓紙鍗曚环涓�**鍚◣**鍗曚环锛�
+ * 鍚◣閲戦 = 鍚◣鍗曚环 脳 鏁伴噺锛涚◣棰� = 鍚◣閲戦 脳 绋庣巼锛涗笉鍚◣閲戦 = 鍚◣閲戦 - 绋庨
+ */
+function recalcRow(row: ErpSaleReturnApi.SaleReturnItem) {
if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxInclusivePrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
+ erpPriceMultiply(taxInclusivePrice, (row.taxPercent || 0) / 100) ?? 0;
+ row.totalProductPrice = taxInclusivePrice - row.taxPrice;
+ row.totalPrice = taxInclusivePrice;
+ }
+}
+
+/**
+ * 鍒濆鍖栬鏁版嵁
+ * 宸叉湁鍗曟嵁鐨勬槑缁嗚锛堝甫 id锛夋部鐢ㄥ悗绔繑鍥炵殑閲戦锛岄伩鍏嶅巻鍙插崟鎹鏂板彛寰勮鐩栵紱
+ * 鍙湁鏈繚瀛樼殑鏂板琛屾墠鎸夋柊鍙e緞閲嶇畻銆�
+ */
+function initRow(row: ErpSaleReturnApi.SaleReturnItem) {
+ if (!row.id) {
+ recalcRow(row);
}
}
@@ -347,11 +363,11 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 涓嶅惈绋庨噾棰濓細{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
</span>
<span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 鍚◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
--
Gitblit v1.9.3