Browse Source

修改分页

YY 2 years ago
parent
commit
84a6bad513

+ 14 - 3
src/components/orderParts/card-1.vue

@@ -4,9 +4,10 @@
       <!-- 平台订单待付款列表 -->
       <el-col :span="24" class="main">
         <el-col :span="24" class="one">
-          <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
+          <search-1 :form="searchForm" @onSubmit="toSearch" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
         </el-col>
-        <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales"> </data-table>
+        <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales">
+        </data-table>
       </el-col>
     </el-row>
   </div>
@@ -40,6 +41,8 @@ export default {
         { label: '商品数量', model: 'buy_num_total' },
       ],
       shopList: [],
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -48,6 +51,11 @@ export default {
   methods: {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
@@ -57,10 +65,13 @@ export default {
         delete condition.buy_time;
       }
       info.status = '0';
-      let res = await this.query({ skip, limit, ...condition, ...info });
+      let query = { skip, limit, ...info };
+      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);
       }
     },
     getAddress(i) {

+ 14 - 3
src/components/orderParts/card-2.vue

@@ -4,9 +4,10 @@
       <!-- 自营订单待付款列表 -->
       <el-col :span="24" class="main" v-loading="loadings" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
         <el-col :span="24" class="one">
-          <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
+          <search-1 :form="searchForm" @onSubmit="toSearch" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
         </el-col>
-        <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales"> </data-table>
+        <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales">
+        </data-table>
       </el-col>
     </el-row>
   </div>
@@ -42,6 +43,8 @@ export default {
       shopList: [],
       skip: 0,
       loadings: true,
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -50,6 +53,11 @@ export default {
   methods: {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
@@ -60,10 +68,13 @@ export default {
       }
       info.status = '0';
       info.shop = this.user.shop.id;
-      let res = await this.query({ skip, limit, ...condition, ...info });
+      let query = { skip, limit, ...info };
+      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;
     },

+ 14 - 2
src/components/orderParts/parts/detail-1.vue

@@ -5,13 +5,14 @@
       <el-col :span="24" class="main" v-loading="loadings" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
         <el-col :span="24" v-if="num == '1'">
           <el-col :span="24" class="one">
-            <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
+            <search-1 :form="searchForm" @onSubmit="toSearch" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
           </el-col>
           <el-col :span="24" class="one">
             <el-button type="primary" size="mini" @click="toDeliver()">生成发货清单</el-button>
             <p>(发货清单里不显示售后的订单)</p>
           </el-col>
           <data-table
+            ref="dataTable"
             :select="true"
             :selected="selected"
             @handleSelect="handleSelect"
@@ -70,6 +71,8 @@ export default {
       // 发货清单
       deliverList: [],
       deliver: '0',
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -78,6 +81,11 @@ export default {
   methods: {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
@@ -87,10 +95,14 @@ export default {
         delete condition.buy_time;
       }
       info.status = '1';
-      let res = await this.query({ skip, limit, ...condition, ...info, shop: this.user.shop.id });
+      info.shop = this.user.shop.id;
+      let query = { skip, limit, ...info };
+      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;
     },

+ 13 - 2
src/views/platActivi/act/index.vue

@@ -17,7 +17,17 @@
             <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
           </el-col>
           <el-col :span="24" class="four">
-            <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @edit="toEdit" @del="toDel" @manage="toManage">
+            <data-table
+              ref="dataTable"
+              :fields="fields"
+              :opera="opera"
+              @query="search"
+              :data="list"
+              :total="total"
+              @edit="toEdit"
+              @del="toDel"
+              @manage="toManage"
+            >
             </data-table>
           </el-col>
         </span>
@@ -103,7 +113,8 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     toSearch() {
-      const res = this.$refs.dataTable.getPageConfig();
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
       this.search(res);
     },
     // 查询

+ 7 - 2
src/views/platActivi/actTags/index.vue

@@ -11,13 +11,13 @@
         <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" :statusList="statusList"></search-1>
           </el-col>
           <el-col :span="24" class="thr">
             <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
           </el-col>
           <el-col :span="24" class="four">
-            <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @edit="toEdit" @del="toDel"> </data-table>
+            <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @edit="toEdit" @del="toDel"> </data-table>
           </el-col>
         </span>
         <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
@@ -99,6 +99,11 @@ export default {
   methods: {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       const condition = _.cloneDeep(this.searchForm);

+ 7 - 5
src/views/platActivi/actTags/parts/search-1.vue

@@ -4,13 +4,15 @@
       <el-col :span="24" class="main">
         <el-form :model="form" ref="form" label-width="130px">
           <el-col :span="6">
-            <el-form-item label="活动标签" prop="label">
-              <el-input v-model="form.label" placeholder="请输入活动标签" size="small"></el-input>
+            <el-form-item label="编码" prop="value">
+              <el-input v-model="form.value" placeholder="请输入编码" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
-            <el-form-item label="编码" prop="value">
-              <el-input v-model="form.value" placeholder="请输入编码" size="small"></el-input>
+            <el-form-item label="是否使用" prop="status">
+              <el-select v-model="form.status" clearable filterable placeholder="请选择" style="width: 100%" size="small">
+                <el-option v-for="i in statusList" :key="i.label" :label="i.label" :value="i.value"></el-option>
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="24" class="btn">
@@ -27,7 +29,7 @@
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'search-1',
-  props: { form: { type: Object } },
+  props: { form: { type: Object }, statusList: { type: Array } },
   components: {},
   data: function () {
     return {};

+ 3 - 2
src/views/platActivi/coupon/index.vue

@@ -26,6 +26,7 @@
           </el-col>
           <el-col :span="24" class="four">
             <data-table
+              ref="dataTable"
               :select="true"
               :selected="selected"
               @handleSelect="handleSelect"
@@ -132,8 +133,8 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     toSearch() {
-      // this.$refs.dataTable.resetPage();
-      const res = this.$refs.dataTable.getPageConfig();
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
       this.search(res);
     },
     // 查询

+ 2 - 2
src/views/platmanag/goods/index.vue

@@ -201,8 +201,8 @@ export default {
     ...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
     toSearch() {
-      // this.$refs.dataTable.resetPage();
-      const res = this.$refs.dataTable.getPageConfig();
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
       this.search(res);
     },
     // 查询

+ 14 - 3
src/views/platmanag/order/index.vue

@@ -27,9 +27,9 @@
               </el-col>
               <el-col :span="24" v-else-if="activeName != '1'">
                 <el-col :span="24" class="one">
-                  <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
+                  <search-1 :form="searchForm" @onSubmit="toSearch" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
                 </el-col>
-                <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetails" @sales="toSaless">
+                <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetails" @sales="toSaless">
                   <template #is_afterSale="{ row }">
                     <span :style="{ color: row.is_afterSale === true ? 'red' : '' }">
                       {{ row.is_afterSale === true ? '该订单有商品申请售后' : '未申请售后' }}
@@ -96,6 +96,8 @@ export default {
         { label: '商品数量', model: 'buy_num_total' },
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后'), custom: true },
       ],
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -106,6 +108,11 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    toSearch() {
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
@@ -122,10 +129,13 @@ export default {
       else if (this.activeName == '7') info.status = '-2';
       else if (this.activeName == '8') info.status = '-3';
       else if (this.activeName == '9') info.status = '-4';
-      let res = await this.query({ skip, limit, ...condition, ...info });
+      let query = { skip, limit, ...info };
+      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;
     },
@@ -154,6 +164,7 @@ export default {
     },
     toBack() {
       this.view = 'list';
+      this.search(this.searchQuery);
     },
     getAddress(i) {
       let name = i.name + ',' + i.phone;

+ 2 - 3
src/views/selfShop/goods/index.vue

@@ -194,10 +194,9 @@ export default {
     ...goodsTags(['tree']),
     ...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
-
     toSearch() {
-      // this.$refs.dataTable.resetPage();
-      const res = this.$refs.dataTable.getPageConfig();
+      this.$refs.dataTable.resetPage();
+      let res = this.$refs.dataTable.getPageConfig();
       this.search(res);
     },
     // 查询