修复:优化解绑优惠券和余额历史

This commit is contained in:
xiaowang
2026-03-27 11:34:53 +08:00
parent 7f92e302bb
commit b1fc6c3b79
9 changed files with 130 additions and 20 deletions
+2 -10
View File
@@ -7,7 +7,7 @@
<a-space>
<a-input-search
v-model:value="searchText"
placeholder="搜索优惠券名称或编码"
placeholder="搜索优惠券名称"
style="width: 260px"
@search="handleSearch"
/>
@@ -115,10 +115,6 @@
:label-col="{ span: 6 }"
:wrapper-col="{ span: 16 }"
>
<a-form-item label="优惠券编码" name="couponCode">
<a-input v-model:value="formState.couponCode" placeholder="请输入优惠券编码" />
</a-form-item>
<a-form-item label="优惠券名称" name="couponName">
<a-input v-model:value="formState.couponName" placeholder="请输入优惠券名称" />
</a-form-item>
@@ -212,7 +208,6 @@
@cancel="viewModalVisible = false"
>
<a-descriptions bordered :column="1" size="small">
<a-descriptions-item label="优惠券编码">{{ currentCoupon?.couponCode || '-' }}</a-descriptions-item>
<a-descriptions-item label="优惠券名称">{{ currentCoupon?.couponName || '-' }}</a-descriptions-item>
<a-descriptions-item label="所属店铺">{{ currentCoupon?.shopName || '-' }}</a-descriptions-item>
<a-descriptions-item label="优惠券类型">{{ currentCoupon?.couponType === 1 ? '折扣券' : '满减券' }}</a-descriptions-item>
@@ -368,7 +363,6 @@ const distributeFormState = reactive({
})
const formRules = {
couponCode: [{ required: true, message: '请输入优惠券编码', trigger: 'blur' }],
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'blur' }],
couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'change' }],
couponScene: [{ required: true, message: '请选择优惠场景', trigger: 'change' }],
@@ -385,7 +379,6 @@ const distributeFormRules = {
} as any
const columns = [
{ title: '优惠券编码', dataIndex: 'couponCode', key: 'couponCode' },
{ title: '优惠券名称', dataIndex: 'couponName', key: 'couponName' },
{ title: '所属店铺', key: 'shop', width: 140 },
{ title: '类型', key: 'couponType', width: 100 },
@@ -530,8 +523,7 @@ const fetchCoupons = async () => {
const list = Array.isArray(coupons) ? coupons : []
const keyword = searchText.value.trim()
couponList.value = keyword
? list.filter(item =>
(item.couponName || '').includes(keyword) || (item.couponCode || '').includes(keyword))
? list.filter(item => (item.couponName || '').includes(keyword))
: list
pagination.total = couponList.value.length
} catch (error) {
+13 -2
View File
@@ -83,7 +83,7 @@
</a-button>
<a-popconfirm
v-if="canShowUnbind(record)"
title="确定要解绑该用户与当前店铺的关系吗?"
:title="getUnbindConfirmText(record)"
@confirm="handleUnbind(record)"
>
<a-button type="link" size="small">
@@ -710,6 +710,13 @@ const canShowUnbind = (record: Partial<UserVO> | Record<string, any>) => {
return record.type !== 4
}
const getUnbindConfirmText = (record: Partial<UserVO> | Record<string, any>) => {
if (currentUserType.value === 2 && record.type === 3) {
return '确定要解绑该美甲师与当前店铺的关系吗?解绑后该账号会同步降级为普通用户。'
}
return '确定要解绑该用户与当前店铺的关系吗?'
}
const getSceneText = (scene?: string) => {
const map: Record<string, string> = {
RECHARGE: '充值',
@@ -1097,7 +1104,11 @@ const handleUnbind = async (record: any) => {
}
userList.value = userList.value.filter(user => user.id !== record.id)
pagination.total = Math.max(0, Number(pagination.total || 0) - 1)
message.success('已解绑当前店铺下的用户')
if (currentUserType.value === 2 && record.type === 3) {
message.success('已解绑当前店铺下的美甲师,并已同步降级为普通用户')
} else {
message.success('已解绑当前店铺下的用户')
}
await fetchUserList()
} catch (error) {
console.error('解绑用户失败:', error)