From c445173855aece19a97a548bacad624c8414ad31 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 6 Oct 2023 22:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E8=AE=B0=E5=BD=95=EF=BC=9A?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combination/combinationRecord.ts | 33 ++++ .../promotion/combination/record/index.vue | 158 +++++++++++++++--- 2 files changed, 168 insertions(+), 23 deletions(-) create mode 100644 src/api/mall/promotion/combination/combinationRecord.ts diff --git a/src/api/mall/promotion/combination/combinationRecord.ts b/src/api/mall/promotion/combination/combinationRecord.ts new file mode 100644 index 00000000..c86dd0c1 --- /dev/null +++ b/src/api/mall/promotion/combination/combinationRecord.ts @@ -0,0 +1,33 @@ +import request from '@/config/axios' + +export interface CombinationRecordVO { + id: number // 拼团记录编号 + activityId: number // 拼团活动编号 + nickname: string // 用户昵称 + avatar: string // 用户头像 + headId: number // 团长编号 + expireTime: string // 过期时间 + userSize: number // 可参团人数 + userCount: number // 已参团人数 + status: number // 拼团状态 + spuName: string // 商品名字 + picUrl: string // 商品图片 + virtualGroup: boolean // 是否虚拟成团 + startTime: string // 开始时间 (订单付款后开始的时间) + endTime: string // 结束时间(成团时间/失败时间) +} + +// 查询拼团记录列表 +export const getCombinationRecordPage = async (params) => { + return await request.get({ url: '/promotion/combination-record/page', params }) +} + +// 获得拼团记录的概要信息 +export const getCombinationRecordSummary = async () => { + return await request.get({ url: '/promotion/combination-record/get-summary' }) +} + +// 获得拼团记录分页 tab count +export const getCombinationRecordCount = async () => { + return await request.get({ url: '/promotion/combination-record/get-count' }) +} diff --git a/src/views/mall/promotion/combination/record/index.vue b/src/views/mall/promotion/combination/record/index.vue index 8f4489b8..08f92fd8 100644 --- a/src/views/mall/promotion/combination/record/index.vue +++ b/src/views/mall/promotion/combination/record/index.vue @@ -12,7 +12,12 @@
参与人数(个)
- +
@@ -28,7 +33,33 @@
成团数量(个)
- + +
+ + + + + +
+
+ +
+
+
虚拟成团(个)
+
@@ -38,19 +69,7 @@
- 时间选择: - - 全部 - 今天 - 昨天 - 最近七天 - 最近30天 - 本月 - 本年 - -
-
- 时间区间选择: + 时间段: -
-
- 拼团状态: + 拼团状态:
+ + + @@ -133,25 +158,112 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { dateFormatter } from '@/utils/formatTime' import { createImageViewer } from '@/components/ImageViewer' +import * as CombinationRecordApi from '@/api/mall/promotion/combination/combinationRecord' +import { TabsPaneContext } from 'element-plus' defineOptions({ name: 'CombinationRecord' }) const queryParams = ref({ + dateType: 0, // 日期类型 status: undefined, // 拼团状态 createTime: undefined, // 创建时间 pageSize: 10, pageNo: 1 }) -const loading = ref(false) // 列表的加载中 +const loading = ref(true) // 列表的加载中 const total = ref(0) // 总记录数 const pageList = ref([]) // 分页数据 -/** - * 获取分页数据 - */ -const getList = async () => {} +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const data = await CombinationRecordApi.getCombinationRecordPage(queryParams.value) + pageList.value = data.list + total.value = data.total + } finally { + loading.value = false + } +} +// 拼团统计数据 +const recordSummary = ref({ + successCount: 0, + userCount: 0, + virtualGroupCount: 0 +}) +/** 获得拼团记录统计信息 */ +const getSummary = async () => { + recordSummary.value = await CombinationRecordApi.getCombinationRecordSummary() +} + +// tabs 数据 +const tabsData = ref([ + { + count: 0, + name: '全部', + type: 'all', + value: 0 + }, + { + count: 0, + name: '今天', + type: 'toDay', + value: 1 + }, + { + count: 0, + name: '昨天', + type: 'yesterday', + value: 2 + }, + { + count: 0, + name: '最近七天', + type: 'lastSevenDays', + value: 3 + }, + { + count: 0, + name: '最近30天', + type: 'last30Days', + value: 4 + }, + { + count: 0, + name: '本月', + type: 'thisMonth', + value: 5 + }, + { + count: 0, + name: '今年', + type: 'thisYear', + value: 6 + } +]) + +/** 获得每个 Tab 的数量 */ +const getTabsCount = async () => { + const res = await CombinationRecordApi.getCombinationRecordCount() + tabsData.value.forEach((tab) => { + tab.count = res[tab.type] + }) +} + +const handleTabClick = async (tab: TabsPaneContext) => { + queryParams.value.dateType = tab.paneName as number + await getList() +} + /** 商品图预览 */ const imagePreview = (imgUrl: string) => { createImageViewer({ urlList: [imgUrl] }) } + +/** 初始化 **/ +onMounted(async () => { + await getSummary() + await getTabsCount() + await getList() +})