YY 2 år sedan
förälder
incheckning
6a9547615f

+ 6 - 0
src/router/module/selfShop.js

@@ -47,4 +47,10 @@ export default [
     meta: { title: '自营店铺-售后管理' },
     component: () => import(/* webpackChunkName: "selfShop_sales" */ '@/views/selfShop/sales/index.vue'),
   },
+  {
+    path: '/selfShop/sales/detail',
+    name: 'selfShop_sales_details',
+    meta: { title: '自营店铺-售后管理-审核' },
+    component: () => import(/* webpackChunkName: "selfShop_sales_detail" */ '@/views/selfShop/sales/detail.vue'),
+  },
 ];

+ 2 - 0
src/store/index.js

@@ -15,6 +15,7 @@ import shop from './module/shop/shop';
 import selfShop from './module/shop/selfShop';
 import goods from './module/shop/goods';
 import goodsSpec from './module/shop/goodsSpec';
+import afterSale from './module/shop/afterSale';
 import order from './module/trade/order';
 import orderDetail from './module/trade/orderDetail';
 import coupon from './module/trade/coupon';
@@ -38,5 +39,6 @@ export default new Vuex.Store({
     order,
     orderDetail,
     coupon,
+    afterSale,
   },
 });

+ 44 - 0
src/store/module/shop/afterSale.js

@@ -0,0 +1,44 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+const _ = require('lodash');
+Vue.use(Vuex);
+const api = {
+  url: '/point/v1/api/afterSale',
+};
+
+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,
+};

+ 214 - 0
src/views/selfShop/sales/detail.vue

@@ -0,0 +1,214 @@
+<template>
+  <div id="form-1">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col class="top-btn">
+          <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
+        </el-col>
+        <el-col :span="8" class="one">
+          <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
+          <el-col :span="24" class="goods">
+            <el-col :span="6"><el-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>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">申请时间</el-col>
+            <el-col :span="18" class="other">{{ form.apply_time }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">结束时间</el-col>
+            <el-col :span="18" class="other">{{ form.end_time || '暂无' }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">售后类型</el-col>
+            <el-col :span="18" class="other">{{ form.zhType }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">售后状态</el-col>
+            <el-col :span="18" class="other">{{ form.zhStatus }}</el-col>
+          </el-col>
+          <el-col :span="24" v-if="form.type == '1'">
+            <el-col :span="6">退回运单号</el-col>
+            <el-col :span="18" class="other">{{ transport.customer_transport_no || '暂无单号' }}</el-col>
+          </el-col>
+          <el-col :span="24" v-if="form.type == '1'">
+            <el-col :span="6">寄出运单号</el-col>
+            <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">售后描述</el-col>
+            <el-col :span="18" class="other">{{ form.desc }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
+              <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-form-item label="寄出运单号" prop="shop_transport_no" v-if="form.status == '2' && form.type == '1'">
+                <el-input v-model="form.shop_transport_no" placeholder="请输入运单号" size="small"></el-input>
+              </el-form-item>
+              <el-form-item label="售后结束时间" prop="end_time" v-if="form.status == '-1' || form.status == '-2' || form.status == '-3'">
+                <el-date-picker v-model="form.end_time" type="datetime" placeholder="选择时间" value-format="yyyy-MM-dd HH:mm:ss"> </el-date-picker>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="onSubmit()">保存</el-button>
+              </el-form-item>
+            </el-form>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+const moment = require('moment');
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('afterSale');
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
+
+export default {
+  name: 'form-1',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      shop: {},
+      file: '',
+      goods: {},
+      good: {},
+      transport: {},
+      typeList: [],
+      statusList: [],
+      form: {},
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...dictData({ dictQuery: 'query' }),
+    ...mapActions(['fetch', 'create', 'update']),
+    // 查询
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        let type = this.typeList.find((i) => i.value == res.data.type);
+        if (type) res.data.zhType = type.label;
+        let status = this.statusList.find((i) => i.value == res.data.status);
+        if (status) res.data.zhStatus = status.label;
+        this.$set(this, `form`, res.data);
+        this.$set(this, `shop`, res.data.shop);
+        if (res.data.transport) {
+          this.$set(this, `transport`, res.data.transport);
+        }
+        // 图片
+        this.$set(this, `file`, res.data.goods.goods.file[0].url);
+        // 商品
+        this.$set(this, `goods`, res.data.goods.goods);
+        // 规格
+        this.$set(this, `good`, res.data.goods);
+      }
+    },
+
+    // 提交
+    async onSubmit() {
+      let form = this.form;
+      let transport = {};
+      let res;
+      if (form.shop_transport_no) {
+        transport.shop_transport_no = form.shop_transport_no;
+        form.transport = transport;
+      }
+      if (form.id) res = await this.update(form);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `维护信息成功` });
+        this.toBack();
+      }
+    },
+    // 查询其他信息
+    async searchOther() {
+      let res;
+      // 类型
+      res = await this.dictQuery({ code: 'afterSale_type' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `typeList`, res.data);
+      }
+      res = await this.dictQuery({ code: 'afterSale_status' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `statusList`, res.data);
+      }
+    },
+    // 返回
+    toBack() {
+      window.history.go('-1');
+    },
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+    status() {
+      return this.$route.query.status;
+    },
+  },
+  metaform() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    font-size: 20px;
+    margin: 10px 0 0 20%;
+    padding: 5px;
+    .add {
+      border-bottom: 2px dashed #ccc;
+      margin: 0 0 5px 0;
+      padding: 5px 0;
+    }
+    .shop {
+      padding: 4px 0;
+      font-size: 22px;
+      border-bottom: 1px solid #ccc;
+    }
+    .goods {
+      padding: 10px 0;
+      .money {
+        text-align: right;
+      }
+    }
+    .other {
+      text-align: right;
+      p {
+        color: red;
+      }
+    }
+    .el-col {
+      margin: 4px 0;
+    }
+  }
+}
+</style>

+ 113 - 8
src/views/selfShop/sales/index.vue

@@ -1,22 +1,123 @@
 <template>
-  <div id="index">
+  <div id="card-1">
     <el-row>
-      <el-col :span="24" class="main"> test </el-col>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" :statusList="statusList" :typeList="typeList" @onSubmit="search" @toReset="toClose"> </search-1>
+        </el-col>
+        <data-table
+          :select="true"
+          :selected="selected"
+          @handleSelect="handleSelect"
+          :fields="fields"
+          :opera="opera"
+          @query="search"
+          :data="list"
+          :total="total"
+          @exam="toExam"
+        >
+        </data-table>
+      </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+const _ = require('lodash');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('afterSale');
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
 export default {
-  name: 'index',
+  name: 'card-1',
   props: {},
-  components: {},
+  components: { search1: () => import('./parts/search-1.vue') },
   data: function () {
-    return {};
+    const that = this;
+    return {
+      searchForm: {},
+      list: [],
+      total: 0,
+      opera: [{ label: '审核', method: 'exam' }],
+      fields: [
+        { label: '顾客', model: 'customer.name' },
+        { label: '商品名称', model: 'goods.goods.name' },
+        { label: '退款金额', model: 'result.money' },
+        {
+          label: '售后类型',
+          model: 'type',
+          format: (i) => {
+            let data = that.typeList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        {
+          label: '售后状态',
+          model: 'status',
+          format: (i) => {
+            let data = that.statusList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        { label: '申请时间', model: 'apply_time' },
+        { label: '结束时间', model: 'end_time' },
+      ],
+      // 多选值
+      selected: [],
+      typeList: [],
+      statusList: [],
+    };
+  },
+  async created() {
+    await this.search();
+    await this.searchOther();
+  },
+  methods: {
+    ...dictData({ dictQuery: 'query' }),
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    computedNeedPay(details) {
+      let total = 0;
+      for (const key in details) {
+        total += details[key];
+      }
+      return _.floor(total, 2);
+    },
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let condition = _.cloneDeep(this.searchForm);
+      let res = await this.query({ skip, limit, ...condition, ...info, shop: _.get(this.shop, '_id') });
+      if (this.$checkRes(res)) {
+        this.$set(this, 'list', res.data);
+        this.$set(this, 'total', res.total);
+      }
+    },
+    toExam({ data }) {
+      this.$router.push({ path: '/selfShop/sales/detail', query: { id: data.id } });
+    },
+    toClose() {
+      this.searchForm = {};
+      this.search();
+    },
+    // 多选
+    handleSelect(data) {
+      this.$emit('handleSelect');
+    },
+    // 查询其他信息
+    async searchOther() {
+      let res;
+      // 类型
+      res = await this.dictQuery({ code: 'afterSale_type' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `typeList`, res.data);
+      }
+      // 售后状态
+      res = await this.dictQuery({ code: 'afterSale_status' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `statusList`, res.data);
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
   },
@@ -33,4 +134,8 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>

+ 74 - 0
src/views/selfShop/sales/parts/search-1.vue

@@ -0,0 +1,74 @@
+<template>
+  <div id="search-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-form :model="form" ref="form" label-width="130px">
+          <el-col :span="6">
+            <el-form-item label="售后类型" prop="type">
+              <el-select v-model="form.type" clearable filterable placeholder="请选择" style="width: 100%" size="small">
+                <el-option v-for="i in typeList" :key="i.label" :label="i.label" :value="i.value"></el-option>
+              </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">
+                <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">
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="onSubmit('form')">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="toReset('form')">重置</el-button>
+          </el-col>
+        </el-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'search-1',
+  props: { form: { type: Object }, statusList: { type: Array }, typeList: { type: Array } },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    onSubmit() {
+      this.$emit('onSubmit');
+    },
+    toReset(formName) {
+      this.$refs[formName].resetFields();
+      this.$emit('toReset');
+    },
+  },
+  computed: {},
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .btn {
+    text-align: right;
+  }
+  /deep/.el-form-item {
+    float: left;
+    width: 100%;
+    margin: 0 0 10px 0;
+  }
+}
+</style>