【功能修复】商城:指定发卷、新人卷,支持无限发放的兜底

pull/552/head
YunaiV 2024-09-11 20:55:38 +08:00
parent 8d116599b1
commit 9d0e77b624
3 changed files with 22 additions and 2 deletions

View File

@ -33,8 +33,19 @@ export const validityTypeFormat = (row: CouponTemplateVO) => {
return '未知【' + row.validityType + '】' return '未知【' + row.validityType + '】'
} }
// 格式化【totalCount】
export const totalCountFormat = (row: CouponTemplateVO) => {
if (row.totalCount === -1) {
return '不限制'
}
return row.totalCount
}
// 格式化【剩余数量】 // 格式化【剩余数量】
export const remainedCountFormat = (row: CouponTemplateVO) => { export const remainedCountFormat = (row: CouponTemplateVO) => {
if (row.totalCount === -1) {
return '不限制'
}
return row.totalCount - row.takeCount return row.totalCount - row.takeCount
} }

View File

@ -115,6 +115,7 @@
<el-radio-group v-model="formData.takeType"> <el-radio-group v-model="formData.takeType">
<el-radio :key="1" :value="1">直接领取</el-radio> <el-radio :key="1" :value="1">直接领取</el-radio>
<el-radio :key="2" :value="2">指定发放</el-radio> <el-radio :key="2" :value="2">指定发放</el-radio>
<el-radio :key="2" :value="3">新人卷</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-if="formData.takeType === 1" label="发放数量" prop="totalCount"> <el-form-item v-if="formData.takeType === 1" label="发放数量" prop="totalCount">
@ -309,7 +310,9 @@ const submitForm = async () => {
validEndTime: validEndTime:
formData.value.validTimes && formData.value.validTimes.length === 2 formData.value.validTimes && formData.value.validTimes.length === 2
? formData.value.validTimes[1] ? formData.value.validTimes[1]
: undefined : undefined,
totalCount: formData.value.takeType === 1 ? formData.value.totalCount : -1,
takeLimitCount: formData.value.takeType === 1 ? formData.value.takeLimitCount : -1
} as unknown as CouponTemplateApi.CouponTemplateVO } as unknown as CouponTemplateApi.CouponTemplateVO
// //

View File

@ -109,7 +109,12 @@
prop="validityType" prop="validityType"
width="185" width="185"
/> />
<el-table-column align="center" label="发放数量" prop="totalCount" /> <el-table-column
:formatter="totalCountFormat"
align="center"
label="发放数量"
prop="totalCount"
/>
<el-table-column <el-table-column
:formatter="remainedCountFormat" :formatter="remainedCountFormat"
align="center" align="center"
@ -189,6 +194,7 @@ import {
discountFormat, discountFormat,
remainedCountFormat, remainedCountFormat,
takeLimitCountFormat, takeLimitCountFormat,
totalCountFormat,
validityTypeFormat validityTypeFormat
} from '@/views/mall/promotion/coupon/formatter' } from '@/views/mall/promotion/coupon/formatter'