mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-08-06 10:57:25 +08:00
feat: 增加礼品卡选择功能及相关逻辑
- 在 api/trade.js 中新增 selectGiftCard 函数以支持礼品卡选择 - 更新多个组件以集成礼品卡功能,包括购物车和订单页面 - 优化商品页面和订单详情展示,支持礼品卡抵扣信息 - 调整相关逻辑以确保礼品卡与其他促销活动的兼容性
This commit is contained in:
@@ -90,8 +90,8 @@
|
||||
|
||||
<GoodsSwiper id="main1" :res="imgList" :video="goodsDetail.goodsVideo" />
|
||||
|
||||
<!-- 促销活动条(E_COUPON 不参与促销 M-01) -->
|
||||
<PromotionAssembleLayout v-if="PromotionList && !isECouponGoods" :detail="goodsDetail" :res="PromotionList" />
|
||||
<!-- 促销活动条(秒杀/限时直降/拼团等,M-02 含 E_COUPON) -->
|
||||
<PromotionAssembleLayout v-if="PromotionList" :detail="goodsDetail" :res="PromotionList" />
|
||||
|
||||
<view class="card-box top-radius-0" id="main2">
|
||||
<!-- 活动不显示价钱 -->
|
||||
@@ -172,8 +172,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 促销/领券入口(E_COUPON 隐藏) -->
|
||||
<view class="card-box" v-if="!isECouponGoods">
|
||||
<!-- 促销/领券入口 -->
|
||||
<view class="card-box">
|
||||
<view class="card-flex" @click="shutMask(1)">
|
||||
<view class="card-title"> 促销 </view>
|
||||
<view class="card-content">
|
||||
@@ -187,7 +187,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 拼团用户列表 -->
|
||||
<PromotionAssembleListLayout v-if="isGroup && !isECouponGoods" @to-assemble-buy-now="toAssembleBuyNow" :res="PromotionList" />
|
||||
<PromotionAssembleListLayout v-if="isGroup" @to-assemble-buy-now="toAssembleBuyNow" :res="PromotionList" />
|
||||
|
||||
<!-- 实物配送地址;E_COUPON / VIRTUAL_GOODS 均不展示 -->
|
||||
<view class="card-box" v-if="!isNonPhysicalGoodsType">
|
||||
@@ -262,7 +262,7 @@
|
||||
<view class="detail-btn" v-if="!isGroup && !takeDownFromSale">
|
||||
<view class="to-store-car to-store-btn" v-if="showAddToCart" @click="shutMask(4)">
|
||||
加入购物车</view>
|
||||
<view class="to-buy to-store-btn" :class="{ 'to-buy--full': isECouponGoods }" @click="shutMask(4, 'buy')">立即购买</view>
|
||||
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view>
|
||||
<view class="to-store-car to-store-btn" v-if="startTimer">暂未开始</view>
|
||||
</view>
|
||||
<!-- 拼团结算 -->
|
||||
@@ -329,7 +329,7 @@ import storage from '@/utils/storage.js'
|
||||
/************工具函数***************/
|
||||
import { useStore } from '@/store'
|
||||
import { unitPrice, goodsFormatPrice, isLogin, parseGoodsImageUrl, clearStrComma, talkIm } from '@/utils/filters.js'
|
||||
import { isECoupon, isNonPhysicalGoods } from '@/utils/goodsType.js'
|
||||
import { isNonPhysicalGoods } from '@/utils/goodsType.js'
|
||||
|
||||
/************组件***************/
|
||||
import PromotionLayout from './product/promotion/-promotion'
|
||||
@@ -430,11 +430,10 @@ const IM = computed(() => {
|
||||
return IMLink.value + storeDetail.value.merchantEuid
|
||||
})
|
||||
|
||||
// E_COUPON:仅立即购买,隐藏促销/地址/加购(FR-B-01 / P-08)
|
||||
const isECouponGoods = computed(() => isECoupon(goodsDetail.value?.goodsType))
|
||||
// E_COUPON:禁加购、免地址;促销展示与 VIRTUAL 对齐(M-02)
|
||||
const isNonPhysicalGoodsType = computed(() => isNonPhysicalGoods(goodsDetail.value?.goodsType))
|
||||
const showAddToCart = computed(() => {
|
||||
return !isNonPhysicalGoodsType.value && !isECouponGoods.value
|
||||
return !isNonPhysicalGoodsType.value
|
||||
})
|
||||
|
||||
// watch
|
||||
@@ -547,10 +546,6 @@ async function init(id: any, goodsId: any, distributionId = "") {
|
||||
|
||||
PromotionList.value &&
|
||||
Object.keys(PromotionList.value).forEach((item: string) => {
|
||||
// E_COUPON 不参与拼团/秒杀(M-01),避免底部出现拼团双按钮
|
||||
if (isECoupon(goodsDetail.value?.goodsType)) {
|
||||
return
|
||||
}
|
||||
if (item.indexOf("PINTUAN") == 0) {
|
||||
isGroup.value = true
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
class="showBox"
|
||||
v-if="
|
||||
promotion.__key == 'SECKILL' ||
|
||||
promotion.__key == 'FLASH_DISCOUNT' ||
|
||||
promotion.__key == 'GROUPBUY' ||
|
||||
promotion.__key == 'PINTUAN'
|
||||
"
|
||||
@@ -36,6 +37,29 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 限时直降 -->
|
||||
<view class="u-group-flex-left" v-if="promotion.__key == 'FLASH_DISCOUNT'">
|
||||
<span
|
||||
class="u-group-flex-left-span"
|
||||
v-if="detail.promotionPrice != undefined"
|
||||
>
|
||||
¥
|
||||
<span class="flex-price">
|
||||
{{ goodsFormatPrice(detail.promotionPrice)[0] }}.{{
|
||||
goodsFormatPrice(detail.promotionPrice)[1]
|
||||
}}</span
|
||||
>
|
||||
</span>
|
||||
<view class="u-group-flex" v-if="detail.price != undefined">
|
||||
<span class="old-price"
|
||||
>¥{{ goodsFormatPrice(detail.price)[0] }}.{{
|
||||
goodsFormatPrice(detail.price)[1]
|
||||
}}</span
|
||||
>
|
||||
<view class="promotion">限时直降</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 团购 -->
|
||||
<view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY'">
|
||||
<span class="u-group-flex-left-span">
|
||||
|
||||
@@ -40,6 +40,26 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="getPromType(prom) == 'FLASH_DISCOUNT'">
|
||||
<view class="res_prom_item">
|
||||
<view class="deg_tag">限时直降</view>
|
||||
<text class="pro-text">{{ props.res[prom].promotionName || props.res[prom].title || '限时直降活动' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="getPromType(prom) == 'NTH_ITEM_DISCOUNT'">
|
||||
<view class="res_prom_item">
|
||||
<view class="deg_tag">第N件优惠</view>
|
||||
<text class="pro-text">
|
||||
第{{ props.res[prom].nthNum || 'N' }}件
|
||||
<text v-if="props.res[prom].discountType === 'FREE'">免费</text>
|
||||
<text v-else-if="props.res[prom].discountType === 'HALF'">半价</text>
|
||||
<text v-else-if="props.res[prom].discountValue">享{{ props.res[prom].discountValue }}折</text>
|
||||
<text v-else>优惠</text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="getPromType(prom) == 'POINTS_GOODS'">
|
||||
<view class="res_prom_item">
|
||||
<view class="deg_tag">积分活动</view>
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
<view>
|
||||
<view v-for="(promotionItem, promotionIndex) in promotion" :key="promotionIndex" class="promotion_row" @click="shutMask(1)">
|
||||
<view v-if="res != null" v-for="(item, index) in Object.keys(res)" :key="index">
|
||||
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'FLASH_DISCOUNT'">
|
||||
<div class="flex">
|
||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||
<div class="text proText">{{ res[item].promotionName || res[item].title || '限时直降' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'NTH_ITEM_DISCOUNT'">
|
||||
<div class="flex">
|
||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||
<div class="text proText">{{ res[item].promotionName || res[item].title || '第N件优惠' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'FULL_DISCOUNT'">
|
||||
<!-- 满减,折扣 -->
|
||||
<div class="flex">
|
||||
|
||||
@@ -8,21 +8,17 @@ const promotion = [
|
||||
value: "KANJIA",
|
||||
},
|
||||
{
|
||||
title: "单品立减",
|
||||
value: "MINUS",
|
||||
title: "限时直降",
|
||||
value: "FLASH_DISCOUNT",
|
||||
},
|
||||
{
|
||||
title: "第N件优惠",
|
||||
value: "NTH_ITEM_DISCOUNT",
|
||||
},
|
||||
{
|
||||
title: "团购",
|
||||
value: "GROUPBUY",
|
||||
},
|
||||
{
|
||||
title: "积分换购",
|
||||
value: "EXCHANGE",
|
||||
},
|
||||
{
|
||||
title: "第二件半价",
|
||||
value: "HALF_PRICE",
|
||||
},
|
||||
{
|
||||
title: "满减优惠",
|
||||
value: "FULL_DISCOUNT",
|
||||
@@ -50,4 +46,4 @@ export function formatType(val){
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user