This commit is contained in:
1 parent
bbbca64436
commit
3349745145
1 file changed
+18
-13
+18
-13
@@ -108,7 +108,7 @@
|
||||
<!-- end 商品 end -->
|
||||
|
||||
<template #main-bottom>
|
||||
<view class="car z-200 p-x-30rpx p-y-30rpx bg-white">
|
||||
<view v-if="state.classifyList.length" class="car z-200 p-x-30rpx p-y-30rpx bg-white">
|
||||
<product-total :totPrice="state.totPrice" :totCount="state.totCount" @doContainer="doVisibleCart" @submit="doBuy" />
|
||||
</view>
|
||||
</template>
|
||||
@@ -208,17 +208,22 @@ const getClassify = async () => {
|
||||
const getPorductList = async () => {
|
||||
const target = state.classifyList[state.currentClassifyIndex]
|
||||
if (isEmpty(target)) return
|
||||
const { code, data }: any = await shopApi.getSupermarketSpuList({
|
||||
merchantId: state.merchantId,
|
||||
categoryId: target.id,
|
||||
current: 1,
|
||||
size: 99999,
|
||||
})
|
||||
if (code == 0) {
|
||||
state.goodsList = data.records
|
||||
return
|
||||
try {
|
||||
uni.showLoading({ title: "加载中...", mask: true })
|
||||
const { code, data }: any = await shopApi.getSupermarketSpuList({
|
||||
merchantId: state.merchantId,
|
||||
categoryId: target.id,
|
||||
current: 1,
|
||||
size: 99999,
|
||||
})
|
||||
if (code == 0) {
|
||||
state.goodsList = data.records
|
||||
return
|
||||
}
|
||||
state.goodsList = []
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
state.goodsList = []
|
||||
}
|
||||
|
||||
const doClassify = async (i: any) => {
|
||||
@@ -262,7 +267,7 @@ const chentProductCount = async (item: any, type?: "add" | "remove") => {
|
||||
state.cartList.push(item)
|
||||
}
|
||||
|
||||
nextTick(async () => await updateShopCar()) // 保存购物车数据
|
||||
nextTick(async () => await updateShopCart()) // 保存购物车数据
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
@@ -271,7 +276,7 @@ const chentProductCount = async (item: any, type?: "add" | "remove") => {
|
||||
}
|
||||
|
||||
// 保存购物车数据
|
||||
const updateShopCar = async () => {
|
||||
const updateShopCart = async () => {
|
||||
if (isEmpty(state.cartList)) return
|
||||
const list = state.cartList
|
||||
.filter((v) => v.productCount && v.productCount > 0)
|
||||
|
||||
Reference in new issue
Block a user