feat:【商城】店铺装修-优惠劵:展示优惠、剩余信息
parent
c95f621144
commit
ad7de47a47
|
@ -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) {
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue