Showing
8 changed files
with
434 additions
and
1 deletions
| @@ -30,7 +30,8 @@ | @@ -30,7 +30,8 @@ | ||
| 30 | "pages/reserve/discount", | 30 | "pages/reserve/discount", |
| 31 | "pages/reserve/indexList", | 31 | "pages/reserve/indexList", |
| 32 | "pages/reserve/share", | 32 | "pages/reserve/share", |
| 33 | - "pages/reserve/submit" | 33 | + "pages/reserve/submit", |
| 34 | + "pages/me/history" | ||
| 34 | ], | 35 | ], |
| 35 | "subpackages": [ | 36 | "subpackages": [ |
| 36 | { | 37 | { |
pages/me/history.js
0 → 100644
| 1 | +// pages/me/history.js | ||
| 2 | +import util from '../../utils/util'; | ||
| 3 | +import App from '../../utils/api'; | ||
| 4 | +Page({ | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * 页面的初始数据 | ||
| 8 | + */ | ||
| 9 | + data: { | ||
| 10 | + sellers:[], | ||
| 11 | + hasMore:true, | ||
| 12 | + hasFirstShow:true, | ||
| 13 | + }, | ||
| 14 | + sellers:[], | ||
| 15 | + /** | ||
| 16 | + * 生命周期函数--监听页面加载 | ||
| 17 | + */ | ||
| 18 | + onLoad: function (options) { | ||
| 19 | + | ||
| 20 | + }, | ||
| 21 | + formatSellers(data){ | ||
| 22 | + let sellers=[]; | ||
| 23 | + let hasChange=false | ||
| 24 | + this.sellers.forEach(seller=>{ | ||
| 25 | + if(seller.id==data.sid){ | ||
| 26 | + hasChange=true | ||
| 27 | + seller.hasFollow=data.hasFollow | ||
| 28 | + } | ||
| 29 | + if(seller.hasFollow){ | ||
| 30 | + sellers.push(seller) | ||
| 31 | + } | ||
| 32 | + }) | ||
| 33 | + if(!hasChange){ | ||
| 34 | + sellers=[] | ||
| 35 | + } | ||
| 36 | + this.setData({ | ||
| 37 | + sellers:sellers | ||
| 38 | + }) | ||
| 39 | + }, | ||
| 40 | + /** | ||
| 41 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 42 | + */ | ||
| 43 | + onReady: function () { | ||
| 44 | + | ||
| 45 | + }, | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 生命周期函数--监听页面显示 | ||
| 49 | + */ | ||
| 50 | + hasOnShow:true, | ||
| 51 | + onShow: function () { | ||
| 52 | + if(this.data.sellers.length==0){ | ||
| 53 | + wx.showLoading({ | ||
| 54 | + title: '加载中', | ||
| 55 | + }) | ||
| 56 | + this.setData({ | ||
| 57 | + hasFirstShow:true, | ||
| 58 | + }) | ||
| 59 | + } | ||
| 60 | + if(this.hasMore || this.data.sellers.length==0){ | ||
| 61 | + this.sellers=[] | ||
| 62 | + this.offset=1 | ||
| 63 | + // this.setData({ | ||
| 64 | + // sellers:[] | ||
| 65 | + // }) | ||
| 66 | + this.hasOnShow=true; | ||
| 67 | + this.selectComponent('#getpos').getPos(); | ||
| 68 | + } | ||
| 69 | + }, | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 生命周期函数--监听页面隐藏 | ||
| 73 | + */ | ||
| 74 | + onHide: function () { | ||
| 75 | + | ||
| 76 | + }, | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 生命周期函数--监听页面卸载 | ||
| 80 | + */ | ||
| 81 | + onUnload: function () { | ||
| 82 | + | ||
| 83 | + }, | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 87 | + */ | ||
| 88 | + onPullDownRefresh: function () { | ||
| 89 | + | ||
| 90 | + }, | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * 页面上拉触底事件的处理函数 | ||
| 94 | + */ | ||
| 95 | + onReachBottom: function (e) { | ||
| 96 | + console.log(e) | ||
| 97 | + if(this.hasMore){ | ||
| 98 | + this.GetCollectionSellerList(); | ||
| 99 | + } | ||
| 100 | + }, | ||
| 101 | + offset:1, | ||
| 102 | + size:10, | ||
| 103 | + hasMore:true, | ||
| 104 | + GetCollectionSellerList(){ | ||
| 105 | + App.Customer.GetCollectionSellerList({ | ||
| 106 | + openid:getApp().openid, | ||
| 107 | + lat:this.location.latitude, | ||
| 108 | + lng:this.location.longitude, | ||
| 109 | + offset:this.offset, | ||
| 110 | + size:this.size, | ||
| 111 | + }).then(res=>{ | ||
| 112 | + let sellers=res.data; | ||
| 113 | + let sellersLength=sellers.length; | ||
| 114 | + this.hasMore=sellersLength>=this.size | ||
| 115 | + if(this.hasMore){ | ||
| 116 | + this.offset+=1 | ||
| 117 | + } | ||
| 118 | + sellers.forEach((seller,si) => { | ||
| 119 | + // if(seller.distance || seller.distance===0){ | ||
| 120 | + // seller.distance = parseInt(seller.distance); | ||
| 121 | + // if (seller.distance > 1000) { | ||
| 122 | + // seller.distance = (seller.distance / 1000).toFixed(2) + 'km' | ||
| 123 | + // } else { | ||
| 124 | + // seller.distance += 'm'; | ||
| 125 | + // } | ||
| 126 | + // } | ||
| 127 | + if(seller.seller_tel){ | ||
| 128 | + seller.seller_tel=seller.seller_tel.split(','); | ||
| 129 | + }else{ | ||
| 130 | + seller.seller_tel=[] | ||
| 131 | + } | ||
| 132 | + seller.hasFollow=true | ||
| 133 | + }) | ||
| 134 | + if(!this.hasOnShow){ | ||
| 135 | + sellers=[...this.data.sellers,...sellers] | ||
| 136 | + } | ||
| 137 | + this.hasOnShow=false; | ||
| 138 | + this.setData({ | ||
| 139 | + sellers:sellers, | ||
| 140 | + hasMore:this.hasMore, | ||
| 141 | + hasFirstShow:false, | ||
| 142 | + }) | ||
| 143 | + this.sellers=sellers | ||
| 144 | + wx.hideLoading() | ||
| 145 | + if(res.data.length==0 && this.offset==1){ | ||
| 146 | + this.GetRecommendSellerLists() | ||
| 147 | + } | ||
| 148 | + }) | ||
| 149 | + }, | ||
| 150 | + gotoDetail(e){ | ||
| 151 | + wx.navigateTo({ | ||
| 152 | + url:'/pages/reserve/detail?id='+util.attr(e,'sid') | ||
| 153 | + }) | ||
| 154 | + }, | ||
| 155 | + onpos(e){ | ||
| 156 | + console.log(e); | ||
| 157 | + this.location=e.detail | ||
| 158 | + this.GetCollectionSellerList(); | ||
| 159 | + }, | ||
| 160 | + | ||
| 161 | + hasRecommend:true, | ||
| 162 | + GetRecommendSellerLists(){ | ||
| 163 | + if(!this.hasRecommend) return | ||
| 164 | + let param={} | ||
| 165 | + if(this.location){ | ||
| 166 | + param={ | ||
| 167 | + lat:this.location.latitude, | ||
| 168 | + lng:this.location.longitude | ||
| 169 | + } | ||
| 170 | + } | ||
| 171 | + App.Customer.GetRecommendSellerLists(param).then(res=>{ | ||
| 172 | + this.setData({ | ||
| 173 | + rsl:res.data | ||
| 174 | + }) | ||
| 175 | + }) | ||
| 176 | + }, | ||
| 177 | + hasGoto:false, | ||
| 178 | + bindtransition(e){ | ||
| 179 | + console.log(e) | ||
| 180 | + if('change'==e.type){ | ||
| 181 | + this.hasGoto=false | ||
| 182 | + } | ||
| 183 | + if('animationfinish'==e.type){ | ||
| 184 | + if(this.hasGoto && (e.detail.current+1)==this.data.rsl.length){ | ||
| 185 | + wx.switchTab({ | ||
| 186 | + url: '/pages/reserve/index' | ||
| 187 | + }) | ||
| 188 | + return; | ||
| 189 | + }else{ | ||
| 190 | + this.hasGoto=true | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + }, | ||
| 194 | + goHome(){ | ||
| 195 | + wx.switchTab({ | ||
| 196 | + url: '/pages/reserve/index' | ||
| 197 | + }) | ||
| 198 | + }, | ||
| 199 | + clean(){ | ||
| 200 | + wx.showModal({ | ||
| 201 | + title: ' '+'确定清空浏览记录?', | ||
| 202 | + cancelColor:'#999999', | ||
| 203 | + confirmColor:'', | ||
| 204 | + success (res) { | ||
| 205 | + if (res.confirm) { | ||
| 206 | + console.log('用户点击确定') | ||
| 207 | + } else if (res.cancel) { | ||
| 208 | + console.log('用户点击取消') | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + }) | ||
| 212 | + }, | ||
| 213 | +}) |
pages/me/history.json
0 → 100644
pages/me/history.wxml
0 → 100644
| 1 | +<!--pages/me/history.wxml--> | ||
| 2 | +<nav>订好座,就用周到安排</nav> | ||
| 3 | +<view class="pages"> | ||
| 4 | + <view class="flex-vc empty" wx:if="{{sellers.length<1}}"> | ||
| 5 | + <block wx:if="{{!hasFirstShow}}"> | ||
| 6 | + <image src="http://qn.colorcun.com/custom/lite-online/image/follow-empty.png"></image> | ||
| 7 | + <view class="text">您还没有留下足迹哦~</view> | ||
| 8 | + <view class="goHome" bindtap="goHome">去首页逛逛</view> | ||
| 9 | + </block> | ||
| 10 | + </view> | ||
| 11 | + <view class="follow" wx:else=""> | ||
| 12 | + <view class="clean flex-rr" bindtap="clean"> | ||
| 13 | + <view class="clean-img"></view> | ||
| 14 | + <view class="clean-text">清空</view> | ||
| 15 | + </view> | ||
| 16 | + <view class="seller-group" wx:for="{{sellers}}" wx:key="sellerskey"> | ||
| 17 | + <view class="timeline">今天</view> | ||
| 18 | + <view class="seller-item flex-ll" wx:for="{{sellers}}" wx:key="sellerskey" wx:for-item="seller" | ||
| 19 | + bindtap="gotoDetail" data-sid="{{item.id}}" wx:if="{{item.hasFollow}}"> | ||
| 20 | + <image mode="aspectFill" class="image" | ||
| 21 | + 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> | ||
| 22 | + <view class="seller-item-info"> | ||
| 23 | + <view class="seller-item-name">{{seller.sellername}}</view> | ||
| 24 | + <view class="seller-item-price" wx:if="{{seller.average>0}}">¥{{seller.average}}元/人</view> | ||
| 25 | + </view> | ||
| 26 | + <view class="seller-item-line"></view> | ||
| 27 | + </view> | ||
| 28 | + </view> | ||
| 29 | + <hr class="seller flex-vc" bgColor="#f5f5f5" wx:if="{{!hasMore}}" style="margin-top: 20rpx;">我是有底线的</hr> | ||
| 30 | + </view> | ||
| 31 | +</view> | ||
| 32 | +<block wx:if="{{!hasFirstShow && sellers.length<1}}"> | ||
| 33 | + <view class="rsl-block"> | ||
| 34 | + <view class="line-push">为你推荐</view> | ||
| 35 | + <view class="transverse-list"> | ||
| 36 | + <swiper | ||
| 37 | + indicator-dots="{{false}}" autoplay="{{false}}" circular="{{false}}" vertical="{{false}}" | ||
| 38 | + interval="2000" duration="500" | ||
| 39 | + previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;" | ||
| 40 | + current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition"> | ||
| 41 | + <block wx:for="{{rsl}}" wx:key="rsl.key"> | ||
| 42 | + <swiper-item bindtap="gotoSellerDetail" id="{{item.id}}"> | ||
| 43 | + <view class="seller" id="seller-{{item.id}}"> | ||
| 44 | + <sb-tr seller="{{item}}" | ||
| 45 | + hasActivityTags="{{false}}" | ||
| 46 | + hasActivityShort="{{true}}" | ||
| 47 | + hasBrand="true" hasActivityTese="true" | ||
| 48 | + hasSlogan="{{false}}"></sb-tr> | ||
| 49 | + </view> | ||
| 50 | + </swiper-item> | ||
| 51 | + </block> | ||
| 52 | + </swiper> | ||
| 53 | + </view> | ||
| 54 | + </view> | ||
| 55 | +</block> | ||
| 56 | +<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos> |
pages/me/history.wxss
0 → 100644
| 1 | +/* pages/me/history.wxss */ | ||
| 2 | +page{ | ||
| 3 | + background-color: #F5F5F5; | ||
| 4 | +} | ||
| 5 | +.pages{ | ||
| 6 | + width: 100%; | ||
| 7 | + margin: 0 auto; | ||
| 8 | + font-size: 30rpx; | ||
| 9 | +} | ||
| 10 | +.seller-group{ | ||
| 11 | + background-color: #ffff; | ||
| 12 | + margin-bottom: 10rpx; | ||
| 13 | +} | ||
| 14 | +.empty{margin-top: 160rpx;} | ||
| 15 | +.empty image{ | ||
| 16 | + width: 191px; | ||
| 17 | + height: 158px; | ||
| 18 | +} | ||
| 19 | +.empty .text{ | ||
| 20 | + font-size: 28rpx; | ||
| 21 | + margin-top: 60rpx; | ||
| 22 | +} | ||
| 23 | +.follow { | ||
| 24 | + padding-bottom: 50rpx; | ||
| 25 | +} | ||
| 26 | +.clean{ | ||
| 27 | + background-color: #fff; | ||
| 28 | + height: 50rpx; | ||
| 29 | + line-height: 50rpx; | ||
| 30 | + padding-top: 10rpx; | ||
| 31 | +} | ||
| 32 | +.clean-img{ | ||
| 33 | + background-image: url("http://qn.colorcun.com/reserve/images/20191224153853.png"); | ||
| 34 | + background-size: 100% 100%; | ||
| 35 | + width: 24rpx; | ||
| 36 | + height: 24rpx; | ||
| 37 | +} | ||
| 38 | +.clean-text{ | ||
| 39 | + margin:0 40rpx 0 10rpx; | ||
| 40 | + font-size:24rpx; | ||
| 41 | + color:rgba(53,53,53,1); | ||
| 42 | +} | ||
| 43 | +.rsl-block{ | ||
| 44 | + position: fixed; | ||
| 45 | + bottom: 0rpx; | ||
| 46 | + width: 100%; | ||
| 47 | +} | ||
| 48 | +.transverse-list{ | ||
| 49 | + background-color: #fefefe; | ||
| 50 | + width: 100%; | ||
| 51 | +} | ||
| 52 | +.transverse-list .seller{ | ||
| 53 | + width: 98%; | ||
| 54 | + margin: 0 auto; | ||
| 55 | +} | ||
| 56 | +.line-push{ | ||
| 57 | + background-image: url("http://qn.colorcun.com/reserve/images/line-push.png"); | ||
| 58 | + width: 328rpx; | ||
| 59 | + height: 42rpx; | ||
| 60 | + background-size: 100% 24rpx; | ||
| 61 | + margin: 0 auto; | ||
| 62 | + font-size:30rpx; | ||
| 63 | + color: #C0A369; | ||
| 64 | + line-height: 24rpx; | ||
| 65 | + background-repeat: no-repeat; | ||
| 66 | + text-align: center; | ||
| 67 | + margin-bottom: 60rpx; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +.goHome{ | ||
| 71 | + width:200rpx; | ||
| 72 | + height:60rpx; | ||
| 73 | + border-radius:30rpx; | ||
| 74 | + border:2rpx solid rgba(192,163,105,1); | ||
| 75 | + | ||
| 76 | + font-size:28rpx; | ||
| 77 | + font-weight:500; | ||
| 78 | + color:rgba(192,163,105,1); | ||
| 79 | + line-height:60rpx; | ||
| 80 | + text-align: center; | ||
| 81 | + margin-top: 40rpx; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +.timeline{ | ||
| 85 | + height: 80rpx; | ||
| 86 | + line-height: 80rpx; | ||
| 87 | + box-sizing: border-box; | ||
| 88 | + | ||
| 89 | + font-size:36rpx; | ||
| 90 | + font-weight:600; | ||
| 91 | + color:rgba(53,53,53,1); | ||
| 92 | + padding-left: 20rpx; | ||
| 93 | + border-bottom: 2rpx solid #f5f5f5; | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +.seller-item{ | ||
| 97 | + box-sizing: border-box; | ||
| 98 | + width: 100%; | ||
| 99 | + height: 280rpx; | ||
| 100 | + padding: 20rpx; | ||
| 101 | + position: relative; | ||
| 102 | +} | ||
| 103 | +.seller-item-line{ | ||
| 104 | + position: absolute; | ||
| 105 | + width: calc(100% - 200rpx); | ||
| 106 | + height: 2rpx; | ||
| 107 | + right:0; | ||
| 108 | + bottom: 0; | ||
| 109 | + background-color: #f5f5f5; | ||
| 110 | +} | ||
| 111 | +.seller-item .image{ | ||
| 112 | + width: 160rpx; | ||
| 113 | + height: 240rpx; | ||
| 114 | + background-color: #4C4E4F; | ||
| 115 | + min-width: 160rpx; | ||
| 116 | + margin-right: 20rpx; | ||
| 117 | +} | ||
| 118 | +.seller-item-info{ | ||
| 119 | + flex-direction: row; | ||
| 120 | + justify-content: space-around; | ||
| 121 | + height:240rpx; | ||
| 122 | + width: calc(100% - 200rpx); | ||
| 123 | +} | ||
| 124 | +.seller-item-name{ | ||
| 125 | + height:44rpx; | ||
| 126 | + font-size:32rpx; | ||
| 127 | + font-weight:600; | ||
| 128 | + color:rgba(53,53,53,1); | ||
| 129 | + line-height:44rpx; | ||
| 130 | + margin-top: 28rpx; | ||
| 131 | + overflow: hidden; | ||
| 132 | + white-space:nowrap; | ||
| 133 | +} | ||
| 134 | +.seller-item-price{ | ||
| 135 | + height:40rpx; | ||
| 136 | + font-size:28rpx; | ||
| 137 | + font-weight:600; | ||
| 138 | + color:rgba(53,53,53,1); | ||
| 139 | + line-height:40rpx; | ||
| 140 | + margin-top: 60rpx; | ||
| 141 | +} |
| @@ -46,6 +46,10 @@ | @@ -46,6 +46,10 @@ | ||
| 46 | <view class="icon picon p1"></view> | 46 | <view class="icon picon p1"></view> |
| 47 | <view class="text">常用联系人</view> | 47 | <view class="text">常用联系人</view> |
| 48 | </navigator> | 48 | </navigator> |
| 49 | + <navigator class="flex-vc" url="/pages/me/history"> | ||
| 50 | + <view class="icon picon p4"></view> | ||
| 51 | + <view class="text">浏览记录</view> | ||
| 52 | + </navigator> | ||
| 49 | <view class="flex-vc" bindtap="gotoSellerBook" wx:if="{{hasSellerBook}}"> | 53 | <view class="flex-vc" bindtap="gotoSellerBook" wx:if="{{hasSellerBook}}"> |
| 50 | <view class="icon picon p2"></view> | 54 | <view class="icon picon p2"></view> |
| 51 | <view class="text">商户模式</view> | 55 | <view class="text">商户模式</view> |
| @@ -96,6 +96,9 @@ image{ | @@ -96,6 +96,9 @@ image{ | ||
| 96 | .picon.p3{ | 96 | .picon.p3{ |
| 97 | background-image: url("http://qn.colorcun.com/custom/me/image/p3.png"); | 97 | background-image: url("http://qn.colorcun.com/custom/me/image/p3.png"); |
| 98 | } | 98 | } |
| 99 | +.picon.p4{ | ||
| 100 | + background-image: url("http://qn.colorcun.com/reserve/images/201912241538531.png"); | ||
| 101 | +} | ||
| 99 | .block-rev .width3{ | 102 | .block-rev .width3{ |
| 100 | width: 75%; | 103 | width: 75%; |
| 101 | } | 104 | } |
| @@ -557,6 +557,12 @@ | @@ -557,6 +557,12 @@ | ||
| 557 | "pathName": "pack-book/pages/book/b_addnew", | 557 | "pathName": "pack-book/pages/book/b_addnew", |
| 558 | "query": "", | 558 | "query": "", |
| 559 | "scene": null | 559 | "scene": null |
| 560 | + }, | ||
| 561 | + { | ||
| 562 | + "id": -1, | ||
| 563 | + "name": "pages/me/history", | ||
| 564 | + "pathName": "pages/me/history", | ||
| 565 | + "scene": null | ||
| 560 | } | 566 | } |
| 561 | ] | 567 | ] |
| 562 | } | 568 | } |
-
Please register or login to post a comment