customer-detail.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <ele-drawer
  3. v-model="visible"
  4. title="客户详情"
  5. :size="1080"
  6. style="max-width: 100%"
  7. :body-style="{
  8. height: '100%',
  9. display: 'flex',
  10. 'flex-direction': 'column'
  11. }"
  12. >
  13. <div class="flex items-center">
  14. <el-avatar :size="50" :src="detail.imgPath" />
  15. <el-text style="margin-left: 10px">{{ detail.nickName }}</el-text>
  16. </div>
  17. <div class="flex items-center mb-5 mt-5 ml-3">
  18. <el-statistic :value="detail.restMoney">
  19. <template #title>
  20. <el-text>账户余额</el-text>
  21. </template>
  22. </el-statistic>
  23. <el-statistic :value="detail.orderNum" style="margin-left: 80px">
  24. <template #title>
  25. <el-text>总订单数</el-text>
  26. </template>
  27. </el-statistic>
  28. <el-statistic :value="detail.sellNum" style="margin-left: 80px">
  29. <template #title>
  30. <el-text>卖书订单数</el-text>
  31. </template>
  32. </el-statistic>
  33. <el-statistic :value="detail.buyNum" style="margin-left: 80px">
  34. <template #title>
  35. <el-text>买书订单数</el-text>
  36. </template>
  37. </el-statistic>
  38. </div>
  39. <el-tabs v-model="activeName" class="demo-tabs flex-1">
  40. <el-tab-pane label="用户基础信息" name="baseinfo">
  41. <base-info :detail="detail" />
  42. </el-tab-pane>
  43. <el-tab-pane label="余额变动" name="accountChange">
  44. <account-change :row="currentRow" />
  45. </el-tab-pane>
  46. <el-tab-pane label="扫描记录" name="scanLog">
  47. <scan-log :row="currentRow" />
  48. </el-tab-pane>
  49. <el-tab-pane label="推荐信息" name="recommend">
  50. <recommend-info :row="currentRow" />
  51. </el-tab-pane>
  52. <el-tab-pane label="意见反馈" name="fallback">
  53. <fallback-info :userId="currentRow.id" />
  54. </el-tab-pane>
  55. <el-tab-pane label="搜索记录" name="searchLog">
  56. <search-log :row="currentRow" />
  57. </el-tab-pane>
  58. </el-tabs>
  59. </ele-drawer>
  60. </template>
  61. <script setup>
  62. import baseInfo from '@/views/customer/list/components/detail/base-info.vue';
  63. import accountChange from '@/views/customer/list/components/detail/account-change.vue';
  64. import scanLog from '@/views/customer/list/components/detail/scan-log.vue';
  65. import searchLog from '@/views/customer/list/components/detail/search-log.vue';
  66. import recommendInfo from '@/views/customer/list/components/detail/recommend-info.vue';
  67. import fallbackInfo from '@/views/customer/list/components/detail/fallback-info.vue';
  68. import request from '@/utils/request';
  69. const visible = ref(false);
  70. const activeName = ref('baseinfo');
  71. const currentRow = ref();
  72. function handleOpen(row, tabName) {
  73. visible.value = true;
  74. currentRow.value = row;
  75. nextTick(() => {
  76. activeName.value = tabName || 'baseinfo';
  77. getUserInfo(row.id);
  78. });
  79. }
  80. //获取用户信息
  81. const detail = ref({});
  82. const getUserInfo = (id) => {
  83. request({
  84. url: `/user/userInfo/getInfo/${id}`,
  85. method: 'get'
  86. }).then((res) => {
  87. detail.value = res.data.data;
  88. });
  89. };
  90. //获取用户账户信息
  91. const accountInfo = ref({ restMoney: 0, totalMoney: 0 });
  92. const getAccountInfo = (id) => {
  93. request({
  94. url: `/user/userAccountInfo/getUserAccount/${id}`,
  95. method: 'get'
  96. }).then((res) => {
  97. accountInfo.value = res.data.data;
  98. });
  99. };
  100. defineExpose({
  101. handleOpen
  102. });
  103. </script>