Commit 4690d1a30b4c897ee464bdad1aedaa4d26ed921d

Authored by vking
1 parent 9134b8ef

history

... ... @@ -30,7 +30,8 @@
"pages/reserve/discount",
"pages/reserve/indexList",
"pages/reserve/share",
"pages/reserve/submit"
"pages/reserve/submit",
"pages/me/history"
],
"subpackages": [
{
... ...
// pages/me/history.js
import util from '../../utils/util';
import App from '../../utils/api';
Page({
/**
* 页面的初始数据
*/
data: {
sellers:[],
hasMore:true,
hasFirstShow:true,
},
sellers:[],
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
formatSellers(data){
let sellers=[];
let hasChange=false
this.sellers.forEach(seller=>{
if(seller.id==data.sid){
hasChange=true
seller.hasFollow=data.hasFollow
}
if(seller.hasFollow){
sellers.push(seller)
}
})
if(!hasChange){
sellers=[]
}
this.setData({
sellers:sellers
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
hasOnShow:true,
onShow: function () {
if(this.data.sellers.length==0){
wx.showLoading({
title: '加载中',
})
this.setData({
hasFirstShow:true,
})
}
if(this.hasMore || this.data.sellers.length==0){
this.sellers=[]
this.offset=1
// this.setData({
// sellers:[]
// })
this.hasOnShow=true;
this.selectComponent('#getpos').getPos();
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function (e) {
console.log(e)
if(this.hasMore){
this.GetCollectionSellerList();
}
},
offset:1,
size:10,
hasMore:true,
GetCollectionSellerList(){
App.Customer.GetCollectionSellerList({
openid:getApp().openid,
lat:this.location.latitude,
lng:this.location.longitude,
offset:this.offset,
size:this.size,
}).then(res=>{
let sellers=res.data;
let sellersLength=sellers.length;
this.hasMore=sellersLength>=this.size
if(this.hasMore){
this.offset+=1
}
sellers.forEach((seller,si) => {
// if(seller.distance || seller.distance===0){
// seller.distance = parseInt(seller.distance);
// if (seller.distance > 1000) {
// seller.distance = (seller.distance / 1000).toFixed(2) + 'km'
// } else {
// seller.distance += 'm';
// }
// }
if(seller.seller_tel){
seller.seller_tel=seller.seller_tel.split(',');
}else{
seller.seller_tel=[]
}
seller.hasFollow=true
})
if(!this.hasOnShow){
sellers=[...this.data.sellers,...sellers]
}
this.hasOnShow=false;
this.setData({
sellers:sellers,
hasMore:this.hasMore,
hasFirstShow:false,
})
this.sellers=sellers
wx.hideLoading()
if(res.data.length==0 && this.offset==1){
this.GetRecommendSellerLists()
}
})
},
gotoDetail(e){
wx.navigateTo({
url:'/pages/reserve/detail?id='+util.attr(e,'sid')
})
},
onpos(e){
console.log(e);
this.location=e.detail
this.GetCollectionSellerList();
},
hasRecommend:true,
GetRecommendSellerLists(){
if(!this.hasRecommend) return
let param={}
if(this.location){
param={
lat:this.location.latitude,
lng:this.location.longitude
}
}
App.Customer.GetRecommendSellerLists(param).then(res=>{
this.setData({
rsl:res.data
})
})
},
hasGoto:false,
bindtransition(e){
console.log(e)
if('change'==e.type){
this.hasGoto=false
}
if('animationfinish'==e.type){
if(this.hasGoto && (e.detail.current+1)==this.data.rsl.length){
wx.switchTab({
url: '/pages/reserve/index'
})
return;
}else{
this.hasGoto=true
}
}
},
goHome(){
wx.switchTab({
url: '/pages/reserve/index'
})
},
clean(){
wx.showModal({
title: '              '+'确定清空浏览记录?',
cancelColor:'#999999',
confirmColor:'',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
})
\ No newline at end of file
... ...
{
"usingComponents": {
"formids":"/components/formids/formids",
"getpos":"/components/userinfo/getpos",
"sb-tr":"/components/reserve/seller-box-transverse/seller-box",
"nav":"/components/nav/nav",
"hr":"/components/hr"
}
}
\ No newline at end of file
... ...
<!--pages/me/history.wxml-->
<nav>订好座,就用周到安排</nav>
<view class="pages">
<view class="flex-vc empty" wx:if="{{sellers.length<1}}">
<block wx:if="{{!hasFirstShow}}">
<image src="http://qn.colorcun.com/custom/lite-online/image/follow-empty.png"></image>
<view class="text">您还没有留下足迹哦~</view>
<view class="goHome" bindtap="goHome">去首页逛逛</view>
</block>
</view>
<view class="follow" wx:else="">
<view class="clean flex-rr" bindtap="clean">
<view class="clean-img"></view>
<view class="clean-text">清空</view>
</view>
<view class="seller-group" wx:for="{{sellers}}" wx:key="sellerskey">
<view class="timeline">今天</view>
<view class="seller-item flex-ll" wx:for="{{sellers}}" wx:key="sellerskey" wx:for-item="seller"
bindtap="gotoDetail" data-sid="{{item.id}}" wx:if="{{item.hasFollow}}">
<image mode="aspectFill" class="image"
src="{{seller.seller_image?seller.seller_image+'?imageView2/2/w/320/interlace/0/q/100':'http://qn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'}}"></image>
<view class="seller-item-info">
<view class="seller-item-name">{{seller.sellername}}</view>
<view class="seller-item-price" wx:if="{{seller.average>0}}">¥{{seller.average}}元/人</view>
</view>
<view class="seller-item-line"></view>
</view>
</view>
<hr class="seller flex-vc" bgColor="#f5f5f5" wx:if="{{!hasMore}}" style="margin-top: 20rpx;">我是有底线的</hr>
</view>
</view>
<block wx:if="{{!hasFirstShow && sellers.length<1}}">
<view class="rsl-block">
<view class="line-push">为你推荐</view>
<view class="transverse-list">
<swiper
indicator-dots="{{false}}" autoplay="{{false}}" circular="{{false}}" vertical="{{false}}"
interval="2000" duration="500"
previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;"
current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition">
<block wx:for="{{rsl}}" wx:key="rsl.key">
<swiper-item bindtap="gotoSellerDetail" id="{{item.id}}">
<view class="seller" id="seller-{{item.id}}">
<sb-tr seller="{{item}}"
hasActivityTags="{{false}}"
hasActivityShort="{{true}}"
hasBrand="true" hasActivityTese="true"
hasSlogan="{{false}}"></sb-tr>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
</block>
<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos>
... ...
/* pages/me/history.wxss */
page{
background-color: #F5F5F5;
}
.pages{
width: 100%;
margin: 0 auto;
font-size: 30rpx;
}
.seller-group{
background-color: #ffff;
margin-bottom: 10rpx;
}
.empty{margin-top: 160rpx;}
.empty image{
width: 191px;
height: 158px;
}
.empty .text{
font-size: 28rpx;
margin-top: 60rpx;
}
.follow {
padding-bottom: 50rpx;
}
.clean{
background-color: #fff;
height: 50rpx;
line-height: 50rpx;
padding-top: 10rpx;
}
.clean-img{
background-image: url("http://qn.colorcun.com/reserve/images/20191224153853.png");
background-size: 100% 100%;
width: 24rpx;
height: 24rpx;
}
.clean-text{
margin:0 40rpx 0 10rpx;
font-size:24rpx;
color:rgba(53,53,53,1);
}
.rsl-block{
position: fixed;
bottom: 0rpx;
width: 100%;
}
.transverse-list{
background-color: #fefefe;
width: 100%;
}
.transverse-list .seller{
width: 98%;
margin: 0 auto;
}
.line-push{
background-image: url("http://qn.colorcun.com/reserve/images/line-push.png");
width: 328rpx;
height: 42rpx;
background-size: 100% 24rpx;
margin: 0 auto;
font-size:30rpx;
color: #C0A369;
line-height: 24rpx;
background-repeat: no-repeat;
text-align: center;
margin-bottom: 60rpx;
}
.goHome{
width:200rpx;
height:60rpx;
border-radius:30rpx;
border:2rpx solid rgba(192,163,105,1);
font-size:28rpx;
font-weight:500;
color:rgba(192,163,105,1);
line-height:60rpx;
text-align: center;
margin-top: 40rpx;
}
.timeline{
height: 80rpx;
line-height: 80rpx;
box-sizing: border-box;
font-size:36rpx;
font-weight:600;
color:rgba(53,53,53,1);
padding-left: 20rpx;
border-bottom: 2rpx solid #f5f5f5;
}
.seller-item{
box-sizing: border-box;
width: 100%;
height: 280rpx;
padding: 20rpx;
position: relative;
}
.seller-item-line{
position: absolute;
width: calc(100% - 200rpx);
height: 2rpx;
right:0;
bottom: 0;
background-color: #f5f5f5;
}
.seller-item .image{
width: 160rpx;
height: 240rpx;
background-color: #4C4E4F;
min-width: 160rpx;
margin-right: 20rpx;
}
.seller-item-info{
flex-direction: row;
justify-content: space-around;
height:240rpx;
width: calc(100% - 200rpx);
}
.seller-item-name{
height:44rpx;
font-size:32rpx;
font-weight:600;
color:rgba(53,53,53,1);
line-height:44rpx;
margin-top: 28rpx;
overflow: hidden;
white-space:nowrap;
}
.seller-item-price{
height:40rpx;
font-size:28rpx;
font-weight:600;
color:rgba(53,53,53,1);
line-height:40rpx;
margin-top: 60rpx;
}
\ No newline at end of file
... ...
... ... @@ -46,6 +46,10 @@
<view class="icon picon p1"></view>
<view class="text">常用联系人</view>
</navigator>
<navigator class="flex-vc" url="/pages/me/history">
<view class="icon picon p4"></view>
<view class="text">浏览记录</view>
</navigator>
<view class="flex-vc" bindtap="gotoSellerBook" wx:if="{{hasSellerBook}}">
<view class="icon picon p2"></view>
<view class="text">商户模式</view>
... ...
... ... @@ -96,6 +96,9 @@ image{
.picon.p3{
background-image: url("http://qn.colorcun.com/custom/me/image/p3.png");
}
.picon.p4{
background-image: url("http://qn.colorcun.com/reserve/images/201912241538531.png");
}
.block-rev .width3{
width: 75%;
}
... ...
... ... @@ -557,6 +557,12 @@
"pathName": "pack-book/pages/book/b_addnew",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/me/history",
"pathName": "pages/me/history",
"scene": null
}
]
}
... ...