From f058a6f4e2413f0a8444e8af541057f25c616c5c Mon Sep 17 00:00:00 2001 From: dzl <786316265@qq.com> Date: Thu, 16 Oct 2025 17:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/imgs/line.png | Bin 0 -> 262 bytes src/views/CouponManage.vue | 239 +++++++++++++++++++++++++++++++++++-- 2 files changed, 229 insertions(+), 10 deletions(-) create mode 100644 public/imgs/line.png diff --git a/public/imgs/line.png b/public/imgs/line.png new file mode 100644 index 0000000000000000000000000000000000000000..9176cb417fa1a7b5bc1ed933f9a34d78a706f2e0 GIT binary patch literal 262 zcmeAS@N?(olHy`uVBq!ia0y~yU@8H!nK;;hsZ&ky)78&q Iol`;+0PGoJ
-

优惠券管理

+
+
<
+
+ 优惠券包 +
+ +
+
-
-
- {{ getCouponName(coupon.couponInfo.type) }}-{{ coupon.use_time === null ? '未使用' : '已使用' }}-{{ coupon.couponInfo.products_id }} -
- {{ product.name }} +
+
+
{{ getCouponName(coupon.couponInfo.type) }}
+
+
+ {{ getCouponTitle(coupon.couponInfo.type)[0] }} + + {{ coupon.couponInfo.discount === "0.00" ? coupon.couponInfo.price === "0.00" ? coupon.couponInfo.precent/10 : coupon.couponInfo.price : coupon.couponInfo.discount }} + + {{ getCouponTitle(coupon.couponInfo.type)[1] }} +
+
{{ getCouponDescribe(coupon.couponInfo.type, coupon.couponInfo.for_a_amount === "0.00" ? coupon.couponInfo.price === "0.00" ? coupon.couponInfo.precent : coupon.couponInfo.price : coupon.couponInfo.for_a_amount) }}
-
+
+ 虚线 +
+ {{ coupon.use_time === null ? '未使用' : '已使用' }} + 适用商品
+ + +
+ {{ product.name }} +
+ +
+
@@ -24,6 +59,9 @@ const user = useUserStore().user const couponList = ref([]) +const dialogVisible = ref(false) +const couponDetail = ref([]) + const getCouponList = async () => { const response = await api.get(`/coupon/user/${user.id}`) couponList.value = response.data.coupon @@ -31,18 +69,199 @@ const getCouponList = async () => { const getCouponName = (couponType) => { const couponName = { - discount_for_a_amount: '满减券', - deduction: '抵扣券', - discount: '折扣券', + 'discount_for_a_amount': '满减券', + 'deduction': '抵扣券', + 'discount': '折扣券', } return couponName[couponType] || couponType } +const getCouponTitle = (couponType) => { + const couponTitle = { + 'discount_for_a_amount': ['¥',''], + 'deduction': ['¥',''], + 'discount': ['商品','折券'], + } + return couponTitle[couponType] || couponType +} + +const getCouponDescribe = (couponType, value) => { + const couponDescribe = { + 'discount_for_a_amount': '满'+value+'可用', + 'deduction': '指定商品可用', + 'discount': '指定商品可用', + } + return couponDescribe[couponType] || couponType +} + +const showCouponDetail = (coupon) => { + couponDetail.value = coupon.couponInfo + dialogVisible.value = true + console.log(coupon) +} + onMounted(() => { getCouponList() })