瀏覽代碼

采购订单维护-编辑:集采中心角色、非自制订单增加手动询价功能;
①修改数量:计算价税合计=含税单价 X 数量;
②修改赠品:赠品为Y,清空价税合计,数量不变,反之核算价税合计;
修改①和②,需要计算主表中:价税合计=子表价税合计总和;总数量=子表数量总和;
③修改供应商、价格类型、物料,需要清空含税单价,并计算含税合计

002390 1 年之前
父節點
當前提交
c6725ae490

+ 0 - 2
src/components/popover-select-v2/index.vue

@@ -227,8 +227,6 @@ export default {
           source[key] = prop[0][dataMapping[key]];
         }
         this.innerValue = prop[0][valueKey];
-        console.log(source, "source");
-        console.log(prop[0], this.$props, "prop[0], this.$props");
         this.$emit("update:source", source);
         this.$emit("change", prop[0], this.$props);
       }

+ 3 - 7
src/views/expend/customerExpend/edit/index.vue

@@ -27,7 +27,6 @@ export default {
       visible: false,
       loading: false,
       opType: "edit",
-      count: 0,
     };
   },
   computed: {
@@ -50,14 +49,11 @@ export default {
     },
     // 查询
     async fetchItem(prop) {
-      console.log(prop, "prop");
       try {
         this.loading = true;
         let { code, data } = await ccdItem(prop.id);
         if (code == 200) {
           this.params = data;
-          this.count++;
-          console.log(this.params, "params");
         }
       } catch (error) {
       } finally {
@@ -94,13 +90,13 @@ export default {
 
 <template>
   <el-drawer
+    :size="width"
+    :title="title"
     v-bind="$attrs"
     v-on="$listeners"
+    v-loading="loading"
     :show-close="false"
-    :size="width"
-    :title="title"
     :visible.sync="visible"
-    v-loading="loading"
     append-to-body
     destroy-on-close
     @close="onHide"

+ 4 - 0
src/views/purchase/purchase-order/add/column.js

@@ -517,6 +517,10 @@ const PurchaseTabColumns = [
         disabled: true,
         width: 180,
         isSummary: true,
+        // formatter: (prop) => {
+        //   const { tax = 0, taxPrice = 0 } = prop;
+        //   return (prop.price = iunitprice(tax, taxPrice));
+        // },
       },
 
       {

+ 45 - 0
src/views/purchase/purchase-order/cai-gou-xun-jia/index.vue

@@ -0,0 +1,45 @@
+<script>
+import orderApi from "@/api/business/purchase/purchase-order";
+export default {
+  name: "CGXJ",
+  props: {
+    // v-model
+    value: {
+      type: [Object],
+      require: true,
+    },
+  },
+  data() {
+    return {
+      title: "手动询价",
+    };
+  },
+  methods: {
+    async useClick() {
+      try {
+        this.$modal.loading("处理中,请稍后...");
+        let { value } = this.$props;
+        console.log(value, "value");
+        let { code, data, msg } = await orderApi.getPrice({
+          ...value,
+          action: "price",
+        });
+        if (code == 200) {
+          this.$notify.success(msg);
+          this.$emit("update:source", data);
+          this.$emit("success", data);
+        }
+      } catch (error) {
+      } finally {
+        this.$modal.closeLoading();
+      }
+    },
+  },
+  created() {},
+};
+</script>
+<template>
+  <el-button v-bind="$attrs" :size="$attrs.size" @click="useClick">{{
+    title
+  }}</el-button>
+</template>

+ 152 - 51
src/views/purchase/purchase-order/edit/index.vue

@@ -20,6 +20,7 @@ export default {
     FileUploadCenter: () => import("../components/FileUploadCenter/index.vue"),
     BatchImport: () => import("@/components/BatchImport/index.vue"),
     ButtonHide: () => import("../components/hide/index.vue"),
+    CgxjButton: () => import("../cai-gou-xun-jia/index.vue"),
   },
   data() {
     return {
@@ -82,6 +83,21 @@ export default {
         });
       },
     },
+    // 手动询价
+    isManualInquiry: {
+      get() {
+        let { handleIsRevise, role, params } = this;
+        if (
+          !handleIsRevise() &&
+          role === "procurementManager" &&
+          params.source != "3"
+        ) {
+          return true;
+        }
+        return false;
+      },
+      set() {},
+    },
   },
   watch: {
     "params.contractType": function (newProp) {
@@ -434,6 +450,19 @@ export default {
           });
 
           Promise.all(promiseArr).then(async () => {
+            // 需要手动询价
+            if (this.isManualInquiry) {
+              // 清空含税单价
+              this.params["puOrderItemList"] = this.params[
+                "puOrderItemList"
+              ].map((item) => ({
+                ...item,
+                taxPrice: 0,
+                money: 0,
+              }));
+              return;
+            }
+
             // 明细不为空的情况下进行询价
             let detailList = this.params["puOrderItemList"].filter(
               (item) => item.material && item.material != ""
@@ -489,35 +518,6 @@ export default {
     },
     // 子表参照改变之后
     async handleTabReferChange(val, type, source) {
-      // 触发物料参照
-      if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
-        source["qty"] = 0;
-
-        // source['whetherCompleteInquiry'] = false;
-
-        source["taxPrice"] = 0;
-
-        source["money"] = 0;
-
-        source["taxDeductMoneya"] = 0;
-
-        source["price"] = 0;
-
-        source["notaxMoney"] = 0;
-
-        source["tax"] = 0;
-
-        this.params["qty"] = 0;
-        this.params["originalQty"] = 0;
-        this.params["money"] = 0;
-        this.params["originalMoney"] = 0;
-        this.params["notaxMoney"] = 0;
-
-        source.isDrug = val.materialMedcine.isDrug == "0" ? "Y" : "N";
-
-        // await this.handleGetPrice();
-      }
-
       // 物料触发税率
       if (type == "MATERIAL_PARAM") {
         let { rateCode } = source;
@@ -533,6 +533,34 @@ export default {
           // finally
           this.loading = false;
         }
+
+        if (source.qty && source.qty != "") {
+          source["qty"] = 0;
+
+          // source['whetherCompleteInquiry'] = false;
+
+          source["taxPrice"] = 0;
+
+          source["money"] = 0;
+
+          source["taxDeductMoneya"] = 0;
+
+          source["price"] = 0;
+
+          source["notaxMoney"] = 0;
+
+          source["tax"] = 0;
+
+          this.params["qty"] = 0;
+          this.params["originalQty"] = 0;
+          this.params["money"] = 0;
+          this.params["originalMoney"] = 0;
+          this.params["notaxMoney"] = 0;
+
+          source.isDrug = val.materialMedcine.isDrug == "0" ? "Y" : "N";
+
+          // await this.handleGetPrice();
+        }
       }
     },
 
@@ -559,15 +587,51 @@ export default {
 
     // 子表下拉框改变
     handleTabSelectChange(type, row) {
-      // && row.qty
-      if (type == "priceType" && row.material && row.qty != "") {
-        // row['whetherCompleteInquiry'] = false;
+      if (type == "priceType") {
+        // 需要手动询价
+        if (this.isManualInquiry) {
+          // 清空含税单价
+          row["taxPrice"] = 0;
+          row["money"] = 0;
+          this.params.money = this.params["puOrderItemList"].reduce(
+            (total, item) => {
+              return (total += item.money);
+            },
+            0
+          );
+          return;
+        }
 
-        this.handleGetPrice();
+        if (row.material && row.qty != "") {
+          // row['whetherCompleteInquiry'] = false;
+          this.handleGetPrice();
+        }
       }
     },
     // 子表inputNumber
     handleInputChange(row, type) {
+      if (this.isManualInquiry) {
+        if (type == "qty" || type === "taxPrice") {
+          // 不进行询价
+          row.money = Number(row.taxPrice) * Number(row.qty);
+
+          // 主表价税合计
+          this.params.money = this.params["puOrderItemList"].reduce(
+            (total, item) => {
+              return (total += item.money);
+            },
+            0
+          );
+          this.params.qty = this.params["puOrderItemList"].reduce(
+            (total, item) => {
+              return (total += item.qty);
+            },
+            0
+          );
+          return;
+        }
+      }
+
       // 物料数量变化----询价
       if (
         (type == "qty" || type == "taxPrice" || type == "taxDeductMoneya") &&
@@ -585,27 +649,30 @@ export default {
         this.$refs.puOrderItemList[0].updateFooter();
         // this.$refs.puOrderExecuteList[0].updateFooter();
       }
-
-      // // 物料数量变化----询价
-      // if (type == 'qty' && row.material) {
-
-      //   row['whetherCompleteInquiry'] = false;
-
-      //   // row.qty && this.handleGetPrice();
-      //   this.handleGetPrice();
-
-      // }
     },
     // 子表多选框改变
-    handleTabCheckbox(type, source) {
+    handleTabCheckbox(type, row) {
+      if (type == "isGift" && this.isManualInquiry) {
+        if (row.isGift === "Y") {
+          row.money = 0;
+        } else {
+          row.money = Number(row.taxPrice) * Number(row.qty);
+        }
+        // 不进行询价
+
+        // 主表价税合计
+        this.params.money = this.params["puOrderItemList"].reduce(
+          (total, item) => {
+            return (total += item.money);
+          },
+          0
+        );
+        return;
+      }
+
       // 勾选赠品,价税合计更新为0,含税单价、无税单价更新为0
-      if (
-        type === "isGift" &&
-        source.material &&
-        source.qty &&
-        source.qty != ""
-      ) {
-        // source['whetherCompleteInquiry'] = false;
+      if (type === "isGift" && row.material && row.qty && row.qty != "") {
+        // row['whetherCompleteInquiry'] = false;
 
         this.handleGetPrice();
       }
@@ -840,9 +907,32 @@ export default {
               return {
                 ...item,
                 qty: munList[index] || item.qty,
+                money: this.isManualInquiry
+                  ? Number(item.taxPrice) * Number(item.qty)
+                  : item.money,
               };
             });
           this.params.puOrderItemList = [...invariant, ...change];
+
+          if (this.isManualInquiry) {
+            // 不进行询价
+
+            // 主表价税合计
+            this.params.money = this.params["puOrderItemList"].reduce(
+              (total, item) => {
+                return (total += Number(item.money));
+              },
+              0
+            );
+            // 原始总数量
+            this.params.qty = this.params["puOrderItemList"].reduce(
+              (total, item) => {
+                return (total += Number(item.qty));
+              },
+              0
+            );
+            return;
+          }
           if (this.params.status === "2") {
             // 修订
             this.handleCalculateOrderAmount();
@@ -906,6 +996,17 @@ export default {
         >
           <h3>{{ handleIsRevise() ? "修订" : "编辑" }}</h3>
           <div style="text-align: right">
+            <!-- 编辑 非自制 采购角色 -->
+            <cgxj-button
+              v-if="
+                !handleIsRevise() &&
+                role === 'procurementManager' &&
+                params.source != '3'
+              "
+              v-model="params"
+              :size="size"
+              :source.sync="params"
+            ></cgxj-button>
             <el-button :size="size" type="primary" @click="handleSava"
               >更 新</el-button
             >