Commit d746633b37adc0014b6fe1e22f28f71d4f52fa3c

Authored by vking
1 parent 4690d1a3

history

... ... @@ -7,9 +7,10 @@ Page({
* 页面的初始数据
*/
data: {
sellers:[],
hasMore:true,
sellers:{},
hasMore:false,
hasFirstShow:true,
sellersLength:0,
},
sellers:[],
/**
... ... @@ -99,48 +100,37 @@ Page({
}
},
offset:1,
size:10,
size:200,
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=>{
App.Customer.GetHistoryList().then(res=>{
let sellers=res.data;
let sellersLength=sellers.length;
this.hasMore=sellersLength>=this.size
if(this.hasMore){
this.offset+=1
}
let group={}
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=[]
let day=util.unixtoTime(seller.cdate,"`DAY/MM月DD日`")
if(!group[day]){
group[day]={
day:day,
sellers:[]
}
}
seller.hasFollow=true
group[day].sellers.push(seller)
})
if(!this.hasOnShow){
sellers=[...this.data.sellers,...sellers]
}
this.hasOnShow=false;
this.setData({
sellers:sellers,
hasMore:this.hasMore,
sellers:group,
sellersLength:sellersLength,
hasFirstShow:false,
})
this.sellers=sellers
this.sellers=group
wx.hideLoading()
if(res.data.length==0 && this.offset==1){
this.GetRecommendSellerLists()
... ... @@ -198,14 +188,17 @@ Page({
},
clean(){
wx.showModal({
title: '              '+'确定清空浏览记录?',
title: '                  '+'确定清空浏览记录?',
cancelColor:'#999999',
confirmColor:'',
success (res) {
success: (res)=> {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
App.Customer.ClearHistory();
this.setData({
sellers:[],
sellersLength:0,
})
this.GetRecommendSellerLists();
}
}
})
... ...
<!--pages/me/history.wxml-->
<nav>订好座,就用周到安排</nav>
<view class="pages">
<view class="flex-vc empty" wx:if="{{sellers.length<1}}">
<view class="flex-vc empty" wx:if="{{sellersLength<1}}">
<block wx:if="{{!hasFirstShow}}">
<image src="http://qn.colorcun.com/custom/lite-online/image/follow-empty.png"></image>
<view class="text">您还没有留下足迹哦~</view>
... ... @@ -13,10 +13,10 @@
<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}}">
<view class="seller-group" wx:for="{{sellers}}" wx:key="sellerskey" wx:for-item="group">
<view class="timeline">{{group.day}}</view>
<view class="seller-item flex-ll" wx:for="{{group.sellers}}" wx:key="groupSellerskey" wx:for-item="seller"
bindtap="gotoDetail" data-sid="{{seller.id}}">
<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">
... ... @@ -29,7 +29,7 @@
<hr class="seller flex-vc" bgColor="#f5f5f5" wx:if="{{!hasMore}}" style="margin-top: 20rpx;">我是有底线的</hr>
</view>
</view>
<block wx:if="{{!hasFirstShow && sellers.length<1}}">
<block wx:if="{{!hasFirstShow && sellersLength<1}}">
<view class="rsl-block">
<view class="line-push">为你推荐</view>
<view class="transverse-list">
... ... @@ -39,7 +39,7 @@
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}}">
<swiper-item bindtap="gotoDetail" data-sid="{{item.id}}" id="{{item.id}}">
<view class="seller" id="seller-{{item.id}}">
<sb-tr seller="{{item}}"
hasActivityTags="{{false}}"
... ...
... ... @@ -28,6 +28,10 @@ page{
height: 50rpx;
line-height: 50rpx;
padding-top: 10rpx;
position: fixed;
right: 0rpx;
width: 100%;
z-index: 10;
}
.clean-img{
background-image: url("http://qn.colorcun.com/reserve/images/20191224153853.png");
... ...
... ... @@ -42,6 +42,7 @@ Page({
})
})
this.SetRelaOpenid();
App.Customer.BindClicks({sid:options.id})
},
GetSellerDetail(){
let options=this.options
... ...
... ... @@ -383,5 +383,20 @@ export default {
'App.System.GetWxLiteCode':null,
//获取在线预定列表
'App.Reserve.GetOnlineReserveList':null,
//绑定关系(用户浏览记录)
'App.Customer.BindClicks':{
openid:'openid',
},
//清空浏览记录(用户浏览记录)
'App.Customer.ClearHistory':{
openid:'openid',
},
//获取用户浏览记录(用户浏览记录)
'App.Customer.GetHistoryList':{
openid:'openid',
},
}
\ No newline at end of file
... ...
... ... @@ -74,7 +74,7 @@ function unixtoTime(ns,format) {
}
}
}
if(format.indexOf('`')>0){
if(format.indexOf('`')>-1){
result=result.replace(/`(.*)\/(.*)`/ig,function($0,$1,$2){
return $1||$2;
});
... ...