Joe 3 éve
szülő
commit
53f64b29a8

+ 80 - 14
src/views/coupon/Coupon_CreateCoupon.vue

@@ -24,6 +24,7 @@
         :inline="true"
         label-width="88px"
       >
+      <!--
         <el-form-item label="设备类型" prop="deviceType">
           <el-select
             v-model="createForm.deviceType"
@@ -44,8 +45,9 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
-
+        -->
         <el-form-item>
+        <!--
           <el-button
             type="cyan"
             icon="el-icon-search"
@@ -60,6 +62,7 @@
             @click="resetQuery"
             >重置</el-button
           >
+          -->
           <el-button
             type="primary"
             icon="el-icon-plus"
@@ -71,6 +74,16 @@
       </el-form>
       <el-table :data="couponList">
         <af-table-column label="优惠券名称" align="center" prop="couponName" />
+        <af-table-column label="状态" align="center">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.status"
+              active-value="1"
+              inactive-value="0"
+              @change="handleStatusChange(scope.row)"
+            ></el-switch>
+          </template>
+        </af-table-column>
         <af-table-column label="卡片类型" align="center">
           <template slot-scope="scope">
           {{scope.row.couponType == 1 ? '现金劵' + '--面值:' + scope.row.couponAmt + '元' : ''}}
@@ -97,10 +110,10 @@
           </template>
         </af-table-column>
 
-        <af-table-column label="有效期限制" align="center">
+        <af-table-column label="有效期内使用限制" align="center">
           <template slot-scope="scope">
           {{ (scope.row.effectiveTimeType == 1 ? scope.row.effectiveTime[0] + '到' + scope.row.effectiveTime[1]   : '用户领取'+ scope.row.effectiveDayNum +'天内有效' ) + '内有效'}}
-          {{ ',且用户只能在1号领取'}}
+          {{ translateTime(scope.row) }}
           </template>
         </af-table-column>
 
@@ -117,17 +130,6 @@
           </template>
         </af-table-column>
 
-        
-        <af-table-column label="状态" align="center">
-          <template slot-scope="scope">
-            <el-switch
-              v-model="scope.row.status"
-              active-value="1"
-              inactive-value="0"
-              @change="handleStatusChange(scope.row)"
-            ></el-switch>
-          </template>
-        </af-table-column>
         <af-table-column
           label="操作"
           align="center"
@@ -537,6 +539,43 @@ export default {
       },
       // 表单校验
       rules: {},
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "1号",
+          "2号",
+          "3号",
+          "4号",
+          "5号",
+          "6号",
+          "7号",
+          "8号",
+          "9号",
+          "10号",
+          "11号",
+          "12号",
+          "13号",
+          "14号",
+          "15号",
+          "16号",
+          "17号",
+          "18号",
+          "19号",
+          "20号",
+          "21号",
+          "22号",
+          "23号",
+          "24号",
+          "25号",
+          "26号",
+          "27号",
+          "28号",
+          "29号",
+          "30号",
+          "31号",
+        ],
+      ],
     };
   },
   created() {
@@ -572,6 +611,33 @@ export default {
     'SelectDay': SelectDay
   },
   methods: {
+    translateTime(row) {
+      let timeString = "";
+      const availableControleType = row.availableControl;
+      if(availableControleType == 0){
+        return ',有效期内一直都可以领取'
+      }
+      timeString = ',且用户只能在'
+      if (availableControleType == 1) {
+        timeString += "每周的";
+      }
+      if (availableControleType == 2) {
+        timeString += "每月的";
+      }
+      if (availableControleType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (availableControleType == 1 || availableControleType == 2) {
+        row.cycleDaysList.forEach((ele) => {
+          timeString += this.timeSelect[availableControleType][ele] + "、";
+        });
+      } else if (availableControleType == 3) {
+        timeString += row.appointedDaysList.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + "可以使用劵";
+      return timeString;
+    },
     getTodayDateString(){
       const date = new Date()
       let y = date.getFullYear();

+ 121 - 10
src/views/coupon/Coupon_CreateIssue.vue

@@ -13,6 +13,7 @@
         :inline="true"
         label-width="88px"
       >
+      <!--
         <el-form-item label="设备类型" prop="deviceType">
           <el-select
             v-model="createForm.deviceType"
@@ -33,8 +34,9 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
-
+-->
         <el-form-item>
+        <!--
           <el-button
             type="cyan"
             icon="el-icon-search"
@@ -49,6 +51,7 @@
             @click="resetQuery"
             >重置</el-button
           >
+          -->
           <el-button
             type="primary"
             icon="el-icon-plus"
@@ -59,8 +62,8 @@
         </el-form-item>
       </el-form>
       <el-table :data="issueList">
-        <af-table-column label="id" align="center" prop="id" />
-        <af-table-column label="状态" align="center" width="100">
+        <af-table-column label="发放方式名称" align="center" prop="issueName" />
+        <af-table-column label="状态" align="center">
           <template slot-scope="scope">
             <el-switch
               v-model="scope.row.status"
@@ -70,6 +73,31 @@
             ></el-switch>
           </template>
         </af-table-column>
+        <af-table-column label="发放方式类型" align="center">
+          <template slot-scope="scope">
+            {{scope.row.issueType == '1'? '消费发放':''}}
+            {{scope.row.issueType == '2'? '网页方式':''}}
+            {{scope.row.issueType == '3'? '二维码-静态码':''}}
+            {{scope.row.issueType == '4'? '支付成功后的领取位':''}}
+          </template>
+        </af-table-column>
+        <af-table-column label="发放门槛" align="center">
+          <template slot-scope="scope">
+            {{scope.row.issueType == '1' ?  scope.row.discountThresholdAmt == '0' ? '无门槛,消费都发放': '满' + scope.row.discountThresholdAmt + '元发放' :''}}
+            {{scope.row.issueType != '1'? '-------':''}}
+          </template>
+        </af-table-column>
+        <af-table-column label="领取限制" align="center">
+          <template slot-scope="scope">
+            {{scope.row.issueType == '1'? '-------':''}}
+            {{scope.row.issueType != '1' ? '用户能进入这个领取界面' + scope.row.giveCount + '次,一次可以领取'+  scope.row.giveLimit + '张优惠券': ''}}
+          </template>
+        </af-table-column>
+        <af-table-column label="可领取时间段" align="center">
+          <template slot-scope="scope">
+            {{ translateTime(scope.row) }}
+          </template>
+        </af-table-column>
         <!-- <af-table-column label="面值" align="center" prop="gunNo" /> -->
         <!-- <af-table-column label="有效期" align="center" prop="deviceFactory" /> -->
         <af-table-column
@@ -121,19 +149,36 @@
             style="width: 180px"
           />
         </el-form-item>
-        <el-form-item label="发放类型" prop="couponName">
+        <el-form-item label="发放类型" prop="issueType">
           <el-radio-group v-model="createForm.issueType">
             <div>
               <el-radio label="1">消费发放</el-radio>
-              <el-radio label="2">展示位发放</el-radio>
+              <el-radio label="2">网页方式</el-radio>
+              <el-radio label="3">二维码-静态码</el-radio>
             </div>
             <div>
-              <el-radio label="3">二维码、网页</el-radio>
-              <el-radio label="4" disabled>更多方式后续开放</el-radio>
+              <el-radio label="4">支付成功后的领取位(只能设置一次)</el-radio>
             </div>
-            
           </el-radio-group>
         </el-form-item>
+        <el-form-item label="能进入的次数" prop="giveCount" v-if="createForm.issueType!=1">
+            用户能进入这个领取界面 <input
+            type="text"
+            class="form-control d-inline-block"
+            v-model.number="createForm.giveCount"
+            style="width: 80px"
+          /> 次
+        </el-form-item>
+
+        <el-form-item label="一次能领取几张次数" prop="giveLimit" v-if="createForm.issueType!=1">
+          用户进入后一次能领取<input
+            type="text"
+            class="form-control d-inline-block"
+            v-model.number="createForm.giveLimit"
+            style="width: 80px"
+          />张
+        </el-form-item>
+        <!--
         <el-form-item label="展示位选择" prop="showIdList" v-if="createForm.issueType==2">
           <el-checkbox-group v-model="createForm.showIdList">
             <div>
@@ -145,6 +190,7 @@
             </div>
           </el-checkbox-group>
         </el-form-item>
+        -->
         <el-form-item label="发放门槛" prop="discountThresholdAmt" v-if="createForm.issueType==1">
           消费达到
           <input
@@ -337,6 +383,8 @@ export default {
         issueType: "2",
         discountThresholdAmt: "0",
         couponIssueRelationList: [],
+        giveLimit:9999999,
+        giveCount:100,
       },
       couponList: [],
       oilNameList: [],
@@ -373,6 +421,43 @@ export default {
       day: [],
       cycle: [],
       issueList:[],
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "1号",
+          "2号",
+          "3号",
+          "4号",
+          "5号",
+          "6号",
+          "7号",
+          "8号",
+          "9号",
+          "10号",
+          "11号",
+          "12号",
+          "13号",
+          "14号",
+          "15号",
+          "16号",
+          "17号",
+          "18号",
+          "19号",
+          "20号",
+          "21号",
+          "22号",
+          "23号",
+          "24号",
+          "25号",
+          "26号",
+          "27号",
+          "28号",
+          "29号",
+          "30号",
+          "31号",
+        ],
+      ],
     };
   },
   components: {
@@ -419,6 +504,33 @@ export default {
     }
   },
   methods: {
+    translateTime(row) {
+      let timeString = "";
+      const availableControleType = row.availableControl;
+      if(availableControleType == 0){
+        return '用户一直都可以领取'
+      }
+      timeString = '用户只能在'
+      if (availableControleType == 1) {
+        timeString += "每周的";
+      }
+      if (availableControleType == 2) {
+        timeString += "每月的";
+      }
+      if (availableControleType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (availableControleType == 1 || availableControleType == 2) {
+        row.cycleDaysList.forEach((ele) => {
+          timeString += this.timeSelect[availableControleType][ele] + "、";
+        });
+      } else if (availableControleType == 3) {
+        timeString += row.appointedDaysList.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + "可以领取劵";
+      return timeString;
+    },
     getIssueList(){
       listIssue(this.queryForm).then((res) => {
           if (res.code == 200) {
@@ -499,10 +611,9 @@ export default {
         });
     },
     handleStatusChange(row) {
-      console.log(row);
       let text = row.status === "1" ? "启用" : "停用";
       this.$confirm(
-        '确认要"' + text + '""' + row.couponName + '"该优惠券吗?',
+        '确认要"' + text + '""' + row.issueName + '"发放方式吗?',
         "警告",
         {
           confirmButtonText: "确定",