Skip to content

Commit cf7ac2c

Browse files
committed
promotion:新增记录记录列表
1 parent 860872a commit cf7ac2c

File tree

4 files changed

+116
-13
lines changed

4 files changed

+116
-13
lines changed

src/api/mall/promotion/bargain/bargainActivity.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ export interface BargainActivityVO {
77
startTime?: Date
88
endTime?: Date
99
status?: number
10-
userSize?: number // 达到该人数,才能砍到低价
10+
helpMaxCount?: number // 达到该人数,才能砍到低价
1111
bargainCount?: number // 最大帮砍次数
1212
totalLimitCount?: number // 最大购买次数
1313
spuId: number
1414
skuId: number
1515
bargainFirstPrice: number // 砍价起始价格,单位分
16-
bargainPrice: number // 砍价底价
16+
bargainMinPrice: number // 砍价底价
1717
stock: number // 活动库存
1818
randomMinPrice?: number // 用户每次砍价的最小金额,单位:分
1919
randomMaxPrice?: number // 用户每次砍价的最大金额,单位:分
20-
successCount?: number // 砍价成功数量
2120
}
2221

2322
// 砍价活动所需属性。选择的商品和属性的时候使用方便使用活动的通用封装
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import request from '@/config/axios'
2+
3+
export interface BargainHelpVO {
4+
id: number
5+
record: number
6+
userId: number
7+
reducePrice: number
8+
endTime: Date
9+
}
10+
11+
// 查询砍价记录列表
12+
export const getBargainHelpPage = async (params) => {
13+
return await request.get({ url: `/promotion/bargain-help/page`, params })
14+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<template>
2+
<Dialog v-model="dialogVisible" title="助力列表">
3+
<!-- 列表 -->
4+
<ContentWrap>
5+
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
6+
<el-table-column label="用户编号" prop="userId" min-width="80px" />
7+
<el-table-column label="用户头像" prop="avatar" min-width="80px">
8+
<template #default="scope">
9+
<el-avatar :src="scope.row.avatar" />
10+
</template>
11+
</el-table-column>
12+
<el-table-column label="用户昵称" prop="nickname" min-width="100px" />
13+
<el-table-column
14+
label="砍价金额"
15+
prop="reducePrice"
16+
min-width="100px"
17+
:formatter="fenToYuanFormat"
18+
/>
19+
<el-table-column
20+
label="助力时间"
21+
align="center"
22+
prop="createTime"
23+
:formatter="dateFormatter"
24+
width="180px"
25+
/>
26+
</el-table>
27+
<!-- 分页 -->
28+
<Pagination
29+
:total="total"
30+
v-model:page="queryParams.pageNo"
31+
v-model:limit="queryParams.pageSize"
32+
@pagination="getList"
33+
/>
34+
</ContentWrap>
35+
</Dialog>
36+
</template>
37+
38+
<script setup lang="ts">
39+
import { dateFormatter } from '@/utils/formatTime'
40+
import * as BargainHelpApi from '@/api/mall/promotion/bargain/bargainHelp'
41+
import { fenToYuanFormat } from '@/utils/formatter'
42+
43+
/** 助力列表 */
44+
defineOptions({ name: 'BargainRecordListDialog' })
45+
46+
const message = useMessage() // 消息弹窗
47+
48+
const loading = ref(true) // 列表的加载中
49+
const total = ref(0) // 列表的总页数
50+
const list = ref([]) // 列表的数据
51+
const queryParams = reactive({
52+
pageNo: 1,
53+
pageSize: 10,
54+
recordId: undefined
55+
})
56+
const queryFormRef = ref() // 搜索的表单
57+
58+
/** 打开弹窗 */
59+
const dialogVisible = ref(false) // 弹窗的是否展示
60+
const open = async (recordId: any) => {
61+
dialogVisible.value = true
62+
queryParams.recordId = recordId
63+
resetQuery()
64+
}
65+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
66+
67+
/** 查询列表 */
68+
const getList = async () => {
69+
loading.value = true
70+
try {
71+
const data = await BargainHelpApi.getBargainHelpPage(queryParams)
72+
list.value = data.list
73+
total.value = data.total
74+
} finally {
75+
loading.value = false
76+
}
77+
}
78+
79+
/** 搜索按钮操作 */
80+
const handleQuery = () => {
81+
queryParams.pageNo = 1
82+
getList()
83+
}
84+
85+
/** 重置按钮操作 */
86+
const resetQuery = () => {
87+
queryFormRef.value?.resetFields()
88+
handleQuery()
89+
}
90+
</script>

src/views/mall/promotion/bargain/record/index.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@
113113
<el-button
114114
link
115115
type="primary"
116-
@click="openForm('update', scope.row.id)"
117-
v-hasPermi="['promotion:bargain-record:update']"
116+
@click="openRecordListDialog(scope.row.id)"
117+
v-hasPermi="['promotion:bargain-help:query']"
118118
>
119-
编辑
119+
助力
120120
</el-button>
121121
</template>
122122
</el-table-column>
@@ -130,16 +130,16 @@
130130
/>
131131
</ContentWrap>
132132

133-
<!-- 表单弹窗:添加/修改 -->
134-
<!-- <BargainRecordForm ref="formRef" @success="getList" />-->
133+
<!-- 表单弹窗 -->
134+
<BargainRecordListDialog ref="recordListDialogRef" />
135135
</template>
136136

137137
<script setup lang="ts">
138138
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
139139
import { dateFormatter } from '@/utils/formatTime'
140140
import * as BargainRecordApi from '@/api/mall/promotion/bargain/bargainRecord'
141141
import { fenToYuanFormat } from '@/utils/formatter'
142-
// import BargainRecordForm from './BargainRecordForm.vue'
142+
import BargainRecordListDialog from './BargainRecordListDialog.vue'
143143
144144
defineOptions({ name: 'PromotionBargainRecord' })
145145
@@ -182,10 +182,10 @@ const resetQuery = () => {
182182
handleQuery()
183183
}
184184
185-
/** 添加/修改操作 */
186-
const formRef = ref()
187-
const openForm = (type: string, id?: number) => {
188-
formRef.value.open(type, id)
185+
/** 打开[助力]弹窗 */
186+
const recordListDialogRef = ref()
187+
const openRecordListDialog = (id?: number) => {
188+
recordListDialogRef.value.open(id)
189189
}
190190
191191
/** 初始化 **/

0 commit comments

Comments
 (0)