index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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="search" @toReset="toClose"> </search-1>
  15. </el-col>
  16. <el-col :span="24" class="four">
  17. <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @exam="toExam"> </data-table>
  18. </el-col>
  19. </span>
  20. <!-- <detail v-if="view === 'order'" :id="id" @toBack="toBack"></detail> -->
  21. </el-col>
  22. </el-row>
  23. </div>
  24. </template>
  25. <script>
  26. const _ = require('lodash');
  27. import { mapState, createNamespacedHelpers } from 'vuex';
  28. const { mapActions } = createNamespacedHelpers('groupAfterSale');
  29. const { mapActions: dictData } = createNamespacedHelpers('dictData');
  30. export default {
  31. name: 'card-1',
  32. props: {},
  33. components: {
  34. search1: () => import('@/components/salesParts/parts/search-1.vue'),
  35. // detail: () => import('@/components/salesParts/detail.vue'),
  36. },
  37. data: function () {
  38. const that = this;
  39. return {
  40. loadings: true,
  41. view: 'list',
  42. searchForm: {},
  43. list: [],
  44. total: 0,
  45. opera: [{ label: '审核', method: 'exam' }],
  46. fields: [
  47. { label: '顾客', model: 'customer.name', showTip: false },
  48. { label: '订单号', model: 'order_detail.no', showTip: false },
  49. { label: '商品名称', model: 'goods.goods.name', showTip: false },
  50. {
  51. label: '售后类型',
  52. model: 'type',
  53. format: (i) => {
  54. let data = that.typeList.find((f) => f.value == i);
  55. if (data) return data.label;
  56. else return '暂无';
  57. },
  58. },
  59. {
  60. label: '售后状态',
  61. model: 'status',
  62. format: (i) => {
  63. let data = that.statusList.find((f) => f.value == i);
  64. if (data) return data.label;
  65. else return '暂无';
  66. },
  67. },
  68. { label: '退款金额', model: 'money' },
  69. { label: '售后处理人', model: 'deal_person.name' },
  70. { label: '申请时间', model: 'apply_time' },
  71. { label: '结束时间', model: 'end_time' },
  72. ],
  73. typeList: [],
  74. statusList: [],
  75. id: '',
  76. };
  77. },
  78. async created() {
  79. await this.search();
  80. await this.searchOther();
  81. },
  82. methods: {
  83. ...dictData({ dictQuery: 'query' }),
  84. ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
  85. // 查询
  86. async search({ skip = 0, limit = this.$limit, ...info } = {}) {
  87. let condition = _.cloneDeep(this.searchForm);
  88. let res = await this.query({ skip, limit, ...condition, ...info });
  89. if (this.$checkRes(res)) {
  90. this.$set(this, 'list', res.data);
  91. this.$set(this, 'total', res.total);
  92. }
  93. this.loadings = false;
  94. },
  95. toExam({ data }) {
  96. this.$set(this, `id`, data.id);
  97. this.$set(this, `view`, 'order');
  98. },
  99. toBack() {
  100. this.view = 'list';
  101. },
  102. toClose() {
  103. this.searchForm = {};
  104. this.search();
  105. },
  106. // 查询其他信息
  107. async searchOther() {
  108. let res;
  109. // 类型
  110. res = await this.dictQuery({ code: 'afterSale_type' });
  111. if (this.$checkRes(res)) this.$set(this, `typeList`, res.data);
  112. // 售后状态
  113. res = await this.dictQuery({ code: 'afterSale_status' });
  114. if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
  115. },
  116. },
  117. computed: {
  118. ...mapState(['user']),
  119. },
  120. metaInfo() {
  121. return { title: this.$route.meta.title };
  122. },
  123. watch: {
  124. test: {
  125. deep: true,
  126. immediate: true,
  127. handler(val) {},
  128. },
  129. },
  130. };
  131. </script>
  132. <style lang="less" scoped>
  133. .one {
  134. margin: 0 0 10px 0;
  135. }
  136. .two {
  137. margin: 0 0 10px 0;
  138. }
  139. </style>