fix(uniapp): 移除购物车右滑删除消除红线,优化地址吸底按钮与订单赠品划线展示及阶梯促销

This commit is contained in:
pikachu1995@126.com
2026-11-10 15:22:50 +08:00
parent 869975b3c3
commit 0a4db7b6f4
8 changed files with 238 additions and 85 deletions

View File

@@ -1,25 +1,23 @@
<!--
移动端商品详情页-促销详情弹窗内容(支持满减、满折、满赠及三级阶梯与赠品明细展示)
@author Bulbasaur
@since 2026-11-09
-->
<template>
<view class="wrapper" v-if="res">
<view v-for="prom in promotionKeys" :key="prom">
<view v-if="getPromType(prom) == 'FULL_DISCOUNT'">
<view class="res_prom_item" v-if="res[prom].fullMinus">
<view class="deg_tag">满减</view>
<text class="pro-text">
满{{ res[prom].fullMoney }}元 立减现金
<text class="price">{{ res[prom].fullMinus }}元</text>
<text v-if="res[prom].couponFlag"> 赠送优惠券</text>
<text v-if="res[prom].pointFlag"> 赠送{{ res[prom].point }}积分</text>
<text v-if="res[prom].giftFlag"> 赠送商品</text>
<text v-if="res[prom].freeFreightFlag"> 赠送包邮服务</text>
</text>
</view>
<view class="res_prom_item" v-if="res[prom].fullRate && res[prom].fullRateFlag">
<view class="deg_tag">打折</view>
<text class="pro-text">
满{{ res[prom].fullMoney }}元,立享
<text class="price">{{ res[prom].fullRate }}折</text>
优惠
</text>
<view class="res_prom_item">
<view class="deg_tag">{{ resolveFullDiscountTag(res[prom]) }}</view>
<view class="pro-text">
<view
v-for="(tierText, idx) in formatFullDiscountTiers(res[prom])"
:key="idx"
class="tier-line"
>
{{ tierText }}
</view>
</view>
</view>
</view>
@@ -82,6 +80,50 @@ function getPromType(key: string) {
return key.split('-')[0]
}
function resolveFullDiscountTag(act: any): string {
if (!act) return '满减'
if (act.activityType === 'FULL_RATE' || act.fullRateFlag) return '满折'
if (act.activityType === 'FULL_GIFT' || (!act.fullMinusFlag && act.giftFlag)) return '满赠'
return '满减'
}
function formatFullDiscountTiers(act: any): string[] {
if (!act) return []
let rules: any[] = Array.isArray(act.ruleList) ? act.ruleList : []
if (!rules.length && act.rulesJson) {
try {
rules = JSON.parse(act.rulesJson) || []
} catch (e) {
rules = []
}
}
const tag = resolveFullDiscountTag(act)
if (rules.length) {
return rules.map((r: any, i: number) => {
const prefix = rules.length > 1 ? `阶梯${i + 1}:` : ''
if (tag === '满折') {
return `${prefix}满${r.fullMoney}元,立享${r.fullRate}折优惠`
}
if (tag === '满赠') {
const gifts = Array.isArray(r.giftItems)
? r.giftItems
.map((g: any) => `${g.goodsName || '赠品'}×${g.num || 1}`)
.join('、')
: '赠品'
return `${prefix}满${r.fullMoney}元,赠送[${gifts}]`
}
return `${prefix}满${r.fullMoney}元,立减现金${r.fullMinus}元`
})
}
if (act.fullRateFlag && act.fullRate) {
return [`满${act.fullMoney}元,立享${act.fullRate}折优惠`]
}
if (act.giftFlag) {
return [`满${act.fullMoney}元,赠送商品`]
}
return [`满${act.fullMoney}元,立减现金${act.fullMinus || 0}元`]
}
function handClickToJoinPromotion(val: string) {
const type = getPromType(val)
const promotionMap: Record<string, string> = {
@@ -115,6 +157,10 @@ function handClickToJoinPromotion(val: string) {
color: #333333;
}
.tier-line {
margin-bottom: 6rpx;
}
.wrapper {
display: block;
}

View File

@@ -1,12 +1,17 @@
<!--
移动端商品详情页-促销信息摘要栏(支持满减、满折、满赠及三级阶梯文案)
@author Bulbasaur
@since 2026-11-09
-->
<template>
<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] == 'FULL_DISCOUNT'">
<!-- 满减,折扣 -->
<!-- 满减 / 满折 / 满赠 -->
<div class="flex">
<view class="deg_tag">{{ promotionItem.title }}</view>
<div class="text proText">满{{ res[item].fullMoney }}元,立享优惠</div>
<view class="deg_tag">{{ resolveFullDiscountTag(res[item]) }}</view>
<div class="text proText">{{ formatFullDiscountSummary(res[item]) }}</div>
</div>
</div>
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'PINTUAN'">
@@ -43,7 +48,6 @@
<view>
<div class="promotion_col coupon" v-if="couponList && promotionIndex == 1">
<!-- 优惠券 -->
<div><view class="deg_tag">优惠券</view></div>
</div>
</view>
@@ -86,6 +90,39 @@ watch(
{ immediate: true }
)
function resolveFullDiscountTag(act: any): string {
if (!act) return '满减'
if (act.activityType === 'FULL_RATE' || act.fullRateFlag) return '满折'
if (act.activityType === 'FULL_GIFT' || (!act.fullMinusFlag && act.giftFlag)) return '满赠'
return '满减'
}
function formatFullDiscountSummary(act: any): string {
if (!act) return ''
if (act.title) return act.title
if (act.rulesJson) {
try {
const rules = JSON.parse(act.rulesJson)
if (Array.isArray(rules) && rules.length) {
return rules
.map((r: any) => {
if (act.activityType === 'FULL_RATE' || act.fullRateFlag) {
return `满${r.fullMoney}元打${r.fullRate}折`
}
if (act.activityType === 'FULL_GIFT' || act.giftFlag) {
return `满${r.fullMoney}元享好礼`
}
return `满${r.fullMoney}元减${r.fullMinus}元`
})
.join(';')
}
} catch (e) {
// ignore
}
}
return `满${act.fullMoney}元,立享优惠`
}
function shutMask(val: number) {
emit('shutMasks', val)
}
@@ -100,11 +137,7 @@ function shutMask(val: number) {
}
.promotion_col {
/**/
// margin: 0 0 17rpx 0;
padding: 0 !important;
margin: 10rpx 0;
}
.promotion_row {