|
12 | 12 | </div>
|
13 | 13 | <div class="ml-[20px]">
|
14 | 14 | <div class="mb-8px text-14px text-gray-400">参与人数(个)</div>
|
15 |
| - <CountTo :duration="2600" :end-val="2200" :start-val="0" class="text-20px" /> |
| 15 | + <CountTo |
| 16 | + :duration="2600" |
| 17 | + :end-val="recordSummary.userCount" |
| 18 | + :start-val="0" |
| 19 | + class="text-20px" |
| 20 | + /> |
16 | 21 | </div>
|
17 | 22 | </div>
|
18 | 23 | </ContentWrap>
|
|
28 | 33 | </div>
|
29 | 34 | <div class="ml-[20px]">
|
30 | 35 | <div class="mb-8px text-14px text-gray-400">成团数量(个)</div>
|
31 |
| - <CountTo :duration="2600" :end-val="2200" :start-val="0" class="text-20px" /> |
| 36 | + <CountTo |
| 37 | + :duration="2600" |
| 38 | + :end-val="recordSummary.successCount" |
| 39 | + :start-val="0" |
| 40 | + class="text-20px" |
| 41 | + /> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + </ContentWrap> |
| 45 | + </el-col> |
| 46 | + <el-col :span="6"> |
| 47 | + <ContentWrap class="h-[110px]"> |
| 48 | + <div class="flex items-center"> |
| 49 | + <div |
| 50 | + class="h-[50px] w-[50px] flex items-center justify-center" |
| 51 | + style="color: rgb(162, 119, 255); background-color: rgba(162, 119, 255, 0.1)" |
| 52 | + > |
| 53 | + <Icon :size="23" icon="fa:user-plus" /> |
| 54 | + </div> |
| 55 | + <div class="ml-[20px]"> |
| 56 | + <div class="mb-8px text-14px text-gray-400">虚拟成团(个)</div> |
| 57 | + <CountTo |
| 58 | + :duration="2600" |
| 59 | + :end-val="recordSummary.virtualGroupCount" |
| 60 | + :start-val="0" |
| 61 | + class="text-20px" |
| 62 | + /> |
32 | 63 | </div>
|
33 | 64 | </div>
|
34 | 65 | </ContentWrap>
|
|
38 | 69 | <ContentWrap>
|
39 | 70 | <!-- 检索条件 -->
|
40 | 71 | <div class="mb-[10px]">
|
41 |
| - <span class="font-size-[14px]" style="font-weight: bold; color: #606266">时间选择:</span> |
42 |
| - <el-button-group class="ml-[10px]"> |
43 |
| - <el-button>全部</el-button> |
44 |
| - <el-button>今天</el-button> |
45 |
| - <el-button>昨天</el-button> |
46 |
| - <el-button>最近七天</el-button> |
47 |
| - <el-button>最近30天</el-button> |
48 |
| - <el-button>本月</el-button> |
49 |
| - <el-button>本年</el-button> |
50 |
| - </el-button-group> |
51 |
| - </div> |
52 |
| - <div class="mb-[10px]"> |
53 |
| - <span class="font-size-[14px]" style="font-weight: bold; color: #606266">时间区间选择:</span> |
| 72 | + <span class="font-size-[14px]" style="font-weight: bold; color: #606266">时间段:</span> |
54 | 73 | <el-date-picker
|
55 | 74 | v-model="queryParams.createTime"
|
56 | 75 | :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
60 | 79 | type="daterange"
|
61 | 80 | value-format="YYYY-MM-DD HH:mm:ss"
|
62 | 81 | />
|
63 |
| - </div> |
64 |
| - <div class="mb-[10px]"> |
65 |
| - <span class="font-size-[14px]" style="font-weight: bold; color: #606266">拼团状态:</span> |
| 82 | + <span class="ml-[10px] font-size-[14px] font-bold" style="color: #606266">拼团状态:</span> |
66 | 83 | <el-select v-model="queryParams.status" class="!w-240px" clearable placeholder="全部">
|
67 | 84 | <el-option
|
68 | 85 | v-for="(dict, index) in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
|
73 | 90 | </el-select>
|
74 | 91 | </div>
|
75 | 92 | <!-- 分页列表数据展示 -->
|
| 93 | + <el-tabs v-model="queryParams.dateType" @tab-click="handleTabClick"> |
| 94 | + <el-tab-pane |
| 95 | + v-for="item in tabsData" |
| 96 | + :key="item.type" |
| 97 | + :label="item.name + '(' + item.count + ')'" |
| 98 | + :name="item.value" |
| 99 | + /> |
| 100 | + </el-tabs> |
76 | 101 | <el-table v-loading="loading" :data="pageList">
|
77 | 102 | <el-table-column align="center" label="编号" prop="id" />
|
78 | 103 | <!-- TODO 是否需要做一个点击用户头像跳转或查看用户信息的功能 -->
|
|
133 | 158 | import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
134 | 159 | import { dateFormatter } from '@/utils/formatTime'
|
135 | 160 | import { createImageViewer } from '@/components/ImageViewer'
|
| 161 | +import * as CombinationRecordApi from '@/api/mall/promotion/combination/combinationRecord' |
| 162 | +import { TabsPaneContext } from 'element-plus' |
136 | 163 |
|
137 | 164 | defineOptions({ name: 'CombinationRecord' })
|
138 | 165 | const queryParams = ref({
|
| 166 | + dateType: 0, // 日期类型 |
139 | 167 | status: undefined, // 拼团状态
|
140 | 168 | createTime: undefined, // 创建时间
|
141 | 169 | pageSize: 10,
|
142 | 170 | pageNo: 1
|
143 | 171 | })
|
144 |
| -const loading = ref(false) // 列表的加载中 |
| 172 | +const loading = ref(true) // 列表的加载中 |
145 | 173 | const total = ref(0) // 总记录数
|
146 | 174 | const pageList = ref([]) // 分页数据
|
147 |
| -/** |
148 |
| - * 获取分页数据 |
149 |
| - */ |
150 |
| -const getList = async () => {} |
| 175 | +/** 查询列表 */ |
| 176 | +const getList = async () => { |
| 177 | + loading.value = true |
| 178 | + try { |
| 179 | + const data = await CombinationRecordApi.getCombinationRecordPage(queryParams.value) |
| 180 | + pageList.value = data.list |
| 181 | + total.value = data.total |
| 182 | + } finally { |
| 183 | + loading.value = false |
| 184 | + } |
| 185 | +} |
| 186 | +// 拼团统计数据 |
| 187 | +const recordSummary = ref({ |
| 188 | + successCount: 0, |
| 189 | + userCount: 0, |
| 190 | + virtualGroupCount: 0 |
| 191 | +}) |
| 192 | +/** 获得拼团记录统计信息 */ |
| 193 | +const getSummary = async () => { |
| 194 | + recordSummary.value = await CombinationRecordApi.getCombinationRecordSummary() |
| 195 | +} |
| 196 | +
|
| 197 | +// tabs 数据 |
| 198 | +const tabsData = ref([ |
| 199 | + { |
| 200 | + count: 0, |
| 201 | + name: '全部', |
| 202 | + type: 'all', |
| 203 | + value: 0 |
| 204 | + }, |
| 205 | + { |
| 206 | + count: 0, |
| 207 | + name: '今天', |
| 208 | + type: 'toDay', |
| 209 | + value: 1 |
| 210 | + }, |
| 211 | + { |
| 212 | + count: 0, |
| 213 | + name: '昨天', |
| 214 | + type: 'yesterday', |
| 215 | + value: 2 |
| 216 | + }, |
| 217 | + { |
| 218 | + count: 0, |
| 219 | + name: '最近七天', |
| 220 | + type: 'lastSevenDays', |
| 221 | + value: 3 |
| 222 | + }, |
| 223 | + { |
| 224 | + count: 0, |
| 225 | + name: '最近30天', |
| 226 | + type: 'last30Days', |
| 227 | + value: 4 |
| 228 | + }, |
| 229 | + { |
| 230 | + count: 0, |
| 231 | + name: '本月', |
| 232 | + type: 'thisMonth', |
| 233 | + value: 5 |
| 234 | + }, |
| 235 | + { |
| 236 | + count: 0, |
| 237 | + name: '今年', |
| 238 | + type: 'thisYear', |
| 239 | + value: 6 |
| 240 | + } |
| 241 | +]) |
| 242 | +
|
| 243 | +/** 获得每个 Tab 的数量 */ |
| 244 | +const getTabsCount = async () => { |
| 245 | + const res = await CombinationRecordApi.getCombinationRecordCount() |
| 246 | + tabsData.value.forEach((tab) => { |
| 247 | + tab.count = res[tab.type] |
| 248 | + }) |
| 249 | +} |
| 250 | +
|
| 251 | +const handleTabClick = async (tab: TabsPaneContext) => { |
| 252 | + queryParams.value.dateType = tab.paneName as number |
| 253 | + await getList() |
| 254 | +} |
| 255 | +
|
151 | 256 | /** 商品图预览 */
|
152 | 257 | const imagePreview = (imgUrl: string) => {
|
153 | 258 | createImageViewer({
|
154 | 259 | urlList: [imgUrl]
|
155 | 260 | })
|
156 | 261 | }
|
| 262 | +
|
| 263 | +/** 初始化 **/ |
| 264 | +onMounted(async () => { |
| 265 | + await getSummary() |
| 266 | + await getTabsCount() |
| 267 | + await getList() |
| 268 | +}) |
157 | 269 | </script>
|
0 commit comments