|
@@ -45,7 +45,7 @@ const hasCartData = computed(() => {
|
|
|
if (cartList.value.length) {
|
|
if (cartList.value.length) {
|
|
|
return '390rpx'
|
|
return '390rpx'
|
|
|
}
|
|
}
|
|
|
- return '0px'
|
|
|
|
|
|
|
+ return '260rpx'
|
|
|
})
|
|
})
|
|
|
const productList = ref<Api.xsbCategoryProductList[]>([])
|
|
const productList = ref<Api.xsbCategoryProductList[]>([])
|
|
|
const topScrollView = ref()
|
|
const topScrollView = ref()
|
|
@@ -112,6 +112,9 @@ async function getProductList() {
|
|
|
function handlScrollBottom() {
|
|
function handlScrollBottom() {
|
|
|
goodsLoading.value = 'loading'
|
|
goodsLoading.value = 'loading'
|
|
|
const index = categories?.value.findIndex(it => it.code === leftActive.value)
|
|
const index = categories?.value.findIndex(it => it.code === leftActive.value)
|
|
|
|
|
+ console.log(index, '-================')
|
|
|
|
|
+ if (index + 1 === categories.value.length)
|
|
|
|
|
+ return
|
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
|
handleChange({ value: categories.value[index + 1].code })
|
|
handleChange({ value: categories.value[index + 1].code })
|
|
|
}
|
|
}
|
|
@@ -295,6 +298,18 @@ async function handleSkuAddCart() {
|
|
|
getGoodsPrice()
|
|
getGoodsPrice()
|
|
|
await getCartCategorList()
|
|
await getCartCategorList()
|
|
|
}
|
|
}
|
|
|
|
|
+function handlePay() {
|
|
|
|
|
+ if (!totalProduct.value) {
|
|
|
|
|
+ useGlobalToast().show('请选择商品')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const shopSkuStock = totalProduct.value.skuList.filter(it => it.num > Number(it.shopSkuStocks))
|
|
|
|
|
+ if (shopSkuStock.length) {
|
|
|
|
|
+ useGlobalToast().show({ msg: `${shopSkuStock[0].skuName}库存不足` })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ router.push({ name: 'xsb-confirmOrder', params: { data: JSON.stringify(totalProduct) } })
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -398,13 +413,12 @@ async function handleSkuAddCart() {
|
|
|
</wd-popup>
|
|
</wd-popup>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="wraper">
|
|
<view class="wraper">
|
|
|
- <wd-sidebar v-model="leftActive" @change="handleChange">
|
|
|
|
|
- <wd-sidebar-item
|
|
|
|
|
- v-for="(item) in categories" :key="item.code"
|
|
|
|
|
- custom-style="font-size:28rpx; white-space: nowrap;text-overflow: ellipsis;overflow: hidden;"
|
|
|
|
|
- :value="item.code" :label="item.name"
|
|
|
|
|
- />
|
|
|
|
|
- </wd-sidebar>
|
|
|
|
|
|
|
+ <scroll-view class="w200rpx" :scroll-into-view-offset="-150" enable-passive scroll-with-animation scroll-y :scroll-into-view="`id${leftActive}`">
|
|
|
|
|
+ <view v-for="item in categories" :id="`id${item.code}`" :key="item.code" :class="[item.code == leftActive ? 'bg-white' : '']" class="relative h100rpx flex items-center justify-center whitespace-nowrap text-28rpx" @click="handleChange({ value: item.code })">
|
|
|
|
|
+ {{ item.name }}
|
|
|
|
|
+ <view v-if="item.code == leftActive" class="absolute left-0 top-20rpx h60rpx w8rpx rounded-4rpx bg-[var(--them-color)]" />
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </scroll-view>
|
|
|
<view class="content">
|
|
<view class="content">
|
|
|
<view class="p20rpx">
|
|
<view class="p20rpx">
|
|
|
<image :src="`${StaticUrl}/class.png`" class="h144rpx w-full" />
|
|
<image :src="`${StaticUrl}/class.png`" class="h144rpx w-full" />
|
|
@@ -494,6 +508,7 @@ async function handleSkuAddCart() {
|
|
|
<wd-loadmore :state="goodsLoading" />
|
|
<wd-loadmore :state="goodsLoading" />
|
|
|
</view>
|
|
</view>
|
|
|
<wd-status-tip v-else image="content" tip="暂无内容" />
|
|
<wd-status-tip v-else image="content" tip="暂无内容" />
|
|
|
|
|
+ <view v-if="goodsLoading == 'finished'" class="h-50vh" />
|
|
|
</scroll-view>
|
|
</scroll-view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -518,7 +533,7 @@ async function handleSkuAddCart() {
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="ml20rpx w160rpx">
|
|
<view class="ml20rpx w160rpx">
|
|
|
- <wd-button block size="large" @click="totalProduct?.price && router.push({ name: 'xsb-confirmOrder', params: { data: JSON.stringify(totalProduct) } })">
|
|
|
|
|
|
|
+ <wd-button block size="large" @click="handlePay">
|
|
|
结算
|
|
结算
|
|
|
</wd-button>
|
|
</wd-button>
|
|
|
</view>
|
|
</view>
|
|
@@ -622,9 +637,9 @@ async function handleSkuAddCart() {
|
|
|
|
|
|
|
|
.wraper {
|
|
.wraper {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- height: calc(100vh - var(--window-top) - v-bind(navHeight) - v-bind(hasCartData));
|
|
|
|
|
- height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData));
|
|
|
|
|
- height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData));
|
|
|
|
|
|
|
+ height: calc(100vh - var(--window-top) - v-bind(navHeight) - v-bind(hasCartData) - var(--window-bottom));
|
|
|
|
|
+ height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData) - var(--window-bottom));
|
|
|
|
|
+ height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom) - v-bind(navHeight) - v-bind(hasCartData) - var(--window-bottom));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
.content {
|