index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div id="card-1">
  3. <el-row>
  4. <el-col
  5. :span="24"
  6. class="main animate__animated animate__backInRight"
  7. v-loading="loadings"
  8. element-loading-text="拼命加载中"
  9. element-loading-spinner="el-icon-loading"
  10. >
  11. <span v-show="view === 'list'">
  12. <el-col :span="24" class="one"> <span>售后管理</span> </el-col>
  13. <el-col :span="24" class="two">
  14. <search-1 :form="searchForm" :statusList="statusList" :typeList="typeList" @onSubmit="toSearch" @toReset="toClose"> </search-1>
  15. </el-col>
  16. <el-col :span="24" class="four">
  17. <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @exam="toExam" @sales="toSales">
  18. </data-table>
  19. </el-col>
  20. </span>
  21. <detail v-if="view === 'order'" :id="id" @toBack="toBack"></detail>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. </template>
  26. <script>
  27. const _ = require('lodash');
  28. import { mapState, createNamespacedHelpers } from 'vuex';
  29. const { mapActions } = createNamespacedHelpers('afterSale');
  30. const { mapActions: dictData } = createNamespacedHelpers('dictData');
  31. const { mapActions: shopNotice } = createNamespacedHelpers('shopNotice');
  32. export default {
  33. name: 'card-1',
  34. props: {},
  35. components: {
  36. search1: () => import('@/components/salesParts/parts/search-1.vue'),
  37. detail: () => import('@/components/salesParts/detail.vue'),
  38. },
  39. data: function () {
  40. const that = this;
  41. return {
  42. loadings: true,
  43. view: 'list',
  44. searchForm: {},
  45. list: [],
  46. total: 0,
  47. opera: [
  48. { label: '审核', method: 'exam' },
  49. { label: '提醒售后', method: 'sales', type: 'warning', display: (i) => i.status == '0' },
  50. ],
  51. fields: [
  52. { label: '顾客', model: 'customer.name', showTip: false },
  53. { label: '订单号', model: 'order_detail.no', showTip: false },
  54. { label: '商品名称', model: 'goods.goods.name', showTip: false },
  55. {
  56. label: '售后类型',
  57. model: 'type',
  58. format: (i) => {
  59. let data = that.typeList.find((f) => f.value == i);
  60. if (data) return data.label;
  61. else return '暂无';
  62. },
  63. },
  64. {
  65. label: '售后状态',
  66. model: 'status',
  67. format: (i) => {
  68. let data = that.statusList.find((f) => f.value == i);
  69. if (data) return data.label;
  70. else return '暂无';
  71. },
  72. },
  73. { label: '退款金额', model: 'money' },
  74. { label: '售后处理人', model: 'deal_person.name' },
  75. { label: '申请时间', model: 'apply_time' },
  76. { label: '结束时间', model: 'end_time' },
  77. ],
  78. typeList: [],
  79. statusList: [],
  80. id: '',
  81. searchQuery: {},
  82. };
  83. },
  84. async created() {
  85. await this.search();
  86. await this.searchOther();
  87. },
  88. methods: {
  89. ...dictData({ dictQuery: 'query' }),
  90. ...shopNotice({ shopRtas: 'rtas' }),
  91. ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
  92. toSearch() {
  93. this.$refs.dataTable.resetPage();
  94. let res = this.$refs.dataTable.getPageConfig();
  95. this.search(res);
  96. },
  97. // 查询
  98. async search({ skip = 0, limit = this.$limit, ...info } = {}) {
  99. let query = { skip, limit, ...info };
  100. if (Object.keys(this.searchForm).length > 0) query = { ...query, ...this.searchForm };
  101. let res = await this.query(query);
  102. if (this.$checkRes(res)) {
  103. this.$set(this, 'list', res.data);
  104. this.$set(this, 'total', res.total);
  105. this.$set(this, `searchQuery`, query);
  106. }
  107. this.loadings = false;
  108. },
  109. toSales({ data }) {
  110. let info = { source_id: data._id };
  111. this.$confirm('是否确认提醒售后', '提示', {
  112. confirmButtonText: '确定',
  113. cancelButtonText: '取消',
  114. type: 'warning',
  115. }).then(async () => {
  116. let res = await this.shopRtas(info);
  117. if (this.$checkRes(res)) {
  118. this.$message({ type: `success`, message: `提醒售后成功` });
  119. this.search();
  120. }
  121. });
  122. },
  123. toExam({ data }) {
  124. this.$set(this, `id`, data.id);
  125. this.$set(this, `view`, 'order');
  126. },
  127. toBack() {
  128. this.view = 'list';
  129. this.search(this.searchQuery);
  130. },
  131. toClose() {
  132. this.searchForm = {};
  133. this.search();
  134. },
  135. // 查询其他信息
  136. async searchOther() {
  137. let res;
  138. // 类型
  139. res = await this.dictQuery({ code: 'afterSale_type' });
  140. if (this.$checkRes(res)) this.$set(this, `typeList`, res.data);
  141. // 售后状态
  142. res = await this.dictQuery({ code: 'afterSale_status' });
  143. if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
  144. },
  145. },
  146. computed: {
  147. ...mapState(['user']),
  148. },
  149. metaInfo() {
  150. return { title: this.$route.meta.title };
  151. },
  152. watch: {
  153. test: {
  154. deep: true,
  155. immediate: true,
  156. handler(val) {},
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="less" scoped>
  162. .one {
  163. margin: 0 0 10px 0;
  164. span:nth-child(1) {
  165. font-size: 20px;
  166. font-weight: 700;
  167. margin-right: 10px;
  168. }
  169. }
  170. .two {
  171. margin: 0 0 10px 0;
  172. }
  173. .el-col {
  174. margin: 10px 0;
  175. }
  176. </style>