Explorar o código

fix(saleOrder): 修复不定项总价计算精度问题

liujt hai 3 meses
pai
achega
5da819da55
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/views/saleManage/saleOrder/components/typeList.vue

+ 2 - 0
src/views/saleManage/saleOrder/components/typeList.vue

@@ -276,6 +276,7 @@
 
           this.allPrice += item.totalPrice;
         });
+        this.allPrice = Number(this.allPrice.toFixed(2));
         this.$emit('setCountAmount', this.allPrice);
         this.$emit('setTotalPlanNum', totalCount);
       },
@@ -284,6 +285,7 @@
       async putTableValue(productList) {
         if (productList) {
           this.form.datasource = productList;
+          this.allPrice = productList?.reduce((acc, item) => acc + item.totalPrice, 0).toFixed(2) || 0;
           this.$refs.table.reload();
         }
       },