feat:用户优惠券
This commit is contained in:
1 parent
70ae62203a
commit
7e24072ff8
5 files changed
+337
-87
No files matched your search
+1
-1
@@ -9,7 +9,7 @@ ENV = 'local'
|
|||||||
|
|
||||||
|
|
||||||
# ADMIN 服务地址
|
# ADMIN 服务地址
|
||||||
VITE_ADMIN_PROXY_PATH = http://localhost:9999/
|
VITE_ADMIN_PROXY_PATH = http://localhost:9999
|
||||||
|
|
||||||
|
|
||||||
# 图片访问基础地址
|
# 图片访问基础地址
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
|
export function fetchList(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/wallet/act-coupon-record/page",
|
||||||
|
method: "get",
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/wallet/act-coupon-record",
|
||||||
|
method: "post",
|
||||||
|
data: obj,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getObj(id?: string) {
|
||||||
|
return request({
|
||||||
|
url: "/wallet/act-coupon-record/" + id,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function delObjs(ids?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/wallet/act-coupon-record",
|
||||||
|
method: "delete",
|
||||||
|
data: ids,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/wallet/act-coupon-record",
|
||||||
|
method: "put",
|
||||||
|
data: obj,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
<el-row class="ml10" v-show="showSearch">
|
||||||
|
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||||
|
<el-form-item label="优惠券名称" prop="couponName">
|
||||||
|
<el-input placeholder="输入优惠券名称" style="max-width: 200px" v-model="state.queryForm.couponName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="优惠券类型" prop="couponType">
|
||||||
|
<el-select placeholder="选择类型" style="max-width: 200px" clearable v-model="state.queryForm.couponType">
|
||||||
|
<el-option v-for="opt in coupon_type" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户ID" prop="userId">
|
||||||
|
<el-input placeholder="输入用户ID" style="max-width: 200px" v-model="state.queryForm.userId" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用状态" prop="status">
|
||||||
|
<el-select placeholder="选择状态" style="max-width: 200px" clearable v-model="state.queryForm.status">
|
||||||
|
<el-option v-for="opt in record_status" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="Search" type="primary" @click="getDataList">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||||
|
v-auth="'wallet_actCouponRecord_add'">
|
||||||
|
新 增
|
||||||
|
</el-button>
|
||||||
|
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_actCouponRecord_del'"
|
||||||
|
@click="handleDelete(selectObjs)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_actCouponRecord_export'"
|
||||||
|
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||||
|
@queryTable="getDataList"></right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||||
|
@sort-change="sortChangeHandle">
|
||||||
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="40" />
|
||||||
|
<el-table-column prop="couponId" label="优惠券ID" width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="userId" label="用户ID" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="userName" label="用户名称" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="couponCode" label="券码(唯一标识)" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="status" label="使用状态" width="140" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="record_status" :value="row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="couponName" label="优惠券名称" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="couponType" label="优惠券类型" width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="coupon_type" :value="row.couponType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="faceValue" label="面额/折扣" width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.couponType === '2'">{{ Number(row.faceValue) }}%</span>
|
||||||
|
<span v-else>¥{{ formatFenToYuan(row.faceValue) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="minPoint" label="使用门槛" width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.minPoint === '0' || row.minPoint === 0 ? '无门槛' : '满¥' +
|
||||||
|
formatFenToYuan(row.minPoint) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="startTime" label="有效开始时间" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="endTime" label="有效结束时间" width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="useTime" label="使用时间" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="orderId" label="关联订单号" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="useAmount" label="抵扣金额" width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">¥{{ formatFenToYuan(row.useAmount) }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="220">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button icon="delete" text type="primary" v-auth="'wallet_actCouponRecord_del'"
|
||||||
|
@click="handleDelete([row.id])">删除</el-button>
|
||||||
|
<el-button icon="Clock" text type="primary" :disabled="row.status !== '0'"
|
||||||
|
@click="openExtend(row)">延长有效期</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 延长期对话框 -->
|
||||||
|
<el-dialog v-model="extendVisible" title="延长优惠券有效期" width="480px" :close-on-click-modal="false" draggable>
|
||||||
|
<el-form label-width="100px">
|
||||||
|
<el-form-item label="当前结束时间">
|
||||||
|
<el-input v-model="extendForm.currentEnd" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="新的结束时间">
|
||||||
|
<el-date-picker v-model="extendForm.newEnd" type="datetime" style="width: 100%" placeholder="选择新的结束时间" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="extendVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitExtend">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="systemActCouponRecord">
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
|
import * as actCouponRecordApi from '/@/api/act/act-coupon-record'
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
|
// 引入组件
|
||||||
|
|
||||||
|
// 定义查询字典
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
|
||||||
|
// 搜索变量
|
||||||
|
const queryRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
// 多选变量
|
||||||
|
const selectObjs = ref([]) as any
|
||||||
|
const multiple = ref(true)
|
||||||
|
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {},
|
||||||
|
pageList: actCouponRecordApi.fetchList
|
||||||
|
})
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const {
|
||||||
|
getDataList,
|
||||||
|
currentChangeHandle,
|
||||||
|
sizeChangeHandle,
|
||||||
|
sortChangeHandle,
|
||||||
|
downBlobFile,
|
||||||
|
tableStyle
|
||||||
|
} = useTable(state)
|
||||||
|
|
||||||
|
// 清空搜索条件
|
||||||
|
const resetQuery = () => {
|
||||||
|
// 清空搜索条件
|
||||||
|
queryRef.value?.resetFields()
|
||||||
|
// 清空多选
|
||||||
|
selectObjs.value = []
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出excel
|
||||||
|
const exportExcel = () => {
|
||||||
|
downBlobFile('/wallet/act-coupon-record/export', Object.assign(state.queryForm, { ids: selectObjs }), 'actCouponRecord.xlsx')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选事件
|
||||||
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
selectObjs.value = objs.map(({ id }) => id);
|
||||||
|
multiple.value = !objs.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (ids: string[]) => {
|
||||||
|
try {
|
||||||
|
await useMessageBox().confirm('此操作将永久删除');
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await actCouponRecordApi.delObjs(ids);
|
||||||
|
getDataList();
|
||||||
|
useMessage().success('删除成功');
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const coupon_type = [
|
||||||
|
{ label: '满减券', value: '1', elTagType: 'primary' },
|
||||||
|
{ label: '折扣券', value: '2', elTagType: 'success' },
|
||||||
|
{ label: '立减券', value: '3', elTagType: 'warning' },
|
||||||
|
{ label: '兑换券', value: '4', elTagType: 'info' }
|
||||||
|
]
|
||||||
|
const record_status = [
|
||||||
|
{ label: '未使用', value: '0', elTagType: 'info' },
|
||||||
|
{ label: '已使用', value: '1', elTagType: 'success' },
|
||||||
|
{ label: '已过期', value: '2', elTagType: 'warning' },
|
||||||
|
{ label: '已作废', value: '3', elTagType: 'danger' }
|
||||||
|
]
|
||||||
|
|
||||||
|
function formatFenToYuan(val: number | string) {
|
||||||
|
const n = Number(val)
|
||||||
|
if (isNaN(n)) return val as any
|
||||||
|
return (n / 100).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
const extendVisible = ref(false)
|
||||||
|
const extendForm = reactive({ id: '', currentEnd: '', newEnd: '' })
|
||||||
|
const openExtend = (row: any) => {
|
||||||
|
extendForm.id = row.id
|
||||||
|
extendForm.currentEnd = row.endTime
|
||||||
|
extendForm.newEnd = row.endTime
|
||||||
|
extendVisible.value = true
|
||||||
|
}
|
||||||
|
const submitExtend = async () => {
|
||||||
|
if (!extendForm.id || !extendForm.newEnd) {
|
||||||
|
useMessage().warning('请选择新的结束时间')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await actCouponRecordApi.putObj({ id: extendForm.id, endTime: extendForm.newEnd })
|
||||||
|
useMessage().success('延长成功')
|
||||||
|
extendVisible.value = false
|
||||||
|
getDataList()
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || '延长失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -97,6 +97,12 @@
|
|||||||
<dict-select v-model="form.scopeId" dict-code="merchant_type" />
|
<dict-select v-model="form.scopeId" dict-code="merchant_type" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-divider>营销相关</el-divider>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="绑定公告" prop="bindNotifyId">
|
||||||
|
<select-notice v-model="form.bindNotifyId" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -141,6 +147,7 @@ const defaultForm = {
|
|||||||
scopeId: '',
|
scopeId: '',
|
||||||
status: '1',
|
status: '1',
|
||||||
description: '',
|
description: '',
|
||||||
|
bindNotifyId: '',
|
||||||
};
|
};
|
||||||
const form = reactive({ ...defaultForm });
|
const form = reactive({ ...defaultForm });
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,10 @@
|
|||||||
<el-input placeholder="输入优惠券名称" style="max-width: 200px" v-model="state.queryForm.name" />
|
<el-input placeholder="输入优惠券名称" style="max-width: 200px" v-model="state.queryForm.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="优惠券类型" prop="type">
|
<el-form-item label="优惠券类型" prop="type">
|
||||||
<el-select placeholder="选择优惠券类型" style="max-width: 200px" clearable v-model="state.queryForm.type">
|
<dict-select style="width: 200px" v-model="state.queryForm.type" dict-code="act_coupon_type" />
|
||||||
<el-option v-for="opt in coupon_type" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select placeholder="选择状态" style="max-width: 200px" clearable v-model="state.queryForm.status">
|
<dict-select style="width: 200px" v-model="state.queryForm.status" dict-code="act_coupon_status" />
|
||||||
<el-option v-for="opt in coupon_status" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="Search" type="primary" @click="getDataList">查询</el-button>
|
<el-button icon="Search" type="primary" @click="getDataList">查询</el-button>
|
||||||
@@ -28,6 +24,10 @@
|
|||||||
v-auth="'wallet_actCoupon_add'">
|
v-auth="'wallet_actCoupon_add'">
|
||||||
新 增
|
新 增
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||||
|
v-auth="'wallet_actCoupon_send'">
|
||||||
|
发放
|
||||||
|
</el-button>
|
||||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_actCoupon_del'"
|
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_actCoupon_del'"
|
||||||
@click="handleDelete(selectObjs)">
|
@click="handleDelete(selectObjs)">
|
||||||
删除
|
删除
|
||||||
@@ -40,58 +40,67 @@
|
|||||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||||
@sort-change="sortChangeHandle">
|
@sort-change="sortChangeHandle">
|
||||||
<el-table-column type="selection" width="40" align="center" />
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
<el-table-column type="index" label="#" width="40" />
|
<el-table-column type="index" label="#" width="60" />
|
||||||
<el-table-column prop="name" label="优惠券名称" show-overflow-tooltip />
|
<el-table-column label="优惠券基础信息">
|
||||||
<el-table-column prop="type" label="优惠券类型" width="160" show-overflow-tooltip>
|
<el-table-column prop="uniqueCode" label="唯一编码" width="100" />
|
||||||
<template #default="{ row }">
|
<el-table-column prop="name" label="名称" width="160" show-overflow-tooltip />
|
||||||
<dict-tag :options="coupon_type" :value="row.type" />
|
<el-table-column prop="type" label="类型" width="100">
|
||||||
</template>
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="act_coupon_type" :value="row.type" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="faceValue" label="面额/折扣" width="150" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.type === '2'">{{ Number(row.faceValue) }}%</span>
|
||||||
|
<span v-else>¥{{ formatFenToYuan(row.faceValue) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="minPoint" label="使用门槛" width="140" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ row.minPoint === '0' || row.minPoint === 0 ? '无门槛' : '满¥' +
|
||||||
|
formatFenToYuan(row.minPoint) }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="totalCount" label="发行总量" width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ Number(row.totalCount) === -1 ? '不限量' : row.totalCount }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="surplusCount" label="剩余数量" width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="status" label="状态" width="140" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="act_coupon_status" :value="row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="faceValue" label="面额/折扣" width="150" show-overflow-tooltip>
|
<el-table-column label="优惠券限领">
|
||||||
<template #default="{ row }">
|
<el-table-column prop="limitType" label="限领类型" width="180" show-overflow-tooltip>
|
||||||
<span v-if="row.type === '2'">{{ Number(row.faceValue) }}%</span>
|
<template #default="{ row }">
|
||||||
<span v-else>¥{{ formatFenToYuan(row.faceValue) }}</span>
|
<dict-tag :options="act_coupon_limit_type" :value="row.limitType" />
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="limitCount" label="每人限领" width="120" show-overflow-tooltip />
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="minPoint" label="使用门槛" width="140" show-overflow-tooltip>
|
<el-table-column label="优惠券有效期">
|
||||||
<template #default="{ row }">{{ row.minPoint === '0' || row.minPoint === 0 ? '无门槛' : '满¥' +
|
<el-table-column prop="validType" label="有效期类型" width="160" show-overflow-tooltip>
|
||||||
formatFenToYuan(row.minPoint) }}</template>
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="act_coupon_valid_type" :value="row.validType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="validType" label="有效期" width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.validType === '2'">领取后{{ row.validDays }}天</span>
|
||||||
|
<span v-else>
|
||||||
|
<span v-if="row.validStartTime">{{ formatDate(row.validStartTime, "YYYY-mm-dd HH:MM:SS") }}</span>
|
||||||
|
至
|
||||||
|
<span v-if="row.validEndTime">{{ formatDate(row.validEndTime, "YYYY-mm-dd HH:MM:SS") }}</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="totalCount" label="发行总量" width="120" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">{{ Number(row.totalCount) === -1 ? '不限量' : row.totalCount }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="surplusCount" label="剩余数量" width="120" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="limitCount" label="每人限领" width="120" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="limitType" label="限领类型" width="180" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<dict-tag :options="limit_type" :value="row.limitType" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="validType" label="有效期类型" width="160" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<dict-tag :options="valid_type" :value="row.validType" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="validStartTime" label="有效期开始时间" width="180" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="validEndTime" label="有效期结束时间" width="180" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="validDays" label="领取后有效天数" width="160" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="useScopeType" label="适用范围" width="180" show-overflow-tooltip>
|
<el-table-column prop="useScopeType" label="适用范围" width="180" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-tag :options="scope_type" :value="row.useScopeType" />
|
<dict-tag :options="act_coupon_use_scope_type" :value="row.useScopeType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="scopeId" label="适用范围ID集合" width="260" show-overflow-tooltip>
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
<template #default="{ row }">
|
|
||||||
<el-tag v-for="id in parseIds(row.scopeId)" :key="id" size="small">{{ id }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="status" label="状态" width="140" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<dict-tag :options="coupon_status" :value="row.status" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="description" label="使用说明" show-overflow-tooltip />
|
|
||||||
<el-table-column label="操作" width="150">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_actCoupon_edit'"
|
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_actCoupon_edit'"
|
||||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||||
@@ -113,11 +122,14 @@
|
|||||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
import * as actCouponApi from '/@/api/act/act-coupon'
|
import * as actCouponApi from '/@/api/act/act-coupon'
|
||||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
|
import { formatDate } from '/@/utils/formatTime';
|
||||||
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
// 定义查询字典
|
// 定义查询字典
|
||||||
|
const { act_coupon_type, act_coupon_limit_type, act_coupon_status, act_coupon_use_scope_type, act_coupon_valid_type }
|
||||||
|
= useDict("act_coupon_type", "act_coupon_limit_type", "act_coupon_status", "act_coupon_use_scope_type", "act_coupon_valid_type")
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const formDialogRef = ref()
|
const formDialogRef = ref()
|
||||||
// 搜索变量
|
// 搜索变量
|
||||||
@@ -179,40 +191,6 @@ const handleDelete = async (ids: string[]) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const coupon_type = [
|
|
||||||
{ label: '满减券', value: '1', elTagType: 'primary' },
|
|
||||||
{ label: '折扣券', value: '2', elTagType: 'success' },
|
|
||||||
{ label: '立减券', value: '3', elTagType: 'warning' },
|
|
||||||
{ label: '兑换券', value: '4', elTagType: 'info' }
|
|
||||||
]
|
|
||||||
|
|
||||||
const limit_type = [
|
|
||||||
{ label: '活动期间一次', value: 'once', elTagType: 'info' },
|
|
||||||
{ label: '每天', value: 'day', elTagType: 'primary' },
|
|
||||||
{ label: '每周', value: 'week', elTagType: 'success' },
|
|
||||||
{ label: '每月', value: 'month', elTagType: 'warning' },
|
|
||||||
{ label: '每年', value: 'year', elTagType: 'danger' }
|
|
||||||
]
|
|
||||||
|
|
||||||
const valid_type = [
|
|
||||||
{ label: '固定日期', value: '1', elTagType: 'primary' },
|
|
||||||
{ label: '领取后生效', value: '2', elTagType: 'success' }
|
|
||||||
]
|
|
||||||
|
|
||||||
const scope_type = [
|
|
||||||
{ label: '全场通用', value: '0', elTagType: 'success' },
|
|
||||||
{ label: '指定商户', value: '1', elTagType: 'primary' },
|
|
||||||
{ label: '指定分类', value: '2', elTagType: 'warning' },
|
|
||||||
{ label: '指定商品', value: '3', elTagType: 'info' }
|
|
||||||
]
|
|
||||||
|
|
||||||
const coupon_status = [
|
|
||||||
{ label: '草稿', value: '0', elTagType: 'info' },
|
|
||||||
{ label: '进行中', value: '1', elTagType: 'success' },
|
|
||||||
{ label: '已结束', value: '2', elTagType: 'warning' },
|
|
||||||
{ label: '已作废', value: '3', elTagType: 'danger' }
|
|
||||||
]
|
|
||||||
|
|
||||||
function formatFenToYuan(val: number | string) {
|
function formatFenToYuan(val: number | string) {
|
||||||
const n = Number(val)
|
const n = Number(val)
|
||||||
if (isNaN(n)) return val as any
|
if (isNaN(n)) return val as any
|
||||||
|
|||||||
Reference in new issue
Block a user