diff --git a/src/views/mall/promotion/coupon/template/CouponTemplateForm.vue b/src/views/mall/promotion/coupon/template/CouponTemplateForm.vue index ad335fb5..ddf44eb3 100644 --- a/src/views/mall/promotion/coupon/template/CouponTemplateForm.vue +++ b/src/views/mall/promotion/coupon/template/CouponTemplateForm.vue @@ -22,14 +22,14 @@
-
+
- +
@@ -37,8 +37,8 @@
@@ -61,10 +61,10 @@ > @@ -75,11 +75,11 @@ > 折 @@ -90,20 +90,20 @@ > @@ -116,20 +116,20 @@ @@ -151,10 +151,10 @@ > 天有效 @@ -199,6 +199,7 @@ import { } from '@/utils/constants' import SpuTableSelect from '@/views/mall/product/spu/components/SpuTableSelect.vue' import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue' +import { convertToInteger, formatToFraction } from '@/utils' defineOptions({ name: 'CouponTemplateForm' }) @@ -265,12 +266,11 @@ const open = async (type: string, id?: number) => { const data = await CouponTemplateApi.getCouponTemplate(id) formData.value = { ...data, - discountPrice: data.discountPrice !== undefined ? data.discountPrice / 100.0 : undefined, + discountPrice: formatToFraction(data.discountPrice), discountPercent: data.discountPercent !== undefined ? data.discountPercent / 10.0 : undefined, - discountLimitPrice: - data.discountLimitPrice !== undefined ? data.discountLimitPrice / 100.0 : undefined, - usePrice: data.usePrice !== undefined ? data.usePrice / 100.0 : undefined, + discountLimitPrice: formatToFraction(data.discountLimitPrice), + usePrice: formatToFraction(data.usePrice), validTimes: [data.validStartTime, data.validEndTime] } // 获得商品范围 @@ -294,17 +294,13 @@ const submitForm = async () => { try { const data = { ...formData.value, - discountPrice: - formData.value.discountPrice !== undefined ? formData.value.discountPrice * 100 : undefined, + discountPrice: convertToInteger(formData.value.discountPrice), discountPercent: formData.value.discountPercent !== undefined ? formData.value.discountPercent * 10 : undefined, - discountLimitPrice: - formData.value.discountLimitPrice !== undefined - ? formData.value.discountLimitPrice * 100 - : undefined, - usePrice: formData.value.usePrice !== undefined ? formData.value.usePrice * 100 : undefined, + discountLimitPrice: convertToInteger(formData.value.discountLimitPrice), + usePrice: convertToInteger(formData.value.usePrice), validStartTime: formData.value.validTimes && formData.value.validTimes.length === 2 ? formData.value.validTimes[0] @@ -385,6 +381,7 @@ const getProductScope = async () => { break } } + /** 设置商品范围 */ function setProductScopeValues(data: CouponTemplateApi.CouponTemplateVO) { switch (formData.value.productScope) { @@ -420,7 +417,7 @@ const handleRemoveSpu = (index: number) => { } -