刘翔宇-旅管家 3 years ago
parent 17d5bd785d
commit 5f7e8e4785

@ -681,7 +681,8 @@
return return
} }
this.toDoBuy(); // jsuni.$u.throttle()
uni.$u.throttle(this.toDoBuy, 1000);
}, },
toDoBuy: function() { toDoBuy: function() {

@ -26,8 +26,8 @@
</view> --> </view> -->
</view> </view>
<view class="shopContent"> <view class="shopContent">
<!--为您推荐--> <!--为您推荐-->
<u-empty v-if="dataList.length==0" marginTop="250" ></u-empty> <u-empty v-if="dataList.length==0" marginTop="250"></u-empty>
<view class="introBox hasMenu" v-if="dataList.length>0"> <view class="introBox hasMenu" v-if="dataList.length>0">
<block v-for="(item,index) in dataList"> <block v-for="(item,index) in dataList">
<view class="intro_column" @tap="gotoDetail" :data-id="item.id"> <view class="intro_column" @tap="gotoDetail" :data-id="item.id">
@ -76,7 +76,8 @@
keyword: "", keyword: "",
dataList: [], dataList: [],
currentPage: 1, currentPage: 1,
product_type_id: 0 product_type_id: 0,
isLoading: false
} }
}, },
@ -96,7 +97,8 @@
} }
}, },
onReachBottom: function(e) { onReachBottom: function(e) {
console.log("onReachBottom", this.currentPage + 1) if (!isLoading)
console.log("onReachBottom", this.currentPage + 1)
this.loadPage(this.currentPage + 1); this.loadPage(this.currentPage + 1);
}, },
onPullDownRefresh: function(e) { onPullDownRefresh: function(e) {
@ -131,16 +133,16 @@
}, },
methods: { methods: {
toback: function() { toback: function() {
let route = getCurrentPages(); let route = getCurrentPages();
console.log(route) console.log(route)
if (route.length >1) { if (route.length > 1) {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
} else { } else {
uni.switchTab({ uni.switchTab({
url: "../../../../pages/home/home" url: "../../../../pages/home/home"
}) })
} }
}, },
confirm: function() { confirm: function() {
@ -155,6 +157,7 @@
loadPage: function(page) { loadPage: function(page) {
uni.hideKeyboard() uni.hideKeyboard()
var that = this; var that = this;
that.isLoading = true;
weixin.request({ weixin.request({
bindThis: that, bindThis: that,
api: '/api/member/get-products', api: '/api/member/get-products',
@ -168,6 +171,7 @@
utilSuccess: function(r) { utilSuccess: function(r) {
var res = r.data.data; var res = r.data.data;
that.isLoading = false;
var hasNoMore = that.dataList.length < 6 && page > 1; var hasNoMore = that.dataList.length < 6 && page > 1;
if (hasNoMore || res.length == 0 && page > 1) { if (hasNoMore || res.length == 0 && page > 1) {

@ -91,7 +91,8 @@
currentPage: 1, currentPage: 1,
dataList: [], dataList: [],
dataActiveList: [], dataActiveList: [],
indexNav: [] indexNav: [],
isLoading: false
} }
}, },
onLoad() { onLoad() {
@ -114,7 +115,8 @@
} }
}, },
onReachBottom() { onReachBottom() {
this.loadPage((this.currentPage + 1), '', 6, 1) if (true)
this.loadPage((this.currentPage + 1), '', 6, 1)
}, },
methods: { methods: {
async getNav(code) { async getNav(code) {
@ -132,7 +134,7 @@
} }
}) })
}, },
toAction: function(item) { toAction: function(item) {
console.log(item) console.log(item)
if (item.link) { if (item.link) {
uni.redirectTo({ uni.redirectTo({
@ -163,6 +165,7 @@
loadPage: function(page, product_type_id, page_size, type) { loadPage: function(page, product_type_id, page_size, type) {
uni.hideKeyboard() uni.hideKeyboard()
var that = this; var that = this;
this.isLoading = true;
weixin.request({ weixin.request({
bindThis: that, bindThis: that,
api: '/api/member/get-products', api: '/api/member/get-products',
@ -175,6 +178,7 @@
}, },
utilSuccess: function(r) { utilSuccess: function(r) {
var res = r.data.data; var res = r.data.data;
that.isLoading = false;
for (var m of res) { for (var m of res) {
// m.created_at = m.created_at.split("T")[0] + " " + m.created_at.split("T")[ // m.created_at = m.created_at.split("T")[0] + " " + m.created_at.split("T")[
// 1] // 1]

Loading…
Cancel
Save