13233904609 4 months ago
parent 24b0d7c81f
commit 881eafd6e6

@ -4,12 +4,12 @@ NODE_ENV=production
VITE_DEV=true
# 请求路径
VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
VITE_BASE_URL='http://localhost:48080'
# 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务
VITE_UPLOAD_TYPE=server
# 上传路径
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
# 接口地址
VITE_API_URL=/admin-api

File diff suppressed because it is too large Load Diff

@ -6,7 +6,7 @@
"private": false,
"scripts": {
"i": "pnpm install",
"dev": "vite",
"dev": "vite --mode dev",
"dev-server": "vite --mode dev",
"ts:check": "vue-tsc --noEmit",
"build:local": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build",

@ -0,0 +1,48 @@
import request from '@/config/axios'
// 分销配置 VO
export interface DistributionConfigVO {
id: number // id主键
productId: number // 分销商品id
status: string // 启用状态
}
// 分销配置 API
export const DistributionConfigApi = {
// 查询分销配置分页
getDistributionConfigPage: async (params: any) => {
return await request.get({ url: `/member/distribution-config/page`, params })
},
// 查询分销配置详情
getDistributionConfig: async (id: number) => {
return await request.get({ url: `/member/distribution-config/get?id=` + id })
},
// 新增分销配置
createDistributionConfig: async (data: DistributionConfigVO) => {
return await request.post({ url: `/member/distribution-config/create`, data })
},
// 修改分销配置
updateDistributionConfig: async (data: DistributionConfigVO) => {
return await request.put({ url: `/member/distribution-config/update`, data })
},
// 删除分销配置
deleteDistributionConfig: async (id: number) => {
return await request.delete({ url: `/member/distribution-config/delete?id=` + id })
},
// 导出分销配置 Excel
exportDistributionConfig: async (params) => {
return await request.download({ url: `/member/distribution-config/export-excel`, params })
},
// ==================== 子表(分销配置关联会员等级) ====================
// 获得分销配置关联会员等级列表
getDistributionMebConfigListByConfigId: async (configId) => {
return await request.get({ url: `/member/distribution-config/distribution-meb-config/list-by-config-id?configId=` + configId })
},
}

@ -0,0 +1,47 @@
import request from '@/config/axios'
// 分销记录 VO
export interface DistributionLogVO {
id: number // id主键
referrerId: number // 推荐人id
oldReferrerId: number // 推荐人id(便于回溯)
mebId: number // 购买人id
brokerage: number // 佣金
status: string // 分佣结算核销状态
gameStatus: string // 游戏状态
convertStatus: string // 游戏兑换状态
levelId: number // 推荐人会员等级id
}
// 分销记录 API
export const DistributionLogApi = {
// 查询分销记录分页
getDistributionLogPage: async (params: any) => {
return await request.get({ url: `/member/distribution-log/page`, params })
},
// 查询分销记录详情
getDistributionLog: async (id: number) => {
return await request.get({ url: `/member/distribution-log/get?id=` + id })
},
// 新增分销记录
createDistributionLog: async (data: DistributionLogVO) => {
return await request.post({ url: `/member/distribution-log/create`, data })
},
// 修改分销记录
updateDistributionLog: async (data: DistributionLogVO) => {
return await request.put({ url: `/member/distribution-log/update`, data })
},
// 删除分销记录
deleteDistributionLog: async (id: number) => {
return await request.delete({ url: `/member/distribution-log/delete?id=` + id })
},
// 导出分销记录 Excel
exportDistributionLog: async (params) => {
return await request.download({ url: `/member/distribution-log/export-excel`, params })
},
}

@ -0,0 +1,49 @@
import request from '@/config/axios'
// 分销统计 VO
export interface DistributionStatisticsVO {
id: number // id主键
levelId: number // 会员等级id
mebId: number // 会员id
logId: number // 推荐记录id
referrerId: number // 推荐人id
status: string // 分佣结算核销状态
}
// 分销统计 API
export const DistributionStatisticsApi = {
// 查询分销统计分页
getDistributionStatisticsPage: async (params: any) => {
return await request.get({ url: `/member/distribution-statistics/page`, params })
},
// 查询分销统计详情
getDistributionStatistics: async (id: number) => {
return await request.get({ url: `/member/distribution-statistics/get?id=` + id })
},
// 新增分销统计
createDistributionStatistics: async (data: DistributionStatisticsVO) => {
return await request.post({ url: `/member/distribution-statistics/create`, data })
},
// 修改分销统计
updateDistributionStatistics: async (data: DistributionStatisticsVO) => {
return await request.put({ url: `/member/distribution-statistics/update`, data })
},
// 结算分销统计
updateAlready: async (data: DistributionStatisticsVO) => {
return await request.put({ url: `/member/distribution-statistics/updateAlready`, data })
},
// 删除分销统计
deleteDistributionStatistics: async (id: number) => {
return await request.delete({ url: `/member/distribution-statistics/delete?id=` + id })
},
// 导出分销统计 Excel
exportDistributionStatistics: async (params) => {
return await request.download({ url: `/member/distribution-statistics/export-excel`, params })
},
}

@ -0,0 +1,52 @@
import request from '@/config/axios'
// 抽奖活动 VO
export interface PrizeDrawVO {
id: number // id主键
name: string // 活动名称
activityRule: string // 活动规则
status: string // 活动状态0开启1关闭
startTime: Date // 开始时间
endTime: Date // 截至时间
mebLevel: number // 会员等级
}
// 抽奖活动 API
export const PrizeDrawApi = {
// 查询抽奖活动分页
getPrizeDrawPage: async (params: any) => {
return await request.get({ url: `/promotion/prize-draw/page`, params })
},
// 查询抽奖活动详情
getPrizeDraw: async (id: number) => {
return await request.get({ url: `/promotion/prize-draw/get?id=` + id })
},
// 新增抽奖活动
createPrizeDraw: async (data: PrizeDrawVO) => {
return await request.post({ url: `/promotion/prize-draw/create`, data })
},
// 修改抽奖活动
updatePrizeDraw: async (data: PrizeDrawVO) => {
return await request.put({ url: `/promotion/prize-draw/update`, data })
},
// 删除抽奖活动
deletePrizeDraw: async (id: number) => {
return await request.delete({ url: `/promotion/prize-draw/delete?id=` + id })
},
// 导出抽奖活动 Excel
exportPrizeDraw: async (params) => {
return await request.download({ url: `/promotion/prize-draw/export-excel`, params })
},
// ==================== 子表(抽奖活动奖品) ====================
// 获得抽奖活动奖品列表
getActivityPrizeListByActivityId: async (activityId) => {
return await request.get({ url: `/promotion/prize-draw/activity-prize/list-by-activity-id?activityId=` + activityId })
},
}

@ -0,0 +1,47 @@
import request from '@/config/axios'
// 抽奖记录 VO
export interface PrizeLogVO {
id: number // 主键id
mebId: number // 会员id
activityId: number // 关联抽奖活动id
name: string // 奖品名称
imgUrl: string // 奖品图片路径
winNum: number // 获奖人数上限
prizeChance: string // 获奖概率
prizePoolAmount: string // 获奖金额
status: string // 兑奖状态0已兑奖1未兑奖
}
// 抽奖记录 API
export const PrizeLogApi = {
// 查询抽奖记录分页
getPrizeLogPage: async (params: any) => {
return await request.get({ url: `/promotion/prize-log/page`, params })
},
// 查询抽奖记录详情
getPrizeLog: async (id: number) => {
return await request.get({ url: `/promotion/prize-log/get?id=` + id })
},
// 新增抽奖记录
createPrizeLog: async (data: PrizeLogVO) => {
return await request.post({ url: `/promotion/prize-log/create`, data })
},
// 修改抽奖记录
updatePrizeLog: async (data: PrizeLogVO) => {
return await request.put({ url: `/promotion/prize-log/update`, data })
},
// 删除抽奖记录
deletePrizeLog: async (id: number) => {
return await request.delete({ url: `/promotion/prize-log/delete?id=` + id })
},
// 导出抽奖记录 Excel
exportPrizeLog: async (params) => {
return await request.download({ url: `/promotion/prize-log/export-excel`, params })
},
}

@ -0,0 +1,46 @@
<template>
<el-select v-model="levelId" placeholder="请选择商品" clearable class="!w-240px">
<el-option v-for="level in levelOptions" :key="level.id" :label="level.name" :value="level.id">
<span class="flex items-center gap-x-8px">
<el-avatar :src="level.picUrl" size="small" />
{{ level.name }}
</span>
</el-option>
</el-select>
</template>
<script lang="ts" setup>
// import * as ProductApi from '@/api/member/level'
// import * as ProductApi from '@/api/erp/product/product'
import * as ProductApi from '@/api/mall/product/spu'
/** 会员等级选择框 **/
defineOptions({ name: 'SkuSelect' })
const props = defineProps({
/** 下拉框选中值 **/
modelValue: {
type: Number,
default: undefined
}
})
const emit = defineEmits(['update:modelValue'])
const levelId = computed({
get() {
return props.modelValue
},
set(value: any) {
emit('update:modelValue', value)
}
})
const levelOptions = ref<ProductApi.Spu[]>([])
const getList = async () => {
levelOptions.value = await ProductApi.getSpuSimpleList()
}
/** 初始化 */
onMounted(() => {
getList()
})
</script>

@ -0,0 +1,125 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="180px"
v-loading="formLoading"
>
<el-form-item label="分销商品" prop="productId">
<SkuSelect v-model="formData.productId" />
</el-form-item>
<el-form-item label="购买人提升至会员等级" prop="levelId">
<MemberLevelSelect v-model="formData.levelId" />
</el-form-item>
<el-form-item label="启用状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<!-- 子表的表单 -->
<el-tabs v-model="subTabsName">
<el-tab-pane label="分销配置关联会员等级" name="distributionMebConfig">
<DistributionMebConfigForm ref="distributionMebConfigFormRef" :config-id="formData.id" />
</el-tab-pane>
</el-tabs>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DistributionConfigApi, DistributionConfigVO } from '@/api/member/distributionconfig'
import DistributionMebConfigForm from './components/DistributionMebConfigForm.vue'
import SkuSelect from '@/views/mall/product/spu/components/SkuSelect.vue'
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
/** 分销配置 表单 */
defineOptions({ name: 'DistributionConfigForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
productId: undefined,
status: undefined,
levelId: undefined,
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 子表的表单 */
const subTabsName = ref('distributionMebConfig')
const distributionMebConfigFormRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await DistributionConfigApi.getDistributionConfig(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
try {
await distributionMebConfigFormRef.value.validate()
} catch (e) {
subTabsName.value = 'distributionMebConfig'
return
}
//
formLoading.value = true
try {
const data = formData.value as unknown as DistributionConfigVO
//
data.distributionMebConfigs = distributionMebConfigFormRef.value.getData()
if (formType.value === 'create') {
await DistributionConfigApi.createDistributionConfig(data)
message.success(t('common.createSuccess'))
} else {
await DistributionConfigApi.updateDistributionConfig(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
productId: undefined,
status: undefined,
levelId: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,97 @@
<template>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
v-loading="formLoading"
label-width="0px"
:inline-message="true"
>
<el-table :data="formData" class="-mt-10px">
<el-table-column label="序号" type="index" width="100" />
<el-table-column label="会员等级" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.levelId`" :rules="formRules.levelId" class="mb-0px!">
<MemberLevelSelect v-model="row.levelId" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="佣金" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.brokerage`" :rules="formRules.brokerage" class="mb-0px!">
<el-input v-model="row.brokerage" placeholder="请输入佣金" />
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="60">
<template #default="{ $index }">
<el-button @click="handleDelete($index)" link></el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<el-row justify="center" class="mt-3">
<el-button @click="handleAdd" round>+ 添加分销配置关联会员等级</el-button>
</el-row>
</template>
<script setup lang="ts">
import { DistributionConfigApi } from '@/api/member/distributionconfig'
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
const props = defineProps<{
configId: undefined // id
}>()
const formLoading = ref(false) //
const formData = ref([])
const formRules = reactive({
})
const formRef = ref() // Ref
/** 监听主表的关联字段的变化,加载对应的子表数据 */
watch(
() => props.configId,
async (val) => {
// 1.
formData.value = []
// 2. val
if (!val) {
return;
}
try {
formLoading.value = true
formData.value = await DistributionConfigApi.getDistributionMebConfigListByConfigId(val)
} finally {
formLoading.value = false
}
},
{ immediate: true }
)
/** 新增按钮操作 */
const handleAdd = () => {
const row = {
id: undefined,
configId: undefined,
levelId: undefined,
brokerage: undefined,
}
row.configId = props.configId
formData.value.push(row)
}
/** 删除按钮操作 */
const handleDelete = (index) => {
formData.value.splice(index, 1)
}
/** 表单校验 */
const validate = () => {
return formRef.value.validate()
}
/** 表单值 */
const getData = () => {
return formData.value
}
defineExpose({ validate, getData })
</script>

@ -0,0 +1,174 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<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="['member:distribution-config:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['member:distribution-config: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="序号" align="center" prop="id" />
<el-table-column label="分销商品" align="center" prop="supName" />
<el-table-column label="提升购买人会员等级" align="center" prop="levelName" />
<el-table-column label="启用状态" align="center" prop="status" >
<template #default="scope">
{{ scope.row.status==0?"启用":"禁用" }}
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['member:distribution-config:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['member:distribution-config:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<DistributionConfigForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { DistributionConfigApi, DistributionConfigVO } from '@/api/member/distributionconfig'
import DistributionConfigForm from './DistributionConfigForm.vue'
/** 分销配置 列表 */
defineOptions({ name: 'DistributionConfig' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<DistributionConfigVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
productId: undefined,
status: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await DistributionConfigApi.getDistributionConfigPage(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)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DistributionConfigApi.deleteDistributionConfig(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DistributionConfigApi.exportDistributionConfig(queryParams)
download.excel(data, '分销配置.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

@ -0,0 +1,108 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="兑换状态" prop="convertStatus">
<el-radio-group v-model="formData.convertStatus">
<el-radio label="0">已兑换</el-radio>
<el-radio label="1">未兑换</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DistributionLogApi, DistributionLogVO } from '@/api/member/distributionlog'
/** 分销记录 表单 */
defineOptions({ name: 'DistributionLogForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
referrerId: undefined,
oldReferrerId: undefined,
mebId: undefined,
brokerage: undefined,
status: undefined,
gameStatus: undefined,
convertStatus: undefined,
levelId: undefined,
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await DistributionLogApi.getDistributionLog(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as DistributionLogVO
if (formType.value === 'create') {
await DistributionLogApi.createDistributionLog(data)
message.success(t('common.createSuccess'))
} else {
await DistributionLogApi.updateDistributionLog(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
referrerId: undefined,
oldReferrerId: undefined,
mebId: undefined,
brokerage: undefined,
status: undefined,
gameStatus: undefined,
convertStatus: undefined,
levelId: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,187 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="兑换状态" prop="convertStatus">
<el-select
v-model="queryParams.convertStatus"
placeholder="请选择兑换状态"
clearable
class="!w-240px"
>
<el-option label="已兑换" value="0" />
<el-option label="未兑换" value="1" />
</el-select>
</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="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['member:distribution-log: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="序号" align="center" prop="id" />
<el-table-column label="用户昵称" align="center" prop="nickname" />
<el-table-column label="真实姓名" align="center" prop="userName" />
<el-table-column label="手机号" align="center" prop="phone" />
<!-- <el-table-column label="佣金" align="center" prop="brokerage" /> -->
<!-- <el-table-column label="分佣结算核销状态" align="center" prop="status" /> -->
<!-- <el-table-column label="游戏状态" align="center" prop="gameStatus" /> -->
<el-table-column label="兑换状态" align="center" prop="convertStatus" >
<template #default="scope">
{{ scope.row.status==0?"已兑换":"未兑换" }}
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['member:distribution-log:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['member:distribution-log:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<DistributionLogForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { DistributionLogApi, DistributionLogVO } from '@/api/member/distributionlog'
import DistributionLogForm from './DistributionLogForm.vue'
/** 分销记录 列表 */
defineOptions({ name: 'DistributionLog' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<DistributionLogVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
referrerId: undefined,
oldReferrerId: undefined,
mebId: undefined,
brokerage: undefined,
status: undefined,
gameStatus: undefined,
convertStatus: undefined,
levelId: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await DistributionLogApi.getDistributionLogPage(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)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DistributionLogApi.deleteDistributionLog(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DistributionLogApi.exportDistributionLog(queryParams)
download.excel(data, '分销记录.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

@ -0,0 +1,113 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="会员等级id" prop="levelId">
<el-input v-model="formData.levelId" placeholder="请输入会员等级id" />
</el-form-item>
<el-form-item label="会员id" prop="mebId">
<el-input v-model="formData.mebId" placeholder="请输入会员id" />
</el-form-item>
<el-form-item label="推荐记录id" prop="logId">
<el-input v-model="formData.logId" placeholder="请输入推荐记录id" />
</el-form-item>
<el-form-item label="推荐人id" prop="referrerId">
<el-input v-model="formData.referrerId" placeholder="请输入推荐人id" />
</el-form-item>
<el-form-item label="分佣结算核销状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DistributionStatisticsApi, DistributionStatisticsVO } from '@/api/member/distributionstatistics'
/** 分销统计 表单 */
defineOptions({ name: 'DistributionStatisticsForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
levelId: undefined,
mebId: undefined,
logId: undefined,
referrerId: undefined,
status: undefined,
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await DistributionStatisticsApi.getDistributionStatistics(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as DistributionStatisticsVO
if (formType.value === 'create') {
await DistributionStatisticsApi.createDistributionStatistics(data)
message.success(t('common.createSuccess'))
} else {
await DistributionStatisticsApi.updateDistributionStatistics(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
levelId: undefined,
mebId: undefined,
logId: undefined,
referrerId: undefined,
status: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,175 @@
<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 label="已结算" value="0" />
<el-option label="未结算" value="1" />
</el-select>
</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="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['member:distribution-statistics: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="序号" align="center" prop="id" />
<el-table-column label="用户名称" align="center" prop="nickname" />
<el-table-column label="真实姓名" align="center" prop="userName" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="会员等级" align="center" prop="levelName" />
<el-table-column label="已结算订单数量" align="center" prop="haveAlready" />
<el-table-column label="未结算订单数量" align="center" prop="unAlready" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="handleAlready(scope.row)"
v-hasPermi="['member:distribution-statistics: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>
<!-- 表单弹窗添加/修改 -->
<DistributionStatisticsForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { DistributionStatisticsApi, DistributionStatisticsVO } from '@/api/member/distributionstatistics'
import DistributionStatisticsForm from './DistributionStatisticsForm.vue'
/** 分销统计 列表 */
defineOptions({ name: 'DistributionStatistics' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<DistributionStatisticsVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
levelId: undefined,
mebId: undefined,
logId: undefined,
referrerId: undefined,
status: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await DistributionStatisticsApi.getDistributionStatisticsPage(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)
}
/** 结算按钮 */
const handleAlready = async (row) => {
try {
//
await message.confirm("确认结算用户"+row.nickname+"会员等级"+row.levelName+"的订单吗?")
//
await DistributionStatisticsApi.updateAlready(row)
message.success('结算完成!')
//
await getList()
} catch {}
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DistributionStatisticsApi.deleteDistributionStatistics(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DistributionStatisticsApi.exportDistributionStatistics(queryParams)
download.excel(data, '分销统计.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

@ -0,0 +1,155 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="活动名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入活动名称" />
</el-form-item>
<el-form-item label="活动规则" prop="activityRule">
<Editor v-model="formData.activityRule" height="150px" />
</el-form-item>
<el-form-item label="活动状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="0">开启</el-radio>
<el-radio label="1">关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker
v-model="formData.startTime"
type="datetime"
value-format="x"
placeholder="选择开始时间"
/>
</el-form-item>
<el-form-item label="截至时间" prop="endTime">
<el-date-picker
v-model="formData.endTime"
type="datetime"
value-format="x"
placeholder="选择截至时间"
/>
</el-form-item>
<el-form-item label="会员等级" prop="mebLevel">
<MemberLevelSelect v-model="formData.mebLevel" />
<!-- <el-input v-model="formData.mebLevel" placeholder="请输入会员等级" /> -->
</el-form-item>
<el-form-item label="每人抽奖次数" prop="drawNum">
<el-input-number v-model="formData.drawNum" :min="1" placeholder="请输入单人次抽奖次数" />
</el-form-item>
</el-form>
<!-- 子表的表单 -->
<el-tabs v-model="subTabsName">
<el-tab-pane label="抽奖活动奖品" name="activityPrize">
<ActivityPrizeForm ref="activityPrizeFormRef" :activity-id="formData.id" />
</el-tab-pane>
</el-tabs>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { PrizeDrawApi, PrizeDrawVO } from '@/api/promotion/prizedraw'
import ActivityPrizeForm from './components/ActivityPrizeForm.vue'
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
/** 抽奖活动 表单 */
defineOptions({ name: 'PrizeDrawForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
name: undefined,
activityRule: undefined,
status: "1",
startTime: undefined,
endTime: undefined,
mebLevel: undefined,
drawNum: undefined,
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 子表的表单 */
const subTabsName = ref('activityPrize')
const activityPrizeFormRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await PrizeDrawApi.getPrizeDraw(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
try {
await activityPrizeFormRef.value.validate()
} catch (e) {
subTabsName.value = 'activityPrize'
return
}
//
formLoading.value = true
try {
const data = formData.value as unknown as PrizeDrawVO
//
data.activityPrizes = activityPrizeFormRef.value.getData()
if (formType.value === 'create') {
await PrizeDrawApi.createPrizeDraw(data)
message.success(t('common.createSuccess'))
} else {
await PrizeDrawApi.updatePrizeDraw(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
name: undefined,
activityRule: undefined,
status: "1",
startTime: undefined,
endTime: undefined,
mebLevel: undefined,
drawNum: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,121 @@
<template>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
v-loading="formLoading"
label-width="0px"
:inline-message="true"
>
<el-table :data="formData" class="-mt-10px">
<el-table-column label="序号" type="index" width="100" />
<el-table-column label="奖品名称" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.name`" :rules="formRules.name" class="mb-0px!">
<el-input v-model="row.name" placeholder="请输入奖品名称" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="奖品图片路径" min-width="200">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.imgUrl`" :rules="formRules.imgUrl" class="mb-0px!">
<UploadImg v-model="row.imgUrl" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="获奖人数上限" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.winNum`" :rules="formRules.winNum" class="mb-0px!">
<el-input v-model="row.winNum" placeholder="请输入获奖人数上限" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="获奖概率" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.prizeChance`" :rules="formRules.prizeChance" class="mb-0px!">
<el-input v-model="row.prizeChance" placeholder="请输入获奖概率" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="获奖金额" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.prizePoolAmount`" :rules="formRules.prizePoolAmount" class="mb-0px!">
<el-input v-model="row.prizePoolAmount" placeholder="请输入获奖金额" />
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="60">
<template #default="{ $index }">
<el-button @click="handleDelete($index)" link></el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<el-row justify="center" class="mt-3">
<el-button @click="handleAdd" round>+ 添加抽奖活动奖品</el-button>
</el-row>
</template>
<script setup lang="ts">
import { PrizeDrawApi } from '@/api/promotion/prizedraw'
const props = defineProps<{
activityId: undefined // id
}>()
const formLoading = ref(false) //
const formData = ref([])
const formRules = reactive({
})
const formRef = ref() // Ref
/** 监听主表的关联字段的变化,加载对应的子表数据 */
watch(
() => props.activityId,
async (val) => {
// 1.
formData.value = []
// 2. val
if (!val) {
return;
}
try {
formLoading.value = true
formData.value = await PrizeDrawApi.getActivityPrizeListByActivityId(val)
} finally {
formLoading.value = false
}
},
{ immediate: true }
)
/** 新增按钮操作 */
const handleAdd = () => {
const row = {
id: undefined,
activityId: undefined,
name: undefined,
imgUrl: undefined,
winNum: undefined,
prizeChance: undefined,
prizePoolAmount: undefined,
}
row.activityId = props.activityId
formData.value.push(row)
}
/** 删除按钮操作 */
const handleDelete = (index) => {
formData.value.splice(index, 1)
}
/** 表单校验 */
const validate = () => {
return formRef.value.validate()
}
/** 表单值 */
const getData = () => {
return formData.value
}
defineExpose({ validate, getData })
</script>

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="活动名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入活动名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="活动状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择活动状态"
clearable
class="!w-240px"
>
<el-option label="开启" value="0" />
<el-option label="关闭" value="1" />
</el-select>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker
v-model="queryParams.startTime"
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 label="截至时间" prop="endTime">
<el-date-picker
v-model="queryParams.endTime"
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 label="会员等级" prop="mebLevel">
<MemberLevelSelect v-model="queryParams.mebLevel" />
<!-- <el-input
v-model="queryParams.mebLevel"
placeholder="请输入会员等级"
clearable
@keyup.enter="handleQuery"
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:prize-draw:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['promotion:prize-draw: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="活动名称" align="center" prop="name" />
<el-table-column label="活动状态" align="center" prop="status" >
<template #default="scope">
{{ scope.row.status==0?"开启":"关闭" }}
</template>
</el-table-column>
<el-table-column label="每人抽奖次数" align="center" prop="drawNum" />
<el-table-column
label="开始时间"
align="center"
prop="startTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column
label="截至时间"
align="center"
prop="endTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="参与会员等级" align="center" prop="levelName" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['promotion:prize-draw:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['promotion:prize-draw:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<PrizeDrawForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { PrizeDrawApi, PrizeDrawVO } from '@/api/promotion/prizedraw'
import PrizeDrawForm from './PrizeDrawForm.vue'
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
/** 抽奖活动 列表 */
defineOptions({ name: 'PrizeDraw' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<PrizeDrawVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
name: undefined,
activityRule: undefined,
status: undefined,
startTime: [],
endTime: [],
mebLevel: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await PrizeDrawApi.getPrizeDrawPage(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)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await PrizeDrawApi.deletePrizeDraw(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PrizeDrawApi.exportPrizeDraw(queryParams)
download.excel(data, '抽奖活动.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

@ -0,0 +1,114 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="奖品名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入奖品名称" disabled/>
</el-form-item>
<el-form-item label="奖品图片" prop="imgUrl">
<el-image style="width: 100px; height: 100px" :src="formData.imgUrl" />
</el-form-item>
<el-form-item label="兑奖状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="0">已兑奖</el-radio>
<el-radio label="1">未兑奖</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { PrizeLogApi, PrizeLogVO } from '@/api/promotion/prizelog'
/** 抽奖记录 表单 */
defineOptions({ name: 'PrizeLogForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
mebId: undefined,
activityId: undefined,
name: undefined,
imgUrl: undefined,
winNum: undefined,
prizeChance: undefined,
prizePoolAmount: undefined,
status: undefined,
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await PrizeLogApi.getPrizeLog(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as PrizeLogVO
if (formType.value === 'create') {
await PrizeLogApi.createPrizeLog(data)
message.success(t('common.createSuccess'))
} else {
await PrizeLogApi.updatePrizeLog(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
mebId: undefined,
activityId: undefined,
name: undefined,
imgUrl: undefined,
winNum: undefined,
prizeChance: undefined,
prizePoolAmount: undefined,
status: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,209 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="奖品名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入奖品名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="兑奖状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择兑奖状态"
clearable
class="!w-240px"
>
<el-option label="已兑奖" value="0" />
<el-option label="未兑奖" value="1" />
</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="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['promotion:prize-log: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="用户名称" align="center" prop="nickname" />
<el-table-column label="活动名称" align="center" prop="activityName" />
<el-table-column label="奖品名称" align="center" prop="name" />
<el-table-column label="奖品图片路径" align="center" prop="imgUrl" >
<template #default="scope">
<el-image style="width: 100px; height: 100px" :src="scope.row.imgUrl" />
</template>
</el-table-column>
<el-table-column label="兑奖状态" align="center" prop="status" >
<template #default="scope">
{{ scope.row.status==0?"已兑换":"未兑换" }}
</template>
</el-table-column>
<el-table-column
label="中奖时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['promotion:prize-log:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['promotion:prize-log:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<PrizeLogForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { PrizeLogApi, PrizeLogVO } from '@/api/promotion/prizelog'
import PrizeLogForm from './PrizeLogForm.vue'
/** 抽奖记录 列表 */
defineOptions({ name: 'PrizeLog' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<PrizeLogVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
nickname: undefined,
activityId: undefined,
activityName: undefined,
name: undefined,
imgUrl: undefined,
winNum: undefined,
prizeChance: undefined,
prizePoolAmount: undefined,
status: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await PrizeLogApi.getPrizeLogPage(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)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await PrizeLogApi.deletePrizeLog(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PrizeLogApi.exportPrizeLog(queryParams)
download.excel(data, '抽奖记录.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>
Loading…
Cancel
Save