|
|
@@ -11,6 +11,11 @@ definePage({
|
|
|
navigationBarTitleText: '星闪豹商品详情',
|
|
|
},
|
|
|
})
|
|
|
+const selectGoods = ref(false)
|
|
|
+const SelectGoodsNum = ref(1)
|
|
|
+const specId = ref()
|
|
|
+const { userInfo } = storeToRefs(useUserStore())
|
|
|
+const { SelectShopInfo } = storeToRefs(useSysXsbStore())
|
|
|
// const goodsTab = ref(0)
|
|
|
const current = ref<number>(0)
|
|
|
const currentDetaile = ref(0)
|
|
|
@@ -80,20 +85,29 @@ function handleGoCurren(id: number) {
|
|
|
}
|
|
|
|
|
|
async function getGoodsDetaile() {
|
|
|
- const res = await Apis.xsb.getProductDetail({ data: { id: goodsId.value } })
|
|
|
+ const res = await Apis.xsb.getProductDetail({ data: { id: goodsId.value, shopId: Number(SelectShopInfo.value?.shopId) || 1, channelId: userInfo.value.channelId || 1 } })
|
|
|
console.log(res, '请求')
|
|
|
goodsInfo.value = res
|
|
|
+ specId.value = res.skuList?.[0].skuId
|
|
|
+}
|
|
|
+function handleConfimOrder() {
|
|
|
+ if (Number(unref(goodsInfo)?.spuStock) < unref(SelectGoodsNum)) {
|
|
|
+ useGlobalToast().show('库存不足,请调整购买数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ router.push({ name: 'xsb-confirmOrder' })
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
+ <page-meta :page-style="selectGoods ? 'overflow: hidden;' : '' " />
|
|
|
<view class="page-xsb">
|
|
|
<wd-navbar
|
|
|
title="商品详情" :custom-style="`background-color:${isShowTab ? '#FFF !important' : 'transparent !important'}`" :bordered="false" :z-index="99"
|
|
|
safe-area-inset-top left-arrow fixed @click-left="router.back()"
|
|
|
/>
|
|
|
<template v-if="goodsInfo">
|
|
|
- <wd-swiper v-model:current="current" :list="swiperList" autoplay :height="375">
|
|
|
+ <wd-swiper v-model:current="current" :list="swiperList" :autoplay="false" :height="375">
|
|
|
<template #indicator="{ current: currentIndex, total }">
|
|
|
<view class="custom-indicator absolute bottom-60rpx right-20rpx px26rpx">
|
|
|
{{ currentIndex + 1 }}/{{ total }}
|
|
|
@@ -161,7 +175,7 @@ async function getGoodsDetaile() {
|
|
|
<view class="flex items-center">
|
|
|
<view class="flex-shrink-0">
|
|
|
<view class="text-28rpx font-semibold">
|
|
|
- {{ goodsInfo.weight }}
|
|
|
+ {{ goodsInfo.skuList[0].weight }}g
|
|
|
</view>
|
|
|
<view class="mt16rpx text-24rpx text-#AAAAAA">
|
|
|
重量
|
|
|
@@ -174,7 +188,7 @@ async function getGoodsDetaile() {
|
|
|
<view class="flex items-center">
|
|
|
<view class="flex-shrink-0">
|
|
|
<view class="text-28rpx font-semibold">
|
|
|
- {{ goodsInfo.weightUnit }}
|
|
|
+ {{ goodsInfo.skuList[0].weightUnit }}
|
|
|
</view>
|
|
|
<view class="mt16rpx text-24rpx text-#AAAAAA">
|
|
|
单位
|
|
|
@@ -275,13 +289,17 @@ async function getGoodsDetaile() {
|
|
|
首页
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="mr36rpx">
|
|
|
- <view class="h44rpx w44rpx">
|
|
|
- <wd-button :icon="`${StaticUrl}/goods-kf.png`" type="icon" open-type="contact" />
|
|
|
- </view>
|
|
|
- <view class="text-20rpx">
|
|
|
- 客服
|
|
|
- </view>
|
|
|
+ <view class="relative mr36rpx">
|
|
|
+ <image
|
|
|
+ :src="`${StaticUrl}/goods-kf.png`"
|
|
|
+ class="h44rpx w44rpx"
|
|
|
+ />
|
|
|
+
|
|
|
+ <button class="zbutton" open-type="contact">
|
|
|
+ <view class="text-20rpx">
|
|
|
+ 客服
|
|
|
+ </view>
|
|
|
+ </button>
|
|
|
</view>
|
|
|
<view @click="router.replace({ name: 'xsb-homeTabbar', animationType: 'fade-out', params: { name: 'xsb-cart' } })">
|
|
|
<image
|
|
|
@@ -294,11 +312,11 @@ async function getGoodsDetaile() {
|
|
|
</view>
|
|
|
<view class="flex items-center">
|
|
|
<view class="w220rpx">
|
|
|
- <wd-button hairline plain block>
|
|
|
+ <wd-button plain hairline block @click="selectGoods = true">
|
|
|
加入购物车
|
|
|
</wd-button>
|
|
|
</view>
|
|
|
- <view class="ml20rpx w220rpx" @click="router.push({ name: 'common-confirmOrder' })">
|
|
|
+ <view class="ml20rpx w220rpx" @click="selectGoods = true">
|
|
|
<wd-button block class="w-full">
|
|
|
立即购买
|
|
|
</wd-button>
|
|
|
@@ -306,6 +324,66 @@ async function getGoodsDetaile() {
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <Zpopup v-model="selectGoods">
|
|
|
+ <view class="bg-white px24rpx py28rpx">
|
|
|
+ <view class="flex items-center">
|
|
|
+ <image
|
|
|
+ :src="goodsInfo.pic"
|
|
|
+ class="h200rpx w200rpx flex-shrink-0 rounded-16rpx"
|
|
|
+ />
|
|
|
+ <view class="ml20rpx">
|
|
|
+ <view class="flex items-end text-#FF4D3A font-semibold">
|
|
|
+ <view class="text-24rpx">
|
|
|
+ ¥
|
|
|
+ </view>
|
|
|
+ <view class="text-36rpx line-height-[36rpx]">
|
|
|
+ {{ goodsInfo?.channelProdPrice }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="mt20rpx flex items-center">
|
|
|
+ <view class="text-24rpx text-#AAAAAA">
|
|
|
+ 已选
|
|
|
+ </view>
|
|
|
+ <view class="ml20rpx text-28rpx font-semibold">
|
|
|
+ {{ goodsInfo.skuList.find((it) => it.skuId === specId)?.spec }} {{ SelectGoodsNum }}件
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="my28rpx h2rpx w-full bg-#F0F0F0" />
|
|
|
+ <view class="mb20rpx">
|
|
|
+ <view class="text-28rpx font-semibold">
|
|
|
+ 规格
|
|
|
+ </view>
|
|
|
+ <wd-radio-group v-model="specId" cell shape="button">
|
|
|
+ <wd-radio v-for="item in goodsInfo.skuList" :key="item.skuId" :value="item.skuId">
|
|
|
+ {{ item.spec }}
|
|
|
+ </wd-radio>
|
|
|
+ </wd-radio-group>
|
|
|
+ </view>
|
|
|
+ <view class="flex items-center justify-between">
|
|
|
+ <view class="text-28rpx font-semibold">
|
|
|
+ 数量
|
|
|
+ </view>
|
|
|
+ <wd-input-number v-model="SelectGoodsNum" />
|
|
|
+ </view>
|
|
|
+ <view class="h200rpx" />
|
|
|
+ </view>
|
|
|
+ <view class="shadow-fixed ios fixed bottom-0 left-0 box-border w-full rounded-t-32rpx bg-white px24rpx">
|
|
|
+ <view class="box-border w-full flex items-center justify-between py20rpx">
|
|
|
+ <view class="w-48%">
|
|
|
+ <wd-button plain hairline block>
|
|
|
+ 加入购物车
|
|
|
+ </wd-button>
|
|
|
+ </view>
|
|
|
+ <view class="w-48%">
|
|
|
+ <wd-button block @click="handleConfimOrder">
|
|
|
+ 立即购买
|
|
|
+ </wd-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </Zpopup>
|
|
|
</template>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -338,6 +416,9 @@ async function getGoodsDetaile() {
|
|
|
.ios .wd-button{
|
|
|
min-width: unset !important;
|
|
|
}
|
|
|
+ .wd-radio-group.is-button{
|
|
|
+ padding: 0!important;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|