From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/components/DiyEditor/components/mobile/CouponCard/component.tsx | 73 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/src/components/DiyEditor/components/mobile/CouponCard/component.tsx b/src/components/DiyEditor/components/mobile/CouponCard/component.tsx
new file mode 100644
index 0000000..afe5dfd
--- /dev/null
+++ b/src/components/DiyEditor/components/mobile/CouponCard/component.tsx
@@ -0,0 +1,73 @@
+import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
+import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/utils/constants'
+import { floatToFixed2 } from '@/utils'
+import { formatDate } from '@/utils/formatTime'
+import { object } from 'vue-types'
+
+// 浼樻儬鍊�
+export const CouponDiscount = defineComponent({
+ name: 'CouponDiscount',
+ props: {
+ coupon: object<CouponTemplateApi.CouponTemplateVO>()
+ },
+ setup(props) {
+ const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
+ // 鎶樻墸
+ let value = coupon.discountPercent / 10 + ''
+ let suffix = ' 鎶�'
+ // 婊″噺
+ if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) {
+ value = floatToFixed2(coupon.discountPrice)
+ suffix = ' 鍏�'
+ }
+ return () => (
+ <div>
+ <span class={'text-20px font-bold'}>{value}</span>
+ <span>{suffix}</span>
+ </div>
+ )
+ }
+})
+
+// 浼樻儬鎻忚堪
+export const CouponDiscountDesc = defineComponent({
+ name: 'CouponDiscountDesc',
+ props: {
+ coupon: object<CouponTemplateApi.CouponTemplateVO>()
+ },
+ setup(props) {
+ const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
+ // 浣跨敤鏉′欢
+ const useCondition = coupon.usePrice > 0 ? `婊�${floatToFixed2(coupon.usePrice)}鍏冿紝` : ''
+ // 浼樻儬鎻忚堪
+ const discountDesc =
+ coupon.discountType === PromotionDiscountTypeEnum.PRICE.type
+ ? `鍑�${floatToFixed2(coupon.discountPrice)}鍏僠
+ : `鎵�${coupon.discountPercent / 10.0}鎶榒
+ return () => (
+ <div>
+ <span>{useCondition}</span>
+ <span>{discountDesc}</span>
+ </div>
+ )
+ }
+})
+
+// 鏈夋晥鏈�
+export const CouponValidTerm = defineComponent({
+ name: 'CouponValidTerm',
+ props: {
+ coupon: object<CouponTemplateApi.CouponTemplateVO>()
+ },
+ setup(props) {
+ const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
+ const text =
+ coupon.validityType === CouponTemplateValidityTypeEnum.DATE.type
+ ? `鏈夋晥鏈燂細${formatDate(coupon.validStartTime, 'YYYY-MM-DD')} 鑷� ${formatDate(
+ coupon.validEndTime,
+ 'YYYY-MM-DD'
+ )}`
+ : `棰嗗彇鍚庣 ${coupon.fixedStartTerm} - ${coupon.fixedEndTerm} 澶╁唴鍙敤`
+ return () => <div>{text}</div>
+ }
+})
--
Gitblit v1.8.0