feat:【商城】店铺装修-优惠劵:展示优惠、剩余信息

pull/147/head
YunaiV 2025-05-01 08:51:50 +08:00
parent c95f621144
commit ad7de47a47
2 changed files with 15 additions and 3 deletions

View File

@ -21,10 +21,11 @@
:textColor="data.textColor"
background=""
:couponId="item.id"
:title="item.name"
:title="formatCouponTitle(item)"
:type="formatCouponDiscountType(item)"
:value="formatCouponDiscountValue(item)"
:sellBy="formatValidityType(item)"
:surplus="item.totalCount === -1 ? -1 : item.totalCount - item.takeCount"
>
<template v-slot:btn>
<!-- 两列时领取按钮坚排 -->
@ -57,6 +58,7 @@
import { ref, onMounted, computed } from 'vue';
import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/sheep/helper/const';
import { floatToFixed2, formatDate } from '@/sheep/helper/utils';
import { formatDiscountPercent, fen2yuanSimple } from '@/sheep/hooks/useGoods';
const props = defineProps({
data: {
@ -114,7 +116,7 @@
return floatToFixed2(coupon.discountPrice);
}
if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
return coupon.discountPercent;
return formatDiscountPercent(coupon.discountPercent);
}
return `未知【${coupon.discountType}`;
};
@ -130,6 +132,15 @@
return '未知【' + row.validityType + '】';
};
//
const formatCouponTitle = (coupon) => {
return `${floatToFixed2(coupon.usePrice)}${
coupon.discountType === PromotionDiscountTypeEnum.PRICE.type
? ',减' + floatToFixed2(coupon.discountPrice) + '元'
: ',打' + formatDiscountPercent(coupon.discountPercent) + '折'
}`;
};
const couponList = ref([]);
//
async function onGetCoupon(id) {

View File

@ -43,7 +43,8 @@
</view>
<view class="ss-m-b-28">
<view class="title-text ss-m-b-10">{{ props.title }}</view>
<view class="surplus-text" v-if="props.surplus">{{ props.surplus }}</view>
<view class="surplus-text" v-if="props.surplus >= 0">{{ props.surplus }}</view>
<view class="surplus-text" v-else-if="props.surplus === -1">仅限不限制</view>
</view>
</view>
<view class="card-right ss-flex ss-row-center">