feat:h5领取食堂优惠券

This commit is contained in:
dzc committed 2026-01-29 11:40:26 +08:00
1 parent 7e24072ff8
commit 50f5d7deb2
3 files changed
+63 -74

No files matched your search

+1 -1
View File
@@ -119,4 +119,4 @@
"type": "git",
"url": "https://gitee.com/log4j/pig"
}
}
}
+59 -67
View File
@@ -3,21 +3,15 @@
<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 style="width: 250px" label="领取用户" prop="userId">
<select-user v-model="state.queryForm.userId" />
</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 style="width: 250px" label="使用状态" prop="status">
<dict-select v-model="state.queryForm.status" dict-code="act_coupon_record_status" />
</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 style="width: 450px" label="申请时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">查询</el-button>
@@ -27,59 +21,71 @@
</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>
<!-- :export="'wallet_actCouponRecord_export'" -->
<right-toolbar v-model:showSearch="showSearch" :export="false" @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 type="index" label="#" width="60" />
<el-table-column label="领取用户">
<el-table-column prop="userName" width="120" label="用户名称" show-overflow-tooltip />
<el-table-column prop="userPhone" width="120" label="用户手机号" show-overflow-tooltip />
</el-table-column>
<el-table-column label="优惠券">
<el-table-column prop="couponCode" width="300" show-overflow-tooltip label="券码" />
<el-table-column prop="couponName" width="100" label="名称" show-overflow-tooltip />
<el-table-column prop="couponType" label="类型" width="160" show-overflow-tooltip>
<template #default="{ row }">
<dict-tag :options="act_coupon_type" :value="row.couponType" />
</template>
</el-table-column>
<el-table-column prop="faceValue" label="面额/折扣" width="100" show-overflow-tooltip>
<template #default="{ row }">
<span v-if="row.couponType === '2'">{{ Number(row.faceValue) }}%</span>
<span v-else>¥{{ displayPrice(row.faceValue) }}</span>
</template>
</el-table-column>
<el-table-column prop="minPoint" label="使用门槛" width="100" show-overflow-tooltip>
<template #default="{ row }">
{{ row.minPoint === '0' || row.minPoint === 0 ? '无门槛' : '满¥' +
displayPrice(row.minPoint) }}
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="status" label="使用状态" width="140" show-overflow-tooltip>
<template #default="{ row }">
<dict-tag :options="record_status" :value="row.status" />
<dict-tag :options="act_coupon_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>
<el-table-column width="340" prop="startTime" label="有效期">
<template #default="{ row }">
<dict-tag :options="coupon_type" :value="row.couponType" />
<view>
<span>{{ row.startTime }}</span>
<span>至</span>
<span>{{ row.endTime }}</span>
</view>
</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 label="使用信息">
<el-table-column prop="useTime" label="使用时间" width="180" show-overflow-tooltip />
<el-table-column prop="useAmount" label="抵扣金额" width="100" show-overflow-tooltip>
<template #default="{ row }">¥{{ displayPrice(row.useAmount) }}</template>
</el-table-column>
</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">
<el-table-column label="操作" fixed="right" width="220">
<template #default="{ row }">
<el-button icon="delete" text type="primary" v-auth="'wallet_actCouponRecord_del'"
@click="handleDelete([row.id])">删除</el-button>
@@ -116,10 +122,14 @@
import { BasicTableProps, useTable } from "/@/hooks/table";
import * as actCouponRecordApi from '/@/api/act/act-coupon-record'
import { useMessage, useMessageBox } from "/@/hooks/message";
import { displayPrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
// 引入组件
// 定义查询字典
const { act_coupon_type, act_coupon_record_status }
= useDict("act_coupon_type", "act_coupon_record_status")
// 定义变量内容
// 搜索变量
@@ -181,24 +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 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: '' })
+3 -6
View File
@@ -24,16 +24,13 @@
v-auth="'wallet_actCoupon_add'">
新 增
</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'"
@click="handleDelete(selectObjs)">
删除
</el-button>
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_actCoupon_export'" @exportExcel="exportExcel"
class="ml10 mr20" style="float: right;" @queryTable="getDataList"></right-toolbar>
<!-- :export="'wallet_actCoupon_export'" -->
<right-toolbar v-model:showSearch="showSearch" :export="false" @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"