预估退税 添加 自定义输入 重新计算利润

This commit is contained in:
浅念
2025-12-10 15:31:41 +08:00
parent 437f5bb567
commit 9b2776e533
2 changed files with 17 additions and 2 deletions
+15
View File
@@ -1385,6 +1385,21 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
{ deep: true } { deep: true }
) )
// 当用户手动输入预估退税额时,重新计算利润
watch(
() => items.value.map((item: any) => item.tax_refund),
() => {
if (isPopulating.value) return
items.value.forEach((it: any, index: number) => {
if (!items.value[index]) return
const profit = calcProfit(it)
items.value[index].profit = isNaN(profit) ? 0 : Number(profit.toFixed(2))
;(items.value[index] as any).profit_currency = (it as any).profit_currency || 'CNY'
})
},
{ deep: true }
)
// 处理用户编辑状态的方法 // 处理用户编辑状态的方法
const handleUserEdit = (index: number) => { const handleUserEdit = (index: number) => {
// 标记用户正在编辑这一行 // 标记用户正在编辑这一行
+2 -2
View File
@@ -455,8 +455,8 @@
</ElCol> </ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4"> <ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="预估退税额" label-width="85px"> <ElFormItem label="预估退税额" label-width="85px">
<ElInput <ElInput
v-model="item.tax_refund" v-model="item.tax_refund"
placeholder="正在计算预估退税额" placeholder="正在计算预估退税额"
@input="handleUserEdit(idx)" @input="handleUserEdit(idx)"
> >