Compare commits
2 Commits
53128f0685
...
af92c1ca00
Author | SHA1 | Date | |
---|---|---|---|
af92c1ca00 | |||
13eb6a75a9 |
@ -67,7 +67,8 @@ export const CouponValidTerm = defineComponent({
|
|||||||
coupon.validEndTime,
|
coupon.validEndTime,
|
||||||
'YYYY-MM-DD'
|
'YYYY-MM-DD'
|
||||||
)}`
|
)}`
|
||||||
: `领取后第 ${coupon.fixedStartTerm} - ${coupon.fixedEndTerm} 天内可用`
|
// : `领取后第 ${coupon.fixedStartTerm} - ${coupon.fixedEndTerm} 天内可用`
|
||||||
|
: `领取后 ${coupon.fixedEndTerm} 天内可用`
|
||||||
return () => <div>{text}</div>
|
return () => <div>{text}</div>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -28,7 +28,8 @@ export const validityTypeFormat = (row: CouponTemplateVO) => {
|
|||||||
return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}`
|
return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}`
|
||||||
}
|
}
|
||||||
if (row.validityType === CouponTemplateValidityTypeEnum.TERM.type) {
|
if (row.validityType === CouponTemplateValidityTypeEnum.TERM.type) {
|
||||||
return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用`
|
// return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用`
|
||||||
|
return `领取后 ${row.fixedEndTerm + 1} 天内可用`
|
||||||
}
|
}
|
||||||
return '未知【' + row.validityType + '】'
|
return '未知【' + row.validityType + '】'
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<el-form-item label="优惠类型" prop="discountType">
|
<el-form-item label="优惠类型" prop="discountType">
|
||||||
<el-radio-group v-model="formData.discountType">
|
<el-radio-group v-model="formData.discountType">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_DISCOUNT_TYPE)"
|
v-for="dict in filteredDictOptions()"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
>
|
>
|
||||||
@ -151,10 +151,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="formData.validityType === CouponTemplateValidityTypeEnum.TERM.type"
|
v-if="formData.validityType === CouponTemplateValidityTypeEnum.TERM.type"
|
||||||
label="领取日期"
|
label="有效日期"
|
||||||
prop="fixedStartTerm"
|
prop="fixedStartTerm"
|
||||||
>
|
>
|
||||||
第
|
<!-- 第
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.fixedStartTerm"
|
v-model="formData.fixedStartTerm"
|
||||||
:min="0"
|
:min="0"
|
||||||
@ -162,13 +162,13 @@
|
|||||||
class="mx-2"
|
class="mx-2"
|
||||||
placeholder="0 为今天生效"
|
placeholder="0 为今天生效"
|
||||||
/>
|
/>
|
||||||
至
|
至 -->
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.fixedEndTerm"
|
v-model="formData.fixedEndTerm"
|
||||||
:min="0"
|
:min="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
class="mx-2"
|
class="mx-2"
|
||||||
placeholder="请输入结束天数"
|
placeholder="请输入有效天数"
|
||||||
/>
|
/>
|
||||||
天有效
|
天有效
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -215,7 +215,7 @@ const formData = ref({
|
|||||||
validTimes: [],
|
validTimes: [],
|
||||||
validStartTime: undefined,
|
validStartTime: undefined,
|
||||||
validEndTime: undefined,
|
validEndTime: undefined,
|
||||||
fixedStartTerm: undefined,
|
fixedStartTerm: 0,
|
||||||
fixedEndTerm: undefined,
|
fixedEndTerm: undefined,
|
||||||
productScope: PromotionProductScopeEnum.ALL.scope,
|
productScope: PromotionProductScopeEnum.ALL.scope,
|
||||||
productScopeValues: [], // 商品范围:值为 品类编号列表 或 商品编号列表 ,用于提交
|
productScopeValues: [], // 商品范围:值为 品类编号列表 或 商品编号列表 ,用于提交
|
||||||
@ -255,6 +255,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
const data = await CouponTemplateApi.getCouponTemplate(id)
|
const data = await CouponTemplateApi.getCouponTemplate(id)
|
||||||
formData.value = {
|
formData.value = {
|
||||||
...data,
|
...data,
|
||||||
|
fixedEndTerm: data.fixedEndTerm - data.fixedStartTerm + 1, // 显示时总天数(实际需要+1)
|
||||||
discountPrice: formatToFraction(data.discountPrice),
|
discountPrice: formatToFraction(data.discountPrice),
|
||||||
discountPercent:
|
discountPercent:
|
||||||
data.discountPercent !== undefined ? data.discountPercent / 10.0 : undefined,
|
data.discountPercent !== undefined ? data.discountPercent / 10.0 : undefined,
|
||||||
@ -283,6 +284,7 @@ const submitForm = async () => {
|
|||||||
try {
|
try {
|
||||||
const data = {
|
const data = {
|
||||||
...formData.value,
|
...formData.value,
|
||||||
|
fixedEndTerm: (formData.value.fixedEndTerm || 0) + formData.value.fixedStartTerm - 1, // 得到结束的天数
|
||||||
discountPrice: convertToInteger(formData.value.discountPrice),
|
discountPrice: convertToInteger(formData.value.discountPrice),
|
||||||
discountPercent:
|
discountPercent:
|
||||||
formData.value.discountPercent !== undefined
|
formData.value.discountPercent !== undefined
|
||||||
@ -335,7 +337,7 @@ const resetForm = () => {
|
|||||||
validTimes: [],
|
validTimes: [],
|
||||||
validStartTime: undefined,
|
validStartTime: undefined,
|
||||||
validEndTime: undefined,
|
validEndTime: undefined,
|
||||||
fixedStartTerm: undefined,
|
fixedStartTerm: 0,
|
||||||
fixedEndTerm: undefined,
|
fixedEndTerm: undefined,
|
||||||
productScope: PromotionProductScopeEnum.ALL.scope,
|
productScope: PromotionProductScopeEnum.ALL.scope,
|
||||||
productScopeValues: [],
|
productScopeValues: [],
|
||||||
@ -383,6 +385,12 @@ function setProductScopeValues(data: CouponTemplateApi.CouponTemplateVO) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** 暂时隐藏掉字典中的折扣 */
|
||||||
|
function filteredDictOptions() {
|
||||||
|
return getIntDictOptions(DICT_TYPE.PROMOTION_DISCOUNT_TYPE).filter(
|
||||||
|
dict => dict.value !== 2 // 过滤掉 value 为 2 的选项
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
Loading…
Reference in New Issue
Block a user