Commit eeab1cda82854c25419ce6111c17115a5569e53f

Authored by liuxuqinfhp1220
1 parent 9d8232a5

获取手机号组件、时间段组件

@@ -46,21 +46,23 @@ Component({ @@ -46,21 +46,23 @@ Component({
46 } 46 }
47 let durlist=[]; 47 let durlist=[];
48 for(let key in timedur){ 48 for(let key in timedur){
49 - let arr=timedur[key].split('-');  
50 - //每个时段的开始时间、结束时间  
51 - let starttime=Number(arr[0].split(':')[0]);  
52 - let endtime=Number(arr[1].split(':')[0]);  
53 - if(util.unixtoTime(date/1000,'YYYY-MM-DD')==this.data.date){  
54 - if(currenttimemark+0.5<endtime){  
55 - if(currenttimemark+0.5>starttime){  
56 - starttime=Math.round(currenttimemark)+0.5; 49 + if(timedur[key]!=""){
  50 + let arr=timedur[key].split('-');
  51 + //每个时段的开始时间、结束时间
  52 + let starttime=Number(arr[0].split(':')[0]);
  53 + let endtime=Number(arr[1].split(':')[0]);
  54 + if(util.unixtoTime(date/1000,'YYYY-MM-DD')==this.data.date){ //当天
  55 + if(currenttimemark+0.5<endtime){
  56 + if(currenttimemark+0.5>starttime){
  57 + starttime=Math.round(currenttimemark)+0.5;
  58 + }
  59 + let thisdurlist=this.getsinglelist(starttime,endtime)
  60 + durlist=durlist.concat(thisdurlist)
57 } 61 }
58 - let thisdurlist=this.getsinglelist(starttime,endtime) 62 + }else{
  63 + let thisdurlist=this.getsinglelist(starttime,endtime);
59 durlist=durlist.concat(thisdurlist) 64 durlist=durlist.concat(thisdurlist)
60 } 65 }
61 - }else{  
62 - let thisdurlist=this.getsinglelist(starttime,endtime);  
63 - durlist=durlist.concat(thisdurlist)  
64 } 66 }
65 } 67 }
66 this.setData({ 68 this.setData({
@@ -3,19 +3,24 @@ Component({ @@ -3,19 +3,24 @@ Component({
3 methods:{ 3 methods:{
4 getphone(e){ 4 getphone(e){
5 console.log(e) 5 console.log(e)
6 - let parmdata={  
7 - session_key:wx.getStorageSync('customer_session_key'),  
8 - encryptedData:e.detail.encryptedData,  
9 - iv:e.detail.iv  
10 -  
11 - }  
12 - App.Customer.GetCustomerTel(parmdata).then((json)=>{  
13 - console.log(json)  
14 - if(json.ret==200){  
15 - let phoneNumber=JSON.parse(json.data).phoneNumber;  
16 - this.triggerEvent('getphoneNumber',{phone:phoneNumber}) 6 + if(e.detail.errMsg=="getPhoneNumber:ok"){
  7 + let parmdata={
  8 + session_key:wx.getStorageSync('customer_session_key'),
  9 + encryptedData:e.detail.encryptedData,
  10 + iv:e.detail.iv
  11 +
17 } 12 }
18 - }) 13 + App.Customer.GetCustomerTel(parmdata).then((json)=>{
  14 + console.log(json)
  15 + if(json.ret==200){
  16 + let phoneNumber=JSON.parse(json.data).phoneNumber;
  17 + this.triggerEvent('getphoneNumber',{ret:200,phone:phoneNumber})
  18 + }else{
  19 + this.triggerEvent('getphoneNumber',{ret:json.ret,msg:jaon.data})
  20 + }
  21 + })
  22 + }
  23 +
19 } 24 }
20 } 25 }
21 }) 26 })
1 -<button class="button-none white-font font28r smooth phone-button flex-cc" open-type="getPhoneNumber" bindgetphonenumber="getphone">一键获取</button>  
  1 +<button class="button-none white-font font28r smooth phone-button flex-cc" open-type="getPhoneNumber" bindgetphonenumber="getphone"><slot></slot></button>
1 -@import "../../app.wxss";  
2 -.phone-button{  
3 - width:160rpx;  
4 - height:50rpx;  
5 - background: #C0A369;  
6 - color:#ffffff;  
7 - font-size:28rpx;  
8 - display:flex;  
9 - display:-webkit-flex;  
10 -}  
  1 +@import "../../app.wxss";
@@ -50,7 +50,9 @@ @@ -50,7 +50,9 @@
50 placeholder-class="input-pl"/> 50 placeholder-class="input-pl"/>
51 <view class="flex-rr"> 51 <view class="flex-rr">
52 <!-- 一键获取 --> 52 <!-- 一键获取 -->
53 - <phone></phone> 53 + <phone>
  54 + <view class="smooth white-font get-phone flex-cc" style="font-size:28rpx;">一键获取</view>
  55 + </phone>
54 </view> 56 </view>
55 </view> 57 </view>
56 </view> 58 </view>
@@ -76,4 +76,9 @@ @@ -76,4 +76,9 @@
76 } 76 }
77 .input-pl{ 77 .input-pl{
78 font-size: 28rpx; 78 font-size: 28rpx;
  79 +}
  80 +.get-phone{
  81 + width:160rpx;
  82 + height:50rpx;
  83 + background: #C0A369;
79 } 84 }