浏览代码

优惠券调试

skyline 1 月之前
父节点
当前提交
1cc4bbba9d

+ 3 - 0
haha-entity/src/main/java/com/haha/entity/UserCoupon.java

@@ -62,6 +62,9 @@ public class UserCoupon implements Serializable {
     @TableField(exist = false)
     private Integer applyScope;
 
+    @TableField(exist = false)
+    private BigDecimal discountValue;
+
     @TableField(exist = false)
     private String statusLabel;
 

+ 1 - 0
haha-mp/src/api/coupon.ts

@@ -19,6 +19,7 @@ export interface UserCouponInfo {
   validStartTime: string;
   validEndTime: string;
   discountAmount: number | null;
+  discountValue: number | null;
   couponName: string;
   couponType: number; // 1-满减券, 2-折扣券, 3-抵扣券, 4-兑换券
   minAmount: number;

+ 2 - 2
haha-mp/src/pages/coupons/coupons.vue

@@ -180,10 +180,10 @@ const loadMore = () => {
  */
 const formatValue = (item: UserCouponInfo): string => {
   if (item.couponType === 2) {
-    const val = item.discountAmount;
+    const val = item.discountValue;
     return val ? `${val}折` : '折扣';
   }
-  const val = item.discountAmount;
+  const val = item.discountValue;
   return val ? `${val}` : '--';
 };
 

+ 1 - 1
haha-mp/src/pages/my/my.vue

@@ -167,7 +167,7 @@ const goToFAQ = () => {
 
 const callService = () => {
   uni.makePhoneCall({
-    phoneNumber: '18371997424'
+    phoneNumber: '400-0755-315'
   });
 };
 

+ 2 - 4
haha-service/src/main/java/com/haha/service/impl/UserCouponServiceImpl.java

@@ -310,10 +310,8 @@ public class UserCouponServiceImpl extends ServiceImpl<UserCouponMapper, UserCou
             userCoupon.setMinAmount(template.getMinAmount());
             userCoupon.setCouponDesc(template.getCouponDesc());
             userCoupon.setApplyScope(template.getApplyScope());
-            // 兼容历史数据:如果discountAmount为空则从模板读取
-            if (userCoupon.getDiscountAmount() == null) {
-                userCoupon.setDiscountAmount(template.getDiscountValue());
-            }
+            // 填充模板的discountValue用于前端显示
+            userCoupon.setDiscountValue(template.getDiscountValue());
         }
         // 填充状态标签
         com.haha.common.vo.StatusLabel label = CouponStatusEnum.getLabelByCode(userCoupon.getStatus());