5 Commits

Author SHA1 Message Date
pikachu1995@126.com
797f6e6ed4 feat(promotion): 新增移动端优惠券礼包专属落地页及一键领取 2026-11-12 16:25:23 +08:00
pikachu1995@126.com
e71b15036f fix(order): 修复已取消订单状态下的投诉和售后逻辑
- 投诉页面增加订单取消状态校验,已取消订单禁止发起投诉并自动返回
- 订单详情页售后入口增加取消状态判断,取消订单不展示售后按钮
- 退款价格展示增加已支付状态校验,避免未支付订单显示退款信息
- 新增 resolveRefundPrice 函数,全额退款时回退使用 flowPrice 计算
- 重构联系方式区域布局,分离电话号码与图标并优化样式
2026-11-12 09:48:04 +08:00
pikachu1995@126.com
870e9c4db4 fix(security): 换绑手机移除冗余用户名传参并强制携带登录token 2026-11-11 14:59:48 +08:00
pikachu1995@126.com
0a4db7b6f4 fix(uniapp): 移除购物车右滑删除消除红线,优化地址吸底按钮与订单赠品划线展示及阶梯促销 2026-11-10 15:22:50 +08:00
pikachu1995@126.com
869975b3c3 fix(merchant): 商家工作台账号密码登录提交前先进行MD5加密 2026-11-09 20:28:15 +08:00
17 changed files with 820 additions and 99 deletions

View File

@@ -160,7 +160,7 @@ lilishop-uniapp
## 8. 升级计划
> 更新日期:2026-11-05,依据各端提交记录及当前代码实现同步。
> 更新日期:2026-11-12,依据各端提交记录及当前代码实现同步。
### ✅ 已完成功能
@@ -168,6 +168,8 @@ lilishop-uniapp
| 时间 | 功能模块 | 完成内容 |
| :--- | :--- | :--- |
| 2026-11-12 | 优惠券礼包 | 新增移动端优惠券礼包专属落地页,支持总立省金额展示、子券清单、一键全部领取。 |
| 2026-11-12 | 出库单 / 库存流水 | 支持商家端出库单管理(录入、审核与作废)及商品库存流水台账。 |
| 2026-11-06 | 提货卡 | 支持提货卡活动与候选商品配置、制卡发卡、兑换核销及使用记录管理。 |
| 2026-11-05 | 付费会员 | 单一付费会员、开通与续费、有效期、关联权益、商家与商品折扣、平台补贴及付费记录。 |
| 2026-11-04 | 客户等级体系 / 客户权益 | 等级配置、权益介绍、经验值任务与明细、权益发放及重试,提供默认等级与权益数据。 |

View File

@@ -23,6 +23,7 @@ export function bindMobile(params) {
url: `/passport/member/bindMobile`,
method: "POST",
params,
needToken: true,
});
}

View File

@@ -239,3 +239,29 @@ export function activateGiftCardCashMemberCard(memberCardId) {
}
/**
* 获取优惠券礼包详情
* @param {string} id 券礼包活动ID
* @author Bulbasaur
* @since 2026-11-12
*/
export function getCouponPackageDetail(id) {
return http.request({
url: /buyer/promotion/coupon/package/,
method: Method.GET,
});
}
/**
* 买家一键领取优惠券礼包
* @param {string} id 券礼包活动ID
* @author Bulbasaur
* @since 2026-11-12
*/
export function receiveCouponPackage(id) {
return http.request({
url: /buyer/promotion/coupon/package/receive/,
method: Method.POST,
});
}

View File

@@ -130,6 +130,7 @@
import { ref, reactive, onBeforeUnmount, nextTick } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import storage from '@/utils/storage.js'
import { md5 } from '@/utils/md5.js'
import myVerification from '@/components/verification/verification.vue'
import {
userLogin,
@@ -250,7 +251,7 @@ const handleVerificationSuccess = () => {
}
}
// 执行账号密码登录
// 执行账号密码登录(密码需先做 MD5 摘要以匹配后端 BCrypt(md5(明文)) 校验口径)
const doAccountLogin = async () => {
submitting.value = true
uni.showLoading({ title: '正在登录...' })
@@ -258,7 +259,7 @@ const doAccountLogin = async () => {
try {
const res: any = await userLogin({
username: accountForm.username.trim(),
password: accountForm.password,
password: md5(accountForm.password),
})
uni.hideLoading()

View File

@@ -732,6 +732,14 @@
{
"root": "pages/promotion",
"pages": [ {
"path": "coupon-pack",
"style": {
"navigationBarTitleText": "专属优惠券礼包",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#ff4142"
}
},
{
"path": "seckill",
"style": {
"navigationBarTitleText": "限时抢购",

View File

@@ -126,7 +126,8 @@
z-index: 99;
padding: 20rpx 30rpx calc(20rpx + constant(safe-area-inset-bottom));
padding: 20rpx 30rpx calc(20rpx + env(safe-area-inset-bottom));
background: $page-color-base;
background: #ffffff;
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
box-sizing: border-box;
}

View File

@@ -32,13 +32,14 @@
</view>
</view>
</view>
<view style="height: 100px"></view>
</view>
<view class="btn-bar">
<view class="btn" @click="addAddress('')">
<u-icon name="plus-circle" color="#ffffff" size="18"></u-icon>
<text class="btn-text">添加新收货人</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">

View File

@@ -72,7 +72,7 @@
<up-form-item label="手机号" label-width="180rpx" :border-bottom="false">
<view v-if="form.mobile" class="form-value">{{ form.mobile }}</view>
<view v-else class="bind-mobile" @click="navigateToBindMobile(form.username)">绑定手机号码</view>
<view v-else class="bind-mobile" @click="navigateToBindMobile">绑定手机号码</view>
</up-form-item>
</up-form>
@@ -263,9 +263,9 @@ function closeBirthdayPicker() {
showBirthday.value = false
}
function navigateToBindMobile(username: string) {
function navigateToBindMobile() {
uni.navigateTo({
url: `/pages/mine/set/securityCenter/bindMobile?username=${username}`,
url: '/pages/mine/set/securityCenter/bindMobile',
})
}

View File

@@ -62,7 +62,6 @@ const verificationPassed = ref(false)
const codeForm = reactive({
mobile: '',
code: '',
username: '',
})
const codeTips = ref('')
const seconds = 69
@@ -90,9 +89,7 @@ const codeRules = {
],
}
onLoad((options) => {
codeForm.username = options?.username || ''
})
onLoad(() => {})
onReady(() => {
validateCodeForm.value?.setRules(codeRules)

View File

@@ -159,6 +159,10 @@ function loadData(orderSn: string) {
order.value = result.order
orderGoodsList.value = result.orderItems
if (store.state.isShowToast) uni.hideLoading()
if (result?.order?.orderStatus === 'CANCELLED') {
uni.showToast({ title: '订单已取消,无法发起投诉', icon: 'none' })
setTimeout(() => { uni.navigateBack() }, 1500)
}
})
}

View File

@@ -68,9 +68,11 @@
:key="goodsIndex">
<u-image border-radius="6" width="131rpx" height="131rpx" mode="aspectFill"
:src="getOrderItemImage(goods, order, goodsIndex)"></u-image>
<text v-if="isGiftItem(goods)" class="gift-corner-badge">赠</text>
</view>
<view class="goods-info">
<view v-if="order.orderItems.length <= 1" class="goods-title u-line-2">
<text v-if="isGiftItem(order.orderItems[0])" class="gift-badge">赠品</text>
{{ order.groupName }}</view>
<view v-if="order.orderItems.length <= 1" class="goods-price">
¥{{unitPrice(order.flowPrice) }}
@@ -444,6 +446,11 @@ async function confirmCancelAfterSale() {
}
}
function isGiftItem(goods: any) {
if (!goods) return false
return goods.promotionType === 'GIFT' || (Number(goods.flowPrice) === 0 && goods.promotionType === 'GIFT')
}
function onAfterSaleExpress(order: any) {
const sku = (order?.orderItems && order.orderItems[0]) || {}
storage.setAfterSaleData({ ...order, ...sku, storeName: order.storeName })
@@ -692,6 +699,7 @@ function reBuy(order: any) {
height: 131rpx;
margin-right: 10rpx;
margin-bottom: 10rpx;
position: relative;
}
.goods-info {
@@ -803,4 +811,30 @@ function reBuy(order: any) {
border-color: $light-color !important;
background-color: #ffffff !important;
}
.gift-corner-badge {
position: absolute;
top: 0;
left: 0;
background: #ff4d4f;
color: #fff;
font-size: 18rpx;
padding: 2rpx 8rpx;
border-top-left-radius: 6rpx;
border-bottom-right-radius: 6rpx;
z-index: 2;
line-height: 1.2;
}
.gift-badge {
display: inline-block;
background: #ff4d4f;
color: #fff;
font-size: 20rpx;
line-height: 28rpx;
padding: 0 10rpx;
border-radius: 6rpx;
margin-right: 8rpx;
vertical-align: middle;
}
</style>

View File

@@ -82,7 +82,12 @@
</view>
<view class="order-info-view" @click="handleCallPhone">
<view class="title">联系方式:</view>
<view class="value">{{ order.storeAddressMobile }}<u-icon name='phone-fill' ></u-icon></view>
<view class="value contact-phone-value">
<text>{{ order.storeAddressMobile }}</text>
<view class="phone-icon-wrap">
<u-icon name="phone-fill" size="28" :color="lightColor || '#2979ff'"></u-icon>
</view>
</view>
</view>
</view>
@@ -108,12 +113,18 @@
</view>
<view class="goods-body">
<view class="goods-info" @click="gotoGoodsDetail(sku)">
<view class="goods-title u-line-2">{{ sku.goodsName }}</view>
<view class="goods-price">
<view class="goods-title u-line-2">
<text v-if="isGiftItem(sku)" class="gift-badge">赠品</text>
{{ sku.goodsName }}
</view>
<view class="goods-price" v-if="isGiftItem(sku)">
<text class="gift-original-price">¥{{ unitPrice(sku.goodsPrice) }}</text>
</view>
<view class="goods-price" v-else>
¥{{unitPrice(sku.goodsPrice) }}
<!-- <span v-if="sku.point">+{{ sku.point }}积分</span> -->
<span style="font-size: 24rpx;margin-left: 14rpx;color: #ff9900;" v-if="!isECouponOrder && !isAppointmentOrderFlag && sku.isRefund && sku.isRefund !== 'NO_REFUND'">
{{refundPriceList(sku.isRefund)}} ({{unitPrice(sku.refundPrice, "¥") }})
<span style="font-size: 24rpx;margin-left: 14rpx;color: #ff9900;" v-if="order.payStatus === 'PAID' && !isECouponOrder && !isAppointmentOrderFlag && sku.isRefund && sku.isRefund !== 'NO_REFUND'">
{{refundPriceList(sku.isRefund)}} ({{unitPrice(resolveRefundPrice(sku), "¥") }})
</span>
</view>
</view>
@@ -122,6 +133,7 @@
<view>x{{ sku.num }}</view>
</view>
<view class="after-sale-btn" v-if="canShowSkuAfterSale(sku)" @click.stop="onSkuAfterSale(sku)">退款/售后</view>
<view class="gift-tip" v-else-if="isGiftItem(sku)">随单赠送</view>
</view>
</view>
</view>
@@ -543,6 +555,16 @@ function refundPriceList(status: string) {
}
}
function resolveRefundPrice(sku: any) {
if (sku?.refundPrice && Number(sku.refundPrice) > 0) {
return sku.refundPrice
}
if (sku?.isRefund === 'ALL_REFUND' && sku?.flowPrice) {
return sku.flowPrice
}
return sku?.refundPrice || 0
}
function handleCallPhone() {
if (order.value.storeAddressMobile) {
callPhone(order.value.storeAddressMobile)
@@ -631,7 +653,14 @@ function canApplySkuAfterSale(sku: any) {
return false
}
function isGiftItem(sku: any) {
if (!sku) return false
return sku.promotionType === 'GIFT' || (Number(sku.flowPrice) === 0 && sku.promotionType === 'GIFT')
}
function canShowSkuAfterSale(sku: any) {
if (order.value?.orderStatus === 'CANCELLED') return false
if (isGiftItem(sku)) return false
if (isECouponOrder.value) return false
if (!order.value?.sn || Number(order.value.flowPrice) === 0) return false
if (isAppointmentOrderFlag.value && !appointmentAllow.value.afterSale) return false
@@ -955,6 +984,19 @@ page,
flex:10;
}
.contact-phone-value {
display: flex;
flex-direction: row;
align-items: center;
.phone-icon-wrap {
margin-left: 12rpx;
display: inline-flex;
align-items: center;
justify-content: center;
}
}
.order-sn-value {
display: flex;
flex-direction: row;
@@ -1178,4 +1220,28 @@ page,
flex:2;
}
}
.gift-badge {
display: inline-block;
background: #ff4d4f;
color: #fff;
font-size: 20rpx;
line-height: 28rpx;
padding: 0 10rpx;
border-radius: 6rpx;
margin-right: 8rpx;
vertical-align: middle;
}
.gift-original-price {
color: #999;
font-size: 26rpx;
text-decoration: line-through;
font-weight: normal;
}
.gift-tip {
font-size: 22rpx;
color: #999;
margin-top: 8rpx;
text-align: right;
}
</style>

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 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 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>
</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 {

View File

@@ -0,0 +1,500 @@
<!--
* 优惠券礼包(券包一键领)专属落地页
* 支持H5及微信小程序环境访问,提供礼包明细展示、总价值汇总、一键领券及凑单导购
*
* @author Bulbasaur
* @since 2026-11-12
-->
<template>
<view class="coupon-pack-page">
<!-- 顶部氛围 Banner -->
<view class="banner-box">
<view class="banner-decor decor-1"></view>
<view class="banner-decor decor-2"></view>
<view class="banner-content">
<text class="pack-badge">限时专享福利</text>
<text class="pack-title">{{ detail.activityName || '专属超值优惠券礼包' }}</text>
<view class="total-amount-box">
<text class="currency">¥</text>
<text class="amount">{{ detail.totalAmount || 0 }}</text>
<text class="amount-tip">立省总额</text>
</view>
<text class="time-tip" v-if="detail.endTime">
活动有效期至:{{ formatTime(detail.endTime) }}
</text>
</view>
</view>
<!-- 券包内优惠券列表 -->
<view class="coupon-list-container">
<view class="section-header">
<text class="title">礼包包含优惠券 (共{{ couponCount }}张)</text>
</view>
<view v-if="detail.couponItems && detail.couponItems.length > 0" class="coupon-card-list">
<view
v-for="(item, index) in detail.couponItems"
:key="index"
class="coupon-card"
>
<!-- 左侧面额 -->
<view class="card-left">
<template v-if="item.couponType === 'PRICE'">
<text class="symbol">¥</text>
<text class="price">{{ item.price || 0 }}</text>
</template>
<template v-else>
<text class="price">{{ item.couponDiscount || 0 }}</text>
<text class="symbol">折</text>
</template>
<text class="threshold">
{{ item.consumeThreshold > 0 ? `满${item.consumeThreshold}元可用` : '无门槛' }}
</text>
</view>
<!-- 中部信息 -->
<view class="card-center">
<view class="name-box">
<text class="coupon-tag">{{ item.couponType === 'PRICE' ? '满减券' : '折扣券' }}</text>
<text class="coupon-name">{{ item.couponName }}</text>
</view>
<text class="coupon-num">发放数量:{{ item.num || 1 }} 张</text>
</view>
</view>
</view>
<!-- 空状态 -->
<view v-else class="empty-box">
<text class="empty-text">礼包暂无可用优惠券或活动已结束</text>
</view>
</view>
<!-- 活动规则说明 -->
<view class="rules-container">
<view class="rules-title">活动说明</view>
<view class="rules-content">
<text class="rule-item">1. 每位用户活动期间仅限一键领取本礼包 1 次;</text>
<text class="rule-item">2. 领取成功后优惠券将自动发放至【我的 - 优惠券】中;</text>
<text class="rule-item">3. 优惠券不可兑现、不找零,下单结算时满足条件自动抵扣;</text>
<text class="rule-item">4. 礼包内优惠券使用规则及有效期以各券券面标注为准。</text>
</view>
</view>
<!-- 底部悬浮操作栏 -->
<view class="bottom-action-bar">
<button
v-if="!isLogin"
class="action-btn primary-btn"
@click="toLogin"
>
登录并一键领取 (¥{{ detail.totalAmount || 0 }})
</button>
<button
v-else-if="detail.hasReceived"
class="action-btn success-btn"
@click="toUse"
>
已领取,去挑选商品凑单 >
</button>
<button
v-else
class="action-btn primary-btn"
:loading="loading"
@click="handleReceive"
>
一键领取全部 (¥{{ detail.totalAmount || 0 }})
</button>
</view>
</view>
</template>
<script>
/**
* 优惠券礼包落地页交互逻辑
*
* @author Bulbasaur
* @since 2026-11-12
*/
import { getCouponPackageDetail, receiveCouponPackage } from "@/api/promotions.js";
import storage from "@/utils/storage.js";
export default {
data() {
return {
packId: "",
detail: {
id: "",
activityName: "",
totalAmount: 0,
endTime: "",
hasReceived: false,
couponItems: []
},
loading: false,
isLogin: false
};
},
computed: {
couponCount() {
if (!this.detail.couponItems) return 0;
return this.detail.couponItems.reduce((acc, cur) => acc + (cur.num || 1), 0);
}
},
onLoad(options) {
if (options && options.id) {
this.packId = options.id;
} else if (options && options.scene) {
// 兼容微信小程序太阳码 scene 参数 (如 scene=pack_123)
const sceneStr = decodeURIComponent(options.scene);
if (sceneStr.startsWith("pack_")) {
this.packId = sceneStr.replace("pack_", "");
} else {
this.packId = sceneStr;
}
}
this.checkLoginStatus();
this.fetchDetail();
},
onShow() {
this.checkLoginStatus();
if (this.packId) {
this.fetchDetail();
}
},
methods: {
checkLoginStatus() {
const accessToken = storage.getAccessToken();
this.isLogin = !!accessToken;
},
async fetchDetail() {
if (!this.packId) {
uni.showToast({ title: "活动参数缺失", icon: "none" });
return;
}
try {
const res = await getCouponPackageDetail(this.packId);
if (res.data.success && res.data.result) {
this.detail = res.data.result;
} else {
uni.showToast({
title: res.data.message || "获取券包失败",
icon: "none"
});
}
} catch (e) {
console.error("加载券包详情异常", e);
}
},
async handleReceive() {
if (!this.isLogin) {
this.toLogin();
return;
}
if (this.loading) return;
this.loading = true;
uni.showLoading({ title: "领取中..." });
try {
const res = await receiveCouponPackage(this.packId);
uni.hideLoading();
this.loading = false;
if (res.data.success) {
uni.showModal({
title: "领取成功",
content: `恭喜!已成功领取礼包内 ${this.couponCount} 张优惠券,快去挑选商品吧!`,
confirmText: "立即去逛",
cancelText: "留在此页",
success: (modalRes) => {
this.detail.hasReceived = true;
if (modalRes.confirm) {
this.toUse();
}
}
});
} else {
uni.showToast({
title: res.data.message || "领取失败,请稍后重试",
icon: "none"
});
}
} catch (err) {
uni.hideLoading();
this.loading = false;
console.error("一键领券异常", err);
}
},
toLogin() {
uni.navigateTo({
url: "/pages/passport/login"
});
},
toUse() {
uni.switchTab({
url: "/pages/tabbar/home/index"
});
},
formatTime(timeStr) {
if (!timeStr) return "";
return String(timeStr).replace("T", " ").substring(0, 16);
}
}
};
</script>
<style lang="scss" scoped>
.coupon-pack-page {
min-height: 100vh;
background-color: #f6f7f9;
padding-bottom: 140rpx;
box-sizing: border-box;
.banner-box {
position: relative;
background: linear-gradient(135deg, #ff4142 0%, #ff6b4a 100%);
padding: 60rpx 40rpx 50rpx;
color: #fff;
overflow: hidden;
.banner-decor {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.08);
&.decor-1 {
width: 300rpx;
height: 300rpx;
top: -100rpx;
right: -80rpx;
}
&.decor-2 {
width: 200rpx;
height: 200rpx;
bottom: -60rpx;
left: -40rpx;
}
}
.banner-content {
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.pack-badge {
display: inline-block;
background: rgba(255, 255, 255, 0.25);
border: 1px solid rgba(255, 255, 255, 0.4);
padding: 4rpx 20rpx;
border-radius: 30rpx;
font-size: 22rpx;
margin-bottom: 16rpx;
letter-spacing: 2rpx;
}
.pack-title {
font-size: 38rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.total-amount-box {
display: flex;
align-items: baseline;
justify-content: center;
margin-bottom: 16rpx;
.currency {
font-size: 40rpx;
font-weight: bold;
}
.amount {
font-size: 88rpx;
font-weight: 800;
line-height: 1;
margin: 0 8rpx;
}
.amount-tip {
font-size: 24rpx;
background: #ffe175;
color: #b33b00;
padding: 2rpx 12rpx;
border-radius: 8rpx;
font-weight: bold;
}
}
.time-tip {
font-size: 22rpx;
opacity: 0.85;
}
}
}
.coupon-list-container {
padding: 30rpx 24rpx 10rpx;
.section-header {
margin-bottom: 20rpx;
.title {
font-size: 30rpx;
font-weight: bold;
color: #333;
}
}
.coupon-card-list {
.coupon-card {
display: flex;
align-items: center;
background: #fff;
border-radius: 16rpx;
margin-bottom: 20rpx;
overflow: hidden;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
position: relative;
.card-left {
width: 220rpx;
background: linear-gradient(135deg, #fff2f0 0%, #ffe9e7 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 30rpx 10rpx;
border-right: 2rpx dashed #ffccc7;
.symbol {
font-size: 28rpx;
color: #ff4142;
font-weight: bold;
}
.price {
font-size: 52rpx;
font-weight: 800;
color: #ff4142;
line-height: 1;
}
.threshold {
font-size: 20rpx;
color: #888;
margin-top: 8rpx;
}
}
.card-center {
flex: 1;
padding: 24rpx;
.name-box {
display: flex;
align-items: center;
margin-bottom: 12rpx;
.coupon-tag {
background: #ff4142;
color: #fff;
font-size: 18rpx;
padding: 2rpx 8rpx;
border-radius: 6rpx;
margin-right: 12rpx;
flex-shrink: 0;
}
.coupon-name {
font-size: 28rpx;
font-weight: bold;
color: #222;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.coupon-num {
font-size: 22rpx;
color: #ff8533;
}
}
}
}
.empty-box {
background: #fff;
padding: 60rpx 20rpx;
text-align: center;
border-radius: 16rpx;
.empty-text {
font-size: 26rpx;
color: #999;
}
}
}
.rules-container {
margin: 20rpx 24rpx;
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
.rules-title {
font-size: 26rpx;
font-weight: bold;
color: #555;
margin-bottom: 14rpx;
}
.rules-content {
display: flex;
flex-direction: column;
.rule-item {
font-size: 22rpx;
color: #888;
line-height: 1.6;
margin-bottom: 6rpx;
}
}
}
.bottom-action-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff;
padding: 20rpx 30rpx;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.06);
z-index: 99;
.action-btn {
width: 100%;
height: 84rpx;
line-height: 84rpx;
border-radius: 42rpx;
font-size: 30rpx;
font-weight: bold;
border: none;
&.primary-btn {
background: linear-gradient(135deg, #ff4142 0%, #ff6b4a 100%);
color: #fff;
}
&.success-btn {
background: #f0f7f2;
color: #2b8555;
border: 1px solid #c2e5d3;
}
}
}
}
</style>

View File

@@ -37,16 +37,14 @@
<span>领劵</span>
</view>
</view>
<u-swipe-action ref="swiperAction" class="cart-item" v-for="(skuItem, i) in item.skuList" :key="skuItem.goodsSku.id">
<u-swipe-action-item :show="skuItem.selected" @open="openAction(skuItem)" :options="options"
:name="i"
@click="changeActionTab(skuItem)" @longpress="changeActionTab(skuItem)">
<!-- 满减活动 -->
<div v-if="Object.keys(skuItem.promotionMap).length != 0">
<view class="cart-item" v-for="(skuItem) in item.skuList" :key="skuItem.goodsSku.id"
@longpress="changeActionTab(skuItem)">
<!-- 满优惠活动 -->
<div v-if="Object.keys(skuItem.promotionMap).length != 0" class="promotion-box">
<div v-if="getPromotion(skuItem).includes('FULL_DISCOUNT')">
<div class="promotion-notice" v-if="item.promotionNotice">
<span class="tips">满减</span>
<span style="flex:10;">{{item.promotionNotice}}</span>
<span class="tips">{{ getFullDiscountTag(skuItem) }}</span>
<span class="notice-desc">{{item.promotionNotice}}</span>
</div>
</div>
</div>
@@ -93,8 +91,7 @@
</view>
</view>
</u-swipe-action-item>
</u-swipe-action>
</view>
</div>
</div>
<u-modal v-if="deleteShow" v-model:show="deleteShow" :confirm-style="modalConfirmStyle" @confirm="deleteConfirm" show-cancel-button
@@ -168,20 +165,10 @@ import { useStore } from '@/store'
import { unitPrice, goodsFormatPrice, isLogin, forceLogin } from '@/utils/filters.js'
const store = useStore()
const swiperAction = ref()
const lightColor = computed(() => store.getters.lightColor)
const loading = ref(false)
const discountDetailsFlag = ref(false)
// 商品栏右侧滑动按钮
const options = [
{
text: "删除",
style: {
backgroundColor: store.getters.lightColor,
},
},
]
const isInvalid = (val: any): boolean => {
if (!val) return false
if (val.invalid == 1 || (!val.checked && val.errorMessage)) {
@@ -226,14 +213,7 @@ onPullDownRefresh(() => {
onShow(() => {
deleteShow.value ? (deleteShow.value = false) : true
if (swiperAction.value) {
(swiperAction.value as any[]).forEach((item: any) => {
item.show = false
})
getCardData()
} else {
getCardData()
}
})
function setCapsuleInset() {
@@ -277,22 +257,9 @@ function getCountDownTime(val: any) {
function discountDetails() {
discountDetailsFlag.value = true
}
/**
* 左滑打开删除
*/
function openAction(skuItem: any) {
cartDetail.value.cartList.forEach((cartItem: any) => {
if (cartItem.skuList) {
cartItem.skuList.forEach((sku: any) => {
sku["selected"] = false
})
}
})
skuItem["selected"] = true
}
/**
* 滑动删除
* 长按或点击删除
*/
function changeActionTab(val: any) {
deleteShow.value = true
@@ -496,6 +463,22 @@ function getPromotion(item: any) {
})
}
/**
* 获取购物车商品绑定的满额活动类型标签(满减/满折/满赠)
*/
function getFullDiscountTag(item: any) {
if (!item || !item.promotionMap) return "满优惠"
const fdKey = Object.keys(item.promotionMap).find((child: string) => child.split("-")[0] === "FULL_DISCOUNT")
if (!fdKey) return "满优惠"
const fdObj = item.promotionMap[fdKey]
if (fdObj && fdObj.activityType === "FULL_RATE") return "满折"
if (fdObj && fdObj.activityType === "FULL_GIFT") return "满赠"
if (fdObj && fdObj.activityType === "FULL_MINUS") return "满减"
if (fdObj && fdObj.fullRateFlag) return "满折"
if (fdObj && fdObj.giftFlag) return "满赠"
return "满减"
}
/**
* 获取购物车数据
*/
@@ -569,22 +552,38 @@ page {
font-size: 28rpx;
}
}
.promotion-box {
background: #fff;
padding-top: 16rpx;
}
.promotion-notice {
margin-top: 10px;
margin-left: 68rpx;
margin: 0 0 0 68rpx;
padding-right: 20rpx;
font-size: 24rpx;
color: #333;
font-weight: bold;
display: flex;
align-items: center;
::v-deep .tips {
margin: 0 8rpx 0 0;
background: #fff;
.tips {
margin: 0 12rpx 0 0;
background: $main-color;
border-radius: 100px;
display: block;
flex: 1;
padding: 2rpx 12rpx;
display: inline-block;
flex-shrink: 0;
padding: 2rpx 14rpx;
color: #fff;
font-size: 20rpx;
line-height: 32rpx;
}
.notice-desc {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.default-color {
@@ -616,8 +615,7 @@ page {
.cart-item {
width: 100%;
border-radius: 0.4em;
transition: 0.35s;
overflow: hidden;
background: #fff;
}
/* 空白页 */

View File

@@ -51,8 +51,11 @@ export function modelNavigateTo(item) {
url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId,
});
break;
// 满减商品
// 满减/满折/满赠商品
case "FULL_DISCOUNT":
case "FULL_MINUS":
case "FULL_RATE":
case "FULL_GIFT":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId,
});