Commit 9251ed7682dcd7113349926cc8ed1eb8a1629064

Authored by wangfan
1 parent 1fd35486

c端预定

@@ -17,8 +17,6 @@ Component({ @@ -17,8 +17,6 @@ Component({
17 * 组件的初始数据 17 * 组件的初始数据
18 */ 18 */
19 data: { 19 data: {
20 - hasShow:false,  
21 - se:{},  
22 }, 20 },
23 attached(){ 21 attached(){
24 this.init() 22 this.init()
1 <!--components/showModal/showModal.wxml--> 1 <!--components/showModal/showModal.wxml-->
2 <view class="seller flex-ll"> 2 <view class="seller flex-ll">
3 <view class="image"> 3 <view class="image">
4 - <image src=""></image> 4 + <image src="{{seller.seller_image}}"></image>
  5 + <view class="room_num" wx:if="{{seller.room_num>0}}">{{seller.room_num}}个包间</view>
5 </view> 6 </view>
6 <view class="info flex-tb"> 7 <view class="info flex-tb">
7 - <view class="name Semibold">{{se.sellername}}</view>  
8 - <view class="text">潮汕火锅 | 距当前位置{{se.distance}}</view> 8 + <view class="name Semibold">{{seller.sellername}}</view>
  9 + <view class="text">{{seller.cate[0].name?seller.cate[0].name+' |':''}}距当前位置{{seller.distance}}</view>
9 <view class="price flex-lr"> 10 <view class="price flex-lr">
10 - <view class="number Semibold">¥50元/人</view> 11 + <view class="number Semibold">
  12 + <block wx:if="{{seller.average>0}}">¥{{seller.average}}元/人</block>
  13 + </view>
11 <view class="phone flex-ll" bindtap="tapButton" data-type="oncall"> 14 <view class="phone flex-ll" bindtap="tapButton" data-type="oncall">
12 <image src="http://qn.colorcun.com/custom/lite-online/image/phone.png"></image> 15 <image src="http://qn.colorcun.com/custom/lite-online/image/phone.png"></image>
13 <text>预订</text> 16 <text>预订</text>
@@ -18,6 +18,20 @@ @@ -18,6 +18,20 @@
18 height: 240rpx; 18 height: 240rpx;
19 background-color: #4C4E4F; 19 background-color: #4C4E4F;
20 min-width: 268rpx; 20 min-width: 268rpx;
  21 + position: relative;
  22 +}
  23 +.seller .image .room_num{
  24 + height: 34rpx;
  25 + width: 120rpx;
  26 + line-height: 34rpx;
  27 + color: #fefefe;
  28 + background-color: rgba(248, 137, 68, 0.86);
  29 + border-radius: 18rpx;
  30 + text-align: center;
  31 + position: absolute;
  32 + top:10rpx;
  33 + left: 74rpx;
  34 + font-size: 24rpx;
21 } 35 }
22 .seller .info{ 36 .seller .info{
23 padding: 10rpx 3%; 37 padding: 10rpx 3%;
  1 +//
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +let getCates=async function(){
  6 + let res=await App.Reserve.GetCustomerConfig();
  7 + let cates=[];
  8 + res.data.cate.forEach(ca=>{
  9 + cates.push(ca.name);
  10 + })
  11 + return cates;
  12 +}
  13 +
1 export default { 14 export default {
2 - caixi:['福建菜','日本菜','火锅','日韩料理','西餐','川湘菜','江浙菜','粤菜','西北菜','徽菜','东北菜','云贵菜','客家菜','新疆菜'], 15 + getCates:getCates,
3 } 16 }
@@ -26,7 +26,7 @@ Page({ @@ -26,7 +26,7 @@ Page({
26 markers: [], 26 markers: [],
27 //polygons:{}, 27 //polygons:{},
28 sellers:[], 28 sellers:[],
29 - multiArray: [['不确定'].concat(renNum()), ['全部菜系'].concat(DA.caixi)], 29 + multiArray: [['不确定'], ['全部菜系']],
30 multiIndex: [6, 0], 30 multiIndex: [6, 0],
31 scrollIntoView:'', 31 scrollIntoView:'',
32 suggestion:{}, 32 suggestion:{},
@@ -37,13 +37,20 @@ Page({ @@ -37,13 +37,20 @@ Page({
37 sellers: [], 37 sellers: [],
38 sellersIds:[], 38 sellersIds:[],
39 searchAddrTop:50, 39 searchAddrTop:50,
  40 + user:{
  41 + latitude: 23.099994,
  42 + longitude: 113.324520,
  43 + },
40 /** 44 /**
41 * 生命周期函数--监听页面加载 45 * 生命周期函数--监听页面加载
42 */ 46 */
43 - onLoad: function (options) { 47 + onLoad: async function (options) {
44 // this.qqmapsdk=new QQMapWX({ 48 // this.qqmapsdk=new QQMapWX({
45 // key: 'SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ' 49 // key: 'SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ'
46 // }); 50 // });
  51 + this.setData({
  52 + multiArray:[['不确定'].concat(renNum()), ['全部菜系'].concat(await DA.getCates())]
  53 + })
47 }, 54 },
48 55
49 /** 56 /**
@@ -77,6 +84,7 @@ Page({ @@ -77,6 +84,7 @@ Page({
77 //this.getPos(); 84 //this.getPos();
78 if(this.data.hasSuggestion) return; 85 if(this.data.hasSuggestion) return;
79 let sys=getApp().system; 86 let sys=getApp().system;
  87 + console.log('onShow',sys.windowHeight,sys.windowHeight-this.transverseViewHeight)
80 this.setData({ 88 this.setData({
81 [`map.height`]: sys.windowHeight-this.transverseViewHeight, 89 [`map.height`]: sys.windowHeight-this.transverseViewHeight,
82 searchAddrTop:sys.statusBarHeight 90 searchAddrTop:sys.statusBarHeight
@@ -125,6 +133,11 @@ Page({ @@ -125,6 +133,11 @@ Page({
125 let map = this.data.map; 133 let map = this.data.map;
126 map.latitude = res.latitude; 134 map.latitude = res.latitude;
127 map.longitude = res.longitude; 135 map.longitude = res.longitude;
  136 +
  137 + this.user.latitude = res.latitude;
  138 + this.user.longitude = res.longitude;
  139 +
  140 + console.log('onShow.getPos',getApp().system.windowHeight,getApp().system.windowHeight-this.transverseViewHeight)
128 map.height = getApp().system.windowHeight-this.transverseViewHeight 141 map.height = getApp().system.windowHeight-this.transverseViewHeight
129 this.setData({ 142 this.setData({
130 map: map, 143 map: map,
@@ -262,8 +275,8 @@ Page({ @@ -262,8 +275,8 @@ Page({
262 let markers = []; 275 let markers = [];
263 let sellers=[]; 276 let sellers=[];
264 App.Reserve.SellerList({ 277 App.Reserve.SellerList({
265 - lat: cmap.latitude,  
266 - lng: cmap.longitude, 278 + lat: this.user.latitude,
  279 + lng: this.user.longitude,
267 offset: 0, 280 offset: 0,
268 rows: 10000, 281 rows: 10000,
269 distance: 100000, 282 distance: 100000,
@@ -279,9 +292,14 @@ Page({ @@ -279,9 +292,14 @@ Page({
279 } 292 }
280 this.sellersIds=sellersIds; 293 this.sellersIds=sellersIds;
281 sellers=res.data; 294 sellers=res.data;
282 - this.sellers = sellers;  
283 -  
284 sellers.forEach(seller => { 295 sellers.forEach(seller => {
  296 + seller.distance=parseInt(seller.distance);
  297 + if(seller.distance>1000){
  298 + seller.distance=(seller.distance/1000).toFixed(2)+'公里'
  299 + }else{
  300 + seller.distance+='米';
  301 + }
  302 +
285 if(this.mapData.scale<13){ 303 if(this.mapData.scale<13){
286 markers.push({ 304 markers.push({
287 id: seller.id, 305 id: seller.id,
@@ -295,7 +313,7 @@ Page({ @@ -295,7 +313,7 @@ Page({
295 return; 313 return;
296 } 314 }
297 let namelength = seller.sellername.replace(/[^\x00-\xff]/g, "01").length + 8; 315 let namelength = seller.sellername.replace(/[^\x00-\xff]/g, "01").length + 8;
298 - markers.push({ 316 + let marker={
299 id: seller.id, 317 id: seller.id,
300 iconPath: "http://qn.colorcun.com/custom/lite-online/image/circle.png", 318 iconPath: "http://qn.colorcun.com/custom/lite-online/image/circle.png",
301 latitude: seller.lat, 319 latitude: seller.lat,
@@ -315,7 +333,16 @@ Page({ @@ -315,7 +333,16 @@ Page({
315 textAlign: 'center', 333 textAlign: 'center',
316 display:'ALWAYS', 334 display:'ALWAYS',
317 }, 335 },
318 - }) 336 + };
  337 + if(seller.level[0].id<3){
  338 + //http://qn.colorcun.com/custom/lite-online/cates/%E6%B1%9F%E6%B5%99%E8%8F%9C.png
  339 + marker.iconPath="http://qn.colorcun.com/custom/lite-online/cates/"
  340 + +(seller.cate.length>0?seller.cate[0].name:'其他菜品')
  341 + +".png";
  342 + marker.width=20;
  343 + marker.height=25;
  344 + }
  345 + markers.push(marker)
319 }) 346 })
320 } else { 347 } else {
321 markers.push({ 348 markers.push({
@@ -341,6 +368,7 @@ Page({ @@ -341,6 +368,7 @@ Page({
341 }, 368 },
342 }) 369 })
343 } 370 }
  371 + this.sellers = sellers;
344 this.setData({ 372 this.setData({
345 markers: markers, 373 markers: markers,
346 sellers:sellers, 374 sellers:sellers,
@@ -150,4 +150,9 @@ export default { @@ -150,4 +150,9 @@ export default {
150 150
151 /**crm**/ 151 /**crm**/
152 'App.Reserve.Members':null, 152 'App.Reserve.Members':null,
  153 +
  154 + //顾客端配置信息、菜系
  155 + 'App.Reserve.GetCustomerConfig':{
  156 + cachetime: 1800,
  157 + },
153 } 158 }