Commit 4b93fe9881e7e28bcc9b7d2adbe094c012c7cb3a

Authored by wangfan
1 parent 2a66a6fd

c端预定

  1 +// components/reserve/seller-box/seller-box.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Component({
  6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + seller:{
  11 + type:Object,
  12 + value:{},
  13 + }
  14 + },
  15 +
  16 + /**
  17 + * 组件的初始数据
  18 + */
  19 + data: {
  20 + hasShow:false,
  21 + se:{},
  22 + },
  23 + attached(){
  24 + this.init()
  25 + },
  26 + /**
  27 + * 组件的方法列表
  28 + */
  29 + methods: {
  30 + init(){
  31 + let seller=this.data.seller
  32 + seller.distance=parseInt(seller.distance);
  33 + if(seller.distance>1000){
  34 + seller.distance=(seller.distance/1000).toFixed(2)+'公里'
  35 + }else{
  36 + seller.distance+='米';
  37 + }
  38 + this.setData({
  39 + se:seller,
  40 + })
  41 + },
  42 + tapButton(e){
  43 + let type=util.attr(e,'type');
  44 + if(type=='oncall'){
  45 + if(!this.data.seller.phone){
  46 + return util.toast('商家电话错误','none');
  47 + }
  48 + wx.makePhoneCall({
  49 + phoneNumber:this.data.seller.phone
  50 + })
  51 + }else{
  52 + util.toast('请打电话预定','none');
  53 + }
  54 + },
  55 + lookLocation:function(){
  56 + wx.openLocation({
  57 + latitude:Number(this.data.seller.lat),
  58 + longitude:Number(this.data.seller.long),
  59 + scale:17,
  60 + address:this.data.seller.map_address,
  61 + success:function (res) {
  62 + console.log(res)
  63 + }
  64 + })
  65 + },
  66 + }
  67 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/showModal/showModal.wxml-->
  2 +<view class="seller flex-ll">
  3 + <view class="image">
  4 + <image src=""></image>
  5 + </view>
  6 + <view class="info flex-tb">
  7 + <view class="name Semibold">{{se.sellername}}</view>
  8 + <view class="text">潮汕火锅 | 距当前位置{{se.distance}}</view>
  9 + <view class="price flex-lr">
  10 + <view class="number Semibold">¥50元/人</view>
  11 + <view class="phone flex-ll" bindtap="tapButton" data-type="oncall">
  12 + <image src="http://qn.colorcun.com/custom/lite-online/image/phone.png"></image>
  13 + <text>预订</text>
  14 + </view>
  15 + </view>
  16 + </view>
  17 +</view>
  1 +/* components/reserve/seller-box/seller-box.wxss */
  2 +@import "../../../app.wxss";
  3 +.seller{
  4 + height: 240rpx;
  5 + overflow: hidden;
  6 + color: #353535;
  7 + width: 100%;
  8 + border: 2rpx solid #E0E0E0;
  9 + border-radius: 6rpx;
  10 + box-shadow: 0 4rpx 8rpx 0 #E0E0E0;
  11 +}
  12 +.seller image{
  13 + width: 100%;
  14 + height: 100%;
  15 +}
  16 +.seller .image{
  17 + width: 268rpx;
  18 + height: 240rpx;
  19 + background-color: #4C4E4F;
  20 + min-width: 268rpx;
  21 +}
  22 +.seller .info{
  23 + padding: 10rpx 3%;
  24 + height: 220rpx;
  25 + width: 94%;
  26 +}
  27 +.seller .name{
  28 + font-size: 32rpx;
  29 +}
  30 +.seller .text{
  31 + font-size: 28rpx;
  32 + color: #999999;
  33 +}
  34 +.seller .price{
  35 + font-size: 30rpx;
  36 + color: #F05522;
  37 + height: 50rpx;
  38 + line-height: 50rpx;
  39 + width: 100%;
  40 +}
  41 +.seller .phone{
  42 + width: 140rpx;
  43 + height: 50rpx;
  44 + background:linear-gradient(to bottom, #838383, #4C4C4C);
  45 + border-radius: 26rpx;
  46 + font-size: 26rpx;
  47 + color: #F0CEA1;
  48 + line-height: 50rpx;
  49 +}
  50 +.seller .phone image{
  51 + width: 28rpx;
  52 + height: 26rpx;
  53 + margin-right: 8rpx;
  54 + margin-left: 24rpx;
  55 +}
  1 +export default {
  2 + caixi:['福建菜','日本菜','火锅','日韩料理','西餐','川湘菜','江浙菜','粤菜','西北菜','徽菜','东北菜','云贵菜','客家菜','新疆菜'],
  3 +}
1 // pages/reservr/index.js 1 // pages/reservr/index.js
2 import util from '../../utils/util'; 2 import util from '../../utils/util';
3 import App from '../../utils/api'; 3 import App from '../../utils/api';
  4 +import DA from './data';
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
5 const mapScale=18 6 const mapScale=18
  7 +const renNum=function(){
  8 + let arr=[]
  9 + for(let i=1;i<=30;i++){
  10 + arr.push(i+'位')
  11 + }
  12 + return arr;
  13 +}
6 Page({ 14 Page({
7 15
8 /** 16 /**
@@ -17,8 +25,11 @@ Page({ @@ -17,8 +25,11 @@ Page({
17 }, 25 },
18 markers: [], 26 markers: [],
19 //polygons:{}, 27 //polygons:{},
  28 + sellers:[],
  29 + multiArray: [['不确定'].concat(renNum()), ['全部菜系'].concat(DA.caixi)],
  30 + multiIndex: [6, 0],
20 }, 31 },
21 - transverseViewHeight:150,//横向滚动高度 32 + transverseViewHeight:170,//横向滚动高度
22 //qqmapsdk:null, 33 //qqmapsdk:null,
23 sellers: [], 34 sellers: [],
24 sellersIds:[], 35 sellersIds:[],
@@ -318,6 +329,7 @@ Page({ @@ -318,6 +329,7 @@ Page({
318 } 329 }
319 this.setData({ 330 this.setData({
320 markers: markers, 331 markers: markers,
  332 + sellers:this.sellers,
321 }) 333 })
322 }) 334 })
323 335
@@ -6,6 +6,6 @@ @@ -6,6 +6,6 @@
6 "formids":"/components/formids/formids", 6 "formids":"/components/formids/formids",
7 "nav":"/components/nav/nav", 7 "nav":"/components/nav/nav",
8 "showModal":"/components/showModal/showModal", 8 "showModal":"/components/showModal/showModal",
9 - "seller-box":"/components/reserve/seller-box/seller-box" 9 + "sb-tr":"/components/reserve/seller-box-transverse/seller-box"
10 } 10 }
11 } 11 }
@@ -17,8 +17,34 @@ @@ -17,8 +17,34 @@
17 </view> 17 </view>
18 <view class="transverse-view"> 18 <view class="transverse-view">
19 <cover-view class="transverse-view-top"></cover-view> 19 <cover-view class="transverse-view-top"></cover-view>
20 - <view class="transverse-search"></view>  
21 - <view class="transverse-list"></view> 20 + <view class="transverse-search">
  21 + <picker
  22 + mode="multiSelector"
  23 + bindchange="bindMultiPickerChange"
  24 + bindcolumnchange="bindMultiPickerColumnChange"
  25 + value="{{multiIndex}}"
  26 + range="{{multiArray}}"
  27 + >
  28 + <view class="picker flex-lr" style="width: 100%">
  29 + <view class="input">{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}</view>
  30 + <view class="more"></view>
  31 + </view>
  32 + </picker>
  33 + </view>
  34 + <view class="transverse-list">
  35 + <scroll-view
  36 + scroll-x
  37 + class="scroll-view_H"
  38 + >
  39 + <view class="flex-ll">
  40 + <view class="seller" wx:for="{{sellers}}" wx:key="{{sellers.key}}">
  41 + <sb-tr seller="{{item}}"></sb-tr>
  42 + </view>
  43 + <view wx:if="{{sellers.length>1}}" style="min-width: 2rpx;min-height: 40rpx;"> </view>
  44 + </view>
  45 +
  46 + </scroll-view>
  47 + </view>
22 </view> 48 </view>
23 </view> 49 </view>
24 <cover-view bindtap="moveToLocation" class="moveToLocation"> 50 <cover-view bindtap="moveToLocation" class="moveToLocation">
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 } 16 }
17 .moveToLocation{ 17 .moveToLocation{
18 position: fixed; 18 position: fixed;
19 - bottom: 344rpx; 19 + bottom: 374rpx;
20 right: 20rpx; 20 right: 20rpx;
21 width: 50rpx; 21 width: 50rpx;
22 height: 50rpx; 22 height: 50rpx;
@@ -33,11 +33,11 @@ @@ -33,11 +33,11 @@
33 position: relative; 33 position: relative;
34 height: 324rpx; 34 height: 324rpx;
35 width: 100%; 35 width: 100%;
36 - background-color: #262628; 36 + background-color: #fefefe;
37 } 37 }
38 .transverse-view-top{ 38 .transverse-view-top{
39 border-radius: 20rpx 20rpx 0 0; 39 border-radius: 20rpx 20rpx 0 0;
40 - background-color: #fe0000; 40 + background-color: #fefefe;
41 position: absolute; 41 position: absolute;
42 top:-20rpx; 42 top:-20rpx;
43 left: 0; 43 left: 0;
@@ -45,12 +45,43 @@ @@ -45,12 +45,43 @@
45 height: 20rpx; 45 height: 20rpx;
46 } 46 }
47 .transverse-search{ 47 .transverse-search{
48 - background-color: #1AAD19; 48 + background-color: #fefefe;
49 height: 60rpx; 49 height: 60rpx;
50 width: 100%; 50 width: 100%;
51 } 51 }
52 .transverse-list{ 52 .transverse-list{
53 - background-color: #199095; 53 + background-color: #fefefe;
54 height: 264rpx; 54 height: 264rpx;
55 width: 100%; 55 width: 100%;
  56 +}
  57 +.transverse-list .seller{
  58 + margin: 16rpx 20rpx 12rpx;
  59 + box-sizing: content-box;
  60 + min-width: 710rpx;
  61 + width: 100%;
  62 +}
  63 +
  64 +.picker{
  65 + border-radius: 30rpx;
  66 + border: 2rpx solid #E0E0E0;
  67 + margin: 0 20rpx;
  68 + height: 55rpx;
  69 + padding: 0 30rpx;
  70 + line-height: 55rpx;
  71 + font-size: 28rpx;
  72 + max-width: 650rpx;
  73 +}
  74 +.picker .input{
  75 + background-image: url("http://qn.colorcun.com/custom/lite-online/image/write.png");
  76 + background-repeat: no-repeat;
  77 + text-indent: 50rpx;
  78 + background-size: 30rpx 28rpx;
  79 + height: 30rpx;
  80 + line-height: 30rpx;
  81 +}
  82 +.picker .more{
  83 + background-image: url("http://qn.colorcun.com/custom/lite-online/image/more-pull.png");
  84 + width: 24rpx;
  85 + height: 12rpx;
  86 + min-width:24rpx;
56 } 87 }