123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <div id="card-1">
- <el-row>
- <el-col
- :span="24"
- class="main animate__animated animate__backInRight"
- v-loading="loadings"
- element-loading-text="拼命加载中"
- element-loading-spinner="el-icon-loading"
- >
- <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" :statusList="statusList" :typeList="typeList" @onSubmit="toSearch" @toReset="toClose"> </search-1>
- </el-col>
- <el-col :span="24" class="four">
- <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @exam="toExam" @sales="toSales">
- </data-table>
- </el-col>
- </span>
- <detail v-if="view === 'order'" :id="id" @toBack="toBack"></detail>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- const _ = require('lodash');
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions } = createNamespacedHelpers('afterSale');
- const { mapActions: dictData } = createNamespacedHelpers('dictData');
- const { mapActions: shopNotice } = createNamespacedHelpers('shopNotice');
- export default {
- name: 'card-1',
- props: {},
- components: {
- search1: () => import('@/components/salesParts/parts/search-1.vue'),
- detail: () => import('@/components/salesParts/detail.vue'),
- },
- data: function () {
- const that = this;
- return {
- loadings: true,
- view: 'list',
- searchForm: {},
- list: [],
- total: 0,
- opera: [
- { label: '审核', method: 'exam' },
- { label: '提醒售后', method: 'sales', type: 'warning', display: (i) => i.status == '0' },
- ],
- fields: [
- { label: '顾客', model: 'customer.name', showTip: false },
- { label: '订单号', model: 'order_detail.no', showTip: false },
- { label: '商品名称', model: 'goods.goods.name', showTip: false },
- {
- 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: 'money' },
- { label: '售后处理人', model: 'deal_person.name' },
- { label: '申请时间', model: 'apply_time' },
- { label: '结束时间', model: 'end_time' },
- ],
- typeList: [],
- statusList: [],
- id: '',
- searchQuery: {},
- };
- },
- async created() {
- await this.search();
- await this.searchOther();
- },
- methods: {
- ...dictData({ dictQuery: 'query' }),
- ...shopNotice({ shopRtas: 'rtas' }),
- ...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 query = { skip, limit, ...info };
- if (Object.keys(this.searchForm).length > 0) query = { ...query, ...this.searchForm };
- 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;
- },
- toSales({ data }) {
- let info = { source_id: data._id };
- this.$confirm('是否确认提醒售后', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(async () => {
- let res = await this.shopRtas(info);
- if (this.$checkRes(res)) {
- this.$message({ type: `success`, message: `提醒售后成功` });
- this.search();
- }
- });
- },
- toExam({ data }) {
- this.$set(this, `id`, data.id);
- this.$set(this, `view`, 'order');
- },
- toBack() {
- this.view = 'list';
- this.search(this.searchQuery);
- },
- toClose() {
- this.searchForm = {};
- this.search();
- },
- // 查询其他信息
- 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);
- },
- },
- computed: {
- ...mapState(['user']),
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- watch: {
- test: {
- deep: true,
- immediate: true,
- handler(val) {},
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .one {
- margin: 0 0 10px 0;
- span:nth-child(1) {
- font-size: 20px;
- font-weight: 700;
- margin-right: 10px;
- }
- }
- .two {
- margin: 0 0 10px 0;
- }
- .el-col {
- margin: 10px 0;
- }
- </style>
|