mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-11-08 01:48:55 +08:00
feat: 更新预约功能与礼品卡支持
- 新增礼品卡页面,支持礼品卡的选择与使用。 - 调整预约下单流程,增强预约信息展示与用户交互。 - 更新支付成功页面的导航逻辑,确保用户体验流畅。 - 优化搜索页面的历史关键词加载逻辑,提升性能。
This commit is contained in:
@@ -53,7 +53,11 @@
|
||||
<span>,{{ num }}个</span>
|
||||
</span>
|
||||
</view>
|
||||
<view class="goods-check-skus">
|
||||
<view class="goods-check-skus" v-if="isAppointmentGoods(goodsDetail?.goodsType)">
|
||||
可预约
|
||||
<span class="goods-check-skus-name">按时段选择</span>
|
||||
</view>
|
||||
<view class="goods-check-skus" v-else>
|
||||
库存
|
||||
<span class="goods-check-skus-name">
|
||||
<span>{{ availableStock }}</span>
|
||||
@@ -105,7 +109,9 @@
|
||||
<!-- 按钮 -->
|
||||
<view class="btns" v-if="availableStock !== 0">
|
||||
<view class="box-btn card" v-if="showAddToCart" @click="addToCartOrBuy('cart')">加入购物车</view>
|
||||
<view class="box-btn buy" @click="addToCartOrBuy('buy')">立即购买</view>
|
||||
<view class="box-btn buy" @click="addToCartOrBuy('buy')">
|
||||
{{ isAppointmentGoods(goodsDetail?.goodsType) ? '立即预约' : '立即购买' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
@@ -124,6 +130,8 @@ import {
|
||||
isAppointmentGoods,
|
||||
getECouponStock,
|
||||
getECouponMaxBuyNum,
|
||||
getAppointmentStock,
|
||||
getAppointmentMaxBuyNum,
|
||||
} from '@/utils/goodsType.js'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
@@ -159,11 +167,14 @@ const formatList = ref<any[]>([])
|
||||
const currentSelected = ref<string[]>([])
|
||||
const skuList = ref('')
|
||||
|
||||
// E_COUPON 库存读 SKU quantity,上限 min(quantity, 999)
|
||||
// E_COUPON 读 SKU quantity;预约商品 quantity 固定 0,库存走时段
|
||||
const availableStock = computed(() => {
|
||||
if (isECoupon(props.goodsDetail?.goodsType)) {
|
||||
return getECouponStock(props.goodsDetail)
|
||||
}
|
||||
if (isAppointmentGoods(props.goodsDetail?.goodsType)) {
|
||||
return getAppointmentStock(props.goodsDetail)
|
||||
}
|
||||
return Number(props.goodsDetail?.quantity) || 0
|
||||
})
|
||||
|
||||
@@ -171,6 +182,9 @@ const maxBuyNum = computed(() => {
|
||||
if (isECoupon(props.goodsDetail?.goodsType)) {
|
||||
return getECouponMaxBuyNum(props.goodsDetail)
|
||||
}
|
||||
if (isAppointmentGoods(props.goodsDetail?.goodsType)) {
|
||||
return getAppointmentMaxBuyNum(props.goodsDetail)
|
||||
}
|
||||
return 999
|
||||
})
|
||||
|
||||
@@ -340,17 +354,17 @@ const addToCartOrBuy = (val: string) => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (isAppointmentGoods(props.goodsDetail?.goodsType)) {
|
||||
const goodsId = props.goodsDetail.goodsId || ''
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/appointment/appointmentCheckout?skuId=${props.goodsDetail.id}&goodsId=${goodsId}&num=${num.value}`,
|
||||
})
|
||||
closeMask()
|
||||
return
|
||||
}
|
||||
data.cartType = resolveCartType()
|
||||
API_trade.addToCart(data).then((res) => {
|
||||
if (res.data.success) {
|
||||
if (isAppointmentGoods(props.goodsDetail?.goodsType)) {
|
||||
const goodsId = props.goodsDetail.goodsId || ''
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/appointment/appointmentCheckout?skuId=${props.goodsDetail.id}&goodsId=${goodsId}&num=${num.value}`,
|
||||
})
|
||||
closeMask()
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/fillorder?way=${data.cartType}&addr=${props.addr?.id || ''}&parentOrder=${encodeURIComponent(JSON.stringify(parentOrder.value || ''))}`,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user