修复无法分页与商品列表返回错误的bug

This commit is contained in:
weipengfei 2023-10-09 18:19:42 +08:00
parent 83d548fd58
commit 2429f37789
2 changed files with 1163 additions and 1363 deletions

File diff suppressed because it is too large Load Diff

View File

@ -217,11 +217,11 @@
</view> </view>
</view> </view>
<view class="good_price_r"> <view class="good_price_r">
<view :class="{x_tra:trnList[index].bottom }" <view :class="{x_tra:trnList[index]?trnList[index].bottom:0 }"
:style="`transform:translateY(${trnList[index].bottom}px);transition:${trnList[index].bottom?1:0}s cubic-bezier(0.4, -0.9, 0.75, 1);`" :style="`transform:translateY(${trnList[index]?trnList[index].bottom:0}px);transition:${trnList[index]?trnList[index].bottom:0?1:0}s cubic-bezier(0.4, -0.9, 0.75, 1);`"
@click.stop="addcart(item,index)"> @click.stop="addcart(item,index)">
<u--image :class="'act_class'+index" <u--image :class="'act_class'+index"
:style="`transform:translateX(${trnList[index].left}px);transition:${trnList[index].bottom?1:0}s `" :style="`transform:translateX(${trnList[index]?trnList[index].left:0}px);transition:${trnList[index]?trnList[index].bottom:0?1:0}s `"
src="/static/images/LHYC/J.png" width="49.07rpx" src="/static/images/LHYC/J.png" width="49.07rpx"
height="49.07rpx"></u--image> height="49.07rpx"></u--image>
</view> </view>
@ -232,7 +232,7 @@
</view> </view>
</view> </view>
</view> </view>
<view style="height: 100rpx;"> <view style="height: 180rpx;">
<!-- <u-loadmore :status="status" /> --> <!-- <u-loadmore :status="status" /> -->
</view> </view>
</view> </view>
@ -531,8 +531,6 @@
this.Area() this.Area()
let that = this let that = this
setTimeout(() => { setTimeout(() => {
uni.createSelectorQuery() uni.createSelectorQuery()
.in(this) .in(this)
.select('.flags1') .select('.flags1')
@ -556,10 +554,10 @@
}, },
// //
onReachBottom() { onReachBottom() {
if (this.flag || !this.goodsList.length) return if (this.flag || !this.goodsList.length) return;
this.status = "loading" this.status = "loading"
this.page_num += 1 this.page_num += 1
this.flag = true // this.flag = true
cloudWarehouse({ cloudWarehouse({
street_code: this.street_code, street_code: this.street_code,
category_id: this.cloudList[this.current]?.category_id || "", category_id: this.cloudList[this.current]?.category_id || "",
@ -568,15 +566,16 @@
page_num: this.page_num page_num: this.page_num
}).then(res => { }).then(res => {
if (res.data.list.length == 0) {
this.status = "nomore"
this.flag = true
return
}
if (res.data.list[0].product_id == this.goodsList[0].product_id) { if (res.data.list[0].product_id == this.goodsList[0].product_id) {
this.status = "nomore" this.status = "nomore"
this.flag = false this.flag = true
} else { } else {
if (res.data.list.length == 0) { this.goodsList = this.goodsList.concat(res.data.list);
this.status = "nomore"
return
}
this.goodsList = this.goodsList.concat(res.data.list)
} }
}) })
@ -589,7 +588,7 @@
.select('.flags') .select('.flags')
.boundingClientRect(rect => { .boundingClientRect(rect => {
this.headtop = rect.top this.headtop = rect.top
console.log(rect.top) // console.log(rect.top)
}) })
.exec(); .exec();
uni.createSelectorQuery() uni.createSelectorQuery()