首页完善
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<listitem></listitem>
|
||||
<listitem :list='list'></listitem>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -41,9 +41,13 @@
|
||||
shopUser: {},
|
||||
userInfo: {},
|
||||
shopInfo: {},
|
||||
teblist: []
|
||||
teblist: [],
|
||||
list:[]
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.init_fn()
|
||||
},
|
||||
onShow() {
|
||||
if (uni.cache.get('token')) {
|
||||
this.loginwxuserInfo()
|
||||
@@ -71,6 +75,45 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
// 精选推荐
|
||||
// 下面初始数据
|
||||
init_fn() {
|
||||
this.list = []
|
||||
this.form = {
|
||||
address: uni.cache.get('getLocationstorage').address, //地址
|
||||
lng: uni.cache.get('getLocationstorage').lng,
|
||||
lat: uni.cache.get('getLocationstorage').lat,
|
||||
type: '', //品类
|
||||
orderBy: 5, //0.今日上新 1.离我最近 2.销量优先 3.价格优先 4.热榜推荐
|
||||
other: '', //附近1KM 1选中 0不选中
|
||||
page: 1, //页数
|
||||
size: 10, //页容量
|
||||
dateType: '',
|
||||
status: 'loadmore'
|
||||
}
|
||||
this.onLoadlist()
|
||||
},
|
||||
async onLoadlist() {
|
||||
try {
|
||||
let res = await this.api.indexlist(this.form)
|
||||
if (res.data.pages < this.form.page) {
|
||||
this.form.status = 'nomore'
|
||||
return false;
|
||||
} else {
|
||||
this.form.status = 'loading';
|
||||
this.form.page = ++this.form.page;
|
||||
setTimeout(() => {
|
||||
this.list = [...this.list, ...res.data.list];
|
||||
this.form.status = 'loading';
|
||||
if (res.data.pageNum == res.data.pages) {
|
||||
this.form.status = 'nomore';
|
||||
} else {
|
||||
this.form.status = 'loading';
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
} catch (e) {}
|
||||
},
|
||||
clickinfo(item, index) {
|
||||
switch (item.jumpType) {
|
||||
case 'scan': //特殊处理点击
|
||||
|
||||
Reference in New Issue
Block a user