MemberFunnelCard.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <el-card shadow="never">
  3. <template #header>
  4. <div class="my--1.5 flex flex-row items-center justify-between">
  5. <CardTitle title="会员概览" />
  6. <!-- 查询条件 -->
  7. <ShortcutDateRangePicker @change="handleTimeRangeChange" />
  8. </div>
  9. </template>
  10. <div class="min-w-225 py-1.75" v-loading="loading">
  11. <div class="relative h-24 flex">
  12. <div class="h-full w-75% bg-blue-50 <lg:w-35% <xl:w-55%">
  13. <div class="ml-15 h-full flex flex-col justify-center">
  14. <div class="font-bold">
  15. 注册用户数量:{{ analyseData?.comparison?.value?.registerUserCount || 0 }}
  16. </div>
  17. <div class="mt-2 text-3.5">
  18. 环比增长率:{{
  19. calculateRelativeRate(
  20. analyseData?.comparison?.value?.registerUserCount,
  21. analyseData?.comparison?.reference?.registerUserCount
  22. )
  23. }}%
  24. </div>
  25. </div>
  26. </div>
  27. <div
  28. class="trapezoid1 ml--38.5 mt-1.5 h-full w-77 flex flex-col items-center justify-center bg-blue-5 text-3.5 text-white"
  29. >
  30. <span class="text-6 font-bold">{{ analyseData?.visitUserCount || 0 }}</span>
  31. <span>访客</span>
  32. </div>
  33. </div>
  34. <div class="relative h-24 flex">
  35. <div class="h-full w-75% flex bg-cyan-50 <lg:w-35% <xl:w-55%">
  36. <div class="ml-15 h-full flex flex-col justify-center">
  37. <div class="font-bold">
  38. 活跃用户数量:{{ analyseData?.comparison?.value?.visitUserCount || 0 }}
  39. </div>
  40. <div class="mt-2 text-3.5">
  41. 环比增长率:{{
  42. calculateRelativeRate(
  43. analyseData?.comparison?.value?.visitUserCount,
  44. analyseData?.comparison?.reference?.visitUserCount
  45. )
  46. }}%
  47. </div>
  48. </div>
  49. </div>
  50. <div
  51. class="trapezoid2 ml--28 mt-1.7 h-25 w-56 flex flex-col items-center justify-center bg-cyan-5 text-3.5 text-white"
  52. >
  53. <span class="text-6 font-bold">{{ analyseData?.orderUserCount || 0 }}</span>
  54. <span>下单</span>
  55. </div>
  56. </div>
  57. <div class="relative h-24 flex">
  58. <div class="w-75% flex bg-slate-50 <lg:w-35% <xl:w-55%">
  59. <div class="ml-15 h-full flex flex-row gap-x-16">
  60. <div class="flex flex-col justify-center">
  61. <div class="font-bold">
  62. 充值用户数量:{{ analyseData?.comparison?.value?.rechargeUserCount || 0 }}
  63. </div>
  64. <div class="mt-2 text-3.5">
  65. 环比增长率:{{
  66. calculateRelativeRate(
  67. analyseData?.comparison?.value?.rechargeUserCount,
  68. analyseData?.comparison?.reference?.rechargeUserCount
  69. )
  70. }}%
  71. </div>
  72. </div>
  73. <div class="flex flex-col justify-center">
  74. <div class="font-bold">客单价:{{ fenToYuan(analyseData?.atv || 0) }}</div>
  75. </div>
  76. </div>
  77. </div>
  78. <div
  79. class="trapezoid3 ml--18 mt-3.25 h-23 w-36 flex flex-col items-center justify-center bg-slate-5 text-3.5 text-white"
  80. >
  81. <span class="text-6 font-bold">{{ analyseData?.payUserCount || 0 }}</span>
  82. <span>成交用户</span>
  83. </div>
  84. </div>
  85. </div>
  86. </el-card>
  87. </template>
  88. <script lang="ts" setup>
  89. import * as MemberStatisticsApi from '@/api/mall/statistics/member'
  90. import dayjs from 'dayjs'
  91. import { calculateRelativeRate, fenToYuan } from '@/utils'
  92. import { MemberAnalyseRespVO } from '@/api/mall/statistics/member'
  93. import { CardTitle } from '@/components/Card'
  94. /** 会员概览卡片 */
  95. defineOptions({ name: 'MemberFunnelCard' })
  96. const loading = ref(true) // 加载中
  97. const analyseData = ref<MemberAnalyseRespVO>() // 会员分析数据
  98. /** 查询会员概览数据列表 */
  99. const handleTimeRangeChange = async (times: [dayjs.ConfigType, dayjs.ConfigType]) => {
  100. loading.value = true
  101. // 查询数据
  102. analyseData.value = await MemberStatisticsApi.getMemberAnalyse({ times })
  103. loading.value = false
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .trapezoid1 {
  108. transform: perspective(5em) rotateX(-11deg);
  109. }
  110. .trapezoid2 {
  111. transform: perspective(7em) rotateX(-20deg);
  112. }
  113. .trapezoid3 {
  114. transform: perspective(3em) rotateX(-13deg);
  115. }
  116. </style>