Bladeren bron

价格,金额,利率相关的字段值要保留小数点后两位(主界面和详情界面都需要更新)

002390 1 jaar geleden
bovenliggende
commit
bdcfad6cb1

+ 5 - 1
src/views/purchase/purchase-order/add/index.vue

@@ -29,6 +29,7 @@ export default {
   data() {
     return {
       visible: false,
+      loading:false,
       columns: NewColumns,
       rules: initRules(NewColumns),
 
@@ -95,6 +96,7 @@ export default {
     async setCopyParams(id) {
 
       try {
+        this.loading = true;
         const { code, msg, data } = await orderApi.details(id);
 
         if (code === 200) {
@@ -114,6 +116,7 @@ export default {
             invoiceMoney:'',
             paymentMoney:'',
             applyPaymentMoney:'',
+            erpOrderCode:'',
 
           };
 
@@ -135,7 +138,7 @@ export default {
       } catch (err) {
         //
       } finally {
-        // this.loading = false;
+        this.loading = false;
       }
     },
     // 增行
@@ -478,6 +481,7 @@ export default {
     :visible.sync="visible"
     @open="beforeOpen"
     @close="$emit('close')"
+    v-loading="loading"
   >
     <el-form
       size="mini"

+ 15 - 15
src/views/purchase/purchase-order/column.js

@@ -55,7 +55,7 @@ export const TableColumns = [
   },
   // { key: "freezeCause", title: "冻结原因" },
   { key: "qty", title: "总数量",width:100, },
-  { key: "money", title: "价税合计",width:100, },
+  { key: "money", title: "价税合计",width:100,precision:2, },
   // {
   //   key: "isMarketing",
   //   title: "已协同生成销售订单",
@@ -74,8 +74,8 @@ export const TableColumns = [
     inputType: 'Checkbox',
     width:80,
   },
-  { key: "rebateMoney", title: "订单使用返利金额" ,},
-  { key: "deductionMoney", title: "订单抵扣余款金额" ,},
+  { key: "rebateMoney", title: "订单使用返利金额" ,precision:2,},
+  { key: "deductionMoney", title: "订单抵扣余款金额" ,precision:2,},
   // { key: "warehouse", title: "WMS入库仓库" },
   { key: "warehouseName", title: "收货仓库" }, //WMS入库仓库名称
   { key: "goodsAllocationName", title: "货位" },
@@ -94,9 +94,9 @@ export const TableColumns = [
     inputType: 'Checkbox',
     width:80,
   },
-  { key: "applyPaymentMoney", title: "累计付款申请金额" },
-  { key: "paymentMoney", title: "累计付款金额" },
-  { key: "invoiceMoney", title: "发票金额" },
+  { key: "applyPaymentMoney", title: "累计付款申请金额", precision:2,},
+  { key: "paymentMoney", title: "累计付款金额" ,precision:2,},
+  { key: "invoiceMoney", title: "发票金额" ,precision:2,},
   // { key: "supplierPersonal", title: "供应商业务员" },
   { key: "supplierPersonalName", title: "供应商业务员" },
   { key: "marketingCode", title: "销售订单号" },
@@ -163,14 +163,14 @@ export const TabColumns = [
       { key: "qty", title: "数量",width:120, },
       // { key: "currency", title: "币种" },
       { key: "currencyName", title: "币种" },
-      { key: "taxPrice", title: "含税单价" ,width:120,},
-      { key: "money", title: "价税合计" ,width:120,},
-      { key: "tax", title: "税率" ,width:120,},
-      { key: "taxDeductMoneya", title: "折扣金额",width:120, },
-      { key: "arrivalQty", title: "已到货数量" ,width:120,},
-      { key: "unarrivedQty", title: "未到货数量" ,width:120,},
-      { key: "price", title: "无税单价" ,width:120,},
-      { key: "notaxMoney", title: "无税金额" ,width:120,},
+      { key: "taxPrice", title: "含税单价" ,width:120,precision:2,},
+      { key: "money", title: "价税合计" ,width:120, precision:2,},
+      { key: "tax", title: "税率" ,width:120, precision:2,},
+      { key: "taxDeductMoneya", title: "折扣金额", width:120, precision:2, },
+      { key: "arrivalQty", title: "已到货数量" , width:120,},
+      { key: "unarrivedQty", title: "未到货数量" , width:120,},
+      { key: "price", title: "无税单价" , idth:120, precision:2,},
+      { key: "notaxMoney", title: "无税金额" , width:120, precision:2,},
       { key: "priceSource", title: "价格目录ID" },
       {
         key: "isStorage",
@@ -241,7 +241,7 @@ export const TabColumns = [
         width:80,
       },
       { key: "originalQty", title: "原始数量" ,width:120,},
-      { key: "originalMoney", title: "原始金额" ,width:120,},
+      { key: "originalMoney", title: "原始金额" ,width:120,precision:2,},
       { key: "reservedQty", title: "预留数量",width:120, },
       { key: "reservedPeriod", title: "预留周期",  },
       { key: "taxDeductClassify", title: "扣税类别" },

+ 20 - 2
src/views/purchase/purchase-order/index.vue

@@ -375,6 +375,24 @@ export default {
 
       console.log(this.checkedTabList, 'this.checkedTabList');
     },
+    keepTwoDecimalStr(num) {
+      console.log(num,'num');
+      if(num){
+          const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+          let s = result.toString();
+          let rs = s.indexOf('.');
+          if (rs < 0) {
+            rs = s.length;
+            s += '.';
+          }
+          while (s.length <= rs + 2) {
+            s += '0';
+          }
+          return s;
+      }else{
+        return '';
+      }
+    }
   }
 };
 </script>
@@ -552,7 +570,7 @@ export default {
             true-label="Y"
             false-label="N"
           > </el-checkbox>
-          <span v-else>{{ scope.row[column.key] }}</span>
+          <span v-else>{{column.precision ? keepTwoDecimalStr(scope.row[column.key]):scope.row[column.key] }}</span>
         </template>
       </el-table-column>
       <el-table-column fixed="right" label="操作" width="120">
@@ -651,7 +669,7 @@ export default {
                   true-label="Y" 
                   false-label="N"
                 ></el-checkbox>
-                <span v-else>{{ scope.row[cColumn.key] }}</span>
+                <span v-else>{{cColumn.precision ? keepTwoDecimalStr(scope.row[cColumn.key]): scope.row[cColumn.key] }}</span>
               </template>
             </el-table-column>
           </el-table>

+ 7 - 2
src/views/purchase/purchase-order/see/index.vue

@@ -30,6 +30,7 @@ export default {
   data() {
     return {
       visible: false,
+      loading:false,
       columns: NewColumns,
       rules: initRules(NewColumns),
       params: {
@@ -129,8 +130,12 @@ export default {
   <el-drawer 
     direction="btt" 
     size="100%" 
-    :with-header="false" :visible.sync="visible" @open="beforeOpen"
-    @close="$emit('close')">
+    :with-header="false" 
+    :visible.sync="visible" 
+    @open="beforeOpen"
+    @close="$emit('close')"
+    v-loading="loading"
+  >
     <el-form 
       size="mini" 
       label-position="right"