YY 2 jaren geleden
bovenliggende
commit
b119fdac1d

+ 17 - 7
src/views/platActivi/act/index.vue

@@ -11,7 +11,7 @@
         <span v-show="view === 'list'">
           <el-col :span="24" class="one"> <span>活动标题</span> </el-col>
           <el-col :span="24" class="two">
-            <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+            <search-1 :form="searchForm" @onSubmit="toSearch" @toReset="toClose"></search-1>
           </el-col>
           <el-col :span="24" class="thr">
             <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
@@ -91,22 +91,31 @@ export default {
       id: '',
       // type: '',
       act_typeList: [],
+      // 查询条件
+      searchQuery: {},
     };
   },
-  async created() {
-    await this.searchOther();
-    await this.search();
+  created() {
+    this.searchOther();
+    this.search();
   },
   methods: {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      const res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
-    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       const condition = _.cloneDeep(this.searchForm);
-      let res = await this.query({ skip, limit, ...condition, ...info });
+      let query = { skip, limit, ...others };
+      if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
+        this.$set(this, `searchQuery`, query);
       }
       this.loadings = false;
     },
@@ -123,6 +132,7 @@ export default {
     },
     toBack() {
       this.view = 'list';
+      this.search(this.searchQuery);
     },
     // 商品管理
     async toManage({ data }) {
@@ -133,7 +143,7 @@ export default {
       let res = await this.delete(data._id);
       if (this.$checkRes(res)) {
         this.$message({ type: `success`, message: `刪除信息成功` });
-        this.search();
+        this.search(this.searchQuery);
       }
     },
     // 重置

+ 9 - 3
src/views/platActivi/actTags/index.vue

@@ -88,6 +88,8 @@ export default {
       // 是否使用
       statusList: [],
       id: '',
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -98,12 +100,15 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       const condition = _.cloneDeep(this.searchForm);
-      let res = await this.query({ skip, limit, ...condition, ...info });
+      let query = { skip, limit, ...others };
+      if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
+        this.$set(this, `searchQuery`, query);
       }
       this.loadings = false;
     },
@@ -120,13 +125,14 @@ export default {
     },
     toBack() {
       this.view = 'list';
+      this.search(this.searchQuery);
     },
     // 删除
     async toDel({ data }) {
       let res = await this.delete(data._id);
       if (this.$checkRes(res)) {
         this.$message({ type: `success`, message: `刪除信息成功` });
-        this.search();
+        this.search(this.searchQuery);
       }
     },
     // 重置

+ 10 - 10
src/views/platActivi/coupon/detail.vue

@@ -20,7 +20,7 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="24">
+            <!-- <el-col :span="24">
               <el-form-item label="店铺" prop="shop" style="display: none">
                 <el-select
                   v-model="form.shop"
@@ -35,7 +35,7 @@
                   <el-option v-for="item in shopList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
                 </el-select>
               </el-form-item>
-            </el-col>
+            </el-col> -->
             <el-col :span="24">
               <el-form-item label="优惠券名称" prop="name">
                 <el-input v-model="form.name" placeholder="请输入优惠券名称" size="small"></el-input>
@@ -220,14 +220,14 @@ export default {
           data.tags = _.get(data, 'use_limit_config.tags');
           data.time = _.get(data, 'expire_config.fixed');
           data.days = _.get(data, 'expire_config.days');
-          if (data.shop) {
-            let list = [];
-            let res = await this.shopFetch(data.shop);
-            if (this.$checkRes(res)) {
-              list.push(res.data);
-              this.$set(this, 'shopList', list);
-            }
-          }
+          // if (data.shop) {
+          //   let list = [];
+          //   let res = await this.shopFetch(data.shop);
+          //   if (this.$checkRes(res)) {
+          //     list.push(res.data);
+          //     this.$set(this, 'shopList', list);
+          //   }
+          // }
           this.$set(this, `form`, data);
         }
       } else this.$set(this, `form`, { status: '0' });

+ 16 - 5
src/views/platActivi/coupon/index.vue

@@ -14,7 +14,7 @@
             <search-1
               :form="searchForm"
               :statusList="statusList"
-              @onSubmit="search"
+              @onSubmit="toSearch"
               @toReset="toClose"
               @querySearch="querySearch"
               :shopList="shopList"
@@ -119,6 +119,8 @@ export default {
       // 减免方式
       discount_typeList: [],
       id: '',
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -129,13 +131,21 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      // this.$refs.dataTable.resetPage();
+      const res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
-    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
-      let condition = _.cloneDeep(this.searchForm);
-      let res = await this.query({ skip, limit, ...condition, ...info });
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      let query = { skip, limit, ...others };
+      if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
+        this.$set(this, `searchQuery`, query);
       }
       this.loadings = false;
     },
@@ -147,6 +157,7 @@ export default {
     },
     toBack() {
       this.view = 'list';
+      this.search(this.searchQuery);
     },
     toGrant({ data }) {
       this.$set(this, `id`, data.id);
@@ -162,7 +173,7 @@ export default {
       let res = await this.delete(data._id);
       if (this.$checkRes(res)) {
         this.$message({ type: `success`, message: `刪除信息成功` });
-        this.search();
+        this.search(this.searchQuery);
       }
     },
     toClose() {

+ 2 - 3
src/views/platActivi/coupon/parts/search-1.vue

@@ -3,7 +3,7 @@
     <el-row>
       <el-col :span="24" class="main">
         <el-form :model="form" ref="form" label-width="130px">
-          <el-col :span="6">
+          <!-- <el-col :span="6">
             <el-form-item label="店铺名称" prop="type">
               <el-select
                 v-model="form.shop"
@@ -18,7 +18,7 @@
                 <el-option v-for="item in shopList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
               </el-select>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="6">
             <el-form-item label="优惠券名称" prop="name">
               <el-input v-model="form.name" placeholder="请输入优惠券名称" size="small"></el-input>
@@ -31,7 +31,6 @@
               </el-select>
             </el-form-item>
           </el-col>
-
           <el-col :span="6">
             <el-form-item label="是否使用" prop="status">
               <el-select v-model="form.status" clearable filterable placeholder="请选择" style="width: 100%" size="small">