|
@@ -68,7 +68,7 @@
|
|
<text class="no-data-tip">{{noDataTip}}</text>
|
|
<text class="no-data-tip">{{noDataTip}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <scroll-view scroll-y scroll-with-animation style="flex: 1;overflow: hidden;">
|
|
|
|
|
|
+ <scroll-view scroll-y scroll-with-animation style="flex: 1;overflow: hidden;" @scrolltolower="onScrollBottom">
|
|
<view class="content-goods2" v-for="item in merchantList" :key="item.id" @click="merchantTab(item)">
|
|
<view class="content-goods2" v-for="item in merchantList" :key="item.id" @click="merchantTab(item)">
|
|
<view>
|
|
<view>
|
|
<image :src="item.avatar" style="width: 230rpx;height: 230rpx;"></image>
|
|
<image :src="item.avatar" style="width: 230rpx;height: 230rpx;"></image>
|
|
@@ -104,6 +104,10 @@
|
|
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ <view class='loadingicon flex-center' :hidden='!loading'>
|
|
|
|
+ <text class='loading iconfont icon-jiazai' style="width: auto;"></text>加载更多
|
|
|
|
+ </view>
|
|
|
|
+ <view class="flex-center no-data-tip" v-if="loadTitle">{{loadTitle}}</view>
|
|
</scroll-view>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -122,7 +126,8 @@
|
|
import navBar from '@/components/navBar';
|
|
import navBar from '@/components/navBar';
|
|
import {
|
|
import {
|
|
getMerchantList,
|
|
getMerchantList,
|
|
- getHomeInfo
|
|
|
|
|
|
+ getHomeInfo,
|
|
|
|
+ getMerchantSearchList
|
|
} from '@/api/home.js';
|
|
} from '@/api/home.js';
|
|
import {
|
|
import {
|
|
getTakeoutList,
|
|
getTakeoutList,
|
|
@@ -163,6 +168,9 @@
|
|
checked: false
|
|
checked: false
|
|
}],
|
|
}],
|
|
merchantList: [],
|
|
merchantList: [],
|
|
|
|
+ loadTitle:'',
|
|
|
|
+ loading: false,
|
|
|
|
+ page: 1,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
@@ -183,6 +191,7 @@
|
|
data[0].icon = '/static/img/quanbu.png';
|
|
data[0].icon = '/static/img/quanbu.png';
|
|
that.optionIndex = data[0].id;
|
|
that.optionIndex = data[0].id;
|
|
that.optionData = data || []
|
|
that.optionData = data || []
|
|
|
|
+ that.page = 1;
|
|
that.getMatchedData()
|
|
that.getMatchedData()
|
|
console.log(that.optionData, '12312321321312321321312312')
|
|
console.log(that.optionData, '12312321321312321321312312')
|
|
})
|
|
})
|
|
@@ -197,6 +206,39 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onScrollBottom() {
|
|
|
|
+ if (!this.loadTitle) {
|
|
|
|
+ this.getMatchedData()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getMatchedData() {
|
|
|
|
+ if (this.loading) return;
|
|
|
|
+ this.loading = true
|
|
|
|
+ getMerchantSearchList({
|
|
|
|
+ latitude: uni.getStorageSync('user_latitude'),
|
|
|
|
+ longitude: uni.getStorageSync('user_longitude'),
|
|
|
|
+ productType: this.takeoutId,
|
|
|
|
+ // typeIds: this.optionIndex==0?"":this.optionIndex,
|
|
|
|
+ page: this.page,
|
|
|
|
+ limit: 10
|
|
|
|
+ }).then(res => {
|
|
|
|
+ let list = res.data.list || [];
|
|
|
|
+ this.merchantList = this.$util.SplitArray(list, this.merchantList);
|
|
|
|
+ if (this.merchantList.length == 0) {
|
|
|
|
+ this.loadTitle = ''
|
|
|
|
+ this.noDataTip = ' 暂无外卖商家 ';
|
|
|
|
+ } else {
|
|
|
|
+ this.noDataTip = ''
|
|
|
|
+ this.loadTitle = list.length < 10 ? "我也是有底线的~" : '';
|
|
|
|
+ }
|
|
|
|
+ this.loading = false
|
|
|
|
+ console.log('商品信息:', this.merchantList);
|
|
|
|
+ this.page += 1;
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ console.log(err)
|
|
|
|
+ });
|
|
|
|
+ },
|
|
handBack() {
|
|
handBack() {
|
|
uni.navigateBack({
|
|
uni.navigateBack({
|
|
delta: 1
|
|
delta: 1
|
|
@@ -208,17 +250,17 @@
|
|
item2Click(item) {
|
|
item2Click(item) {
|
|
item.checked = !item.checked;
|
|
item.checked = !item.checked;
|
|
},
|
|
},
|
|
- getMatchedData() {
|
|
|
|
- getMerchantList({
|
|
|
|
- latitude: uni.getStorageSync('user_latitude'),
|
|
|
|
- longitude: uni.getStorageSync('user_longitude'),
|
|
|
|
- cateId: this.takeoutId
|
|
|
|
- }).then(res => {
|
|
|
|
- this.merchantList = res.data.list;
|
|
|
|
- this.noDataTip = this.merchantList.length ? '' : ' 暂无外卖商家 ';
|
|
|
|
- console.log('商品信息:', this.merchantList);
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ // getMatchedData() {
|
|
|
|
+ // getMerchantList({
|
|
|
|
+ // latitude: uni.getStorageSync('user_latitude'),
|
|
|
|
+ // longitude: uni.getStorageSync('user_longitude'),
|
|
|
|
+ // cateId: this.takeoutId
|
|
|
|
+ // }).then(res => {
|
|
|
|
+ // this.merchantList = res.data.list;
|
|
|
|
+ // this.noDataTip = this.merchantList.length ? '' : ' 暂无外卖商家 ';
|
|
|
|
+ // console.log('商品信息:', this.merchantList);
|
|
|
|
+ // });
|
|
|
|
+ // },
|
|
onOptionClick(item) {
|
|
onOptionClick(item) {
|
|
if (this.optionIndex === item.id) return
|
|
if (this.optionIndex === item.id) return
|
|
this.optionIndex = item.id;
|
|
this.optionIndex = item.id;
|