promotion:新增记录记录列表

This commit is contained in:
YunaiV 2023-10-05 12:42:00 +08:00
parent 860872a890
commit cf7ac2cb10
4 changed files with 116 additions and 13 deletions

View File

@ -7,17 +7,16 @@ export interface BargainActivityVO {
startTime?: Date
endTime?: Date
status?: number
userSize?: number // 达到该人数,才能砍到低价
helpMaxCount?: number // 达到该人数,才能砍到低价
bargainCount?: number // 最大帮砍次数
totalLimitCount?: number // 最大购买次数
spuId: number
skuId: number
bargainFirstPrice: number // 砍价起始价格,单位分
bargainPrice: number // 砍价底价
bargainMinPrice: number // 砍价底价
stock: number // 活动库存
randomMinPrice?: number // 用户每次砍价的最小金额,单位:分
randomMaxPrice?: number // 用户每次砍价的最大金额,单位:分
successCount?: number // 砍价成功数量
}
// 砍价活动所需属性。选择的商品和属性的时候使用方便使用活动的通用封装

View File

@ -0,0 +1,14 @@
import request from '@/config/axios'
export interface BargainHelpVO {
id: number
record: number
userId: number
reducePrice: number
endTime: Date
}
// 查询砍价记录列表
export const getBargainHelpPage = async (params) => {
return await request.get({ url: `/promotion/bargain-help/page`, params })
}

View File

@ -0,0 +1,90 @@
<template>
<Dialog v-model="dialogVisible" title="助力列表">
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="用户编号" prop="userId" min-width="80px" />
<el-table-column label="用户头像" prop="avatar" min-width="80px">
<template #default="scope">
<el-avatar :src="scope.row.avatar" />
</template>
</el-table-column>
<el-table-column label="用户昵称" prop="nickname" min-width="100px" />
<el-table-column
label="砍价金额"
prop="reducePrice"
min-width="100px"
:formatter="fenToYuanFormat"
/>
<el-table-column
label="助力时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
</Dialog>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import * as BargainHelpApi from '@/api/mall/promotion/bargain/bargainHelp'
import { fenToYuanFormat } from '@/utils/formatter'
/** 助力列表 */
defineOptions({ name: 'BargainRecordListDialog' })
const message = useMessage() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
recordId: undefined
})
const queryFormRef = ref() //
/** 打开弹窗 */
const dialogVisible = ref(false) //
const open = async (recordId: any) => {
dialogVisible.value = true
queryParams.recordId = recordId
resetQuery()
}
defineExpose({ open }) // open
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await BargainHelpApi.getBargainHelpPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields()
handleQuery()
}
</script>

View File

@ -113,10 +113,10 @@
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['promotion:bargain-record:update']"
@click="openRecordListDialog(scope.row.id)"
v-hasPermi="['promotion:bargain-help:query']"
>
编辑
助力
</el-button>
</template>
</el-table-column>
@ -130,8 +130,8 @@
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<!-- <BargainRecordForm ref="formRef" @success="getList" />-->
<!-- 表单弹窗 -->
<BargainRecordListDialog ref="recordListDialogRef" />
</template>
<script setup lang="ts">
@ -139,7 +139,7 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import * as BargainRecordApi from '@/api/mall/promotion/bargain/bargainRecord'
import { fenToYuanFormat } from '@/utils/formatter'
// import BargainRecordForm from './BargainRecordForm.vue'
import BargainRecordListDialog from './BargainRecordListDialog.vue'
defineOptions({ name: 'PromotionBargainRecord' })
@ -182,10 +182,10 @@ const resetQuery = () => {
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
/** 打开[助力]弹窗 */
const recordListDialogRef = ref()
const openRecordListDialog = (id?: number) => {
recordListDialogRef.value.open(id)
}
/** 初始化 **/