From 0df7d2cc1ef75c9aa1b3483dc7067a728af7ceb3 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期一, 22 四月 2024 15:44:20 +0800
Subject: [PATCH] 计算金额从后端获取,创建时不改变数值

---
 north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue b/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
index 3d167c2..3217d84 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
@@ -1,5 +1,5 @@
 <script setup>
-import {onMounted, reactive, ref, watch} from "vue"
+import {computed, onMounted, reactive, ref, watch} from "vue"
 import {filterChanged} from "@/hook"
 import {useI18n} from "vue-i18n"
 import {ElMessage} from "element-plus";
@@ -36,7 +36,7 @@
     // {field: 'buildingNumber',width:120,  title: '妤煎彿',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter'}, sortable: true,filterMethod:filterChanged},
     {field: 'alias', title:'鍏朵粬鍔犲伐',editRender: { name: 'input'},minWith:'130'},
     {field: 'price',  title:'鍗曚环',editRender: { name: 'input'}},
-    {field: 'quantity',  title:'鏁伴噺',editRender: { name: 'input'} },
+    {field: 'quantity',  title:'鏁伴噺' },
     {field: 'money', slots:{default:'default'},  title:'閲戦'}
   ],
   //琛ㄥ崟楠岃瘉
@@ -149,9 +149,12 @@
   xGrid.value.reloadData(prop.otherMoney)
 })
 
-const countAmount = (row)=>{
+const countAmount = computed(() => (row) => {
+  const price = row.price===null?0:row.price
+  const quantity = row.quantity===null?0:row.quantity
   return parseFloat((row.price * row.quantity).toFixed(2))
-}
+})
+
 
 const validate = async () => {
   const errMap = await xGrid.value.validate(true)

--
Gitblit v1.8.0