promotion:新增砍价记录列表

This commit is contained in:
YunaiV 2023-10-05 12:06:57 +08:00
parent 42f0bf07f0
commit 860872a890
5 changed files with 220 additions and 3 deletions

View File

@ -0,0 +1,19 @@
import request from '@/config/axios'
export interface BargainRecordVO {
id: number
activityId: number
userId: number
spuId: number
skuId: number
bargainFirstPrice: number
bargainPrice: number
status: number
orderId: number
endTime: Date
}
// 查询砍价记录列表
export const getBargainRecordPage = async (params) => {
return await request.get({ url: `/promotion/bargain-record/page`, params })
}

View File

@ -2,6 +2,8 @@ import request from '@/config/axios'
import dayjs from 'dayjs'
import { formatDate } from '@/utils/formatTime'
// todo @疯狂:挪到 mall 里哈
/** 交易统计对照 Response VO */
export interface TradeStatisticsComparisonRespVO<T> {
value: T

View File

@ -180,5 +180,6 @@ export enum DICT_TYPE {
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
PROMOTION_CONDITION_TYPE = 'promotion_condition_type' // 营销的条件类型枚举
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status' // 砍价记录的状态
}

View File

@ -6,7 +6,7 @@ export const rules = reactive({
name: [required],
startTime: [required],
endTime: [required],
userSize: [required],
helpMaxCount: [required],
bargainCount: [required],
singleLimitCount: [required]
})
@ -72,7 +72,7 @@ const crudSchemas = reactive<CrudSchema[]>([
},
{
label: '砍价人数',
field: 'userSize',
field: 'helpMaxCount',
isSearch: false,
form: {
component: 'InputNumber',

View File

@ -0,0 +1,195 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="砍价状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择砍价状态"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_BARGAIN_RECORD_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['promotion:bargain-record:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['promotion:bargain-record:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" min-width="50" prop="id" />
<el-table-column label="发起用户" min-width="120">
<template #default="scope">
<el-image
:src="scope.row.avatar"
class="h-20px w-20px"
:preview-src-list="[scope.row.avatar]"
preview-teleported
/>
{{ scope.row.nickname }}
</template>
</el-table-column>
<el-table-column
label="发起时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="砍价活动" min-width="150" prop="activity.name" />
<el-table-column
label="最低价"
min-width="100"
prop="activity.bargainMinPrice"
:formatter="fenToYuanFormat"
/>
<el-table-column
label="当前价"
min-width="100"
prop="bargainPrice"
:formatter="fenToYuanFormat"
/>
<el-table-column label="总砍价次数" min-width="100" prop="activity.helpMaxCount" />
<el-table-column label="剩余砍价次数" min-width="100" prop="helpCount" />
<el-table-column label="砍价状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_BARGAIN_RECORD_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
label="结束时间"
align="center"
prop="endTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="订单编号" align="center" prop="orderId" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['promotion:bargain-record:update']"
>
编辑
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<!-- <BargainRecordForm ref="formRef" @success="getList" />-->
</template>
<script setup lang="ts">
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'
defineOptions({ name: 'PromotionBargainRecord' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
status: null,
createTime: []
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await BargainRecordApi.getBargainRecordPage(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()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>