index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="">
  3. <toolbar @on-filter="filterData" @on-reset="filterData" />
  4. <base-table
  5. class="m-10 bg-w p-20 br-10"
  6. :columns="columns"
  7. :items="items"
  8. :pagination="pagination"
  9. :page-change="pageChange"
  10. />
  11. </div>
  12. </template>
  13. <script>
  14. import toolbar from './toolbar';
  15. import mxFilterList from '@/mixins/filterList';
  16. import { getPage } from '@/api/order';
  17. export default {
  18. name: 'OrderManagement',
  19. components: { toolbar },
  20. mixins: [
  21. mxFilterList({
  22. fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
  23. })
  24. ],
  25. data() {
  26. return {
  27. columns: [
  28. {
  29. key: 'id',
  30. name: '订单编号',
  31. width: this.$col.b
  32. },
  33. {
  34. key: 'nickname',
  35. name: '账号昵称'
  36. },
  37. {
  38. key: 'phonenumber',
  39. name: '账号手机号码',
  40. width: this.$col.m
  41. },
  42. {
  43. key: 'payablePrice',
  44. name: '应付金额',
  45. width: this.$col.m,
  46. render: (h, { row }) => h('span', `¥${row.payablePrice}`)
  47. },
  48. {
  49. key: 'paidPrice',
  50. name: '实付金额',
  51. width: this.$col.m,
  52. render: (h, { row }) => h('span', `¥${row.paidPrice}`)
  53. },
  54. {
  55. key: 'payChannels',
  56. name: '支付渠道',
  57. width: this.$col.m
  58. },
  59. {
  60. key: 'createAt',
  61. name: '创建时间',
  62. width: this.$col.b
  63. },
  64. {
  65. key: 'payEndTime',
  66. name: '支付时间',
  67. width: this.$col.b
  68. },
  69. {
  70. key: 'state',
  71. name: '订单状态',
  72. width: this.$col.s,
  73. type: 'tag',
  74. fetchTagType: val => {
  75. switch (val) {
  76. case 1:
  77. return 'success';
  78. case 0:
  79. return 'info';
  80. case -1:
  81. return 'warning';
  82. default:
  83. return 'info';
  84. }
  85. },
  86. tagName: row => {
  87. switch (row.state) {
  88. case 1:
  89. return '已支付';
  90. case 0:
  91. return '未支付';
  92. case -1:
  93. return '取消支付';
  94. default:
  95. return '-';
  96. }
  97. }
  98. }
  99. ]
  100. };
  101. }
  102. };
  103. </script>
  104. <style type="scss" scoped></style>