Showing
9 changed files
with
170 additions
and
60 deletions
| @@ -40,19 +40,7 @@ Page({ | @@ -40,19 +40,7 @@ Page({ | ||
| 40 | * 生命周期函数--监听页面显示 | 40 | * 生命周期函数--监听页面显示 |
| 41 | */ | 41 | */ |
| 42 | onShow: function () { | 42 | onShow: function () { |
| 43 | - App.Reserve.Detail({ | ||
| 44 | - openid: getApp().openid, | ||
| 45 | - rid: this.id | ||
| 46 | - }).then(res => { | ||
| 47 | - let detail=this.formatDatail(res.data) | ||
| 48 | - this.setData({ | ||
| 49 | - detail: detail, | ||
| 50 | - hasOnlineReserve:res.data.type==1, | ||
| 51 | - }) | ||
| 52 | - if(detail.type==1 && detail.status==6){ | ||
| 53 | - this.GetRecommendSellerList(detail.seller.id) | ||
| 54 | - } | ||
| 55 | - }) | 43 | + this.selectComponent('#getpos').getPos(); |
| 56 | }, | 44 | }, |
| 57 | 45 | ||
| 58 | /** | 46 | /** |
| @@ -185,9 +173,14 @@ Page({ | @@ -185,9 +173,14 @@ Page({ | ||
| 185 | console.log(e) | 173 | console.log(e) |
| 186 | }, | 174 | }, |
| 187 | GetRecommendSellerList(sid){ | 175 | GetRecommendSellerList(sid){ |
| 188 | - App.Customer.GetRecommendSellerList({ | 176 | + let param={ |
| 189 | sid:sid, | 177 | sid:sid, |
| 190 | - }).then(res=>{ | 178 | + } |
| 179 | + if(this.location){ | ||
| 180 | + param.lat=this.location.latitude | ||
| 181 | + param.lng=this.location.longitude | ||
| 182 | + } | ||
| 183 | + App.Customer.GetRecommendSellerList(param).then(res=>{ | ||
| 191 | this.setData({ | 184 | this.setData({ |
| 192 | rsl:res.data | 185 | rsl:res.data |
| 193 | }) | 186 | }) |
| @@ -209,4 +202,29 @@ Page({ | @@ -209,4 +202,29 @@ Page({ | ||
| 209 | } | 202 | } |
| 210 | } | 203 | } |
| 211 | }, | 204 | }, |
| 205 | + location:null, | ||
| 206 | + onpos(e){ | ||
| 207 | + console.log('onpos',e); | ||
| 208 | + this.location=e.detail | ||
| 209 | + App.Reserve.Detail({ | ||
| 210 | + openid: getApp().openid, | ||
| 211 | + rid: this.id | ||
| 212 | + }).then(res => { | ||
| 213 | + let detail=this.formatDatail(res.data) | ||
| 214 | + this.setData({ | ||
| 215 | + detail: detail, | ||
| 216 | + hasOnlineReserve:res.data.type==1, | ||
| 217 | + }) | ||
| 218 | + if(detail.type==1 && detail.status==6){ | ||
| 219 | + this.GetRecommendSellerList(detail.seller.id) | ||
| 220 | + } | ||
| 221 | + }) | ||
| 222 | + }, | ||
| 223 | + gotoSellerDetail(e){ | ||
| 224 | + console.log(e) | ||
| 225 | + let url='/pages/reserve/detail?id='+e.currentTarget.id | ||
| 226 | + wx.navigateTo({ | ||
| 227 | + url:url, | ||
| 228 | + }) | ||
| 229 | + }, | ||
| 212 | }) | 230 | }) |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | "card":"/components/seller-card/seller-card", | 10 | "card":"/components/seller-card/seller-card", |
| 11 | "formids":"/components/formids/formids", | 11 | "formids":"/components/formids/formids", |
| 12 | "sb-tr":"/components/reserve/seller-box-transverse/seller-box", | 12 | "sb-tr":"/components/reserve/seller-box-transverse/seller-box", |
| 13 | + "getpos":"/components/userinfo/getpos", | ||
| 13 | "as":"/components/actionSheet/index" | 14 | "as":"/components/actionSheet/index" |
| 14 | } | 15 | } |
| 15 | } | 16 | } |
| @@ -130,8 +130,8 @@ | @@ -130,8 +130,8 @@ | ||
| 130 | previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;" | 130 | previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;" |
| 131 | current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition"> | 131 | current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition"> |
| 132 | <block wx:for="{{rsl}}" wx:key="rsl.key"> | 132 | <block wx:for="{{rsl}}" wx:key="rsl.key"> |
| 133 | - <swiper-item bindtap="gotoDetail" data-sid="{{id}}"> | ||
| 134 | - <view class="seller" id="seller-{{id}}"> | 133 | + <swiper-item bindtap="gotoSellerDetail" id="{{item.id}}"> |
| 134 | + <view class="seller" id="seller-{{item.id}}"> | ||
| 135 | <sb-tr seller="{{item}}" | 135 | <sb-tr seller="{{item}}" |
| 136 | hasActivityTags="{{false}}" | 136 | hasActivityTags="{{false}}" |
| 137 | hasActivityShort="{{true}}" | 137 | hasActivityShort="{{true}}" |
| @@ -146,4 +146,5 @@ | @@ -146,4 +146,5 @@ | ||
| 146 | <view style="height: 50rpx;"></view> | 146 | <view style="height: 50rpx;"></view> |
| 147 | </view> | 147 | </view> |
| 148 | <manager manager="{{detail}}" id="manager"></manager> | 148 | <manager manager="{{detail}}" id="manager"></manager> |
| 149 | -<as id="as" items="{{detail.seller.seller_tel}}" bindclick="callSellerPhone">拨打电话</as> | ||
| 149 | +<as id="as" items="{{detail.seller.seller_tel}}" bindclick="callSellerPhone">拨打电话</as> | ||
| 150 | +<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos> |
| @@ -13,10 +13,11 @@ Page({ | @@ -13,10 +13,11 @@ Page({ | ||
| 13 | total: 0, | 13 | total: 0, |
| 14 | tabType:1, | 14 | tabType:1, |
| 15 | hasMore:true, | 15 | hasMore:true, |
| 16 | + rsl:[],//推荐商家 | ||
| 16 | }, | 17 | }, |
| 17 | tabType:1, | 18 | tabType:1, |
| 18 | - offset:1, | ||
| 19 | - limit:10, | 19 | + offset:0, |
| 20 | + limit:3, | ||
| 20 | hasMore:true, | 21 | hasMore:true, |
| 21 | /** | 22 | /** |
| 22 | * 生命周期函数--监听页面加载 | 23 | * 生命周期函数--监听页面加载 |
| @@ -36,7 +37,7 @@ Page({ | @@ -36,7 +37,7 @@ Page({ | ||
| 36 | * 生命周期函数--监听页面显示 | 37 | * 生命周期函数--监听页面显示 |
| 37 | */ | 38 | */ |
| 38 | onShow: function () { | 39 | onShow: function () { |
| 39 | - this.getListData(); | 40 | + this.selectComponent('#getpos').getPos(); |
| 40 | }, | 41 | }, |
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| @@ -53,49 +54,41 @@ Page({ | @@ -53,49 +54,41 @@ Page({ | ||
| 53 | 54 | ||
| 54 | }, | 55 | }, |
| 55 | getListData() { | 56 | getListData() { |
| 56 | - App.Reserve.GetListFromScheAndRes({ | ||
| 57 | - flag: 1, | 57 | + App.Customer.GetMyOrder({ |
| 58 | type: this.tabType, | 58 | type: this.tabType, |
| 59 | openid: getApp().openid, | 59 | openid: getApp().openid, |
| 60 | offset:this.offset, | 60 | offset:this.offset, |
| 61 | limit:this.limit, | 61 | limit:this.limit, |
| 62 | }).then(res => { | 62 | }).then(res => { |
| 63 | - let total = res.data.success.length | 63 | + let total = res.data.length |
| 64 | let data = this.formatList(res.data); | 64 | let data = this.formatList(res.data); |
| 65 | - | ||
| 66 | - this.hasMore=data.success.length>=this.limit | 65 | + this.hasMore=res.data.length>=this.limit |
| 67 | if(this.hasMore){ | 66 | if(this.hasMore){ |
| 68 | this.offset+=this.limit | 67 | this.offset+=this.limit |
| 69 | } | 68 | } |
| 70 | this.setData({ | 69 | this.setData({ |
| 71 | - list: data.success, | 70 | + list: this.data.list.concat(data), |
| 72 | hasMore:this.hasMore | 71 | hasMore:this.hasMore |
| 73 | }) | 72 | }) |
| 73 | + if(res.data.length==0){ | ||
| 74 | + this.GetRecommendSellerLists() | ||
| 75 | + } | ||
| 74 | }) | 76 | }) |
| 75 | }, | 77 | }, |
| 76 | - _formatList(list) { | ||
| 77 | - if (!list) return {}; | ||
| 78 | - let dlist = {}; | ||
| 79 | - if (list.length > 0) { | ||
| 80 | - let openid = getApp().openid; | ||
| 81 | - list.forEach(row => { | ||
| 82 | - row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II'); | ||
| 83 | - row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer'; | ||
| 84 | - let d = util.unixtoTime(row.rdate, 'MM月DD日 DAY 星期WW'); | ||
| 85 | - typeof dlist[d] == 'undefined' ? dlist[d] = [] : ''; | ||
| 86 | - dlist[d].push(row); | ||
| 87 | - }) | ||
| 88 | - } | 78 | + formatList(list) { |
| 79 | + if (list.length<1) return []; | ||
| 80 | + let dlist = []; | ||
| 81 | + let openid = getApp().openid; | ||
| 82 | + list.forEach(row => { | ||
| 83 | + row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II'); | ||
| 84 | + row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer'; | ||
| 85 | + dlist.push(row); | ||
| 86 | + }) | ||
| 89 | return dlist; | 87 | return dlist; |
| 90 | }, | 88 | }, |
| 91 | - formatList(res) { | ||
| 92 | - res.success = this._formatList(res.success); | ||
| 93 | - res.padding = this._formatList(res.padding); | ||
| 94 | - return res; | ||
| 95 | - }, | ||
| 96 | switchTab(e) { | 89 | switchTab(e) { |
| 97 | this.setData({ | 90 | this.setData({ |
| 98 | - tabFlag: util.attr(e, 'index') | 91 | + tabFlag: util.attr(e, 'index'), |
| 99 | }) | 92 | }) |
| 100 | this.getListData(); | 93 | this.getListData(); |
| 101 | }, | 94 | }, |
| @@ -121,10 +114,20 @@ Page({ | @@ -121,10 +114,20 @@ Page({ | ||
| 121 | url:url, | 114 | url:url, |
| 122 | }) | 115 | }) |
| 123 | }, | 116 | }, |
| 117 | + gotoSellerDetail(e){ | ||
| 118 | + console.log(e) | ||
| 119 | + let url='/pages/reserve/detail?id='+e.currentTarget.id | ||
| 120 | + wx.navigateTo({ | ||
| 121 | + url:url, | ||
| 122 | + }) | ||
| 123 | + }, | ||
| 124 | switchType(e){ | 124 | switchType(e){ |
| 125 | + this.hasRecommend=true | ||
| 125 | this.tabType=util.attr(e,'type') | 126 | this.tabType=util.attr(e,'type') |
| 126 | this.setData({ | 127 | this.setData({ |
| 127 | tabType:this.tabType, | 128 | tabType:this.tabType, |
| 129 | + list: [], | ||
| 130 | + hasMore:false | ||
| 128 | }) | 131 | }) |
| 129 | this.getListData() | 132 | this.getListData() |
| 130 | }, | 133 | }, |
| @@ -137,4 +140,43 @@ Page({ | @@ -137,4 +140,43 @@ Page({ | ||
| 137 | this.getListData(); | 140 | this.getListData(); |
| 138 | } | 141 | } |
| 139 | }, | 142 | }, |
| 143 | + hasRecommend:true, | ||
| 144 | + GetRecommendSellerLists(){ | ||
| 145 | + if(!this.hasRecommend) return | ||
| 146 | + let param={} | ||
| 147 | + if(this.location){ | ||
| 148 | + param={ | ||
| 149 | + lat:this.location.latitude, | ||
| 150 | + lng:this.location.longitude | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + App.Customer.GetRecommendSellerLists(param).then(res=>{ | ||
| 154 | + this.setData({ | ||
| 155 | + rsl:res.data | ||
| 156 | + }) | ||
| 157 | + }) | ||
| 158 | + }, | ||
| 159 | + hasGoto:false, | ||
| 160 | + bindtransition(e){ | ||
| 161 | + console.log(e) | ||
| 162 | + if('change'==e.type){ | ||
| 163 | + this.hasGoto=false | ||
| 164 | + } | ||
| 165 | + if('animationfinish'==e.type){ | ||
| 166 | + if(this.hasGoto && (e.detail.current+1)==this.data.rsl.length){ | ||
| 167 | + wx.switchTab({ | ||
| 168 | + url: '/pages/reserve/index' | ||
| 169 | + }) | ||
| 170 | + return; | ||
| 171 | + }else{ | ||
| 172 | + this.hasGoto=true | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + }, | ||
| 176 | + location:null, | ||
| 177 | + onpos(e){ | ||
| 178 | + console.log('onpos',e); | ||
| 179 | + this.location=e.detail | ||
| 180 | + this.getListData(); | ||
| 181 | + }, | ||
| 140 | }) | 182 | }) |
| @@ -6,6 +6,8 @@ | @@ -6,6 +6,8 @@ | ||
| 6 | "userinfo": "/components/userinfo/userinfo", | 6 | "userinfo": "/components/userinfo/userinfo", |
| 7 | "formids":"/components/formids/formids", | 7 | "formids":"/components/formids/formids", |
| 8 | "nav":"/components/nav/nav", | 8 | "nav":"/components/nav/nav", |
| 9 | + "sb-tr":"/components/reserve/seller-box-transverse/seller-box", | ||
| 10 | + "getpos":"/components/userinfo/getpos", | ||
| 9 | "card":"/components/seller-card/seller-card" | 11 | "card":"/components/seller-card/seller-card" |
| 10 | } | 12 | } |
| 11 | } | 13 | } |
| @@ -9,21 +9,40 @@ | @@ -9,21 +9,40 @@ | ||
| 9 | <view class="page"> | 9 | <view class="page"> |
| 10 | <block wx:if="{{list.length==0}}"> | 10 | <block wx:if="{{list.length==0}}"> |
| 11 | <view class="flex-vc empry"> | 11 | <view class="flex-vc empry"> |
| 12 | - <image src="http://qn.colorcun.com/custom/lite/image/empty-order.png"></image> | 12 | + <image src="http://qn.colorcun.com/reserve/images/order-empty.png"></image> |
| 13 | <view class="Medium">暂无订座</view> | 13 | <view class="Medium">暂无订座</view> |
| 14 | </view> | 14 | </view> |
| 15 | + <block wx:if="{{rsl.length>0}}"> | ||
| 16 | + <view class="line-push">为你推荐</view> | ||
| 17 | + <view class="transverse-list"> | ||
| 18 | + <swiper | ||
| 19 | + indicator-dots="{{false}}" autoplay="{{false}}" circular="{{false}}" vertical="{{false}}" | ||
| 20 | + interval="2000" duration="500" | ||
| 21 | + previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;" | ||
| 22 | + current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition"> | ||
| 23 | + <block wx:for="{{rsl}}" wx:key="rsl.key"> | ||
| 24 | + <swiper-item bindtap="gotoSellerDetail" id="{{item.id}}"> | ||
| 25 | + <view class="seller" id="seller-{{item.id}}"> | ||
| 26 | + <sb-tr seller="{{item}}" | ||
| 27 | + hasActivityTags="{{false}}" | ||
| 28 | + hasActivityShort="{{true}}" | ||
| 29 | + hasBrand="true" hasActivityTese="true" | ||
| 30 | + hasSlogan="{{false}}"></sb-tr> | ||
| 31 | + </view> | ||
| 32 | + </swiper-item> | ||
| 33 | + </block> | ||
| 34 | + </swiper> | ||
| 35 | + </view> | ||
| 36 | + </block> | ||
| 15 | </block> | 37 | </block> |
| 16 | <block wx:else=""> | 38 | <block wx:else=""> |
| 17 | - <block wx:for="{{list}}" wx:key="success.key" wx:for-item="part" wx:for-index="dateIndex"> | ||
| 18 | - <view class="list-content" wx:if="{{part.length>0}}"> | ||
| 19 | - <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail"> | ||
| 20 | - <view class="card"> | ||
| 21 | - <card | ||
| 22 | - hasShowStatus bindevent="gotoDetail" | ||
| 23 | - seller="{{detail.seller}}" detail="{{detail}}"></card> | ||
| 24 | - </view> | ||
| 25 | - </block> | 39 | + <block wx:for="{{list}}" wx:key="success.key" wx:for-item="detail" wx:for-index="dateIndex"> |
| 40 | + <view class="card"> | ||
| 41 | + <card | ||
| 42 | + hasShowStatus bindevent="gotoDetail" | ||
| 43 | + seller="{{detail.seller}}" detail="{{detail}}"></card> | ||
| 26 | </view> | 44 | </view> |
| 27 | </block> | 45 | </block> |
| 28 | </block> | 46 | </block> |
| 29 | </view> | 47 | </view> |
| 48 | +<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos> |
| @@ -81,13 +81,13 @@ | @@ -81,13 +81,13 @@ | ||
| 81 | border-color: #C8B16D; | 81 | border-color: #C8B16D; |
| 82 | } | 82 | } |
| 83 | .empry{ | 83 | .empry{ |
| 84 | - font-size: 34rpx; | 84 | + font-size: 28rpx; |
| 85 | + margin-top: 210rpx; | ||
| 85 | } | 86 | } |
| 86 | .empry image{ | 87 | .empry image{ |
| 87 | width:384rpx; | 88 | width:384rpx; |
| 88 | height: 296rpx; | 89 | height: 296rpx; |
| 89 | - margin-bottom: 100rpx; | ||
| 90 | - margin-top: 176rpx; | 90 | + margin-bottom: 60rpx; |
| 91 | } | 91 | } |
| 92 | .cate-class{ | 92 | .cate-class{ |
| 93 | margin-bottom: 72rpx; | 93 | margin-bottom: 72rpx; |
| @@ -106,4 +106,27 @@ | @@ -106,4 +106,27 @@ | ||
| 106 | } | 106 | } |
| 107 | .customers view{ | 107 | .customers view{ |
| 108 | margin-left: 14rpx; | 108 | margin-left: 14rpx; |
| 109 | +} | ||
| 110 | + | ||
| 111 | +.line-push{ | ||
| 112 | + background-image: url("https://qn.colorcun.com/reserve/images/line-push.png"); | ||
| 113 | + width: 328rpx; | ||
| 114 | + height: 42rpx; | ||
| 115 | + background-size: 100% 24rpx; | ||
| 116 | + margin: 0 auto; | ||
| 117 | + font-size:30rpx; | ||
| 118 | + color: #C0A369; | ||
| 119 | + line-height: 24rpx; | ||
| 120 | + background-repeat: no-repeat; | ||
| 121 | + text-align: center; | ||
| 122 | + margin-top: 158rpx; | ||
| 123 | +} | ||
| 124 | +.transverse-list{ | ||
| 125 | + background-color: #fefefe; | ||
| 126 | + width: 100%; | ||
| 127 | + margin-top: 40rpx; | ||
| 128 | +} | ||
| 129 | +.transverse-list .seller{ | ||
| 130 | + width: 98%; | ||
| 131 | + margin: 0 auto; | ||
| 109 | } | 132 | } |
| @@ -352,7 +352,7 @@ | @@ -352,7 +352,7 @@ | ||
| 352 | "id": 39, | 352 | "id": 39, |
| 353 | "name": "pages/reserve/detail 在线订座 ", | 353 | "name": "pages/reserve/detail 在线订座 ", |
| 354 | "pathName": "pages/reserve/detail", | 354 | "pathName": "pages/reserve/detail", |
| 355 | - "query": "id=1&fromid=&activeTab=", | 355 | + "query": "id=1&fromid=&activeTab=reserve", |
| 356 | "scene": null | 356 | "scene": null |
| 357 | }, | 357 | }, |
| 358 | { | 358 | { |
| @@ -285,6 +285,10 @@ export default { | @@ -285,6 +285,10 @@ export default { | ||
| 285 | openid:'openid', | 285 | openid:'openid', |
| 286 | silence:false, | 286 | silence:false, |
| 287 | }, | 287 | }, |
| 288 | + | ||
| 289 | + //我的订单 | ||
| 290 | + 'App.Customer.GetMyOrder':null, | ||
| 291 | + | ||
| 288 | // 预定失败推荐商家接口 | 292 | // 预定失败推荐商家接口 |
| 289 | 'App.Customer.GetRecommendSellerList':null, | 293 | 'App.Customer.GetRecommendSellerList':null, |
| 290 | 294 |
-
Please register or login to post a comment