Commit 5c9bfe299ec0a18ea10390262ae59b1dea2e4717

Authored by vking
1 parent 902a975a

推荐商家

... ... @@ -40,19 +40,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
}).then(res => {
let detail=this.formatDatail(res.data)
this.setData({
detail: detail,
hasOnlineReserve:res.data.type==1,
})
if(detail.type==1 && detail.status==6){
this.GetRecommendSellerList(detail.seller.id)
}
})
this.selectComponent('#getpos').getPos();
},
/**
... ... @@ -185,9 +173,14 @@ Page({
console.log(e)
},
GetRecommendSellerList(sid){
App.Customer.GetRecommendSellerList({
let param={
sid:sid,
}).then(res=>{
}
if(this.location){
param.lat=this.location.latitude
param.lng=this.location.longitude
}
App.Customer.GetRecommendSellerList(param).then(res=>{
this.setData({
rsl:res.data
})
... ... @@ -209,4 +202,29 @@ Page({
}
}
},
location:null,
onpos(e){
console.log('onpos',e);
this.location=e.detail
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
}).then(res => {
let detail=this.formatDatail(res.data)
this.setData({
detail: detail,
hasOnlineReserve:res.data.type==1,
})
if(detail.type==1 && detail.status==6){
this.GetRecommendSellerList(detail.seller.id)
}
})
},
gotoSellerDetail(e){
console.log(e)
let url='/pages/reserve/detail?id='+e.currentTarget.id
wx.navigateTo({
url:url,
})
},
})
\ No newline at end of file
... ...
... ... @@ -10,6 +10,7 @@
"card":"/components/seller-card/seller-card",
"formids":"/components/formids/formids",
"sb-tr":"/components/reserve/seller-box-transverse/seller-box",
"getpos":"/components/userinfo/getpos",
"as":"/components/actionSheet/index"
}
}
\ No newline at end of file
... ...
... ... @@ -130,8 +130,8 @@
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="gotoDetail" data-sid="{{id}}">
<view class="seller" id="seller-{{id}}">
<swiper-item bindtap="gotoSellerDetail" id="{{item.id}}">
<view class="seller" id="seller-{{item.id}}">
<sb-tr seller="{{item}}"
hasActivityTags="{{false}}"
hasActivityShort="{{true}}"
... ... @@ -146,4 +146,5 @@
<view style="height: 50rpx;"></view>
</view>
<manager manager="{{detail}}" id="manager"></manager>
<as id="as" items="{{detail.seller.seller_tel}}" bindclick="callSellerPhone">拨打电话</as>
\ No newline at end of file
<as id="as" items="{{detail.seller.seller_tel}}" bindclick="callSellerPhone">拨打电话</as>
<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos>
\ No newline at end of file
... ...
... ... @@ -13,10 +13,11 @@ Page({
total: 0,
tabType:1,
hasMore:true,
rsl:[],//推荐商家
},
tabType:1,
offset:1,
limit:10,
offset:0,
limit:3,
hasMore:true,
/**
* 生命周期函数--监听页面加载
... ... @@ -36,7 +37,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getListData();
this.selectComponent('#getpos').getPos();
},
/**
... ... @@ -53,49 +54,41 @@ Page({
},
getListData() {
App.Reserve.GetListFromScheAndRes({
flag: 1,
App.Customer.GetMyOrder({
type: this.tabType,
openid: getApp().openid,
offset:this.offset,
limit:this.limit,
}).then(res => {
let total = res.data.success.length
let total = res.data.length
let data = this.formatList(res.data);
this.hasMore=data.success.length>=this.limit
this.hasMore=res.data.length>=this.limit
if(this.hasMore){
this.offset+=this.limit
}
this.setData({
list: data.success,
list: this.data.list.concat(data),
hasMore:this.hasMore
})
if(res.data.length==0){
this.GetRecommendSellerLists()
}
})
},
_formatList(list) {
if (!list) return {};
let dlist = {};
if (list.length > 0) {
let openid = getApp().openid;
list.forEach(row => {
row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II');
row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
let d = util.unixtoTime(row.rdate, 'MM月DD日 DAY 星期WW');
typeof dlist[d] == 'undefined' ? dlist[d] = [] : '';
dlist[d].push(row);
})
}
formatList(list) {
if (list.length<1) return [];
let dlist = [];
let openid = getApp().openid;
list.forEach(row => {
row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II');
row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
dlist.push(row);
})
return dlist;
},
formatList(res) {
res.success = this._formatList(res.success);
res.padding = this._formatList(res.padding);
return res;
},
switchTab(e) {
this.setData({
tabFlag: util.attr(e, 'index')
tabFlag: util.attr(e, 'index'),
})
this.getListData();
},
... ... @@ -121,10 +114,20 @@ Page({
url:url,
})
},
gotoSellerDetail(e){
console.log(e)
let url='/pages/reserve/detail?id='+e.currentTarget.id
wx.navigateTo({
url:url,
})
},
switchType(e){
this.hasRecommend=true
this.tabType=util.attr(e,'type')
this.setData({
tabType:this.tabType,
list: [],
hasMore:false
})
this.getListData()
},
... ... @@ -137,4 +140,43 @@ Page({
this.getListData();
}
},
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
}
}
},
location:null,
onpos(e){
console.log('onpos',e);
this.location=e.detail
this.getListData();
},
})
\ No newline at end of file
... ...
... ... @@ -6,6 +6,8 @@
"userinfo": "/components/userinfo/userinfo",
"formids":"/components/formids/formids",
"nav":"/components/nav/nav",
"sb-tr":"/components/reserve/seller-box-transverse/seller-box",
"getpos":"/components/userinfo/getpos",
"card":"/components/seller-card/seller-card"
}
}
\ No newline at end of file
... ...
... ... @@ -9,21 +9,40 @@
<view class="page">
<block wx:if="{{list.length==0}}">
<view class="flex-vc empry">
<image src="http://qn.colorcun.com/custom/lite/image/empty-order.png"></image>
<image src="http://qn.colorcun.com/reserve/images/order-empty.png"></image>
<view class="Medium">暂无订座</view>
</view>
<block wx:if="{{rsl.length>0}}">
<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>
</block>
</block>
<block wx:else="">
<block wx:for="{{list}}" wx:key="success.key" wx:for-item="part" wx:for-index="dateIndex">
<view class="list-content" wx:if="{{part.length>0}}">
<block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
<view class="card">
<card
hasShowStatus bindevent="gotoDetail"
seller="{{detail.seller}}" detail="{{detail}}"></card>
</view>
</block>
<block wx:for="{{list}}" wx:key="success.key" wx:for-item="detail" wx:for-index="dateIndex">
<view class="card">
<card
hasShowStatus bindevent="gotoDetail"
seller="{{detail.seller}}" detail="{{detail}}"></card>
</view>
</block>
</block>
</view>
<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos>
\ No newline at end of file
... ...
... ... @@ -81,13 +81,13 @@
border-color: #C8B16D;
}
.empry{
font-size: 34rpx;
font-size: 28rpx;
margin-top: 210rpx;
}
.empry image{
width:384rpx;
height: 296rpx;
margin-bottom: 100rpx;
margin-top: 176rpx;
margin-bottom: 60rpx;
}
.cate-class{
margin-bottom: 72rpx;
... ... @@ -106,4 +106,27 @@
}
.customers view{
margin-left: 14rpx;
}
.line-push{
background-image: url("https://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-top: 158rpx;
}
.transverse-list{
background-color: #fefefe;
width: 100%;
margin-top: 40rpx;
}
.transverse-list .seller{
width: 98%;
margin: 0 auto;
}
\ No newline at end of file
... ...
... ... @@ -352,7 +352,7 @@
"id": 39,
"name": "pages/reserve/detail 在线订座 ",
"pathName": "pages/reserve/detail",
"query": "id=1&fromid=&activeTab=",
"query": "id=1&fromid=&activeTab=reserve",
"scene": null
},
{
... ...
... ... @@ -285,6 +285,10 @@ export default {
openid:'openid',
silence:false,
},
//我的订单
'App.Customer.GetMyOrder':null,
// 预定失败推荐商家接口
'App.Customer.GetRecommendSellerList':null,
... ...