Browse Source

feat(商品成本):有赞禁止选择实时金价

snow 1 year ago
parent
commit
450342dafa

+ 1 - 1
src/apis/service/sellOut/combindAdd/index.js

@@ -3,7 +3,7 @@ import http from '@/apis/axios'
 const api = 'admin/'
 export default {
   // 添加
-  add: (data, params) => http(api + 'salezxcreate', data, 'post', params),
+  add: (data, params) => http(api + 'combindadd', data, 'post', params),
   // 删除
   delete: (data, params) => http(api + 'Consultdel', data, 'post', params),
   // 分页查询

+ 9 - 4
src/views/goodStore/goodsCost/columns.js

@@ -78,10 +78,10 @@ const listCol = [
     width: '85px'
   },
   {
-    prop:'is_combind',
-    label:'组合类型',
+    prop: 'is_combind',
+    label: '组合类型',
     width: '95px',
-    _slot_:'is_combind',
+    _slot_: 'is_combind'
   },
   {
     prop: 'isonline',
@@ -210,7 +210,7 @@ const validate_good_name = (rule, value, callback) => {
   }
 }
 const rules = {
-  is_combind:[
+  is_combind: [
     {
       required: true,
       message: '请选择是否组合商品',
@@ -639,6 +639,11 @@ const basicColumns = [
     _slot_: 'is_combind',
     span: 6
   },
+  // {
+  //   prop: '定价模式',
+  //   label: '定价模式',
+  //   span: 6
+  // },
   {
     prop: 'noble',
     _slot_: 'noble',

+ 84 - 75
src/views/goodStore/goodsCost/components/addEdit.vue

@@ -37,7 +37,7 @@
                     :src="scope.row.good_thumb_img"
                     style="display: inline-block; width: 100%; height: 100%"
                     alt
-                  >
+                  />
                 </div>
               </template>
             </el-table-column>
@@ -119,7 +119,7 @@
                 <el-button v-if="id !== '007'" type="primary" :size="'mini'" @click="submitForm">保 存</el-button>
                 <el-button :size="'mini'" @click="showModelThis = false">
                   {{
-                    id == "007" ? "关 闭" : "取 消"
+                  id == "007" ? "关 闭" : "取 消"
                   }}
                 </el-button>
               </el-col>
@@ -131,174 +131,183 @@
   </el-dialog>
 </template>
 <script>
-import asyncRequest from '@/apis/service/goodStore/goodsCost'
-import resToken from '@/mixins/resToken'
-import { replaceTextWrapAndSpace } from '@/utils'
+import asyncRequest from "@/apis/service/goodStore/goodsCost";
+import resToken from "@/mixins/resToken";
+import { replaceTextWrapAndSpace } from "@/utils";
 export default {
-  name: 'Brand',
+  name: "Brand",
   mixins: [resToken],
-  props: ['showModel', 'id', 'sitem', 'isNobleMetal'],
+  props: ["showModel", "id", "sitem", "isNobleMetal"],
   data() {
     return {
       loading: false,
+      isYZPlatform: false,
       showModelThis: this.showModel,
       ruleForm: {
-        platform: '', // string	平台id
-        is_fixed: '', // string 定价模式
-        online_reason: '', // string	上线原因
-        online_remark: '' // string	上线备注
+        platform: "", // string	平台id
+        is_fixed: "", // string 定价模式
+        online_reason: "", // string	上线原因
+        online_remark: "" // string	上线备注
       },
       // 是否定制
       options1: [
-        { id: '0', name: '否' },
-        { id: '1', name: '是' }
+        { id: "0", name: "否" },
+        { id: "1", name: "是" }
       ],
       rulesThis: this.rules,
       rules: {
         platform: [
           {
             required: true,
-            message: '请选择所属平台',
-            trigger: 'change'
+            message: "请选择所属平台",
+            trigger: "change"
           }
         ],
         is_fixed: [
           {
             required: true,
-            message: '请选择定价模式',
-            trigger: 'change'
+            message: "请选择定价模式",
+            trigger: "change"
           }
         ],
         online_reason: [
           {
             required: true,
-            message: '上线原因不能为空',
-            trigger: 'blur'
+            message: "上线原因不能为空",
+            trigger: "blur"
           }
         ],
         online_remark: [
           {
             required: true,
-            message: '上线备注不能为空',
-            trigger: 'blur'
+            message: "上线备注不能为空",
+            trigger: "blur"
           }
         ]
       }
-    }
+    };
   },
   computed: {
+    isFiexed() {
+      return !this.isYZPlatform && this.isNobleMetal;
+    },
     pricingOptions() {
-      const inm = this.isNobleMetal
-      return ([
-        { value: '1', label: '一口价' },
-        ...(inm ? [{ value: '0', label: '实时金价' }] : [])
-      ])
+      return [
+        { value: "1", label: "一口价" },
+        ...(this.isFiexed ? [{ value: "0", label: "实时金价" }] : [])
+      ];
     }
   },
   watch: {
+    isFiexed() {
+      if (this.ruleForm.is_fixed === "0") {
+        this.ruleForm.is_fixed = "";
+      }
+    },
     showModel: function(val) {
-      this.showModelThis = val
+      this.showModelThis = val;
       if (val) {
-        this.initForm()
+        this.initForm();
       }
     },
     showModelThis(val) {
       if (!val) {
-        this.$emit('cancel')
+        this.$emit("cancel");
       }
     }
   },
   methods: {
     async initForm() {
-      this.loading = true
-      this.rulesThis = this.rules
-      await this.resetForm()
-      this.loading = false
+      this.loading = true;
+      this.rulesThis = this.rules;
+      await this.resetForm();
+      this.loading = false;
     },
     async resetForm() {
       // 重置
       await this.$nextTick(() => {
         if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields()
-          this.$refs.ruleForm.clearValidate()
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
           this.ruleForm = {
-            platform: '', // string	平台id
-            online_reason: '', // string	上线原因
-            online_remark: '' // string	上线备注
-          }
+            platform: "", // string	平台id
+            online_reason: "", // string	上线原因
+            online_remark: "" // string	上线备注
+          };
         }
-      })
+      });
     },
     platform_codesearchChange(e) {
-      const { id, code, label } = e
-      this.ruleForm.platform = id || ''
-      this.$refs.ruleForm.validateField('platform')
+      const { id, code, label, platform_type } = e;
+      this.ruleForm.platform = id || "";
+      this.isYZPlatform = platform_type === "1";
+      this.$refs.ruleForm.validateField("platform");
     },
     async submitForm() {
       this.ruleForm.online_remark = replaceTextWrapAndSpace(
         this.ruleForm.online_remark
-      )
+      );
       await this.$refs.ruleForm.validate(async valid => {
         if (valid) {
           if (!this.loading) {
-            this.loading = true
-            const model = JSON.parse(JSON.stringify(this.ruleForm))
+            this.loading = true;
+            const model = JSON.parse(JSON.stringify(this.ruleForm));
             // model.platform = model.platform.toString();
-            model.codes = []
-            const list = JSON.parse(JSON.stringify(this.sitem))
+            model.codes = [];
+            const list = JSON.parse(JSON.stringify(this.sitem));
             list.forEach(e => {
-              model.codes.push(e.spuCode)
-            })
+              model.codes.push(e.spuCode);
+            });
             const { code, data, message } = await asyncRequest.online_add(
               model
-            )
-            this.loading = false
+            );
+            this.loading = false;
             if (code === 0) {
               this.$notify.success({
-                title: '已成功添加至上线流程!',
-                message: ''
-              })
-              this.showModelThis = false
+                title: "已成功添加至上线流程!",
+                message: ""
+              });
+              this.showModelThis = false;
               // 刷新
-              this.$emit('refresh')
+              this.$emit("refresh");
             } else if (code >= 100 && code <= 104) {
-              await this.logout()
-            } else if (message === '一口价商品请先完善商品成本单价') {
-              this.$message.warning(message)
+              await this.logout();
+            } else if (message === "一口价商品请先完善商品成本单价") {
+              this.$message.warning(message);
             } else if (code === 1004) {
               this.open_show(
                 data,
-                '以下商品的业务公司和平台支付渠道中的业务公司重复,不允许上线'
-              )
+                "以下商品的业务公司和平台支付渠道中的业务公司重复,不允许上线"
+              );
             } else if (code === 1009) {
-              this.open_show(data, '以下商品已申请过商品上线!')
+              this.open_show(data, "以下商品已申请过商品上线!");
             } else if (code === 1010) {
-              this.open_show(data, '该平台要求商品必须要有一件的成本!')
+              this.open_show(data, "该平台要求商品必须要有一件的成本!");
             } else {
-              this.$message.warning(message)
+              this.$message.warning(message);
             }
           }
         } else {
-          return false
+          return false;
         }
-      })
+      });
     },
     open_show(data, title) {
-      const resList = JSON.parse(JSON.stringify(data))
-      let htmlList = '<ul>'
+      const resList = JSON.parse(JSON.stringify(data));
+      let htmlList = "<ul>";
       resList.forEach(v => {
         htmlList += `<li>
-                  <span>${v.good_name}</span></li>`
-      })
-      htmlList += '</ul>'
+                  <span>${v.good_name}</span></li>`;
+      });
+      htmlList += "</ul>";
       this.$notify({
         title: title,
         dangerouslyUseHTMLString: true,
         message: htmlList
-      })
+      });
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 19 - 43
src/views/goodStore/goodsCost/index.vue

@@ -196,46 +196,7 @@
           </el-row>
 
           <el-row style="margin-top: 10px">
-            <!-- <el-col :span="4" style="width: 225px">
-              <el-select
-                v-model="parmValue.is_stock"
-                size="mini"
-                style="width: 100%"
-                placeholder="商品类型"
-                clearable
-                @change="
-                  pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-              >
-                <el-option
-                  v-for="opt in isStockOptions"
-                  :key="opt.value"
-                  :value="opt.value"
-                  :label="opt.label"
-                />
-              </el-select>
-            </el-col>-->
-            <el-col :span="3" style="margin-right:25px">
-              <el-select
-                clearable
-                v-model="parmValue.is_combind"
-                placeholder="组合类型"
-                style="width:225px"
-                size="mini"
-                @change="
-                  pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-              >
-                <el-option label="组合商品" value="1" />
-                <el-option label="非组合商品" value="0" />
-              </el-select>
-            </el-col>
-
-            <el-col :span="4" style="width: 360px">
+            <el-col :span="4" style="width: 370px">
               <el-input
                 :size="searchSize"
                 v-model="sinput"
@@ -260,12 +221,27 @@
                 >
                   <el-option label="商品编号" value="1" />
                   <el-option label="商品名称" value="2" />
-                  <!-- <el-option label="业务企业编号" value="3" /> -->
-                  <!-- <el-option label="供应商编号" value="4" /> -->
-                  <!-- <el-option label="创建人部门" value="5" /> -->
                 </el-select>
               </el-input>
             </el-col>
+
+            <el-col :span="3" style="margin-left:10px">
+              <el-select
+                clearable
+                v-model="parmValue.is_combind"
+                placeholder="组合类型"
+                style="width:225px"
+                size="mini"
+                @change="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+              >
+                <el-option label="组合商品" value="1" />
+                <el-option label="非组合商品" value="0" />
+              </el-select>
+            </el-col>
           </el-row>
         </div>
       </template>

+ 7 - 1
src/views/goodStore/goodsOnline/ShowDataTableColumns.js

@@ -182,11 +182,17 @@ const public_listCol = [
     span: 4
   },
 
+  {
+    prop:'is_fixed',
+    label:'定价模式',
+    span:4,
+    _slot_:'is_fixed'
+  },
   {
     prop: 'noble',
     label: '贵金属信息',
     _slot_: 'noble',
-    span: 16
+    span: 12
   },
   {
     prop: 'sample_day',

+ 26 - 19
src/views/goodStore/goodsOnline/add.vue

@@ -162,6 +162,9 @@ export default {
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    isFiexed() {
+      return !this.isYzPlatform && this.isNoble;
+    },
     powers() {
       const tran =
         this.$store.getters.btnList.find(
@@ -170,11 +173,11 @@ export default {
       const { action } = tran ?? {};
       return action ?? [];
     },
-    fixedOptions(){
+    fixedOptions() {
       return [
-        { value: '1', label: '一口价' },
-        ...(this.isNoble ? [{ value: '0', label: '实时金价' }] : [])
-      ]
+        { value: "1", label: "一口价" },
+        ...(this.isFiexed ? [{ value: "0", label: "实时金价" }] : [])
+      ];
     }
   },
   watch: {
@@ -183,9 +186,9 @@ export default {
         this.initForm();
       }
     },
-    isNoble(){
-      if(this.ruleForm.is_fixed === '0'){
-        this.ruleForm.is_fixed = ""
+    isFiexed() {
+      if (this.ruleForm.is_fixed === "0") {
+        this.ruleForm.is_fixed = "";
       }
     }
   },
@@ -200,6 +203,7 @@ export default {
       status: "",
       rulesThis: this.rules,
       activeName: "1",
+      isYzPlatform: false,
       loading: true,
       //是否定制
       options1: options1,
@@ -221,8 +225,8 @@ export default {
 
     openDel(index) {
       this.tableData.splice(index, 1);
-      if(this.tableData.length === 0){
-        this.isNoble = null
+      if (this.tableData.length === 0) {
+        this.isNoble = null;
       }
     },
     resultList(e) {
@@ -230,21 +234,23 @@ export default {
       let list = JSON.parse(JSON.stringify(e));
       let oldList = JSON.parse(JSON.stringify(this.tableData));
 
-      const categoryIds = list.map(({cat_info, is_gold_price}) => ({
+      const categoryIds = list.map(({ cat_info, is_gold_price }) => ({
         id: String(cat_info[0].id),
         isGoldPrice: String(is_gold_price)
-      }))
+      }));
 
-      const nobleIds = categoryIds.filter(({id, isGoldPrice}
-      ) => id === '6' && isGoldPrice === "1")
+      const nobleIds = categoryIds.filter(
+        ({ id, isGoldPrice }) => id === "6" && isGoldPrice === "1"
+      );
 
-      console.log(nobleIds, categoryIds)
+      console.log(nobleIds, categoryIds);
 
-      this.isNoble = nobleIds.length > 0 && categoryIds.length === nobleIds.length;
+      this.isNoble =
+        nobleIds.length > 0 && categoryIds.length === nobleIds.length;
 
       list.forEach((e, ei) => {
         let index = oldList.findIndex(a => {
-          return e.spuCode === a.spuCode
+          return e.spuCode === a.spuCode;
         });
 
         if (index === -1) {
@@ -288,8 +294,8 @@ export default {
               this.routeReGoto("goodsOnline", {});
             } else if (code >= 100 && code <= 104) {
               await this.logout(code <= 104);
-            } else if (message === '一口价商品请先完善商品成本单价') {
-              this.$message.warning(message)
+            } else if (message === "一口价商品请先完善商品成本单价") {
+              this.$message.warning(message);
             } else if (code === 1004) {
               this.open_show(
                 data,
@@ -346,8 +352,9 @@ export default {
     },
 
     platform_codesearchChange(e) {
-      const { id, code, label } = e;
+      const { id, code, label, platform_type } = e;
       this.ruleForm.platform = id || "";
+      this.isYzPlatform = String(platform_type) === "1";
       this.$refs.ruleForm.validateField("platform");
     }
   }

+ 2 - 0
src/views/goodStore/goodsOnline/detail.vue

@@ -45,6 +45,8 @@
                   <span v-else>暂无凭证</span>
                 </template>
 
+                <tempalte slot="is_fixed">{{String(sitem.is_fixed) === "1" ? '实时金价' : '一口价'}}</tempalte>
+
                 <template slot="good_name">
                   <img
                     v-viewer

+ 39 - 39
src/views/goodStore/goodsOnline/index.vue

@@ -124,45 +124,8 @@
             </el-col>
           </el-row>
           <el-row style="padding: 10px 0 0 0">
-            <el-col :span="4" style="width: 450px">
-              <el-input
-                :size="searchSize"
-                v-model="sinput"
-                :maxlength="40"
-                @blur="
-                  pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-                placeholder="关键字"
-              >
-                <el-select
-                  v-model="select"
-                  slot="prepend"
-                  :size="searchSize"
-                  style="width: 140px"
-                  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                  placeholder="关键字类型"
-                >
-                  <el-option label="商品名称" value="1" />
-                  <el-option label="供应商名称" value="3" />
-                  <el-option label="成本商品编号" value="2" />
-                  <el-option label="上线商品编号" value="8" />
-                  <!-- <el-option label="平台编号" value="3" /> -->
-                  <el-option label="业务企业编号" value="5" />
-                  <el-option label="平台商品编号" value="6" />
-                  <el-option label="成本创建人" value="7" />
-                  <el-option label="上线创建人" value="10" />
-                  <el-option label="上线创建人部门" value="9" />
-                </el-select>
-              </el-input>
-            </el-col>
 
-            <el-col :span="4" style="margin-left:10px">
+            <el-col :span="4" style="margin-right:10px">
               <el-select
                 style="width:100%"
                 v-model="parmValue.is_stock"
@@ -184,7 +147,7 @@
               </el-select>
             </el-col>
 
-            <el-col :span="4" style="margin-left:10px">
+            <el-col :span="4" style="right:10px">
               <el-select
                 style="width:100%"
                 v-model="parmValue.is_compliance"
@@ -203,6 +166,43 @@
               </el-select>
             </el-col>
 
+            <el-col :span="4" style="width: 350;margin-left:10px">
+              <el-input
+                :size="searchSize"
+                v-model="sinput"
+                :maxlength="40"
+                @blur="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+                placeholder="关键字"
+              >
+                <el-select
+                  v-model="select"
+                  slot="prepend"
+                  :size="searchSize"
+                  style="width: 120px"
+                  @change="
+                    pageInfo.curr = 1;
+                    parmValue.page = 1;
+                    searchList();
+                  "
+                  placeholder="关键字类型"
+                >
+                  <el-option label="商品名称" value="1" />
+                  <el-option label="供应商名称" value="3" />
+                  <el-option label="成本商品编号" value="2" />
+                  <el-option label="上线商品编号" value="8" />
+                  <el-option label="业务企业编号" value="5" />
+                  <el-option label="平台商品编号" value="6" />
+                  <el-option label="成本创建人" value="7" />
+                  <el-option label="上线创建人" value="10" />
+                  <el-option label="上线创建人部门" value="9" />
+                </el-select>
+              </el-input>
+            </el-col>
+
             <el-col
               :span="3"
               class="fr"

+ 74 - 17
src/views/sellOut/combinedAdd/components/baseForm.vue

@@ -1,6 +1,6 @@
 <template>
-  <el-form label-width="90px" size="mini">
-    <el-form-item v-loading="loading.product" label="组合商品">
+  <el-form ref="ruleForm" v-loading="loading.full" label-width="90px" size="mini" :model="ruleForm" :rules="rules">
+    <el-form-item v-loading="loading.product" label="组合商品" prop="spuCode">
       <el-input v-if="!productinfo" placeholder="选择组合商品" @focus="pVisible = true" />
 
       <div v-else key="product" style="display:flex">
@@ -116,7 +116,7 @@
       </div>
     </el-form-item>
 
-    <el-form-item v-loading="loading.stock" label="所在仓库">
+    <el-form-item v-loading="loading.stock" label="所在仓库" prop="wsm_code">
       <el-input v-if="!stockinfo" placeholder="选择所在仓库" @focus="sVisible = true" />
 
       <div v-else key="stock" style="display:flex">
@@ -133,9 +133,9 @@
 
     <el-row>
       <el-col :span="12">
-        <el-form-item label="添加库存数">
+        <el-form-item label="添加库存数" prop="stock_num" label-width="110px">
           <digital-input
-            :values="ruleForm.stock_moq"
+            :values="ruleForm.stock_num"
             :placeholder="'添加库存数'"
             :min="0"
             :max="100000000000"
@@ -144,7 +144,7 @@
             :size="'mini'"
             :controls="false"
             :append="''"
-            @reschange="number_change($event, 'stock_moq')"
+            @reschange="number_change($event, 'stock_num')"
           />
         </el-form-item>
       </el-col>
@@ -152,7 +152,7 @@
       <el-col :span="12">
         <el-form-item label="可用库存数">
           <digital-input
-            :values="ruleForm.can_stock"
+            :values="ruleForm.usable_stock"
             :placeholder="'可用库存数'"
             :min="0"
             :max="100000000000"
@@ -162,7 +162,7 @@
             :controls="false"
             :disabled="true"
             :append="''"
-            @reschange="number_change($event, 'can_stock')"
+            @reschange="number_change($event, 'usable_stock')"
           />
         </el-form-item>
       </el-col>
@@ -193,7 +193,7 @@
 
     <el-form-item>
       <div class="flex-end" style="width:100%;display:flex;justify-content:flex-end">
-        <el-button size="mini" type="primary">保存</el-button>
+        <el-button size="mini" type="primary" @click="submit">保存</el-button>
       </div>
     </el-form-item>
 
@@ -208,6 +208,25 @@ import ProductModal from './productModal.vue'
 import asyncRequest from '@/apis/service/sellOut/combindAdd'
 import { stockColumns, productColumns } from './columnsForm'
 import privateField from '@/mixins/privateField'
+import { add_sum, isnumber } from '@/utils/validate'
+
+const validateNum = (rule, value, callback) => {
+  if (value === '') {
+    callback(new Error('添加库存数不能为空!'))
+  } else {
+    const num = parseInt(value + '')
+    console.log(num)
+    if (!isnumber(value)) {
+      callback(new Error('添加库存数必须是整数!'))
+    } else if (num === NaN) {
+      callback(new Error('添加库存数必须是整数!'))
+    } else if (num === 0) {
+      callback(new Error('添加库存数不能为零!'))
+    } else {
+      callback()
+    }
+  }
+}
 
 export default {
   name: 'BaseForm',
@@ -223,11 +242,14 @@ export default {
       productinfo: null,
       loading: {
         product: false,
-        stock: false
+        stock: false,
+        full: false
       },
       ruleForm: {
-        stock_moq: 0,
-        can_stock: 0
+        spuCode: '',
+        wsm_code: '',
+        stock_num: 0,
+        usable_stock: 0
       },
       options6: [
         { id: '1', name: '全国' },
@@ -236,18 +258,48 @@ export default {
       options3: [
         { id: '0', name: '无销售权限' },
         { id: '1', name: '有销售权限' }
-      ]
+      ],
+      rules: {
+        spuCode: [{ required: true, trigger: 'change', message: '请选择组合商品' }],
+        wsm_code: [{ required: true, trigger: 'change', message: '请选择所在仓库' }],
+        stock_num: [{ required: true, trigger: 'change', validator: validateNum }]
+      }
     }
   },
   methods: {
+    async submit() {
+      try {
+        await this.$refs.ruleForm.validate()
+        const { usable_stock: _, ...params } = this.ruleForm
+        this.loading.full = true
+        const { code, message } = await asyncRequest.add({
+          ...params,
+          flag: '1'
+        })
+        this.loading.full = false
+        if (Number(code) === 0) {
+          this.$router.push('/sellOut/combinedAdd')
+          return
+        } else if (code === 1004) {
+          this.$message.warning(message)
+        }
+      } catch (e) {
+        console.log(e)
+      }
+    },
     number_change(e, key) {
       this.ruleForm[key] = e
+      this.$nextTick(() => {
+        this.$refs.ruleForm && this.$refs.ruleForm.validateField(key)
+      })
     },
     resetStock() {
       this.stockinfo = null
+      this.ruleForm.wsm_code = ''
     },
     resetProduct() {
       this.productinfo = null
+      this.ruleForm.spuCode = ''
     },
     async handleStockSelected(evt) {
       const { id } = evt
@@ -284,6 +336,7 @@ export default {
       }
 
       this.stockinfo = data
+      this.ruleForm.wsm_code = data.wsm_code
     },
     async getArea(prop = 'delivery_place') {
       const chunks = this.productinfo[prop].split(',')
@@ -297,15 +350,19 @@ export default {
       area = area.find(({ area_code }) => area_code === chunks[2]) || {}
       return [province, city, area].map(({ name }) => name).join('')
     },
-    async handleProductSelected(spuCode, id) {
+    async handleProductSelected(spuCode) {
       this.loading.product = true
       const { code, data } = await asyncRequest.productinfo({ spuCode })
-      this.productinfo = data
+      if (code !== 0) return
+      this.productinfo = data;
+
+      (data.combind_list || []).forEach(item => {
+        this.ruleForm.usable_stock = add_sum(this.ruleForm.usable_stock || 0, item.usable_stock || 0)
+      })
+      this.ruleForm.spuCode = spuCode
       this.delivery_place = await this.getArea('delivery_place')
       this.origin_place = await this.getArea('origin_place')
-      console.log(this.origin_place)
       this.loading.product = false
-      if (code !== 0) return
     }
   }
 }

+ 4 - 3
src/views/sellOut/combinedAdd/components/stockModal.vue

@@ -201,7 +201,8 @@ export default {
       columns: [
         {
           type: "selection",
-          width: "80px"
+          width: "80px",
+          fixed: 'left'
         },
         {
           prop: "wsm_code",
@@ -260,8 +261,8 @@ export default {
     };
   },
   watch: {
-    _visible(nV) {
-      if (!nV) return;
+    _visible(NV) {
+      if (!NV) return;
       this.searchList();
     }
   },

+ 10 - 4
src/views/sellOut/combinedAdd/index.vue

@@ -25,12 +25,12 @@
           <div style="width: 100%">
             <el-row style="padding: 0 0 0 80px">
               <el-col :span="24">
-                <el-col :span="6" style="width: 293px;">
+                <el-col :span="6" style="width: 355px;">
                   <period-date-picker
                     :create_start="parmValue.create_start"
                     :create_end="parmValue.create_end"
                     :type="1"
-                    :width="'135px'"
+                    :width="'165px'"
                     :size="searchSize"
                     placeholder="创建"
                     @timeReturned="timeReturned($event)"
@@ -67,15 +67,21 @@
                 <el-input
                   v-model="value"
                   :size="searchSize"
+                  placeholder="关键字"
+                  clearable
                   :maxlength="40"
-                  @blur="
+                  @change="
                       pageInfo.curr = 1;
                       parmValue.page = 1;
                       searchList();
                     "
                 >
                   <template #prepend>
-                    <el-select v-model="parmValue.key" style="width:100px">
+                    <el-select v-model="parmValue.key" style="width:100px" @change="
+                      pageInfo.curr = 1;
+                      parmValue.page = 1;
+                      searchList();
+                    ">
                       <el-option label="商品名称" value="spuCode" />
                       <el-option label="商品编码" value="good_name" />
                     </el-select>