Browse Source

团购售后

YY 2 năm trước cách đây
mục cha
commit
302fdc5b70

+ 41 - 82
src/components/salesParts/guide_detail.vue

@@ -26,49 +26,16 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
-          <el-col v-if="info.type == '1' || info.type == '2' || info.type == '3'">
-            <el-col :span="24" class="goods">
-              <el-col :span="6"><el-image class="image" :src="file"></el-image></el-col>
-              <el-col :span="18">
-                <el-col :span="12">
-                  <p>{{ goods.name }}</p>
-                  <p>规格:{{ good.name }}</p>
-                </el-col>
-                <el-col :span="12" class="money">
-                  <p>¥{{ good.sell_money }}</p>
-                  <p>X{{ good.buy_num }}</p>
-                </el-col>
+          <el-col :span="24" class="goods">
+            <el-col :span="6"><el-image class="image" :src="file"></el-image></el-col>
+            <el-col :span="18">
+              <el-col :span="12">
+                <p>{{ goods.name }}</p>
+                <p>规格:{{ spec.name }}</p>
               </el-col>
-            </el-col>
-          </el-col>
-          <el-col v-if="info.type == '4' || info.type == '5'">
-            <el-col :span="24" v-for="(item, index) in list" :key="index">
-              <el-col :span="24" class="goods bode">
-                <el-col :span="6" v-if="item.goods.file"><el-image class="image" :src="item.goods.file[0].url"></el-image></el-col>
-                <el-col :span="6" v-else-if="item.url"><el-image class="image" :src="item.url"></el-image></el-col>
-                <el-col :span="18">
-                  <el-col :span="12">
-                    <el-col>
-                      <p>{{ item.goods.name }}</p>
-                    </el-col>
-                    <el-col>
-                      <p>规格:{{ item.name }}</p>
-                    </el-col>
-                  </el-col>
-                  <el-col :span="12" class="money">
-                    <el-col>
-                      <p>¥{{ item.sell_money }}</p>
-                    </el-col>
-                    <el-col>
-                      <p>X{{ item.buy_num }}</p>
-                    </el-col>
-                  </el-col>
-                </el-col>
-              </el-col>
-              <el-col :span="24" class="bode">
-                <el-col :span="6">运费</el-col>
-                <el-col :span="18" class="other" v-if="!item.goods.freight == '0'">{{ item.goods.freight }}</el-col>
-                <el-col :span="18" class="other" v-else>包邮</el-col>
+              <el-col :span="12" class="money">
+                <p style="color: red">¥{{ spec.price }}</p>
+                <p>X{{ spec.num }}</p>
               </el-col>
             </el-col>
           </el-col>
@@ -86,7 +53,7 @@
           </el-col>
           <el-col :span="24" v-if="info.type == '1' || info.type == '2' || info.type == '4' || info.type == '5'">
             <el-col :span="6">退款金额</el-col>
-            <el-col :span="18" class="other">{{ info.money || '' }}</el-col>
+            <el-col :span="18" class="other" style="color: red">{{ info.money || '' }}</el-col>
           </el-col>
           <el-col :span="24">
             <el-col :span="6">售后状态</el-col>
@@ -150,8 +117,7 @@ const moment = require('moment');
 import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('groupAfterSale');
 const { mapActions: dictData } = createNamespacedHelpers('dictData');
-const { mapActions: sot } = createNamespacedHelpers('sot');
-const { mapActions: getTransportInfo } = createNamespacedHelpers('getTransportInfo');
+const { mapActions: salesTransport } = createNamespacedHelpers('salesTransport');
 
 export default {
   name: 'form-1',
@@ -174,7 +140,7 @@ export default {
       // 商品
       goods: {},
       // 规格
-      good: {},
+      spec: {},
       // 地址
       address: {},
       // 购买人
@@ -201,9 +167,8 @@ export default {
     await this.search();
   },
   methods: {
-    ...sot({ sotFetch: 'fetch' }),
     ...dictData({ dictQuery: 'query' }),
-    ...getTransportInfo({ getFetch: 'fetch' }),
+    ...salesTransport({ getCreate: 'create' }),
     ...mapActions(['fetch', 'create', 'update']),
     // 查询
     async search() {
@@ -215,20 +180,12 @@ export default {
         if (status) res.data.zhStatus = status.label;
         this.$set(this, `info`, res.data);
         this.$set(this, `shop`, res.data.shop);
-        this.$set(this, `address`, res.data.order_detail.address);
-        this.$set(this, `customers`, res.data.order_detail.customer);
-        if (res.data.type == '4' || res.data.type == '5') this.$set(this, `list`, res.data.order_detail.goods); // 商品
-        else if (res.data.type == '1' || res.data.type == '2' || res.data.type == '3') {
-          if (res.data.transport) this.$set(this, `transport`, res.data.transport);
-          // 图片
-          if (res.data.goods.file && res.data.goods.file.length != 0) this.$set(this, `file`, res.data.goods.file[0].url);
-          else if (res.data.goods.goods.file) this.$set(this, `file`, res.data.goods.goods.file[0].url);
-          else this.$set(this, `file`, res.data.goods.url);
-          // 商品
-          this.$set(this, `goods`, res.data.goods.goods);
-          // 规格
-          this.$set(this, `good`, res.data.goods);
-        }
+        this.$set(this, `address`, res.data.address);
+        this.$set(this, `customers`, res.data.customer);
+        this.$set(this, `goods`, res.data.goods);
+        this.$set(this, `spec`, res.data.goodsSpec);
+        if (res.data.goodsSpec.file && res.data.goodsSpec.file.length != 0) this.$set(this, `file`, res.data.goodsSpec.file[0].url);
+        else if (res.data.goods.file) this.$set(this, `file`, res.data.goods.file[0].url);
         // 仅退款
         if (res.data.status == '-1') this.$set(this, `active`, 3);
         else if (res.data.status == '!1') this.$set(this, `active`, 4);
@@ -281,31 +238,33 @@ export default {
         }
       }
       // 显示物流
-      let res = await this.getFetch(this.id);
+      let sales = { id: this.id };
+      let res = await this.getCreate(sales);
       if (this.$checkRes(res)) {
-        if (res.errcode == '0') {
-          if (res.data.customer) {
+        if (res.data.customer) {
+          if (res.data.customer.list) {
             let customer = res.data.customer.list;
             this.$set(this, `customer`, customer);
             customer[0].color = '#0bbd87';
-            if (res.data.customer.is_check == '已签收' && this.info.status == '3') this.$set(this, `active`, 3);
-            if (res.data.customer.is_check == '已签收' && this.info.status == '2') this.$set(this, `active`, 3);
           }
-          if (res.data.shop) {
-            if (this.info.status == '3') this.$set(this, `active`, 4);
+          if (res.data.customer.is_check == '已签收' && this.info.status == '3') this.$set(this, `active`, 3);
+          if (res.data.customer.is_check == '已签收' && this.info.status == '2') this.$set(this, `active`, 3);
+        }
+        if (res.data.shop) {
+          if (this.info.status == '3') this.$set(this, `active`, 4);
+          if (res.data.shop.list) {
             let shopList = res.data.shop.list;
             this.$set(this, `shopList`, shopList);
             shopList[0].color = '#0bbd87';
-            if (res.data.shop.is_check == '已签收' && this.info.status == '3') this.$set(this, `active`, 5);
           }
-          this.$set(this, `activit`, res.data);
+          if (res.data.shop.is_check == '已签收' && this.info.status == '3') this.$set(this, `active`, 5);
         }
+        this.$set(this, `activit`, res.data);
       }
     },
     // 审核
     async exam(status, form) {
-      let info = this.info;
-      info.status = status;
+      let info = { _id: this.info._id, status: status };
       if (status == '-2' && info.transport) info.transport.shop_receive = true;
       else if (status == '-2' && !info.transport) {
         let transport = {};
@@ -325,7 +284,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning',
       }).then(async () => {
-        if (info.id) res = await this.update(info);
+        if (info._id) res = await this.update(info);
         if (this.$checkRes(res)) {
           this.$message({ type: `success`, message: `维护信息成功` });
           this.search();
@@ -333,15 +292,14 @@ export default {
       });
     },
     async exam_one(status) {
-      let info = this.info;
-      info.status = status;
-      let res;
       this.$confirm('是否确认不填写单号修改售后状态', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning',
       }).then(async () => {
-        if (info.id) res = await this.update(info);
+        let info = { _id: this.info._id, status: status };
+        let res;
+        if (info._id) res = await this.update(info);
         if (this.$checkRes(res)) {
           this.$message({ type: `success`, message: `维护信息成功` });
           this.search();
@@ -375,15 +333,16 @@ export default {
     },
     // 保存
     async onSubmit(val) {
-      let info = this.info;
+      let form = this.info;
+      let info = { _id: this.info._id };
       let res;
-      if (info.transport) {
-        info.transport = { ...info.transport, shop_transport_no: val.shop_transport_no, shop_transport_type: val.shop_transport_type, shop_receive: true };
+      if (form.transport) {
+        info.transport = { ...form.transport, shop_transport_no: val.shop_transport_no, shop_transport_type: val.shop_transport_type, shop_receive: true };
       } else {
         let transport = { shop_transport_no: val.shop_transport_no, shop_transport_type: val.shop_transport_type, shop_receive: true };
         info.transport = transport;
       }
-      if (info.id) res = await this.update(info);
+      if (info._id) res = await this.update(info);
       if (this.$checkRes(res)) {
         this.$message({ type: `success`, message: `维护信息成功` });
         this.search();

+ 2 - 0
src/store/index.js

@@ -62,6 +62,7 @@ import goodsConfig from './module/group/goodsConfig';
 import group from './module/group/group';
 // 快递
 import groupTransport from './module/group/groupTransport';
+import salesTransport from './module/group/salesTransport';
 
 Vue.use(Vuex);
 
@@ -108,5 +109,6 @@ export default new Vuex.Store({
     goodsConfig,
     group,
     groupTransport,
+    salesTransport,
   },
 });

+ 1 - 1
src/store/module/group/groupTransport.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 const _ = require('lodash');
 Vue.use(Vuex);
 const api = {
-  url: '/point/group/v1/api//orderOthers/transport',
+  url: '/point/group/v1/api/orderOthers/transport',
 };
 
 const state = () => ({});

+ 44 - 0
src/store/module/group/salesTransport.js

@@ -0,0 +1,44 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+const _ = require('lodash');
+Vue.use(Vuex);
+const api = {
+  url: '/point/group/v1/api/orderOthers/afterSale/transport',
+};
+
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.url}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.url}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.url}/${payload}`);
+    return res;
+  },
+  async update({ commit }, payload) {
+    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const res = await this.$axios.$post(`${api.url}/${id}`, payload);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.url}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 2 - 0
src/views/platGroup/goods/detail.vue

@@ -52,6 +52,7 @@ export default {
         { label: '团长价', model: 'leader_price', type: 'number' },
         { label: '团购价', model: 'price', type: 'number' },
         { label: '团长提成金额', model: 'leader_get', type: 'number' },
+        { label: '运费', model: 'freight', type: 'number' },
       ],
       rules: {
         goods: [{ required: true, message: '商品名称', trigger: 'change' }],
@@ -59,6 +60,7 @@ export default {
         leader_price: [{ required: true, message: '团长价', trigger: 'blur' }],
         price: [{ required: true, message: '团购价', trigger: 'blur' }],
         leader_get: [{ required: true, message: '团长提成金额', trigger: 'blur' }],
+        freight: [{ required: true, message: '运费', trigger: 'blur' }],
       },
       form: {},
       // 加载

+ 1 - 0
src/views/platGroup/goods/index.vue

@@ -82,6 +82,7 @@ export default {
         { label: '团长价', model: 'leader_price' },
         { label: '团购价', model: 'price' },
         { label: '团长提成金额', model: 'leader_get' },
+        { label: '运费', model: 'freight' },
       ],
       opera: [
         { label: '修改', method: 'edit' },

+ 5 - 0
src/views/platGroup/group/detail.vue

@@ -57,6 +57,11 @@
                     <el-input v-model="row.leader_get" type="number" placeholder="请输入团长提成金额"></el-input>
                   </template>
                 </el-table-column>
+                <el-table-column label="运费" prop="freight" align="center">
+                  <template #default="{ row }">
+                    <el-input v-model="row.freight" type="number" placeholder="请输入运费"></el-input>
+                  </template>
+                </el-table-column>
                 <el-table-column label="操作" align="center">
                   <template #default="scope">
                     <el-button type="danger" size="mini" @click="toDel(scope.$index, 'group_config')">删除</el-button>