Commit 25a2b9d0449c9bd405796b46b91fdde9f319df69

Authored by vking
1 parent 075b711c

new 2.0

@@ -17,24 +17,3 @@ @@ -17,24 +17,3 @@
17 </view> 17 </view>
18 </view> 18 </view>
19 </view> 19 </view>
20 -<!--  
21 -<view class="mask flex-vc {{cla}}" hidden="{{!hasShow}}">  
22 - <view class="showModal">  
23 - <view class="header">  
24 - {{opt.header}}  
25 - </view>  
26 - <view class="body">  
27 - {{opt.body}}  
28 - <slot name="body"></slot>  
29 - </view>  
30 - <view class="footer flex-cc">  
31 - <button class="button-none cancel" plain wx:if="{{opt.cancelText}}"  
32 - bindtap="tapButton" data-type="cancel"  
33 - style="color:{{opt.cancelColor}};">{{opt.cancelText}}</button>  
34 - <button class="button-none confirm bg-brown" plain  
35 - bindtap="tapButton" data-type="confirm"  
36 - style="color:{{opt.confirmColor}};">{{opt.confirmText}}</button>  
37 - </view>  
38 - </view>  
39 -</view>  
40 --->  
  1 +// components/actionSheet/phone.js
  2 +import util from '../../../utils/util';
  3 +Component({
  4 + /**
  5 + * 组件的属性列表
  6 + */
  7 + properties: {
  8 + //items: Array,//电话列表
  9 + //seller:Object,//商家信息
  10 + hasTip:{
  11 + type:Boolean,
  12 + value:true,
  13 + },
  14 + },
  15 +
  16 + /**
  17 + * 组件的初始数据
  18 + */
  19 + data: {
  20 + actionSheetHidden: true,
  21 + hasOnlineReserve:false,
  22 + },
  23 +
  24 + /**
  25 + * 组件的方法列表
  26 + */
  27 + methods: {
  28 + show(seller){
  29 + this.seller=seller
  30 + let seller_tel = this.seller.seller_tel;
  31 + // if(this.seller.is_online_reserve==1 && this.seller.is_tele==0){
  32 + // //开通在线预订,但无商家接单设备,拨打运营电话
  33 + // seller_tel = ['400-000-9690']
  34 + // }else{
  35 + // if (seller_tel.length < 1) {
  36 + // seller_tel = [this.seller.phone]
  37 + // }
  38 + // }
  39 + console.log('seller_tel',seller_tel)
  40 + if (seller_tel.length < 1) {
  41 + seller_tel = [this.seller.phone]
  42 + }
  43 + this.setData({
  44 + actionSheetHidden: false,
  45 + items:seller_tel,
  46 + hasOnlineReserve:this.seller.is_online_reserve==1
  47 + })
  48 + },
  49 + hide(){
  50 + this.setData({
  51 + actionSheetHidden: true,
  52 + })
  53 + },
  54 + bindItemTap(e){
  55 + this.hide();
  56 + let index=util.attr(e,'index')
  57 + if(index=='reserve'){//跳转到预订页
  58 + let pages=getCurrentPages();
  59 + let p=pages[pages.length-1];
  60 + if(p.route=='pages/reserve/detail'){
  61 + p.setData({
  62 + activeTab:'reserve'
  63 + })
  64 + }else{
  65 + let url=util.http_build_query({id:this.seller.id,activeTab:'reserve'},'/pages/reserve/detail')
  66 + wx.navigateTo({
  67 + url:url,
  68 + })
  69 + }
  70 + return;
  71 + }else{
  72 + let value=util.attr(e,'value')
  73 + wx.makePhoneCall({
  74 + phoneNumber: value.replace(/[^\d]/g, '')
  75 + })
  76 + }
  77 + },
  78 + actionSheetChange(){
  79 + this.hide();
  80 + }
  81 + }
  82 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/actionSheet/phone.wxml-->
  2 +<view class="cu-modal bottom-modal {{!actionSheetHidden?'show':''}}" catchtap="hide">
  3 + <view class="cu-dialog bg-white" catchtap="catchtap" style="border-radius: 40rpx 40rpx 0rpx 0rpx">
  4 + <view class="view flex flex-direction justify-center align-center padding-lr-xl" >
  5 + <block wx:for="{{items}}" wx:key="itemskey">
  6 + <view class="view flex justify-center align-center phone-item" style="width: 100%;"
  7 + bindtap="bindItemTap" data-value="{{item}}" data-index="{{index}}">
  8 + <view class="view p2"></view>
  9 + <view class="margin-left-sm margin-tb-lg" style="font-size: 34rpx;">{{item}}</view>
  10 + </view>
  11 + </block>
  12 + <view class="action-sheet-cancel view" bindtap="hide">取消</view>
  13 + </view>
  14 + </view>
  15 +</view>
  1 +/* components/actionSheet/phone.wxss */
  2 +@import "../../../colorui/main.wxss";
  3 +.p2{
  4 + background-image: url("http://nosqn.colorcun.com/2.0/home%20%2816%29.png");
  5 + width: 40rpx;
  6 + height: 40rpx;
  7 +}
  8 +.action-sheet-cancel{
  9 + height:80rpx;
  10 + background:#F5F5F5;
  11 + border-radius:42rpx;
  12 + width: 100%;
  13 + text-align: center;
  14 + font-size:34rpx;
  15 + font-weight:400;
  16 + color: #666666;
  17 + line-height:80rpx;
  18 + margin-top: 20rpx;
  19 + margin-bottom: 40rpx;
  20 +}
  21 +.phone-item+.phone-item{
  22 + border-top: 2rpx solid #E5E5E5;
  23 +}
1 // components/2.0/seller/card.js 1 // components/2.0/seller/card.js
  2 +import util from '../../../utils/util'
2 Component({ 3 Component({
3 /** 4 /**
4 * 组件的属性列表 5 * 组件的属性列表
@@ -27,5 +28,22 @@ Component({ @@ -27,5 +28,22 @@ Component({
27 seller:seller, 28 seller:seller,
28 }) 29 })
29 }, 30 },
  31 + reserve(e){
  32 + if(this.data.seller.is_online_reserve==1){
  33 + let url=util.http_build_query({id:this.data.seller.id,activeTab:'reserve'},'/pages/reserve/detail')
  34 + let cid=util.attr(e,'cid')
  35 + if(cid){
  36 + url=util.http_build_query({
  37 + classID:cid,
  38 + className:util.attr(e,'cname'),
  39 + },url)
  40 + }
  41 + return wx.navigateTo({
  42 + url:url,
  43 + })
  44 + }else{
  45 + this.triggerEvent('event',{type:'phone',seller:this.data.seller})
  46 + }
  47 + },
30 } 48 }
31 }) 49 })
@@ -31,11 +31,13 @@ @@ -31,11 +31,13 @@
31 <view class="view flex align-center justify-between margin-top-sm reserve-view" catchtap="catchtap"> 31 <view class="view flex align-center justify-between margin-top-sm reserve-view" catchtap="catchtap">
32 <view class="view rooms flex-treble flex" style="overflow-x: auto"> 32 <view class="view rooms flex-treble flex" style="overflow-x: auto">
33 <block wx:for="{{seller.class}}" wx:key="seclass"> 33 <block wx:for="{{seller.class}}" wx:key="seclass">
34 - <view class="cu-tag round line-blue text-blue view">{{item.name}}</view> 34 + <view
  35 + bindtap="reserve" data-cid="{{item.id}}" data-cname="{{item.name}}"
  36 + class="cu-tag round line-blue text-blue view">{{item.name}}</view>
35 </block> 37 </block>
36 <view class="cu-tag round line-white text-blue view cu-tag-end"></view> 38 <view class="cu-tag round line-white text-blue view cu-tag-end"></view>
37 </view> 39 </view>
38 - <view class="view button-view flex justify-end"> 40 + <view class="view button-view flex justify-end" bindtap="reserve">
39 <view class="cu-btn bg-blue text-white round reserve-button text-df text-bold view padding-xs">订包间</view> 41 <view class="cu-btn bg-blue text-white round reserve-button text-df text-bold view padding-xs">订包间</view>
40 </view> 42 </view>
41 </view> 43 </view>
@@ -292,6 +292,11 @@ Page({ @@ -292,6 +292,11 @@ Page({
292 this.filterGroupData=e.detail 292 this.filterGroupData=e.detail
293 this.debounce(this.getSellers,500) 293 this.debounce(this.getSellers,500)
294 }, 294 },
  295 + sellerCardEvent(e){
  296 + if(e.detail.type=='phone'){
  297 + this.selectComponent('#as').show(e.detail.seller);
  298 + }
  299 + },
295 back:function() { 300 back:function() {
296 /* 301 /*
297 var mta = require('mta-wechat-analysis') 302 var mta = require('mta-wechat-analysis')
@@ -8,6 +8,6 @@ @@ -8,6 +8,6 @@
8 "filter-group":"/components/2.0/filter/filter-group", 8 "filter-group":"/components/2.0/filter/filter-group",
9 "seller-card":"/components/2.0/seller/card", 9 "seller-card":"/components/2.0/seller/card",
10 "chatbot":"/components/userinfo/chatbot", 10 "chatbot":"/components/userinfo/chatbot",
11 - "as-phone":"/components/actionSheet/phone" 11 + "as-phone":"/components/2.0/dialog/phone"
12 } 12 }
13 } 13 }
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover"> 60 <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover">
61 <seller-card class="seller-card" id="seller-{{item.id}}" 61 <seller-card class="seller-card" id="seller-{{item.id}}"
62 activeSellerID="{{activeSellerID}}" 62 activeSellerID="{{activeSellerID}}"
63 - seller="{{item}}" ></seller-card> 63 + seller="{{item}}" bindevent="sellerCardEvent" ></seller-card>
64 </navigator> 64 </navigator>
65 </block> 65 </block>
66 <view class="view" style="height: 192rpx;"></view> 66 <view class="view" style="height: 192rpx;"></view>
@@ -95,4 +95,5 @@ @@ -95,4 +95,5 @@
95 <as-phone id="as"></as-phone> 95 <as-phone id="as"></as-phone>
96 <filter id="filter" bindevent="filterEvent"></filter> 96 <filter id="filter" bindevent="filterEvent"></filter>
97 --> 97 -->
98 -<a2l bindshow="a2lshow" bindhide="a2lshow" key="INDEX" type="black20"></a2l>  
  98 +<a2l bindshow="a2lshow" bindhide="a2lshow" key="INDEX" type="black20"></a2l>
  99 +<as-phone id="as"></as-phone>