Commit 346a26c9d20c66d97cf10dd774ff2bfe0eb96622

Authored by zhangyan
1 parent efd73b53

no message

  1 +Component({
  2 + properties: {
  3 + searchlist:Array
  4 + },
  5 + methods:{
  6 + selectphone:function (e) {
  7 + console.log(e)
  8 + var target=e.currentTarget.dataset;
  9 + this.triggerEvent('selectphone',{phone:target.phone,rname:target.rname})
  10 + }
  11 + }
  12 +})
  1 +{
  2 + "component":true
  3 +}
  1 +<view class="search-react">
  2 + <view class="angel bg_white"></view>
  3 + <scroll-view class="search-list bg_white" scroll-y>
  4 + <block wx:for="{{searchlist}}">
  5 + <view class="list-single flex-lr black-font font30r" data-id="{{item.id}}" data-phone="{{item.phone}}" data-rname="{{item.rname}}" bindtap="selectphone">
  6 + <view>{{item.phone}}</view>
  7 + <view>{{item.rname}}</view>
  8 + </view>
  9 + </block>
  10 + </scroll-view>
  11 +</view>
  1 +@import '../../app.wxss';
  2 +.search-react{
  3 + width:400rpx;
  4 + height:541rpx;
  5 + position:absolute;
  6 + left:0;
  7 + top:142rpx;
  8 +}
  9 +.angel{
  10 + width:30rpx;
  11 + height:30rpx;
  12 + border-top:1px solid #E0E0E0;
  13 + border-left:1px solid #E0E0E0;
  14 + transform:rotate(45deg);
  15 + margin:0 auto;
  16 + position:relative;
  17 + z-index:2;
  18 +}
  19 +.search-list{
  20 + width:100%;
  21 + max-height:500rpx;
  22 + border:1px solid #E0E0E0;
  23 + border-radius:16rpx;
  24 + position:relative;
  25 + top:-16rpx;
  26 + box-shadow:0 0 4px rgba(0,0,0,.1);
  27 +}
  28 +.list-single{
  29 + width:100%;
  30 + height:100rpx;
  31 + padding:35rpx 30rpx 5rpx;
  32 + border-top:1px solid #E0E0E0;
  33 + box-sizing:border-box;
  34 +}
@@ -195,4 +195,28 @@ Page({ @@ -195,4 +195,28 @@ Page({
195 }) 195 })
196 }catch (e){} 196 }catch (e){}
197 }, 197 },
  198 + selectedValue:function(e){
  199 + var that=this;
  200 + if(e.detail.value!='' && e.detail.value.length>=3) {
  201 + App.Reserve.GetReserveUser({keywords:e.detail.value}).then(function(json){
  202 + if(json.ret==200 && json.data.length>0){
  203 + that.setData({
  204 + searchlist:json.data
  205 + })
  206 + }else{
  207 + that.setData({
  208 + searchlist:null
  209 + })
  210 + }
  211 + })
  212 + }
  213 + },
  214 + selectphone:function(e){
  215 + this.data.form.phone=e.detail.phone;
  216 + this.data.form.rname=e.detail.rname;
  217 + this.setData({
  218 + form:this.data.form,
  219 + searchlist:null
  220 + })
  221 + }
198 }) 222 })
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 "nothingBook":"/components/book/nothing/nothing", 6 "nothingBook":"/components/book/nothing/nothing",
7 "bookList":"/components/book/list/list", 7 "bookList":"/components/book/list/list",
8 "nav":"/components/nav/nav", 8 "nav":"/components/nav/nav",
9 - "tabBar":"/components/book/tabBar/tabBar" 9 + "tabBar":"/components/book/tabBar/tabBar",
  10 + "searchList":"/components/searchlist/searchlist"
10 } 11 }
11 } 12 }
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 </view> 103 </view>
104 </view> 104 </view>
105 <view class="book-info"> 105 <view class="book-info">
106 - <view class="book-info-single flex-lr" style="align-items:flex-start;"> 106 + <view class="book-info-single flex-lr" style="align-items:flex-start;position:relative;z-index:5;">
107 <input placeholder="预订人电话" placeholder-class="gray-font font34r" class="black-font font34r" type="number" maxlength="11" 107 <input placeholder="预订人电话" placeholder-class="gray-font font34r" class="black-font font34r" type="number" maxlength="11"
108 bindinput="selectedValue" 108 bindinput="selectedValue"
109 bindconfirm="selectedValue" 109 bindconfirm="selectedValue"
@@ -115,6 +115,9 @@ @@ -115,6 +115,9 @@
115 <image src="../image/name-have.png" class="phone-reminder"></image> 115 <image src="../image/name-have.png" class="phone-reminder"></image>
116 </view> 116 </view>
117 </block> 117 </block>
  118 + <block wx:if="{{searchlist}}">
  119 + <searchList searchlist="{{searchlist}}" bind:selectphone="selectphone"></searchList>
  120 + </block>
118 </view> 121 </view>
119 <view class="book-info-single flex-lr" style="align-items:flex-start;"> 122 <view class="book-info-single flex-lr" style="align-items:flex-start;">
120 <input placeholder="预订人姓名(必填)" placeholder-class="gray-font font34r" class="black-font font34r" maxlength="5" style="width:450rpx;" value="{{form.rname}}" 123 <input placeholder="预订人姓名(必填)" placeholder-class="gray-font font34r" class="black-font font34r" maxlength="5" style="width:450rpx;" value="{{form.rname}}"
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
140 .book-info-single{ 140 .book-info-single{
141 width:100%; 141 width:100%;
142 height:120rpx; 142 height:120rpx;
143 - padding-top:80rpx; 143 + padding-top:40rpx;
144 border-bottom:1px solid #efeef3; 144 border-bottom:1px solid #efeef3;
145 } 145 }
146 .book-info-single>input{ 146 .book-info-single>input{
@@ -45,5 +45,6 @@ export default { @@ -45,5 +45,6 @@ export default {
45 'App.SendSMS.Message':{ 45 'App.SendSMS.Message':{
46 silence:false, 46 silence:false,
47 }, 47 },
  48 + 'App.Reserve.GetReserveUser':null
48 49
49 } 50 }