YY 2 rokov pred
rodič
commit
8f9924ae43
1 zmenil súbory, kde vykonal 9 pridanie a 26 odobranie
  1. 9 26
      src/views/selfShop/goods/index.vue

+ 9 - 26
src/views/selfShop/goods/index.vue

@@ -30,15 +30,8 @@
             <template #tags="{ item }">
               <el-cascader v-model="form[item.model]" :options="tagsList" :props="props" clearable filterable :show-all-levels="false"></el-cascader>
             </template>
-            <template #act_tags="{ item }">
-              <el-cascader
-                v-model="form[item.model]"
-                :options="act_tagsList"
-                :props="act_tagsProps"
-                clearable
-                filterable
-                :show-all-levels="false"
-              ></el-cascader>
+            <template #act_tags>
+              <el-option v-for="i in act_tagsList" :key="i.value" :label="i.label" :value="i.value"></el-option>
             </template>
             <template #status>
               <el-option v-for="i in goodsStatusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
@@ -90,7 +83,7 @@ export default {
       infoFields: [
         { label: '商品名称', model: 'name' },
         { label: '商品分类', model: 'tags', custom: true },
-        { label: '活动标签', model: 'act_tags', custom: true },
+        { label: '活动标签', model: 'act_tags', type: 'selectMany' },
         { label: '简短简介', model: 'shot_brief', maxLength: 50 },
         { label: '预计发货时间', model: 'send_time' },
         { label: '商品图片', model: 'file', type: 'upload', url: '/files/point/goods/upload' },
@@ -104,10 +97,8 @@ export default {
       props: { multiple: true, label: 'label', value: 'code' },
       // 活动标签
       act_tagsList: [],
-      act_tagsProps: { multiple: true, label: 'label', value: 'value' },
 
       goodsStatusList: [],
-
       shop: {},
     };
   },
@@ -152,24 +143,16 @@ export default {
       if (res) return res.label;
       return '';
     },
-    getTags(data) {
-      let list = this.tagsList;
-      const getChildren = (list) =>
-        list.map((i) => {
-          if (i.children) return getChildren(i.children);
-          return i;
-        });
-      list = _.flattenDeep(getChildren(list));
+    getAct_tags(data) {
       const arr = [];
-      for (const ts of data) {
-        const last = _.last(ts);
-        const r = list.find((f) => f.code === last);
+      for (const val of data) {
+        const r = this.act_tagsList.find((f) => f.value === val);
         if (r) arr.push(r.label);
       }
       return arr.join(';');
     },
-    getAct_tags(data) {
-      let list = this.act_tagsList;
+    getTags(data) {
+      let list = this.tagsList;
       const getChildren = (list) =>
         list.map((i) => {
           if (i.children) return getChildren(i.children);
@@ -179,7 +162,7 @@ export default {
       const arr = [];
       for (const ts of data) {
         const last = _.last(ts);
-        const r = list.find((f) => f.value === last);
+        const r = list.find((f) => f.code === last);
         if (r) arr.push(r.label);
       }
       return arr.join(';');