소스 검색

商品标签

yuhongqi 2 일 전
부모
커밋
0b460dab21
2개의 변경된 파일105개의 추가작업 그리고 3개의 파일을 삭제
  1. 53 2
      src/views/hisStore/storeProduct/index.vue
  2. 52 1
      src/views/hisStore/storeProduct/indexZm.vue

+ 53 - 2
src/views/hisStore/storeProduct/index.vue

@@ -595,6 +595,21 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-form-item label="标签类型" prop="tagType">
+          <el-select v-model="tagType" placeholder="请选择标签类型" clearable style="width: 100%" @change="onTagTypeChange">
+            <el-option label="不分润商品" value="no_commission" />
+            <el-option label="预售商品" value="presale" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="最晚发货时间" prop="presaleShippingTime" v-if="tagType === 'presale'">
+          <el-date-picker
+            v-model="presaleShippingTime"
+            type="datetime"
+            placeholder="请选择最晚发货时间"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            style="width: 100%"
+          />
+        </el-form-item>
         <el-form-item label="商品图片" prop="image">
           <Material v-model="imageArr" type="image" :num="1" :width="150" :height="150" />
         </el-form-item>
@@ -1253,6 +1268,8 @@ export default {
       ],
       photoArr:[],
       imageArr:[],
+      tagType: null,
+      presaleShippingTime: null,
       activeName:"1",
       productTypeOptions:[],
       isDisplayOptions:[],
@@ -1743,6 +1760,12 @@ export default {
       this.open = false;
       this.reset();
     },
+    // 标签类型变更
+    onTagTypeChange(val) {
+      if (val !== 'presale') {
+        this.presaleShippingTime = null;
+      }
+    },
     // 表单重置
     reset() {
       this.form = {
@@ -1808,8 +1831,12 @@ export default {
         adverseReactions: null, // 不良反应
         contraindications: null, // 禁忌
         precautions: null, // 注意事项
-        purchaseLimit: null // 限购数量
+        purchaseLimit: null, // 限购数量
+        tagInfo: null // 标签信息
       };
+      // 重置标签类型和预售发货时间
+      this.tagType = null;
+      this.presaleShippingTime = null;
       // 重置药品展示图
       this.drugImageArr = [];
       this.resetForm("form");
@@ -1903,9 +1930,23 @@ export default {
           });
         }
         // 组装companyIds
-        if (response.data.companyIds != null && response.data.companyIds != undefined && response.data.companyIds.length > 0) {
+        if (this.form.companyIds != null && this.form.companyIds != undefined && response.data.companyIds.length > 0) {
           this.form.companyIds = response.data.companyIds.split(',').map(Number);
         }
+        // 解析标签信息
+        if (this.form.tagInfo) {
+          try {
+            const tagObj = JSON.parse(this.form.tagInfo);
+            this.tagType = tagObj.type || null;
+            this.presaleShippingTime = tagObj.shippingTime || null;
+          } catch (e) {
+            this.tagType = null;
+            this.presaleShippingTime = null;
+          }
+        } else {
+          this.tagType = null;
+          this.presaleShippingTime = null;
+        }
         this.appIds = this.form.appIds ? this.form.appIds.split(',') : [];
         setTimeout(() => {
           that.generate();
@@ -1967,6 +2008,16 @@ export default {
           if (this.form.companyIds != null && this.form.companyIds != undefined) {
             this.form.companyIds = this.form.companyIds.join(',');
           }
+          // 组装标签信息 tagInfo
+          if (this.tagType) {
+            const tagObj = { type: this.tagType };
+            if (this.tagType === 'presale' && this.presaleShippingTime) {
+              tagObj.shippingTime = this.presaleShippingTime;
+            }
+            this.form.tagInfo = JSON.stringify(tagObj);
+          } else {
+            this.form.tagInfo = null;
+          }
           // 小程序
           const params = {
             ...this.form,

+ 52 - 1
src/views/hisStore/storeProduct/indexZm.vue

@@ -595,6 +595,21 @@
 <!--            </el-form-item>-->
 <!--          </el-col>-->
 <!--        </el-row>-->
+        <el-form-item label="标签类型" prop="tagType">
+          <el-select v-model="tagType" placeholder="请选择标签类型" clearable style="width: 100%" @change="onTagTypeChange">
+            <el-option label="不分润商品" value="no_commission" />
+            <el-option label="预售商品" value="presale" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="最晚发货时间" prop="presaleShippingTime" v-if="tagType === 'presale'">
+          <el-date-picker
+            v-model="presaleShippingTime"
+            type="datetime"
+            placeholder="请选择最晚发货时间"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            style="width: 100%"
+          />
+        </el-form-item>
         <el-form-item label="商品图片" prop="image">
           <Material v-model="imageArr" type="image" :num="1" :width="150" :height="150" />
         </el-form-item>
@@ -1218,6 +1233,8 @@ export default {
       ],
       photoArr:[],
       imageArr:[],
+      tagType: null,
+      presaleShippingTime: null,
       activeName:"1",
       productTypeOptions:[],
       isDisplayOptions:[],
@@ -1821,6 +1838,12 @@ export default {
       this.open = false;
       this.reset();
     },
+    // 标签类型变更
+    onTagTypeChange(val) {
+      if (val !== 'presale') {
+        this.presaleShippingTime = null;
+      }
+    },
     // 表单重置
     reset() {
       this.form = {
@@ -1893,8 +1916,12 @@ export default {
         purchaseLimit: null, // 限购数量
         singlePurchaseLimit: null, // 单次购买数量上限
         userEndCategoryIds: [],
-        tagIds: []
+        tagIds: [],
+        tagInfo: null // 标签信息
       };
+      // 重置标签类型和预售发货时间
+      this.tagType = null;
+      this.presaleShippingTime = null;
       // 重置药品展示图
       this.drugImageArr = [];
       this.resetForm("form");
@@ -1996,6 +2023,20 @@ export default {
         if (response.data.companyIds != null && response.data.companyIds != undefined && response.data.companyIds.length > 0) {
           this.form.companyIds = response.data.companyIds.split(',').map(Number);
         }
+        // 解析标签信息
+        if (this.form.tagInfo) {
+          try {
+            const tagObj = JSON.parse(this.form.tagInfo);
+            this.tagType = tagObj.type || null;
+            this.presaleShippingTime = tagObj.shippingTime || null;
+          } catch (e) {
+            this.tagType = null;
+            this.presaleShippingTime = null;
+          }
+        } else {
+          this.tagType = null;
+          this.presaleShippingTime = null;
+        }
         this.$set(this.form, 'userEndCategoryIds', (response.userEndCategoryIds || []).map(id => Number(id)).filter(id => !Number.isNaN(id)));
         this.$set(this.form, 'tagIds', (response.tagIds || []).map(id => Number(id)).filter(id => !Number.isNaN(id)));
         Promise.all([
@@ -2084,6 +2125,16 @@ export default {
           if (this.form.companyIds != null && this.form.companyIds != undefined) {
             this.form.companyIds = this.form.companyIds.join(',');
           }
+          // 组装标签信息 tagInfo
+          if (this.tagType) {
+            const tagObj = { type: this.tagType };
+            if (this.tagType === 'presale' && this.presaleShippingTime) {
+              tagObj.shippingTime = this.presaleShippingTime;
+            }
+            this.form.tagInfo = JSON.stringify(tagObj);
+          } else {
+            this.form.tagInfo = null;
+          }
           addOrEdit(this.form).then(response => {
             if (response.code === 200) {
               this.msgSuccess("修改成功");