Bläddra i källkod

修改查询,添加待收货确认收货按钮

YY 2 år sedan
förälder
incheckning
25dd76e4bd

+ 3 - 5
src/views/platmanag/goods/index.vue

@@ -177,7 +177,6 @@ export default {
       statusList: [],
       // 返现金额类型
       typeList: [{ label: '固定金额' }, { label: '百分比' }],
-      skip: 0,
     };
   },
   created() {
@@ -192,12 +191,11 @@ export default {
     ...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...others } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       let query = { skip, limit, ...others };
       if (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
       const res = await this.query(query);
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
       }
@@ -331,12 +329,12 @@ export default {
         let form = this.form;
         form.cb_config = this.cb_config;
         form.cb_config.money = Number(form.cb_config.money);
-        if (form.id) res = await this.update(form);
+        if (form._id) res = await this.update(form);
         else res = await this.create(form);
       } else {
         data.cb_config = this.cb_config;
         data.cb_config.money = Number(data.cb_config.money);
-        if (data.id) res = await this.update(data);
+        if (data._id) res = await this.update(data);
         else res = await this.create(data);
       }
       if (this.$checkRes(res)) {

+ 1 - 3
src/views/platmanag/order/parts/card-1.vue

@@ -40,7 +40,6 @@ export default {
         { label: '商品数量', model: 'buy_num_total' },
       ],
       shopList: [],
-      skip: 0,
     };
   },
   async created() {
@@ -50,7 +49,7 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);
@@ -60,7 +59,6 @@ export default {
       info.status = '0';
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }

+ 1 - 3
src/views/platmanag/order/parts/card-2.vue

@@ -40,7 +40,6 @@ export default {
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
       ],
       shopList: [],
-      skip: 0,
     };
   },
   async created() {
@@ -50,7 +49,7 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);
@@ -60,7 +59,6 @@ export default {
       info.status = '1';
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }

+ 22 - 5
src/views/platmanag/order/parts/card-3.vue

@@ -1,11 +1,12 @@
 <template>
   <div id="card-1">
     <el-row>
-      <el-col :span="24" class="main">
+      <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>
         </el-col>
-        <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales"> </data-table>
+        <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales" @confirm="toConfirm">
+        </data-table>
       </el-col>
     </el-row>
   </div>
@@ -23,12 +24,14 @@ export default {
   components: { search1: () => import('./search-1.vue') },
   data: function () {
     return {
+      loadings: true,
       searchForm: {},
       list: [],
       total: 0,
       opera: [
         { label: '详情', method: 'detail' },
         { label: '售后', method: 'sales', type: 'danger' },
+        { label: '确认收货', method: 'confirm', type: 'warning' },
       ],
       fields: [
         { label: '订单号', model: 'no', showTip: false },
@@ -40,7 +43,6 @@ export default {
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
       ],
       shopList: [],
-      skip: 0,
     };
   },
   async created() {
@@ -50,7 +52,7 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);
@@ -60,10 +62,10 @@ export default {
       info.status = '2';
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }
+      this.loadings = false;
     },
     getAddress(i) {
       let name = i.name + ',' + i.phone;
@@ -72,6 +74,21 @@ export default {
     toDetail({ data }) {
       this.$emit('toDetails', data._id);
     },
+    toConfirm({ data }) {
+      this.$confirm('是否确认收货', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let res;
+        data.status = '3';
+        if (data._id) res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `确认收货成功` });
+          this.search();
+        }
+      });
+    },
     toSales({ data }) {
       this.$emit('toSaless', { id: data._id, status: '2' });
     },

+ 3 - 4
src/views/platmanag/order/parts/card-4.vue

@@ -28,7 +28,7 @@ export default {
       total: 0,
       opera: [
         { label: '详情', method: 'detail' },
-        { label: '售后', method: 'sales', type: 'danger' },
+        { label: '售后', method: 'confirm', type: 'danger' },
       ],
       fields: [
         { label: '订单号', model: 'no', showTip: false },
@@ -40,7 +40,6 @@ export default {
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
       ],
       shopList: [],
-      skip: 0,
     };
   },
   async created() {
@@ -50,7 +49,7 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);
@@ -60,7 +59,6 @@ export default {
       info.status = '3';
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }
@@ -75,6 +73,7 @@ export default {
     toSales({ data }) {
       this.$emit('toSaless', { id: data._id, status: '3' });
     },
+
     toClose() {
       this.searchForm = {};
       this.search();

+ 1 - 3
src/views/platmanag/order/parts/card-5.vue

@@ -38,7 +38,6 @@ export default {
         { label: '商品数量', model: 'buy_num_total' },
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
       ],
-      skip: 0,
     };
   },
   async created() {
@@ -47,7 +46,7 @@ export default {
   methods: {
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);
@@ -57,7 +56,6 @@ export default {
       info.status = '2-';
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }

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

@@ -166,7 +166,6 @@ export default {
       statusList: [],
       // 返现金额类型
       typeList: [{ label: '固定金额' }, { label: '百分比' }],
-      skip: 0,
     };
   },
   created() {
@@ -180,12 +179,11 @@ export default {
     ...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...others } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       let query = { skip, limit, ...others, shop: this.user.shop.id };
       if (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
       const res = await this.query(query);
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
       }

+ 29 - 2
src/views/selfShop/order/parts/card-3.vue

@@ -3,9 +3,10 @@
     <el-row>
       <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" @toReset="toClose"></search-1>
+          <search-1 :form="searchForm" @onSubmit="search" @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 :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetail" @sales="toSales" @confirm="toConfirm">
+        </data-table>
       </el-col>
     </el-row>
   </div>
@@ -16,6 +17,7 @@ const _ = require('lodash');
 
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('orderDetail');
+const { mapActions: shop } = createNamespacedHelpers('shop');
 export default {
   name: 'card-1',
   props: { statusList: { type: Array } },
@@ -29,6 +31,7 @@ export default {
       opera: [
         { label: '详情', method: 'detail' },
         { label: '售后', method: 'sales', type: 'danger' },
+        { label: '确认收货', method: 'confirm', type: 'warning' },
       ],
       fields: [
         { label: '订单号', model: 'no', showTip: false },
@@ -39,12 +42,14 @@ export default {
         { label: '商品数量', model: 'buy_num_total' },
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
       ],
+      shopList: [],
     };
   },
   async created() {
     await this.search();
   },
   methods: {
+    ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
@@ -69,6 +74,21 @@ export default {
     toDetail({ data }) {
       this.$emit('toDetails', data._id);
     },
+    toConfirm({ data }) {
+      this.$confirm('是否确认收货', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let res;
+        data.status = '3';
+        if (data._id) res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `确认收货成功` });
+          this.search();
+        }
+      });
+    },
     toSales({ data }) {
       this.$emit('toSaless', { id: data._id, status: '2' });
     },
@@ -76,6 +96,13 @@ export default {
       this.searchForm = {};
       this.search();
     },
+    // 店铺名称远程查询
+    async querySearch(value) {
+      let res = await this.shopQuery({ name: value });
+      if (this.$checkRes(res)) {
+        this.$set(this, 'shopList', res.data);
+      }
+    },
   },
   computed: {
     ...mapState(['user']),

+ 1 - 2
src/views/selfShop/order/parts/card-5.vue

@@ -39,7 +39,6 @@ export default {
         { label: '商品数量', model: 'buy_num_total' },
         { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
       ],
-      skip: 0,
     };
   },
   async created() {
@@ -48,7 +47,7 @@ export default {
   methods: {
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);

+ 1 - 3
src/views/selfShop/order/parts/parts/detail-1.vue

@@ -66,7 +66,6 @@ export default {
       // 发货清单
       deliverList: [],
       deliver: '0',
-      skip: 0,
     };
   },
   async created() {
@@ -76,7 +75,7 @@ export default {
     ...shop({ shopQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       if (condition.buy_time) {
         condition[`buy_time@start`] = _.head(condition.buy_time);
@@ -86,7 +85,6 @@ export default {
       info.status = '1';
       let res = await this.query({ skip, limit, ...condition, ...info, shop: this.user.shop.id });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, skip);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }

+ 1 - 3
src/views/selfShop/sales/index.vue

@@ -69,7 +69,6 @@ export default {
       ],
       typeList: [],
       statusList: [],
-      skip: 0,
       id: '',
     };
   },
@@ -81,12 +80,11 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       info.shop = this.user.shop.id;
       let condition = _.cloneDeep(this.searchForm);
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `skip`, 'skip');
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }