From 1b9a98da38674a800dcb7e5f422d3af858a77b8e Mon Sep 17 00:00:00 2001
From: weipengfei <2187978347@qq.com>
Date: Fri, 27 Oct 2023 15:23:05 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E9=94=80=E6=96=B0=E5=A2=9E=E5=8C=BA?=
=?UTF-8?q?=E5=9F=9F=E6=97=A0=E5=95=86=E5=93=81=E6=97=B6=E6=8E=A8=E8=8D=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/supply_chains/supply_chains.vue | 96 ++++++++++++++++++++++++---
1 file changed, 87 insertions(+), 9 deletions(-)
diff --git a/pages/supply_chains/supply_chains.vue b/pages/supply_chains/supply_chains.vue
index baed312..87784d2 100644
--- a/pages/supply_chains/supply_chains.vue
+++ b/pages/supply_chains/supply_chains.vue
@@ -128,11 +128,21 @@
-
+
+
+ - 此区域没有更多商品了 -
+
+ 为你推荐
+
+
+
{{loadTitle}}
+
+ {{loadTitle2}}
+
@@ -227,13 +237,19 @@
page: 1,
limit: 6
},
+ where2: {
+ category_id: 0,
+ page: 1,
+ limit: 6
+ },
currentItemId: 69, // 默认获取 社区的数据 0 表示推荐 || 69 社区
keyword: '',
location: '',
emptyShow: false,
town: '',
- productList: [],
+ productList: [], // 当前区域列表
+ productList2: [], // 当前推荐列表
recoList: [],
articleList: [],
street_id: '',
@@ -244,6 +260,9 @@
loadend: false,
loading: false,
loadTitle: '加载更多',
+ loadend2: false,
+ loading2: false,
+ loadTitle2: '加载更多',
}
},
onPullDownRefresh() {
@@ -272,12 +291,18 @@
},
onReachBottom() {
+ console.log('ss');
if (this.productList.length > 0) {
setTimeout(() => {
this.list(false, this.street_id);
+ this.productList2 = [];
}, 500)
- }
-
+ }
+ else if (this.productList2.length > 0) {
+ setTimeout(() => {
+ this.list2(false, '');
+ }, 500)
+ }
},
beforeDestroy() {
// 销毁监听事件
@@ -316,8 +341,6 @@
} else if (scrollTop > 100) {
this.backColor = 1
this.isFshow = true
-
-
}
},
// #endif
@@ -330,6 +353,7 @@
},
//获取商品列表
list(isPage, id) {
+ if(!id) return that.list2(true, ''); // 定位没有获取到时,直接推荐
let that = this;
if (that.loadend) return;
if (that.loading) return;
@@ -346,6 +370,9 @@
}).then(res => {
// console.log(222)
let list = res.data.list;
+ if(list.length==0){
+ that.list2(true, '');
+ }
let productList = that.$util.SplitArray(list, that.productList);
let loadend = list.length < that.where.limit;
that.loadend = loadend;
@@ -360,10 +387,39 @@
that.loadTitle = '加载更多';
});
-
-
-
},
+ list2(isPage, id) {
+ let that = this;
+ if (that.loadend2) return;
+ if (that.loading2) return;
+
+ if (isPage === true) that.$set(that, 'productList2', []);
+
+ that.loading2 = true;
+ that.loadTitle2 = '';
+ cloudWarehouse({
+ page: that.where2.page,
+ limit: that.where2.limit,
+ street_code: id,
+ category_id: 0
+ }).then(res => {
+ // console.log(222)
+ let list = res.data.list;
+ let productList = that.$util.SplitArray(list, that.productList2);
+ let loadend = list.length < that.where2.limit;
+ that.loadend2 = loadend;
+ that.loading2 = false;
+ that.loadTitle2 = loadend ? '已全部加载' : '加载更多';
+ that.$set(that, 'productList2', productList);
+ // console.log(that.productList)
+ that.$set(that.where2, 'page', that.where2.page + 1);
+ if (that.where.page2 == 1 && res.data.list.length <= 0) that.emptyShow2 = true
+ }).catch(err => {
+ that.loading2 = false;
+ that.loadTitle2 = '加载更多';
+ });
+
+ },
scrolling() {
// 滚动条距文档顶部的距离
let scrollTop =
@@ -417,7 +473,9 @@
this.street_id = e.value[1].code
this.town = e.value[1].name
this.loadend = false;
+ this.loadend2 = false;
this.$set(this.where, 'page', 1)
+ this.$set(this.where2, 'page', 1)
this.list(true, this.street_id)
this.$nextTick(() => {
this.$bus.$emit('value-updated', e.value[1].name + ',' + e.value[1].code);
@@ -1014,5 +1072,25 @@
.goodslist {
margin: 0 auto;
width: 725rpx;
+ .no-more{
+ text-align: center;
+ padding-top: 18rpx;
+ }
+ .common-hd {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 118rpx;
+ .title {
+ padding: 0 80rpx;
+ font-size: 34rpx;
+ color: $theme-color;
+ font-weight: bold;
+ background-image: url("~@/static/images/index-title.png");
+ background-repeat: no-repeat;
+ background-size: 100% auto;
+ background-position: left center;
+ }
+ }
}
\ No newline at end of file