Parcourir la source

Merge branch '0709_OA' into 11/24SAAS

lex il y a 2 ans
Parent
commit
279a3f1a8a

+ 2 - 1
src/constant/index.js

@@ -419,7 +419,8 @@ export const chargingStatus = {
 
 export const coupontypeDetail = {
   FULLCOUPON: "全类券",
-  OTHER: "其他",
+  // OTHER: "其他",
+  MALLCOUPON: "商城",
   MUSICAL: "乐器",
   ACCESSORIES: "辅件",
   MAINTENANCE: "乐保服务",

+ 15 - 13
src/views/couponManager/couponGiveChiose.vue

@@ -22,7 +22,6 @@
           style="width: 180px !important"
           v-model.trim="searchForm.organId"
           clearable
-          multiple
           placeholder="请选择分部"
         >
           <el-option
@@ -33,11 +32,15 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item prop="ops">
-        <el-select v-model="searchForm.ops" placeholder="使用状态" clearable>
+      <el-form-item prop="usageStatus">
+        <el-select
+          v-model="searchForm.usageStatus"
+          placeholder="使用状态"
+          clearable
+        >
           <el-option label="未使用" :value="0"></el-option>
           <el-option label="已使用" :value="1"></el-option>
-          <el-option label="已撤销" :value="1"></el-option>
+          <el-option label="已过期" :value="2"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item>
@@ -89,7 +92,7 @@ import { getIssueRecordDetail } from "./api.js";
 import pagination from "@/components/Pagination/index";
 export default {
   components: {
-    pagination,
+    pagination
   },
   props: ["activeRow"],
   data() {
@@ -98,15 +101,15 @@ export default {
       searchForm: {
         search: null,
         organId: null,
-        usageStatus: null,
+        usageStatus: null
       },
       rules: {
         // 分页规则
         limit: 10, // 限制显示条数
         page: 1, // 当前页
         total: 0, // 总条数
-        page_size: [10, 20, 40, 50], // 选择限制显示条数
-      },
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
+      }
     };
   },
   async mounted() {
@@ -120,7 +123,7 @@ export default {
           page: this.rules.page,
           rows: this.rules.limit,
           ...this.searchForm,
-          issueId: this.activeRow.id,
+          issueId: this.activeRow.id
         });
         this.tableList = res.data.rows;
         this.rules.total = res.data.total;
@@ -133,9 +136,8 @@ export default {
     onReSet() {
       this.$refs.searchForm.resetFields();
       this.search();
-    },
-  },
+    }
+  }
 };
 </script>
-<style lang="less" scoped>
-</style>
+<style lang="less" scoped></style>

+ 105 - 49
src/views/couponManager/couponUpdate.vue

@@ -8,7 +8,27 @@
     <div class="m-core">
       <el-form :model="form" ref="form" class="form">
         <el-row>
-          <el-col style="width: 500px">
+          <el-col style="width: 395px">
+            <el-form-item
+              label="系统类型"
+              prop="useSystem"
+              :rules="[{ required: true, message: '系统类型' }]"
+            >
+              <el-select
+                :disabled="isDisabled"
+                placeholder="系统类型"
+                v-model.trim="form.useSystem"
+                filterable
+                clearable
+                style="width: 375px !important"
+                @change="onUseSystemChange"
+              >
+                <el-option value="MALL" label="商城"></el-option>
+                <el-option value="MEC" label="管乐迷"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col style="width: 395px">
             <el-form-item
               label="优惠券名称"
               prop="name"
@@ -23,32 +43,21 @@
           </el-col>
         </el-row>
         <el-row>
-          <el-col style="width: 500px">
-            <!-- <el-form-item
-              label="预警值"
-              prop="warningStockNum"
-              :rules="[{ required: true, message: '请输入预警值' }]"
-            >
-              <el-input :disabled='form.warningStockNum ==-1' v-model="form.warningStockNum" placeholder="请输入预警值">
-                <template slot="append">张</template>
-              </el-input>
-              <el-checkbox   v-model="form.warningStockNum" :true-label='-1' false-label=''	 @change="(val)=>{checkNo(val,'warningStockNum')}" >不限制</el-checkbox>
-            </el-form-item> -->
+          <el-col style="width: 395px">
             <el-form-item
               label="可用分部"
               prop="organId"
               :rules="[{ required: true, message: '请选择可用分部' }]"
             >
-            <br/>
+              <br />
               <select-all
-                style="width: 100% !important"
+                style="width: 375px !important"
                 class="multiple"
                 v-model.trim="form.organId"
                 filterable
                 multiple
                 clearable
                 placeholder="请选择分部"
-
               >
                 <el-option
                   v-for="(item, index) in selects.branchs"
@@ -59,9 +68,7 @@
               </select-all>
             </el-form-item>
           </el-col>
-        </el-row>
-        <el-row>
-          <el-col style="width: 500px">
+          <el-col style="width: 395px">
             <el-form-item
               label="描述"
               prop="description"
@@ -92,7 +99,7 @@
                 v-model.trim="form.issuanceType"
                 filterable
                 clearable
-                style="width: 355px !important"
+                style="width: 375px !important"
               >
                 <el-option :value="0" label="学员主动领取"></el-option>
                 <el-option :value="1" label="后台手动发放"></el-option>
@@ -111,13 +118,14 @@
                 v-model.trim="form.typeDetail"
                 filterable
                 clearable
-                style="width: 355px !important"
+                style="width: 375px !important"
               >
                 <el-option
                   v-for="item in coupontypeDetail"
                   :key="item.value"
                   :value="item.value"
                   :label="item.label"
+                  :disabled="item.disabled"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -137,7 +145,7 @@
                 filterable
                 clearable
                 @change="changeType"
-                style="width: 355px !important"
+                style="width: 375px !important"
               >
                 <el-option
                   v-for="item in couponTypeList"
@@ -159,7 +167,9 @@
                 placeholder="请输入满减金额"
                 :disabled="isDisabled"
               >
-                <template slot="append">元</template>
+                <template slot="append"
+                  >元</template
+                >
               </el-input>
             </el-form-item>
           </el-col>
@@ -174,7 +184,9 @@
                 placeholder="请输入面值"
                 :disabled="isDisabled"
               >
-                <template slot="append">元</template>
+                <template slot="append"
+                  >元</template
+                >
               </el-input>
             </el-form-item>
           </el-col>
@@ -190,7 +202,9 @@
                 placeholder="请输入折扣"
                 :disabled="isDisabled"
               >
-                <template slot="append">%</template>
+                <template slot="append"
+                  >%</template
+                >
               </el-input>
             </el-form-item>
           </el-col>
@@ -204,7 +218,7 @@
               :rules="[{ required: true, message: '请选择有效期类型' }]"
             >
               <el-select
-                style="width: 355px !important"
+                style="width: 375px !important"
                 placeholder="优惠券类型"
                 v-model.trim="form.effectiveType"
                 filterable
@@ -236,7 +250,9 @@
                 placeholder="请输入有效期天数"
                 :disabled="isDisabled"
               >
-                <template slot="append">天</template>
+                <template slot="append"
+                  >天</template
+                >
               </el-input>
             </el-form-item>
           </el-col>
@@ -284,14 +300,16 @@
                 v-model="form.stockCount"
                 placeholder="请输入库存总量"
               >
-                <template slot="append">张</template>
+                <template slot="append"
+                  >张</template
+                >
               </el-input>
               <el-checkbox
                 v-model="form.stockCount"
                 :true-label="-1"
                 false-label=""
                 @change="
-                  (val) => {
+                  val => {
                     checkNo(val, 'stockCount');
                   }
                 "
@@ -308,8 +326,8 @@
                 {
                   pattern: /^[1-9][0-9]?$/,
                   message: '请输入1-99的正整数',
-                  trigger: 'blur',
-                },
+                  trigger: 'blur'
+                }
               ]"
             >
               <span style="color: #606266">
@@ -326,7 +344,9 @@
                 v-model="form.limitExchangeNum"
                 placeholder="请输入领取上限"
               >
-                <template slot="append">张</template>
+                <template slot="append"
+                  >张</template
+                >
               </el-input>
             </el-form-item>
           </el-col>
@@ -367,12 +387,20 @@
 import { addSysCoupon, resetSysCoupon } from "./api.js";
 import { couponTypeList, coupontypeDetailList } from "@/utils/searchArray";
 import { getTimes } from "@/utils";
+const mallTypeList = [
+  {
+    value: "MALLCOUPON",
+    label: "商城"
+  }
+];
 export default {
   data() {
     return {
       couponTypeList,
       coupontypeDetail: coupontypeDetailList,
       form: {
+        useSystem: "",
+        typeDetail: null,
         name: "",
         description: "",
         type: "FULL_REDUCTION",
@@ -384,27 +412,31 @@ export default {
         warningStockNum: "",
         limitExchangeNum: "",
         getTime: [],
-        organId: [],
+        organId: []
       },
       activeRow: null,
       isDisabled: false,
       title: "新增优惠券",
-      warningStockNum: "",
+      warningStockNum: ""
     };
   },
   mounted() {
     this.$store.dispatch("setBranchs");
     if (this.$route.query.row) {
       this.activeRow = JSON.parse(this.$route.query.row);
-       let organIdStr =''
-      if( this.activeRow.useCondition&&JSON.parse(this.activeRow.useCondition)&&JSON.parse(this.activeRow.useCondition).organId){
-          organIdStr = JSON.parse(this.activeRow.useCondition).organId;
+      let organIdStr = "";
+      if (
+        this.activeRow.useCondition &&
+        JSON.parse(this.activeRow.useCondition) &&
+        JSON.parse(this.activeRow.useCondition).organId
+      ) {
+        organIdStr = JSON.parse(this.activeRow.useCondition).organId;
       }
 
       let organId = [];
       if (organIdStr) {
         organId =
-          organIdStr.split(",").map((item) => {
+          organIdStr.split(",").map(item => {
             return Number(item);
           }) || [];
       }
@@ -419,7 +451,7 @@ export default {
       let endDate = this.activeRow.endDate;
       this.$set(this.form, "effectiveTime", [
         effectiveStartTime,
-        effectiveExpireTime,
+        effectiveExpireTime
       ]);
       this.$set(this.form, "getTime", [startDate, endDate]);
       this.title = this.activeRow.name;
@@ -429,6 +461,30 @@ export default {
     }
   },
   methods: {
+    onUseSystemChange(val) {
+      if (val === "MALL") {
+        this.coupontypeDetail.forEach(item => {
+          if (item.value === "MALLCOUPON") {
+            item.disabled = false;
+          } else {
+            item.disabled = true;
+          }
+        });
+      } else if (val === "MEC") {
+        this.coupontypeDetail.forEach(item => {
+          if (item.value === "MALLCOUPON") {
+            item.disabled = true;
+          } else {
+            item.disabled = false;
+          }
+        });
+      }
+      this.form.typeDetail = null;
+      // 处理显示问题
+      setTimeout(() => {
+        this.$refs.form.clearValidate("typeDetail");
+      }, 0);
+    },
     changeType(val) {
       this.form.faceValue = "";
       this.form.fullAmount = "";
@@ -458,24 +514,24 @@ export default {
         let endDate = this.activeRow.endDate;
         this.$set(this.form, "effectiveTime", [
           effectiveStartTime,
-          effectiveExpireTime,
+          effectiveExpireTime
         ]);
         this.$set(this.form, "getTime", [startDate, endDate]);
       }
     },
     async addCoupon() {
-      this.$refs.form.validate(async (some) => {
+      this.$refs.form.validate(async some => {
         if (some) {
           this.$confirm("您确定新增优惠券?", "提示", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
-            type: "warning",
+            type: "warning"
           })
             .then(async () => {
               try {
                 let { effectiveTime, getTime, ...rest } = this.form;
                 let str = JSON.stringify({
-                  organId: this.form.organId.join(","),
+                  organId: this.form.organId.join(",")
                 });
                 let params = {
                   ...rest,
@@ -489,7 +545,7 @@ export default {
                     ["startDate", "endDate"],
                     "YYYY-MM-DD HH:mm:ss"
                   ),
-                  useCondition:str,
+                  useCondition: str
                 };
                 const res = await addSysCoupon(params);
                 this.$message.success("新增成功");
@@ -503,18 +559,18 @@ export default {
       });
     },
     resetCoupon() {
-      this.$refs.form.validate(async (some) => {
+      this.$refs.form.validate(async some => {
         if (some) {
           this.$confirm("您确定修改优惠券?", "提示", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
-            type: "warning",
+            type: "warning"
           })
             .then(async () => {
               try {
                 let { effectiveTime, getTime, ...rest } = this.form;
                 let str = JSON.stringify({
-                  organId: this.form.organId.join(","),
+                  organId: this.form.organId.join(",")
                 });
 
                 let params = {
@@ -529,7 +585,7 @@ export default {
                     ["startDate", "endDate"],
                     "YYYY-MM-DD HH:mm:ss"
                   ),
-                  useCondition: str,
+                  useCondition: str
                 };
                 const res = await resetSysCoupon(params);
                 this.$message.success("修改成功");
@@ -548,8 +604,8 @@ export default {
       } else {
         this.form[type] = null;
       }
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 61 - 31
src/views/couponManager/index.vue

@@ -17,8 +17,8 @@
           <el-input
             v-model.trim="searchForm.search"
             clearable
-                    @keyup.enter.native="
-              (e) => {
+            @keyup.enter.native="
+              e => {
                 e.target.blur();
                 $refs.searchForm.save();
                 search();
@@ -57,9 +57,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item
-          prop="issuanceType"
-        >
+        <el-form-item prop="issuanceType">
           <el-select
             placeholder="领券方式"
             v-model.trim="searchForm.issuanceType"
@@ -137,7 +135,7 @@
           <el-table-column
             align="center"
             prop="cloudStudyUseStudentDuty"
-            width="140px"
+            width="100px"
           >
             <template slot="header" slot-scope="slot">
               <div class="titleCell">
@@ -168,7 +166,7 @@
           <el-table-column
             align="center"
             prop="cloudStudyUseStudentDuty"
-            width="140px"
+            width="100px"
           >
             <template slot="header" slot-scope="slot">
               <div class="titleCell">
@@ -191,7 +189,11 @@
               <div>{{ scope.row.fullAmount | hasMoneyFormat }}</div>
             </template>
           </el-table-column>
-          <el-table-column align="center" prop="cloudStudyUseStudentDuty" width="100">
+          <el-table-column
+            align="center"
+            prop="cloudStudyUseStudentDuty"
+            width="100"
+          >
             <template slot="header" slot-scope="slot">
               <div class="titleCell">
                 <span>领取上限</span>
@@ -213,7 +215,11 @@
               <div>{{ scope.row.limitExchangeNum }}</div>
             </template>
           </el-table-column>
-          <el-table-column align="center" prop="cloudStudyUseStudentDuty" width="120">
+          <el-table-column
+            align="center"
+            prop="cloudStudyUseStudentDuty"
+            width="120"
+          >
             <template slot="header" slot-scope="slot">
               <div class="titleCell">
                 <span>有效期天数</span>
@@ -268,7 +274,7 @@
           <el-table-column
             align="center"
             prop="cloudStudyUseStudentDuty"
-            width="160px"
+            width="165px"
           >
             <template slot="header" slot-scope="slot">
               <div class="titleCell">
@@ -314,6 +320,16 @@
               </div>
             </template>
           </el-table-column>
+          <el-table-column align="center" prop="useSystem" label="系统类型">
+            <template slot-scope="scope">
+              <div v-if="scope.row.useSystem == 'MALL'">
+                商城
+              </div>
+              <div v-if="scope.row.useSystem == 'MEC'">
+                管乐迷
+              </div>
+            </template>
+          </el-table-column>
           <!-- <el-table-column
             align="center"
             prop="warningStockNum"
@@ -371,12 +387,18 @@
                     >删除</el-button
                   >
                 </auth>
-                <auth auths="sysCoupon/delete" v-if="scope.row.issuanceType&&scope.row.status">
+                <auth
+                  auths="sysCoupon/delete"
+                  v-if="scope.row.issuanceType && scope.row.status"
+                >
                   <el-button type="text" @click="getCoupon(scope.row)"
                     >手动发放</el-button
                   >
                 </auth>
-                <auth auths="sysCoupon/delete" v-if="scope.row.issuanceType&&scope.row.status">
+                <auth
+                  auths="sysCoupon/delete"
+                  v-if="scope.row.issuanceType && scope.row.status"
+                >
                   <el-button type="text" @click="getCouponRecord(scope.row)"
                     >发放记录</el-button
                   >
@@ -395,13 +417,21 @@
         />
       </div>
     </div>
-    <el-dialog :title="title" :visible.sync="addCouponVisible" width="1200px" v-if="addCouponVisible">
-      <couponGrant :activeRow="activeRow" ref='couponGrant' @getList='getList' @close='addCouponVisible = false'/>
+    <el-dialog
+      :title="title"
+      :visible.sync="addCouponVisible"
+      width="1200px"
+      v-if="addCouponVisible"
+    >
+      <couponGrant
+        :activeRow="activeRow"
+        ref="couponGrant"
+        @getList="getList"
+        @close="addCouponVisible = false"
+      />
       <span slot="footer" class="dialog-footer">
         <el-button @click="addCouponVisible = false">取 消</el-button>
-        <el-button @click="addCouponSubmit" type="primary"
-          >确 定</el-button
-        >
+        <el-button @click="addCouponSubmit" type="primary">确 定</el-button>
       </span>
     </el-dialog>
     <el-dialog
@@ -442,7 +472,7 @@ export default {
         type: null,
         status: null,
         typeDetail: null,
-        issuanceType:null
+        issuanceType: null
       },
       activeRow: null,
       tableList: [],
@@ -452,11 +482,11 @@ export default {
         limit: 10, // 限制显示条数
         page: 1, // 当前页
         total: 0, // 总条数
-        page_size: [10, 20, 40, 50], // 选择限制显示条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
       },
       addCouponVisible: false,
       giveCouponVisible: false,
-      title: "",
+      title: ""
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -476,7 +506,7 @@ export default {
         const res = await getSysCoupon({
           ...this.searchForm,
           page: this.rules.page,
-          rows: this.rules.limit,
+          rows: this.rules.limit
         });
         this.tableList = res.data.rows;
         this.rules.total = res.data.total;
@@ -496,7 +526,7 @@ export default {
       if (row) {
         this.$router.push({
           path: "/operateManager/couponUpdate",
-          query: { row: JSON.stringify(row) },
+          query: { row: JSON.stringify(row) }
         });
       } else {
         this.$router.push("/operateManager/couponUpdate");
@@ -506,12 +536,12 @@ export default {
       this.$confirm("您确定停用优惠券?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           try {
             let params = {
-              ...row,
+              ...row
             };
             params.status = 0;
             const res = await resetSysCoupon(params);
@@ -527,12 +557,12 @@ export default {
       this.$confirm("您确定启用优惠券?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           try {
             let params = {
-              ...row,
+              ...row
             };
             params.status = 1;
             const res = await resetSysCoupon(params);
@@ -548,7 +578,7 @@ export default {
       this.$confirm("您确定删除优惠券?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           try {
@@ -574,13 +604,13 @@ export default {
       this.activeRow = row;
       this.giveCouponVisible = true;
     },
-    addCouponSubmit(){
-      this.$refs.couponGrant.submit()
+    addCouponSubmit() {
+      this.$refs.couponGrant.submit();
     }
-  },
+  }
 };
 </script>
-<style lang='scss' scoped>
+<style lang="scss" scoped>
 .titleCell {
   display: inline-block;
 }