mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-08-06 10:57:25 +08:00
feat: 添加电子卡券功能及相关逻辑
- 在 pages.json 中新增卡密详情页面路径 - 在多个组件中实现电子卡券(E_COUPON)逻辑,包括库存管理、结算页面处理、订单详情展示等 - 优化商品页面和订单页面以支持电子卡券的特性,隐藏不适用的功能 - 新增 utils/goodsType.js 文件,集中管理与电子卡券相关的类型和工具函数 - 更新样式以适应电子卡券的展示需求
This commit is contained in:
@@ -90,8 +90,8 @@
|
||||
|
||||
<GoodsSwiper id="main1" :res="imgList" :video="goodsDetail.goodsVideo" />
|
||||
|
||||
<!-- 促销活动条 -->
|
||||
<PromotionAssembleLayout v-if="PromotionList" :detail="goodsDetail" :res="PromotionList" />
|
||||
<!-- 促销活动条(E_COUPON 不参与促销 M-01) -->
|
||||
<PromotionAssembleLayout v-if="PromotionList && !isECouponGoods" :detail="goodsDetail" :res="PromotionList" />
|
||||
|
||||
<view class="card-box top-radius-0" id="main2">
|
||||
<!-- 活动不显示价钱 -->
|
||||
@@ -172,7 +172,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-box">
|
||||
<!-- 促销/领券入口(E_COUPON 隐藏) -->
|
||||
<view class="card-box" v-if="!isECouponGoods">
|
||||
<view class="card-flex" @click="shutMask(1)">
|
||||
<view class="card-title"> 促销 </view>
|
||||
<view class="card-content">
|
||||
@@ -186,10 +187,10 @@
|
||||
</view>
|
||||
|
||||
<!-- 拼团用户列表 -->
|
||||
<PromotionAssembleListLayout v-if="isGroup" @to-assemble-buy-now="toAssembleBuyNow" :res="PromotionList" />
|
||||
<PromotionAssembleListLayout v-if="isGroup && !isECouponGoods" @to-assemble-buy-now="toAssembleBuyNow" :res="PromotionList" />
|
||||
|
||||
<!-- 配置地址 如果是虚拟产品的时候不展示 -->
|
||||
<view class="card-box" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'">
|
||||
<!-- 实物配送地址;E_COUPON / VIRTUAL_GOODS 均不展示 -->
|
||||
<view class="card-box" v-if="!isNonPhysicalGoodsType">
|
||||
<view class="card-flex" @click="shutMask(4)">
|
||||
<view class="card-title"> 已选 </view>
|
||||
<view class="card-content">
|
||||
@@ -259,9 +260,9 @@
|
||||
</div>
|
||||
<!-- 正常结算页面 -->
|
||||
<view class="detail-btn" v-if="!isGroup && !takeDownFromSale">
|
||||
<view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'" @click="shutMask(4)">
|
||||
<view class="to-store-car to-store-btn" v-if="showAddToCart" @click="shutMask(4)">
|
||||
加入购物车</view>
|
||||
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view>
|
||||
<view class="to-buy to-store-btn" :class="{ 'to-buy--full': isECouponGoods }" @click="shutMask(4, 'buy')">立即购买</view>
|
||||
<view class="to-store-car to-store-btn" v-if="startTimer">暂未开始</view>
|
||||
</view>
|
||||
<!-- 拼团结算 -->
|
||||
@@ -328,6 +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 PromotionLayout from './product/promotion/-promotion'
|
||||
@@ -428,6 +430,13 @@ const IM = computed(() => {
|
||||
return IMLink.value + storeDetail.value.merchantEuid
|
||||
})
|
||||
|
||||
// E_COUPON:仅立即购买,隐藏促销/地址/加购(FR-B-01 / P-08)
|
||||
const isECouponGoods = computed(() => isECoupon(goodsDetail.value?.goodsType))
|
||||
const isNonPhysicalGoodsType = computed(() => isNonPhysicalGoods(goodsDetail.value?.goodsType))
|
||||
const showAddToCart = computed(() => {
|
||||
return !isNonPhysicalGoodsType.value && !isECouponGoods.value
|
||||
})
|
||||
|
||||
// watch
|
||||
watch(isGroup, (val) => {
|
||||
if (val) {
|
||||
@@ -538,6 +547,10 @@ 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
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ page {
|
||||
border-radius: 214px;
|
||||
padding: 0;
|
||||
}
|
||||
> .to-buy--full {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
> .pt-buy {
|
||||
line-height: 1.2;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user