diff --git a/pages/mine/address/address.scss b/pages/mine/address/address.scss index 944e4dc..ade56c8 100644 --- a/pages/mine/address/address.scss +++ b/pages/mine/address/address.scss @@ -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; } diff --git a/pages/mine/address/address.vue b/pages/mine/address/address.vue index 6090a69..fb5012c 100644 --- a/pages/mine/address/address.vue +++ b/pages/mine/address/address.vue @@ -32,11 +32,12 @@ - - - - 添加新收货人 + + + + 添加新收货人 + diff --git a/pages/order/myOrder.vue b/pages/order/myOrder.vue index ce77b31..2b5856b 100644 --- a/pages/order/myOrder.vue +++ b/pages/order/myOrder.vue @@ -68,9 +68,11 @@ :key="goodsIndex"> + 赠 + 赠品 {{ order.groupName }} ¥{{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; + } \ No newline at end of file diff --git a/pages/order/orderDetail.vue b/pages/order/orderDetail.vue index 131bac4..6fdb1e8 100644 --- a/pages/order/orderDetail.vue +++ b/pages/order/orderDetail.vue @@ -108,8 +108,14 @@ - {{ sku.goodsName }} - + + 赠品 + {{ sku.goodsName }} + + + ¥{{ unitPrice(sku.goodsPrice) }} + + ¥{{unitPrice(sku.goodsPrice) }} @@ -122,6 +128,7 @@ x{{ sku.num }} 退款/售后 + 随单赠送 @@ -631,7 +638,13 @@ 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 (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 @@ -1178,4 +1191,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; +} diff --git a/pages/product/product/promotion/-promotion-details.vue b/pages/product/product/promotion/-promotion-details.vue index 2ed0d34..d8749e1 100644 --- a/pages/product/product/promotion/-promotion-details.vue +++ b/pages/product/product/promotion/-promotion-details.vue @@ -1,25 +1,23 @@ + - - 满减 - - 满{{ res[prom].fullMoney }}元 立减现金 - {{ res[prom].fullMinus }}元 - 赠送优惠券 - 赠送{{ res[prom].point }}积分 - 赠送商品 - 赠送包邮服务 - - - - 打折 - - 满{{ res[prom].fullMoney }}元,立享 - {{ res[prom].fullRate }}折 - 优惠 - + + {{ resolveFullDiscountTag(res[prom]) }} + + + {{ tierText }} + + @@ -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 = { @@ -115,6 +157,10 @@ function handClickToJoinPromotion(val: string) { color: #333333; } +.tier-line { + margin-bottom: 6rpx; +} + .wrapper { display: block; } diff --git a/pages/product/product/promotion/-promotion.vue b/pages/product/product/promotion/-promotion.vue index 8ff9c85..4408ea3 100644 --- a/pages/product/product/promotion/-promotion.vue +++ b/pages/product/product/promotion/-promotion.vue @@ -1,12 +1,17 @@ + - + - {{ promotionItem.title }} - 满{{ res[item].fullMoney }}元,立享优惠 + {{ resolveFullDiscountTag(res[item]) }} + {{ formatFullDiscountSummary(res[item]) }} @@ -43,7 +48,6 @@ - 优惠券 @@ -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 { diff --git a/pages/tabbar/cart/cartList.vue b/pages/tabbar/cart/cartList.vue index 39bced7..1e4285a 100644 --- a/pages/tabbar/cart/cartList.vue +++ b/pages/tabbar/cart/cartList.vue @@ -37,16 +37,14 @@ 领劵 - - - - + + + - 满减 - {{item.promotionNotice}} + {{ getFullDiscountTag(skuItem) }} + {{item.promotionNotice}} @@ -93,8 +91,7 @@ - - + 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() - } + 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; } /* 空白页 */ diff --git a/pages/tabbar/home/template/tpl.js b/pages/tabbar/home/template/tpl.js index 40b7e50..afd7a15 100644 --- a/pages/tabbar/home/template/tpl.js +++ b/pages/tabbar/home/template/tpl.js @@ -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, });