YY 2 anni fa
parent
commit
31c34d7cb4

+ 13 - 2
src/components/orderParts/parts/detail-3.vue

@@ -9,7 +9,7 @@
               :form="searchForm"
               :shopList="shopList"
               :goodsList="goodsList"
-              @onSubmit="search"
+              @onSubmit="toSearch"
               @querySearch="querySearch"
               @toReset="toClose"
               @goodsSearch="goodsSearch"
@@ -21,6 +21,7 @@
             <p>(发货清单里不显示售后的订单)</p>
           </el-col>
           <data-table
+            ref="dataTable"
             :select="true"
             :selected="selected"
             @handleSelect="handleSelect"
@@ -84,6 +85,8 @@ export default {
       // 发货清单
       deliverList: [],
       deliver: '0',
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -93,6 +96,11 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...goods({ goodsQuery: '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);
@@ -102,10 +110,13 @@ export default {
         delete condition.buy_time;
       }
       info.status = '1';
-      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;
     },

+ 13 - 3
src/views/platGroup/order/index.vue

@@ -27,14 +27,14 @@
                     :form="searchForm"
                     :shopList="shopList"
                     :goodsList="goodsList"
-                    @onSubmit="search"
+                    @onSubmit="toSearch"
                     @querySearch="querySearch"
                     @toReset="toClose"
                     @goodsSearch="goodsSearch"
                   >
                   </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 ? '该订单有商品申请售后' : '未申请售后' }}
@@ -102,6 +102,8 @@ export default {
         { label: '购买数量', model: 'num' },
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后'), custom: true },
       ],
+      // 查询条件
+      searchQuery: {},
     };
   },
   async created() {
@@ -113,6 +115,11 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...goods({ goodsQuery: '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);
@@ -126,10 +133,13 @@ export default {
       else if (this.activeName == '3') info.status = '2';
       else if (this.activeName == '4') info.status = '3';
       else if (this.activeName == '5') info.status = '-1';
-      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;
     },