Selaa lähdekoodia

兑换码订阅

natasha 1 vuosi sitten
vanhempi
commit
a769c18c84
1 muutettua tiedostoa jossa 208 lisäystä ja 6 poistoa
  1. 208 6
      src/views/cdkey_manage/AddGoods.vue

+ 208 - 6
src/views/cdkey_manage/AddGoods.vue

@@ -90,6 +90,23 @@
         </template>
         <template v-else-if="itemType === 'baozhi'">
           <div class="filt-item">
+            <label>订阅</label>
+            <ul>
+              <li
+                :class="[itemy.value === baozhiForm.orderValue ? 'active' : '']"
+                v-for="(itemy, indexy) in orderList"
+                :key="indexy"
+                @click="handleClick('baozhiForm', 'orderValue', itemy.value)"
+              >
+                <i
+                  v-if="itemy.value === baozhiForm.orderValue"
+                  class="el-icon-success"
+                ></i>
+                {{ itemy.label }}
+              </li>
+            </ul>
+          </div>
+          <div class="filt-item" v-if="baozhiForm.orderValue === 'false'">
             <label>年份</label>
             <ul>
               <li
@@ -106,6 +123,40 @@
               </li>
             </ul>
           </div>
+          <div class="filt-item" v-else>
+            <label>期数</label>
+            <ul>
+              <li
+                :class="[
+                  itemy.value === baozhiForm.period_count ? 'active' : '',
+                ]"
+                v-for="(itemy, indexy) in periodList"
+                :key="indexy"
+                @click="handleClick('baozhiForm', 'period_count', itemy.value)"
+              >
+                <i
+                  v-if="itemy.value === baozhiForm.period_count"
+                  class="el-icon-success"
+                ></i>
+                {{ itemy.label }}
+              </li>
+            </ul>
+          </div>
+          <div
+            class="filt-item"
+            style="margin-bottom: 24px"
+            v-if="baozhiForm.orderValue === 'true'"
+          >
+            <label>时间</label>
+            <el-date-picker
+              v-model="baozhiForm.begin_date"
+              type="month"
+              placeholder="请选择订阅起始月"
+              format="yyyy-MM"
+              value-format="yyyy-MM"
+            >
+            </el-date-picker>
+          </div>
           <div class="filt-item">
             <label>学段</label>
             <ul>
@@ -132,7 +183,7 @@
               </li>
             </ul>
           </div>
-          <div class="filt-item">
+          <div class="filt-item" v-if="baozhiForm.orderValue === 'false'">
             <label>类型</label>
             <ul>
               <li
@@ -199,6 +250,23 @@
         </template>
         <template v-else-if="itemType === 'huakan'">
           <div class="filt-item">
+            <label>订阅</label>
+            <ul>
+              <li
+                :class="[itemy.value === huakanForm.orderValue ? 'active' : '']"
+                v-for="(itemy, indexy) in orderList"
+                :key="indexy"
+                @click="handleClick('huakanForm', 'orderValue', itemy.value)"
+              >
+                <i
+                  v-if="itemy.value === huakanForm.orderValue"
+                  class="el-icon-success"
+                ></i>
+                {{ itemy.label }}
+              </li>
+            </ul>
+          </div>
+          <div class="filt-item" v-if="huakanForm.orderValue === 'false'">
             <label>年份</label>
             <ul>
               <li
@@ -215,8 +283,50 @@
               </li>
             </ul>
           </div>
+          <div class="filt-item" v-else>
+            <label>期数</label>
+            <ul>
+              <li
+                :class="[
+                  itemy.value === huakanForm.period_count ? 'active' : '',
+                ]"
+                v-for="(itemy, indexy) in periodList"
+                :key="indexy"
+                @click="handleClick('huakanForm', 'period_count', itemy.value)"
+              >
+                <i
+                  v-if="itemy.value === huakanForm.period_count"
+                  class="el-icon-success"
+                ></i>
+                {{ itemy.label }}
+              </li>
+            </ul>
+          </div>
+          <div
+            class="filt-item"
+            style="margin-bottom: 24px"
+            v-if="huakanForm.orderValue === 'true'"
+          >
+            <label>时间</label>
+            <el-date-picker
+              v-model="huakanForm.begin_date"
+              type="month"
+              placeholder="请选择订阅起始月"
+              format="yyyy-MM"
+              value-format="yyyy-MM"
+            >
+            </el-date-picker>
+          </div>
         </template>
-        <div class="filt-item">
+        <div
+          class="filt-item"
+          v-if="
+            (itemType === 'baozhi' && baozhiForm.orderValue === 'false') ||
+            itemType === 'jingdu' ||
+            (itemType === 'huakan' && huakanForm.orderValue === 'false') ||
+            itemType === 'kecheng'
+          "
+        >
           <label>搜索</label>
           <el-input placeholder="搜索" v-model="searchValue" maxlength="20">
             <el-button
@@ -333,6 +443,38 @@ export default {
       loading: false,
       tableLoading: false,
       itemType: "baozhi",
+      orderList: [
+        {
+          label: "非订阅",
+          value: "false",
+        },
+        {
+          label: "订阅",
+          value: "true",
+        },
+      ],
+      periodList: [
+        {
+          label: "5 期",
+          value: 5,
+        },
+        {
+          label: "10 期",
+          value: 10,
+        },
+        {
+          label: "20 期",
+          value: 20,
+        },
+        {
+          label: "40 期",
+          value: 40,
+        },
+        {
+          label: "一年",
+          value: -1,
+        },
+      ],
       typeSelectList: [
         {
           label: "报纸",
@@ -441,6 +583,9 @@ export default {
           ? window.localStorage.getItem("baozhiFormstudyValue") * 1
           : 11,
         typeValue: 0,
+        orderValue: "false",
+        period_count: 5,
+        begin_date: "",
       },
       jingduForm: {
         studyValue: 11,
@@ -449,6 +594,9 @@ export default {
       huakanForm: {
         yearValue: null,
         key_word: "",
+        orderValue: "false",
+        period_count: 5,
+        begin_date: "",
       },
       searchValue: "",
       page_capacity: 18,
@@ -653,14 +801,22 @@ export default {
       this[form][file] = value;
       this.currentPage = 1;
       this.currentPages = 1;
+
+      if (
+        (form === "baozhiForm" || form === "huakanForm") &&
+        file === "orderValue" &&
+        value === "true"
+      ) {
+        this.tableData = [];
+        this.total_count = 0;
+        this.checkGoodsIdList = [];
+        this.checkGoodsList = [];
+        return;
+      }
       this.getList();
     },
     // 提交表单
     handleChooseGoods() {
-      if (this.checkGoodsList.length === 0) {
-        this.$message.warning("至少需要选择一个内容");
-        return;
-      }
       this.loading = true;
       let MethodName =
         "/ShopServer/Manager/DiscountCodeManager/AddGoodsToDiscountCode";
@@ -670,6 +826,52 @@ export default {
           : "",
         goods_list: this.checkGoodsList,
       };
+      if (this.itemType === "baozhi" && this.baozhiForm.orderValue === "true") {
+        if (this.baozhiForm.begin_date !== "") {
+          MethodName =
+            "/ShopServer/Manager/DiscountCodeManager/AddReservationToDiscountCode";
+          data = {
+            discount_code_id: window.localStorage.getItem("cdKeyId")
+              ? window.localStorage.getItem("cdKeyId")
+              : "",
+            goods_type: 2,
+            study_phase: this.baozhiForm.studyValue * 1,
+            begin_date: this.baozhiForm.begin_date + "-01",
+            period_count: this.baozhiForm.period_count * 1,
+          };
+        } else {
+          this.loading = false;
+          this.$message.warning("请选择订阅起始月");
+          return;
+        }
+      } else if (
+        this.itemType === "huakan" &&
+        this.huakanForm.orderValue === "true"
+      ) {
+        if (this.huakanForm.begin_date !== "") {
+          MethodName =
+            "/ShopServer/Manager/DiscountCodeManager/AddReservationToDiscountCode";
+          data = {
+            discount_code_id: window.localStorage.getItem("cdKeyId")
+              ? window.localStorage.getItem("cdKeyId")
+              : "",
+            goods_type: 2,
+            study_phase: 1,
+            begin_date: this.huakanForm.begin_date + "-01",
+            period_count: this.huakanForm.period_count * 1,
+          };
+        } else {
+          this.loading = false;
+          this.$message.warning("请选择订阅起始月");
+          return;
+        }
+      } else {
+        if (this.checkGoodsList.length === 0) {
+          this.$message.warning("至少需要选择一个内容");
+          return;
+        }
+      }
+
       getLogin(MethodName, data)
         .then((res) => {
           this.loading = false;