From 95d7d1eb426151e70f0bc41a8b2b129c5ebd0ebe Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 24 Oct 2023 17:39:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=8D=B7=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coupon/template/CouponTemplateForm.vue | 85 +++++++++---------- .../mall/promotion/coupon/template/index.vue | 67 +++++++++------ 2 files changed, 81 insertions(+), 71 deletions(-) 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) => { } -