Jelajahi Sumber

Merge branch 'feat' into develop

zh 2 tahun lalu
induk
melakukan
c539e4fd76
1 mengubah file dengan 46 tambahan dan 30 penghapusan
  1. 46 30
      src/views/basic_data/dealer/components/dealer_list-detail.vue

+ 46 - 30
src/views/basic_data/dealer/components/dealer_list-detail.vue

@@ -290,21 +290,32 @@
           </el-col>
           <el-col>
             <el-form-item label="提货方式">
-              <div>
-                <el-checkbox-group v-model="radio">
-                  <el-checkbox :label="1"> 物流配送(嘉贤物流)</el-checkbox>
-                  <el-checkbox :label="2">商家自提</el-checkbox>
-                </el-checkbox-group>
-              </div>
-              <div>选择商家自提需配置物流产品类别</div>
-              <div>
-
-                <el-checkbox-group v-model="pickCategory">
-                  <el-checkbox v-for="(item, index) in dataList" :key="index" :label="item.id">
-                    {{ item.name }}
-                  </el-checkbox>
-                </el-checkbox-group>
-              </div>
+              <el-col :span="12">
+                <div>
+                    <el-checkbox v-model="isFront" :label="true"> 物流配送(嘉贤物流)</el-checkbox>
+                </div>
+                <div>选择商家自提需配置物流产品类别</div>
+                <div>
+                  <el-checkbox-group v-model="frontCategory">
+                    <el-checkbox v-for="(item, index) in dataList" :key="index" :label="item.id">
+                      {{ item.name }}
+                    </el-checkbox>
+                  </el-checkbox-group>
+                </div>
+              </el-col>
+              <el-col :span="12">
+                <div>
+                    <el-checkbox v-model="isPick" :label="true">商家自提</el-checkbox>
+                </div>
+                <div>选择商家自提需配置自提产品类别</div>
+                <div>
+                  <el-checkbox-group v-model="pickCategory">
+                    <el-checkbox v-for="(item, index) in dataList" :key="index" :label="item.id">
+                      {{ item.name }}
+                    </el-checkbox>
+                  </el-checkbox-group>
+                </div>
+              </el-col>
               <div>注:设置配送方式后提货预约可根据配置的提货方式进行选择</div>
               <div>
                 <el-button type="primary" size="default" @click="onSubmit">保存</el-button>
@@ -334,24 +345,27 @@ export default {
       infoList: {},
       dataList: [],
       radio: [],
-      pickCategory: []
+      isFront:false,
+      isPick:false,
+      pickCategory: [],
+      frontCategory: []
     }
   },
 
   async created() {
     this.getDataList()
     const res = await getDealerInfo({ id: this.detailsId })
-    if (res.data.isFront) {
-      this.radio.push(1)
-    }
-    if (res.data.isPick) {
-      this.radio.push(2)
+    this.isFront = res.data.isFront
+    this.isPick = res.data.isPick
+    if (res.data.kingDeeCustomerCategoriesFront&& res.data.kingDeeCustomerCategoriesFront.length) {
+      this.frontCategory = res.data.kingDeeCustomerCategoriesFront.map(k => {
+        return k.categoryId
+      })
     }
-    if (res.data.kingDeeCustomerCategories) {
-      this.pickCategory  = res.data.kingDeeCustomerCategories.map(k=>{
+    if (res.data.kingDeeCustomerCategories&& res.data.kingDeeCustomerCategories.length) {
+      this.pickCategory = res.data.kingDeeCustomerCategories.map(k => {
         return k.categoryId
       })
-     
     }
     this.infoList = res.data
   },
@@ -374,19 +388,21 @@ export default {
       })
     },
     onSubmit() {
-      if (!this.radio.length) {
+      if (!this.isFront && !this.isPick) {
         this.$errorMsg('必须选择一种提货方式')
         return
       }
-      if (this.radio.includes(2) && !this.pickCategory.length) {
-        this.$errorMsg('商家自提必须选择产品类别')
+      if ((this.isFront && !this.frontCategory.length) || (this.isPick && !this.pickCategory.length)) {
+        this.$errorMsg('必须选择产品类别')
         return
       }
+ 
       updatePick({
         id: this.detailsId,
-        isFront: this.radio.includes(1),
-        isPick: this.radio.includes(2),
-        pickCategory: this.pickCategory.join(',')
+        isFront: this.isFront,
+        isPick: this.isPick,
+        pickCategory: this.pickCategory.join(','),
+        frontCategory:this.frontCategory.join(',')
       }).then(res => {
         this.$successMsg('保存成功')
         this.$parent.isShow = true