accumulatePointsMotivateHistory.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <m-dialog ref="dialog" title="积分兑换记录">
  3. <m-table
  4. clearHeader
  5. shadow="never"
  6. v-loading="loading"
  7. :items="items"
  8. :headers="headers"
  9. :page-size="pageInfo.size"
  10. :page-current="pageInfo.current"
  11. :total="total"
  12. @page-change="onPageChange"
  13. @sort-change="onSortChange"
  14. >
  15. </m-table>
  16. </m-dialog>
  17. </template>
  18. <script>
  19. import {
  20. getAccumulatePointProductHistory
  21. } from '@/api/accumulatePoint'
  22. export default {
  23. name: 'accumulatePointsMotivateHistory',
  24. data () {
  25. return {
  26. loading: false,
  27. items: [],
  28. headers: [
  29. {
  30. label: '兑换物品',
  31. prop: 'scoreProductName'
  32. },
  33. {
  34. label: '兑换数量',
  35. prop: 'num',
  36. align: 'center'
  37. },
  38. {
  39. label: '兑换积分',
  40. prop: 'score',
  41. align: 'center'
  42. },
  43. {
  44. label: '兑换时间',
  45. prop: 'createDate'
  46. }
  47. ],
  48. pageInfo: {
  49. current: 1,
  50. size: 10
  51. },
  52. total: 0,
  53. orders: [
  54. {
  55. column: 'create_date',
  56. asc: false
  57. }
  58. ]
  59. }
  60. },
  61. methods: {
  62. open () {
  63. this.$refs.dialog.open()
  64. this.pageInfo.current = 1
  65. this.onInit()
  66. },
  67. async onInit () {
  68. this.loading = true
  69. try {
  70. const { data } = await getAccumulatePointProductHistory({
  71. page: {
  72. ...this.pageInfo,
  73. orders: this.orders
  74. }
  75. })
  76. this.items = data.records
  77. this.total = data.total
  78. } catch (error) {
  79. this.$message.error(error)
  80. } finally {
  81. this.loading = false
  82. }
  83. },
  84. onPageChange (index) {
  85. this.pageInfo.current = index
  86. this.onInit()
  87. },
  88. onSortChange (orders) {
  89. this.orders = orders
  90. this.onInit()
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. </style>