Skip to content

Commit 860872a

Browse files
committed
promotion:新增砍价记录列表
1 parent 42f0bf0 commit 860872a

File tree

5 files changed

+220
-3
lines changed

5 files changed

+220
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import request from '@/config/axios'
2+
3+
export interface BargainRecordVO {
4+
id: number
5+
activityId: number
6+
userId: number
7+
spuId: number
8+
skuId: number
9+
bargainFirstPrice: number
10+
bargainPrice: number
11+
status: number
12+
orderId: number
13+
endTime: Date
14+
}
15+
16+
// 查询砍价记录列表
17+
export const getBargainRecordPage = async (params) => {
18+
return await request.get({ url: `/promotion/bargain-record/page`, params })
19+
}

src/api/statistics/trade.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import request from '@/config/axios'
22
import dayjs from 'dayjs'
33
import { formatDate } from '@/utils/formatTime'
44

5+
// todo @疯狂:挪到 mall 里哈
6+
57
/** 交易统计对照 Response VO */
68
export interface TradeStatisticsComparisonRespVO<T> {
79
value: T

src/utils/dict.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,6 @@ export enum DICT_TYPE {
180180
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
181181
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
182182
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
183-
PROMOTION_CONDITION_TYPE = 'promotion_condition_type' // 营销的条件类型枚举
183+
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
184+
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status' // 砍价记录的状态
184185
}

src/views/mall/promotion/bargain/activity/bargainActivity.data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const rules = reactive({
66
name: [required],
77
startTime: [required],
88
endTime: [required],
9-
userSize: [required],
9+
helpMaxCount: [required],
1010
bargainCount: [required],
1111
singleLimitCount: [required]
1212
})
@@ -72,7 +72,7 @@ const crudSchemas = reactive<CrudSchema[]>([
7272
},
7373
{
7474
label: '砍价人数',
75-
field: 'userSize',
75+
field: 'helpMaxCount',
7676
isSearch: false,
7777
form: {
7878
component: 'InputNumber',
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
<template>
2+
<ContentWrap>
3+
<!-- 搜索工作栏 -->
4+
<el-form
5+
class="-mb-15px"
6+
:model="queryParams"
7+
ref="queryFormRef"
8+
:inline="true"
9+
label-width="68px"
10+
>
11+
<el-form-item label="砍价状态" prop="status">
12+
<el-select
13+
v-model="queryParams.status"
14+
placeholder="请选择砍价状态"
15+
clearable
16+
class="!w-240px"
17+
>
18+
<el-option
19+
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_BARGAIN_RECORD_STATUS)"
20+
:key="dict.value"
21+
:label="dict.label"
22+
:value="dict.value"
23+
/>
24+
</el-select>
25+
</el-form-item>
26+
<el-form-item label="创建时间" prop="createTime">
27+
<el-date-picker
28+
v-model="queryParams.createTime"
29+
value-format="YYYY-MM-DD HH:mm:ss"
30+
type="daterange"
31+
start-placeholder="开始日期"
32+
end-placeholder="结束日期"
33+
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
34+
class="!w-240px"
35+
/>
36+
</el-form-item>
37+
<el-form-item>
38+
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
39+
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
40+
<el-button
41+
type="primary"
42+
plain
43+
@click="openForm('create')"
44+
v-hasPermi="['promotion:bargain-record:create']"
45+
>
46+
<Icon icon="ep:plus" class="mr-5px" /> 新增
47+
</el-button>
48+
<el-button
49+
type="success"
50+
plain
51+
@click="handleExport"
52+
:loading="exportLoading"
53+
v-hasPermi="['promotion:bargain-record:export']"
54+
>
55+
<Icon icon="ep:download" class="mr-5px" /> 导出
56+
</el-button>
57+
</el-form-item>
58+
</el-form>
59+
</ContentWrap>
60+
61+
<!-- 列表 -->
62+
<ContentWrap>
63+
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
64+
<el-table-column label="编号" min-width="50" prop="id" />
65+
<el-table-column label="发起用户" min-width="120">
66+
<template #default="scope">
67+
<el-image
68+
:src="scope.row.avatar"
69+
class="h-20px w-20px"
70+
:preview-src-list="[scope.row.avatar]"
71+
preview-teleported
72+
/>
73+
{{ scope.row.nickname }}
74+
</template>
75+
</el-table-column>
76+
<el-table-column
77+
label="发起时间"
78+
align="center"
79+
prop="createTime"
80+
:formatter="dateFormatter"
81+
width="180px"
82+
/>
83+
<el-table-column label="砍价活动" min-width="150" prop="activity.name" />
84+
<el-table-column
85+
label="最低价"
86+
min-width="100"
87+
prop="activity.bargainMinPrice"
88+
:formatter="fenToYuanFormat"
89+
/>
90+
<el-table-column
91+
label="当前价"
92+
min-width="100"
93+
prop="bargainPrice"
94+
:formatter="fenToYuanFormat"
95+
/>
96+
<el-table-column label="总砍价次数" min-width="100" prop="activity.helpMaxCount" />
97+
<el-table-column label="剩余砍价次数" min-width="100" prop="helpCount" />
98+
<el-table-column label="砍价状态" align="center" prop="status">
99+
<template #default="scope">
100+
<dict-tag :type="DICT_TYPE.PROMOTION_BARGAIN_RECORD_STATUS" :value="scope.row.status" />
101+
</template>
102+
</el-table-column>
103+
<el-table-column
104+
label="结束时间"
105+
align="center"
106+
prop="endTime"
107+
:formatter="dateFormatter"
108+
width="180px"
109+
/>
110+
<el-table-column label="订单编号" align="center" prop="orderId" />
111+
<el-table-column label="操作" align="center">
112+
<template #default="scope">
113+
<el-button
114+
link
115+
type="primary"
116+
@click="openForm('update', scope.row.id)"
117+
v-hasPermi="['promotion:bargain-record:update']"
118+
>
119+
编辑
120+
</el-button>
121+
</template>
122+
</el-table-column>
123+
</el-table>
124+
<!-- 分页 -->
125+
<Pagination
126+
:total="total"
127+
v-model:page="queryParams.pageNo"
128+
v-model:limit="queryParams.pageSize"
129+
@pagination="getList"
130+
/>
131+
</ContentWrap>
132+
133+
<!-- 表单弹窗:添加/修改 -->
134+
<!-- <BargainRecordForm ref="formRef" @success="getList" />-->
135+
</template>
136+
137+
<script setup lang="ts">
138+
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
139+
import { dateFormatter } from '@/utils/formatTime'
140+
import * as BargainRecordApi from '@/api/mall/promotion/bargain/bargainRecord'
141+
import { fenToYuanFormat } from '@/utils/formatter'
142+
// import BargainRecordForm from './BargainRecordForm.vue'
143+
144+
defineOptions({ name: 'PromotionBargainRecord' })
145+
146+
const message = useMessage() // 消息弹窗
147+
const { t } = useI18n() // 国际化
148+
149+
const loading = ref(true) // 列表的加载中
150+
const total = ref(0) // 列表的总页数
151+
const list = ref([]) // 列表的数据
152+
const queryParams = reactive({
153+
pageNo: 1,
154+
pageSize: 10,
155+
status: null,
156+
createTime: []
157+
})
158+
const queryFormRef = ref() // 搜索的表单
159+
const exportLoading = ref(false) // 导出的加载中
160+
161+
/** 查询列表 */
162+
const getList = async () => {
163+
loading.value = true
164+
try {
165+
const data = await BargainRecordApi.getBargainRecordPage(queryParams)
166+
list.value = data.list
167+
total.value = data.total
168+
} finally {
169+
loading.value = false
170+
}
171+
}
172+
173+
/** 搜索按钮操作 */
174+
const handleQuery = () => {
175+
queryParams.pageNo = 1
176+
getList()
177+
}
178+
179+
/** 重置按钮操作 */
180+
const resetQuery = () => {
181+
queryFormRef.value.resetFields()
182+
handleQuery()
183+
}
184+
185+
/** 添加/修改操作 */
186+
const formRef = ref()
187+
const openForm = (type: string, id?: number) => {
188+
formRef.value.open(type, id)
189+
}
190+
191+
/** 初始化 **/
192+
onMounted(() => {
193+
getList()
194+
})
195+
</script>

0 commit comments

Comments
 (0)