10 changed files with 525 additions and 46 deletions
-
2common/api.js
-
18common/styles/iconfont.css
-
35components/lf-nav/lf-nav.vue
-
6pages.json
-
2pages/goodsDetail/index.vue
-
2pages/index/index.vue
-
12pages/recommList/index.vue
-
97pages/search/search.vue
-
71pages/search/searchList.vue
-
294pages/shopmap/index.vue
@ -0,0 +1,294 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<view class="lf-p-t-20 head" v-if="tab_list_father.length"> |
||||
|
<u-tabs :list="tab_list_father" :is-scroll="true" :current="current_father" @change="tabChangeFather()"></u-tabs> |
||||
|
</view> |
||||
|
<view> |
||||
|
<map class="lf-map-height" :longitude="self_longitude" :latitude="self_latitude" :markers="markers_list"> |
||||
|
</map> |
||||
|
</view> |
||||
|
<view class="lf-m-t-40 lf-p-l-32 lf-p-r-32"> |
||||
|
<view class="lf-row-between lf-m-b-40"> |
||||
|
<view class="lf-font-32 lf-color-222">地图上的门店</view> |
||||
|
<view class="lf-font-24 lf-color-blue lf-row-center"> |
||||
|
<text class="lf-iconfont lf-icon-dingwei lf-m-r-10 lf-font-22"></text> |
||||
|
我的位置 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="special_tab" style="position: relative;"> |
||||
|
<u-tabs :list="tab_list" active-color="#1998FE" inactive-color='#777777' :is-scroll="true" @click="clicksort" :current="current" @change="tabChange"></u-tabs> |
||||
|
<view style="position: absolute;right: 44rpx;top: 20rpx;display: flex;flex-direction: column;"> |
||||
|
<u-icon name="arrow-up" style="font-size: 20rpx;" :class="sort==0?'':'lf-color-blue'"></u-icon> |
||||
|
<u-icon name="arrow-down" style="font-size: 20rpx;" :class="sort==0?'lf-color-blue':''"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
<swiper :style="{height: '600rpx', width: '750rpx'}" :current="current" @change="swiperChange"> |
||||
|
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"> |
||||
|
<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="tabItem.isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh"> |
||||
|
<view class="lf-m-t-20"></view> |
||||
|
<view> |
||||
|
<!-- 活动列表 --> |
||||
|
<view class="content"> |
||||
|
<view class="item" v-for="(item,index) of tabItem.list" :key="index" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)"> |
||||
|
<view class="cover"> |
||||
|
<image :src="item.picture" class="lf-w-100 lf-h-100" mode="aspectFill"></image> |
||||
|
</view> |
||||
|
<view style="width: 420rpx;"> |
||||
|
<view class="lf-font-28 lf-color-333 lf-line-2">{{item.title}}</view> |
||||
|
<view class="lf-font-24 lf-color-gray lf-line-2 lf-m-t-10" style="min-height: 64rpx;">本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩</view> |
||||
|
<view class="lf-flex lf-m-t-25"> |
||||
|
<lf-price :price="item.price"></lf-price> |
||||
|
<text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥{{item.original_price}}</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- 加载 --> |
||||
|
<view class="loading-more"> |
||||
|
<text v-if="tabItem.list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text> |
||||
|
<lf-nocontent v-else></lf-nocontent> |
||||
|
</view> |
||||
|
<!-- 回到顶部 --> |
||||
|
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</swiper-item> |
||||
|
</swiper> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template>ß |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
tab_list_father: [], |
||||
|
current_father: 0, |
||||
|
windowHeight: 0, |
||||
|
markers_list: [ |
||||
|
{ |
||||
|
id: 0, |
||||
|
name: '时尚', |
||||
|
address: '杭州市', |
||||
|
latitude: 30.353351, |
||||
|
longitude: 120.231010, |
||||
|
width: 50, |
||||
|
height: 50 |
||||
|
} |
||||
|
], |
||||
|
self_latitude: '', |
||||
|
self_longitude: '', |
||||
|
//排序 |
||||
|
tab_list: [ |
||||
|
{ |
||||
|
id: 1, |
||||
|
name: '销量', |
||||
|
list: [], |
||||
|
isRefresher: false, |
||||
|
loadingClass: true, |
||||
|
loadingText: '正在加载中', |
||||
|
page: 1, |
||||
|
isPage: true |
||||
|
}, |
||||
|
{ |
||||
|
id: 2, |
||||
|
name: '距离', |
||||
|
list: [], |
||||
|
isRefresher: false, |
||||
|
loadingClass: true, |
||||
|
loadingText: '正在加载中', |
||||
|
page: 1, |
||||
|
isPage: true |
||||
|
}, |
||||
|
{ |
||||
|
id: 4, |
||||
|
name: '价格', |
||||
|
list: [], |
||||
|
isRefresher: false, |
||||
|
loadingClass: true, |
||||
|
loadingText: '正在加载中', |
||||
|
page: 1, |
||||
|
isPage: true |
||||
|
}, |
||||
|
], |
||||
|
current: 0, |
||||
|
loadingClass: false, |
||||
|
loadingText: '已加载全部数据~', |
||||
|
page: 1, |
||||
|
isPage: true, |
||||
|
pageSize: 20, |
||||
|
isRefresher: false, |
||||
|
sort: 0, |
||||
|
} |
||||
|
}, |
||||
|
onLoad() { |
||||
|
this.getCategory(); |
||||
|
this.windowHeight = getApp().globalData.windowHeight; |
||||
|
this.getShopDistance(); |
||||
|
}, |
||||
|
methods: { |
||||
|
//获取当前位置 计算商店距离 |
||||
|
getShopDistance() { |
||||
|
let that = this; |
||||
|
wx.getLocation({ |
||||
|
type: 'wgs84', |
||||
|
isHighAccuracy: true, |
||||
|
success (res) { |
||||
|
that.self_latitude = res.latitude |
||||
|
that.self_longitude = res.longitude |
||||
|
console.log(that.self_longitude) |
||||
|
console.log(that.self_latitude) |
||||
|
console.log(res) |
||||
|
}, |
||||
|
fail(err) { |
||||
|
console.log(err) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
tabChangeFather(index){ |
||||
|
this.current_father = index; |
||||
|
this.clearTabItem() |
||||
|
if(this.tab_list_father[index].list.length <= 0){ |
||||
|
this.getActivityList(); // tab下没有数据,请求第一页 |
||||
|
} |
||||
|
}, |
||||
|
clearTabItem(){ |
||||
|
let tab_item = this.tab_list_father[this.current]; |
||||
|
tab_item.page = 1; |
||||
|
tab_item.isPage = true; |
||||
|
tab_item.isRefresher = true; |
||||
|
tab_item.loadingClass = true; |
||||
|
tab_item.loadingText = '正在加载中'; |
||||
|
tab_item.list = []; |
||||
|
}, |
||||
|
getCategory(options = {}) { |
||||
|
this.$http(this.API.API_CATEGORYLIST).then(res => { |
||||
|
let res_list = res.data || []; |
||||
|
let tab_list_father = res_list.map(item => { |
||||
|
return { |
||||
|
id: item.id, |
||||
|
name: item.name, |
||||
|
list: [], |
||||
|
isRefresher: false, |
||||
|
loadingClass: true, |
||||
|
loadingText: '正在加载中', |
||||
|
page: 1, |
||||
|
isPage: true, |
||||
|
pid: item.pid |
||||
|
} |
||||
|
}); |
||||
|
let list = [] |
||||
|
tab_list_father.forEach((item,index) => { |
||||
|
if(item.pid == 0) { |
||||
|
list.push(item) |
||||
|
} |
||||
|
}) |
||||
|
console.log(list) |
||||
|
this.tab_list_father = list; |
||||
|
|
||||
|
console.log(this.tab_list_father) |
||||
|
this.getActivityList() |
||||
|
}).catch(err => { |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
clicksort(index) { |
||||
|
if(index == 3) { |
||||
|
if(this.sort == 0) { |
||||
|
this.sort = 1 |
||||
|
}else { |
||||
|
this.sort = 0 |
||||
|
} |
||||
|
this.getActivityList() |
||||
|
}else { |
||||
|
return |
||||
|
} |
||||
|
}, |
||||
|
tabChange(index){ |
||||
|
this.current = index; |
||||
|
console.log('重复只想') |
||||
|
this.getActivityList() |
||||
|
}, |
||||
|
// 滑块下标值变化 |
||||
|
swiperChange(event){ |
||||
|
this.current = event.detail.current; |
||||
|
if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理 |
||||
|
}, |
||||
|
changeSort(sort) { |
||||
|
console.log('排序') |
||||
|
this.sort != this.sort |
||||
|
this.getActivityList() |
||||
|
}, |
||||
|
// scroll-view 下拉刷新 |
||||
|
onRefresherrefresh(){ |
||||
|
this.tab_list_father[this.current].isRefresher = true; |
||||
|
this.$u.throttle(() => { |
||||
|
this.clearTabItem(); |
||||
|
this.getActivityList(); |
||||
|
}, 200); |
||||
|
}, |
||||
|
// 页面触底,加载下一页 |
||||
|
onScrolltolower(){ |
||||
|
let tab_item = this.tab_list_father[this.current]; |
||||
|
if(tab_item.isPage){ |
||||
|
tab_item.page = tab_item.page + 1; |
||||
|
this.getActivityList(); |
||||
|
} |
||||
|
}, |
||||
|
getActivityList(){ |
||||
|
let tab_item = this.tab_list_father[this.current_father]; |
||||
|
console.log('页数',tab_item.id) |
||||
|
if(this.$shared.isValueType(tab_item) == 'undefined') return; |
||||
|
this.$http(this.API.API_ADVICELIST,{page: tab_item.page,category_id: tab_item.id}).then(res => { |
||||
|
let isPage = res.data.next_page_url == null?false:true; |
||||
|
tab_item.isPage = isPage; |
||||
|
if(!isPage){ |
||||
|
tab_item.loadingClass = false; |
||||
|
tab_item.loadingText = '没有更多数据啦~'; |
||||
|
} |
||||
|
tab_item.isRefresher = false; |
||||
|
if(tab_item.page == 1){ |
||||
|
tab_item.list = res.data.data; |
||||
|
}else{ |
||||
|
tab_item.list.push(...res.data.data); |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.lf-map-height { |
||||
|
width: 100%; |
||||
|
height: 500rpx; |
||||
|
} |
||||
|
/deep/.special_tab .u-scroll-box { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); |
||||
|
} |
||||
|
/deep/.special_tab .u-scroll-box .u-tab-bar { |
||||
|
background-color: #1998FE!important; |
||||
|
width: 80rpx!important; |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
bottom: -12rpx; |
||||
|
} |
||||
|
|
||||
|
/deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar { |
||||
|
background-color: #1998FE!important; |
||||
|
width: 56rpx!important; |
||||
|
position: absolute; |
||||
|
height: 5rpx!important; |
||||
|
left: 8rpx; |
||||
|
bottom: -4rpx; |
||||
|
} |
||||
|
|
||||
|
/deep/.special_tab .u-tab-item { |
||||
|
font-size: 28rpx!important; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue