userIntegralDetails.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!-- UserIntegralLogs.vue -->
  2. <template>
  3. <div class="integral-logs-container">
  4. <el-table
  5. v-loading="loading"
  6. border
  7. :data="userIntegralLogsList"
  8. @selection-change="handleSelectionChange"
  9. >
  10. <el-table-column label="用户id" align="center" prop="userId" />
  11. <el-table-column label="用户昵称" align="center" prop="nickName" />
  12. <el-table-column label="用户电话" align="center" prop="phone" />
  13. <el-table-column label="类别" align="center" prop="logType">
  14. <template slot-scope="scope">
  15. <dict-tag :options="intefralLogTypeOptions" :value="scope.row.logType"/>
  16. </template>
  17. </el-table-column>
  18. <el-table-column label="积分" align="center" prop="integral" />
  19. <el-table-column label="积分余额" align="center" prop="balance" />
  20. <el-table-column label="订单关联id" align="center" prop="businessId" />
  21. <el-table-column label="时间" align="center" prop="createTime" />
  22. </el-table>
  23. <!-- 分页组件 -->
  24. <pagination
  25. v-show="total > 0"
  26. :total="total"
  27. :page.sync="queryParams.pageNum"
  28. :limit.sync="queryParams.pageSize"
  29. @pagination="getList"
  30. />
  31. </div>
  32. </template>
  33. <script>
  34. import { listUserIntegralLogs} from "@/api/company/userIntegralLogs";
  35. export default {
  36. name: 'UserIntegralLogs',
  37. props: {
  38. fsUserId: {
  39. type: [String, Number],
  40. required: false
  41. }
  42. },
  43. data() {
  44. return {
  45. loading: false,
  46. userIntegralLogsList: [],
  47. total: 0,
  48. queryParams: {
  49. pageNum: 1,
  50. pageSize: 10,
  51. userId: this.fsUserId
  52. },
  53. intefralLogTypeOptions: [],
  54. selections: []
  55. }
  56. },
  57. watch: {
  58. fsUserId: {
  59. handler(newVal) {
  60. this.queryParams.userId = newVal;
  61. this.getList();
  62. },
  63. immediate: true
  64. }
  65. },
  66. created() {
  67. this.getList();
  68. this.getDictOptions();
  69. },
  70. methods: {
  71. // 获取积分日志列表
  72. getList() {
  73. if (!this.queryParams.userId) return;
  74. this.loading = true;
  75. listUserIntegralLogs(this.queryParams).then(response => {
  76. this.userIntegralLogsList = response.rows;
  77. this.total = response.total;
  78. this.loading = false;
  79. });
  80. },
  81. getIntegralLogs(fsUserId){
  82. this.queryParams.userId=fsUserId;
  83. this.getList();
  84. },
  85. // 获取字典选项
  86. getDictOptions() {
  87. // 获取积分日志类型字典
  88. this.getDicts("sys_integral_log_type").then(response => {
  89. this.intefralLogTypeOptions = response.data;
  90. });
  91. },
  92. // 处理选择变化
  93. handleSelectionChange(selection) {
  94. this.selections = selection;
  95. }
  96. }
  97. }
  98. </script>
  99. <style scoped>
  100. .integral-logs-container {
  101. padding: 20px;
  102. }
  103. </style>