Преглед на файлове

修订时,修改明细数量不进行询价,通过另外的价格接口查询

002390 преди 1 година
родител
ревизия
f7fe57c89f
променени са 2 файла, в които са добавени 57 реда и са изтрити 10 реда
  1. 12 1
      src/api/business/purchase/purchase-order.js
  2. 45 9
      src/views/purchase/purchase-order/edit/index.vue

+ 12 - 1
src/api/business/purchase/purchase-order.js

@@ -74,6 +74,16 @@ const getPrice = (data) => {
   });
 }
 
+// 采购订单-计算金额
+const calculateOrderAmount = (data) => {
+  return request({
+    url: `/pu/order/calculateOrderAmount`,
+    method: "post",
+    data,
+  });
+}
+
+
 // 采购订单退回
 const documentsReturn = (data) => {
   return request({
@@ -83,7 +93,7 @@ const documentsReturn = (data) => {
   });
 }
 
-// 采购订单退回
+// 采购订单整单关闭
 const close = (data) => {
   return request({
     url: `/pu/order/close`,
@@ -144,6 +154,7 @@ export default {
   revision,
   remove,
   getPrice,
+  calculateOrderAmount,
   documentsReturn,
   close,
   toNc,

+ 45 - 9
src/views/purchase/purchase-order/edit/index.vue

@@ -346,7 +346,7 @@ export default {
 
      // 子表下拉框改变
      handleTabSelectChange(type,row){
-
+ 
       // && row.qty
       if(type == 'priceType' && row.material  && row.qty != ""){
 
@@ -358,16 +358,36 @@ export default {
     },
     // 子表inputNumber
     handleInputChange(row, type) {
+
+
       // 物料数量变化----询价
-      if (type == 'qty' && row.material) {
+      if (type == 'qty' && row.material ) {
 
-        row['whetherCompleteInquiry'] = false;
+        if(this.params.status === '2'){
 
-        // row.qty && this.handleGetPrice();
-        this.handleGetPrice();
+          // 修订
+          this.handleCalculateOrderAmount();
+
+        }else{
+
+          row['whetherCompleteInquiry'] = false;
+
+          row.qty && this.handleGetPrice();
+
+        }
 
       }
 
+      // // 物料数量变化----询价
+      // if (type == 'qty' && row.material) {
+
+      //   row['whetherCompleteInquiry'] = false;
+
+      //   // row.qty && this.handleGetPrice();
+      //   this.handleGetPrice();
+
+      // }
+
     },
     // 子表多选框改变
     handleTabCheckbox(type,source){
@@ -398,17 +418,33 @@ export default {
 
       }
     },
+    // 修订——计算金额
+    async handleCalculateOrderAmount(){
+
+      try {
+        let { code, data } = await orderApi.calculateOrderAmount({ 
+          ...this.params,
+          action: this.handleIsRevise() ? 'revise':'update',
+        });
+        
+          code == 200 &&  (this.params = data);
+
+      } catch (error) {} 
+      finally {}
+
+    },
+
     // 判断修订还是编辑
     handleIsRevise() {
       return this.params.status == '2';
     },
 
     // /handleIsRevise() ? scope.row[cColumn.key] : Infinity
-    getInputNumberMax(key,num){
+    getInputNumberMax(key,row){
 
       if(key === 'qty'){
 
-        return this.handleIsRevise() ? num : Infinity
+        return this.handleIsRevise() ? row['originalQty'] : Infinity
       
       }
 
@@ -495,7 +531,7 @@ export default {
               <el-input-number v-if="column.inputType === 'InputNumber'" 
                 v-model="params[column.key]"
                 :precision="column.precision"
-                :max="getInputNumberMax(column.key, params[column.key])"
+                :max="handleIsRevise() ? params[column.key] : Infinity"
                 :controls-position="column.controlsPosition" 
                 :placeholder="column.placeholder"
                 :clearable="column.clearable" 
@@ -654,7 +690,7 @@ export default {
                     v-model="scope.row[cColumn.key]"
                     :precision="cColumn.precision"
                     :controls-position="cColumn.controlsPosition"
-                    :max="getInputNumberMax(cColumn.key, scope.row[cColumn.key])"
+                    :max="getInputNumberMax(cColumn.key, scope.row)"
                     @change="handleInputChange(scope.row, cColumn.key)" 
                     :placeholder="cColumn.placeholder"
                     :clearable="cColumn.clearable"