lxf il y a 1 an
Parent
commit
92525a0932
1 fichiers modifiés avec 60 ajouts et 11 suppressions
  1. 60 11
      src/components/makeBOM/index.vue

+ 60 - 11
src/components/makeBOM/index.vue

@@ -54,7 +54,7 @@
             <el-table-column label="颜色" width="120">
               <template #default="{ row, $index }">
                 <el-form-item :prop="'bomSpecList.' + $index + '.colour'" style="width: 100%">
-                  <el-input v-model="row.colour" placeholder="请输入颜色" />
+                  <el-input v-model="row.colour" placeholder="请输入颜色" @change="calculatePrice(row)" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -68,7 +68,8 @@
                     style="width: 100%"
                     :controls="false"
                     :min="0"
-                    :precision="2" />
+                    :precision="2"
+                    :disabled="judgeDisabled(row)" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -82,7 +83,8 @@
                     style="width: 100%"
                     :controls="false"
                     :min="0"
-                    :precision="2" />
+                    :precision="2"
+                    :disabled="judgeDisabled(row)" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -96,7 +98,8 @@
                     style="width: 100%"
                     :controls="false"
                     :min="0"
-                    :precision="2" />
+                    :precision="2"
+                    :disabled="judgeDisabled(row)" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -126,7 +129,8 @@
                         style="width: 100%"
                         :controls="false"
                         :min="0"
-                        :precision="2" />
+                        :precision="2"
+                        @change="calculatePrice(row)" />
                     </el-col>
                     <el-col :span="8">
                       <el-input-number
@@ -136,7 +140,8 @@
                         style="width: 100%"
                         :controls="false"
                         :min="0"
-                        :precision="2" />
+                        :precision="2"
+                        @change="calculatePrice(row)" />
                     </el-col>
                     <el-col :span="8">
                       <el-input-number
@@ -146,7 +151,8 @@
                         style="width: 100%"
                         :controls="false"
                         :min="0"
-                        :precision="2" />
+                        :precision="2"
+                        @change="calculatePrice(row)" />
                     </el-col>
                   </el-row>
                 </el-form-item>
@@ -345,6 +351,13 @@ const formConfig = computed(() => {
     },
     {
       type: "select",
+      label: "角度",
+      prop: "angle",
+      data: proxy.useUserStore().allDict["bom_angle"],
+      itemWidth: 50,
+    },
+    {
+      type: "select",
       label: "售价体系",
       prop: "sellingPriceSystem",
       data: proxy.useUserStore().allDict["bom_sellingPriceSystem"],
@@ -352,9 +365,9 @@ const formConfig = computed(() => {
     },
     {
       type: "select",
-      label: "角度",
-      prop: "angle",
-      data: proxy.useUserStore().allDict["bom_angle"],
+      label: "等级",
+      prop: "level",
+      data: proxy.useUserStore().allDict["bom_level"],
       itemWidth: 50,
     },
     {
@@ -391,7 +404,6 @@ const formConfig = computed(() => {
       slotName: "detailText",
       label: "详情描述",
     },
-    // bom_colour
   ];
 });
 const rules = ref({
@@ -553,6 +565,43 @@ const getStyle = (text) => {
     return "";
   }
 };
+const judgeDisabled = (item) => {
+  if (
+    formData.data.chromatophore &&
+    formData.data.sellingPriceSystem &&
+    formData.data.level &&
+    formData.data.embossingProcess &&
+    formData.data.bomClassifyId &&
+    item.colour &&
+    item.length &&
+    item.width &&
+    item.height
+  ) {
+    return false;
+  }
+  return true;
+};
+const calculatePrice = (item) => {
+  if (item.colour && item.length && item.width && item.height) {
+    proxy
+      .post("/bomSpec/getPriceByParam", {
+        bomClassifyId: formData.data.bomClassifyId,
+        chromatophore: formData.data.chromatophore,
+        level: formData.data.level,
+        sellingPriceSystem: formData.data.sellingPriceSystem,
+        embossingProcess: formData.data.embossingProcess,
+        colour: item.colour,
+        length: item.length,
+        width: item.width,
+        height: item.height,
+      })
+      .then((res) => {
+        item.costPrice = res;
+        item.internalSellingPrice = res;
+        item.externalSellingPrice = res;
+      });
+  }
+};
 </script>
 
 <style lang="scss" scoped>