فهرست منبع

Amend Voucher Management
https://dev.wormwood.com.sg/zentao/task-view-157.html

vbea 2 سال پیش
والد
کامیت
2498ea0985

+ 3 - 0
Strides-Admin/src/http/api/voucher.js

@@ -83,6 +83,9 @@ const voucher = {
    */
   deleteVoucher(voucherId) {
     return del(prefix + "vouchers/" + voucherId)
+  },
+  getWeekOptions() {
+    return get(prefix + "day-of-week-select")
   }
 }
 

+ 3 - 3
Strides-Admin/src/views/campaign/detail.vue

@@ -499,13 +499,13 @@ export default {
         this.form.discounts[index].loading = false;
       })
     },
-    changeUserType(dsIndex, dsType) {
+    changeUserType(dsIndex, dsType, again) {
       let type = this.form.discounts[dsIndex].userType;
       if (dsType != type) {
         this.form.discounts[dsIndex].userType = dsType;
         this.form.discounts[dsIndex].groupPk = "";
       }
-      if (dsType) {
+      if (dsType && !again) {
         if (this.groupOptions[dsType] && this.groupOptions[dsType].length > 0) {
           this.form.discounts[dsIndex].groupList = this.groupOptions[dsType];
         } else {
@@ -520,7 +520,7 @@ export default {
       apiUser.getGroupByType(type).then(res => {
         if (res.data) {
           this.groupOptions[type] = res.data
-          this.changeUserType(index, type)
+          this.changeUserType(index, type, true)
         }
       }).catch(err => {
         this.$message({

+ 23 - 5
Strides-Admin/src/views/voucher/detail.vue

@@ -241,10 +241,10 @@
               multiple
               clearable>
               <el-option
-                v-for="(item, index) in options.days"
+                v-for="(item, index) in options.weeks"
                 :key="index"
-                :label="item"
-                :value="item"/>
+                :label="item.key"
+                :value="item.value"/>
             </el-select>
           </el-form-item>
         </div>
@@ -316,6 +316,7 @@ export default {
         days: [],
         site: [],
         type: [],
+        weeks: [],
         charge: ["AC", "DC"],
         redemp: [],
         country: []
@@ -424,10 +425,10 @@ export default {
       })
     },
     getCountryOptions() {
-      this.options.days = [];
+      /*this.options.days = [];
       for (let i = 1; i <= 31; i++) {
         this.options.days.push(i);
-      }
+      }*/
       site.getCountryList().then(res => {
         if (res.data) {
           this.options.country = res.data
@@ -442,11 +443,28 @@ export default {
         })
         this.options.country = []
       }).finally(() => {
+        this.getWeekOptions();
         this.getRedemTypeOptions();
         this.getVoucherTypeOptions();
         this.getAllSite();
       })
     },
+    getWeekOptions() {
+      api.getWeekOptions().then(res => {
+        if (res.data) {
+          this.options.weeks = res.data
+        } else {
+          this.options.weeks = []
+        }
+      }).catch(() => {
+        this.$message({
+          message: err,
+          type: 'error',
+          duration: 3000,
+        })
+        this.options.weeks = []
+      })
+    },
     getRedemTypeOptions() {
       api.getRedemMethodOptions().then(res => {
         if (res.data) {