新增用户详情下成长值页面。

This commit is contained in:
绮梦 2023-09-04 15:02:41 +08:00
parent 130208959d
commit fe6cf7ce98
4 changed files with 209 additions and 2 deletions

View File

@ -0,0 +1,42 @@
import request from '@/config/axios'
export interface ExperienceRecordVO {
id: number
userId: number
bizId: string
bizType: number
title: string
description: string
experience: number
totalExperience: number
}
// 查询会员经验记录列表
export const getExperienceRecordPage = async (params) => {
return await request.get({ url: `/member/experience-record/page`, params })
}
// 查询会员经验记录详情
export const getExperienceRecord = async (id: number) => {
return await request.get({ url: `/member/experience-record/get?id=` + id })
}
// 新增会员经验记录
export const createExperienceRecord = async (data: ExperienceRecordVO) => {
return await request.post({ url: `/member/experience-record/create`, data })
}
// 修改会员经验记录
export const updateExperienceRecord = async (data: ExperienceRecordVO) => {
return await request.put({ url: `/member/experience-record/update`, data })
}
// 删除会员经验记录
export const deleteExperienceRecord = async (id: number) => {
return await request.delete({ url: `/member/experience-record/delete?id=` + id })
}
// 导出会员经验记录 Excel
export const exportExperienceRecord = async (params) => {
return await request.download({ url: `/member/experience-record/export-excel`, params })
}

View File

@ -143,7 +143,7 @@ export enum DICT_TYPE {
// ========== MALL - 会员模块 ========== // ========== MALL - 会员模块 ==========
MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', // 积分的业务类型 MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', // 积分的业务类型
MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型
// ========== MALL - 商品模块 ========== // ========== MALL - 商品模块 ==========
PRODUCT_UNIT = 'product_unit', // 商品单位 PRODUCT_UNIT = 'product_unit', // 商品单位
PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态 PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态

View File

@ -0,0 +1,162 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="业务类型" prop="bizType">
<el-select
v-model="queryParams.bizType"
placeholder="请选择业务类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_EXPERIENCE_BIZ_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</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-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" width="150px" />
<el-table-column label="业务编号" align="center" prop="bizId" width="150px">
<!-- TODO 芋艿此处应创建对应的字典 -->
<template #default="scope">
<dict-tag :type="DICT_TYPE.MEMBER_EXPERIENCE_BIZ_ID" :value="scope.row.bizId" />
</template>
</el-table-column>
<el-table-column label="业务类型" align="center" prop="bizType" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.MEMBER_EXPERIENCE_BIZ_TYPE" :value="scope.row.bizType" />
</template>
</el-table-column>
<el-table-column label="标题" align="center" prop="title" width="150px" />
<el-table-column label="描述" align="center" prop="description" />
<el-table-column label="经验" align="center" prop="experience" width="150px">
<template #default="scope">
<el-tag v-if="scope.row.experience > 0" class="ml-2" type="success" effect="dark">
+{{ scope.row.experience }}
</el-tag>
<el-tag v-else class="ml-2" type="danger" effect="dark">
{{ scope.row.experience }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="变更后的经验" align="center" prop="totalExperience" width="150px">
<template #default="scope">
<el-tag class="ml-2" effect="dark">
{{ scope.row.totalExperience }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
/>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import * as ExperienceRecordApi from '@/api/member/experience-record/index'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
defineOptions({ name: 'UserExperienceRecord' })
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
userId: null,
bizId: null,
bizType: null,
title: null,
description: null,
experience: null,
totalExperience: null,
createTime: []
})
const queryFormRef = ref() //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await ExperienceRecordApi.getExperienceRecordPage(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 { userId } = defineProps({
userId: {
type: Number,
required: true
}
})
/** 初始化 **/
onMounted(() => {
queryParams.userId = userId
getList()
})
</script>

View File

@ -36,7 +36,9 @@
<el-tab-pane label="签到" name="sign" lazy> <el-tab-pane label="签到" name="sign" lazy>
<UserSignList :user-id="id" /> <UserSignList :user-id="id" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="成长值" name="third">成长值(WIP)</el-tab-pane> <el-tab-pane label="成长值" name="experience">
<UserExperienceRecord :user-id="id"
/></el-tab-pane>
<el-tab-pane label="余额" name="fourth">余额(WIP)</el-tab-pane> <el-tab-pane label="余额" name="fourth">余额(WIP)</el-tab-pane>
<el-tab-pane label="收货地址" name="address" lazy> <el-tab-pane label="收货地址" name="address" lazy>
<UserAddressList :user-id="id" /> <UserAddressList :user-id="id" />
@ -62,6 +64,7 @@ import UserAccountInfo from './UserAccountInfo.vue'
import UserAddressList from './UserAddressList.vue' import UserAddressList from './UserAddressList.vue'
import UserPointList from './UserPointList.vue' import UserPointList from './UserPointList.vue'
import UserSignList from './UserSignList.vue' import UserSignList from './UserSignList.vue'
import UserExperienceRecord from './UserExperienceRecord.vue'
import { CardTitle } from '@/components/Card/index' import { CardTitle } from '@/components/Card/index'
defineOptions({ name: 'MemberDetail' }) defineOptions({ name: 'MemberDetail' })