Browse Source

完成会员日

Joe 4 years ago
parent
commit
9a5c1bc279
1 changed files with 74 additions and 22 deletions
  1. 74 22
      src/views/market/Market_Discount.vue

+ 74 - 22
src/views/market/Market_Discount.vue

@@ -101,14 +101,14 @@
         </el-form-item>
         <el-form-item
           label="会员日"
-          prop="discountSettingAAA"
+          prop="discountSettingFlag"
           :rules="{
             required: true,
             message: '请选择是否开启会员日',
             trigger: 'change',
           }"
         >
-          <el-radio-group v-model="updateForm.discountSettingAAA">
+          <el-radio-group v-model="updateForm.discountSettingFlag">
             <el-radio label="0">关闭</el-radio>
             <el-radio label="1">开启</el-radio>
           </el-radio-group>
@@ -116,9 +116,9 @@
         <el-form-item
           label="会员日周期类型"
           prop="discountType"
-          v-show="updateForm.discountSettingAAA == 1"
+          v-show="updateForm.discountSettingFlag == 1"
           :rules="{
-            required: updateForm.discountSettingAAA == 1,
+            required: updateForm.discountSettingFlag == 1,
             message: '请选择会员日的周期类型',
             trigger: 'change',
           }"
@@ -189,9 +189,9 @@
         <el-form-item
           label="会员日优惠条件"
           prop="discountActivityAmt"
-          v-show="updateForm.discountSettingAAA == 1"
+          v-show="updateForm.discountSettingFlag == 1"
           :rules="{
-            required: updateForm.discountSettingAAA == 1,
+            required: updateForm.discountSettingFlag == 1,
             message: '请填写会员日的优惠金额',
             trigger: 'change',
           }"
@@ -210,7 +210,7 @@
             }}</span>
             ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
             <el-input-number
-              v-model="updateForm.gasoilDiscountAmt"
+              v-model="updateForm.discountActivityAmt"
               size="mini"
               :min="0"
             />元
@@ -336,7 +336,19 @@
           {{ scope.row.gasoilDiscountAmt }} 元
         </template>
       </af-table-column>
-
+      <af-table-column
+        label="会员日"
+        align="center"
+      >
+        <template slot-scope="scope">
+          <span v-if="scope.row.discountSettingFlag == 0">
+            无活动
+          </span>
+          <span v-else-if="scope.row.discountSettingFlag == 1">
+            {{discountSettingTranslate(scope.row)}}
+          </span>
+        </template>
+      </af-table-column>
       <af-table-column
         label="叠加等级优惠"
         align="center"
@@ -473,8 +485,7 @@ export default {
       discountSetting: 0,
       updateForm: {
         collectClickCalendar: [],
-        collectClickCalendar: [],
-        collectClickDay: "",
+        collectClickDay: '',
       },
       currentDiscountName: "",
       timeSelect: [
@@ -536,7 +547,7 @@ export default {
         });
         return flag;
       });
-    },
+    }
   },
   created() {
     this.setPageStatus();
@@ -645,18 +656,18 @@ export default {
     handleSubmit() {
       this.$refs["updateForm"].validate((valid) => {
         if (valid) {
-          if (
-            this.updateForm.discountType == "1" ||
-            this.updateForm.discountType == "2"
-          ) {
-            this.updateForm.datePickerTime =
-              this.updateForm.collectClickCalendar.toString();
-          } else {
-            this.updateForm.datePickerTime =
-              this.updateForm.collectClickDay.toString();
+          if(this.updateForm.discountSettingFlag == "1") {
+            if (
+              this.updateForm.discountType == "1" ||
+              this.updateForm.discountType == "2"
+            ) {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickCalendar.toString();
+            } else {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickDay.toString();
+            }
           }
-
-          console.log(this.updateForm);
           if (this.updateForm.id != null) {
             updatePlan(this.updateForm).then((response) => {
               this.msgSuccess("修改成功");
@@ -727,6 +738,47 @@ export default {
     //       this.download(response.msg);
     //     });
     // },
+    discountSettingTranslate(row) {
+      if (row.discountSettingFlag == 0) {
+        return "未设置";
+      }
+      // if (this.discountList.integralActivity == 0) {
+      //   return "";
+      // }
+
+      let timeString = "";
+      const discountType = row.discountType;
+
+
+      if (discountType == 1) {
+        timeString += "每周的";
+      }
+      if (discountType == 2) {
+        timeString += "每月的";
+      }
+      if (discountType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (discountType == 1 || discountType == 2) {
+        (row.discountDate||'').split(',').filter((ele)=>{
+          return ele !== ''
+        }).forEach((ele) => {
+          timeString += this.timeSelect[discountType][ele] + "、";
+        });
+      } else if (discountType == 3) {
+        timeString += row.discountDate.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + " 优惠:";
+      if(this.discountSetting == 3){
+        timeString +=  '满' +  row.discountAmt + (row.discountTerm == 2 ? "元" : "L" ) + ',每升优惠' + row.discountActivityAmt + '元'
+      }else if(this.discountSetting == 1){
+        timeString += '每满' + row.discountAmt + '元,减' + row.discountActivityAmt + '元'
+      }else if(this.discountSetting == 2){
+        timeString += '满' + row.discountAmt + '元,减' + row.discountActivityAmt + '元'
+      }
+      return timeString;
+    },
   },
 };
 </script>