Commit 352c5b4221ce7763c53da3238e076c4987e20d64

Authored by wangfan
1 parent 2c232e8c

v2 book list

@@ -10,9 +10,12 @@ Component({ @@ -10,9 +10,12 @@ Component({
10 attached(){ 10 attached(){
11 let item=this.data.item; 11 let item=this.data.item;
12 item.table_ids=item.tid.split(','); 12 item.table_ids=item.tid.split(',');
13 - item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){  
14 - return $1+'**'+$3;  
15 - }) 13 + item.phone_mask='';
  14 + if(item.phone){
  15 + item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){
  16 + return $1+'**'+$3;
  17 + })
  18 + }
16 this.setData({vitem:item}) 19 this.setData({vitem:item})
17 }, 20 },
18 methods:{ 21 methods:{
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 </view> 5 </view>
6 <view class="book-list-td flex-vc"> 6 <view class="book-list-td flex-vc">
7 <view class="Medium">{{vitem.rname}}</view> 7 <view class="Medium">{{vitem.rname}}</view>
8 - <view class="Medium">{{vitem.phone_mask}}</view> 8 + <view class="Medium">{{vitem.phone_mask||''}}</view>
9 </view> 9 </view>
10 <view class="book-list-td flex-cc">{{vitem.order_time}}</view> 10 <view class="book-list-td flex-cc">{{vitem.order_time}}</view>
11 <view class="book-list-td flex-rr green-font">通知订座人</view> 11 <view class="book-list-td flex-rr green-font">通知订座人</view>
@@ -108,7 +108,7 @@ @@ -108,7 +108,7 @@
108 bindblur="selectedValue" 108 bindblur="selectedValue"
109 bindconfirm="selectedValue" 109 bindconfirm="selectedValue"
110 data-key="phone" 110 data-key="phone"
111 - value="{{phone}}" style="color:{{reminder ? '#E14553' : '#353535'}};width:{{reminder ? 400 : 680}}rpx;"/> 111 + value="{{form.phone}}" style="color:{{reminder ? '#E14553' : '#353535'}};width:{{reminder ? 400 : 680}}rpx;"/>
112 <block wx:if="{{reminder}}"> 112 <block wx:if="{{reminder}}">
113 <view class="flex-rr" style="height:100rpx;"> 113 <view class="flex-rr" style="height:100rpx;">
114 <view style="color:#E14553;" class="font28r">{{reminder}}</view> 114 <view style="color:#E14553;" class="font28r">{{reminder}}</view>
@@ -13,6 +13,7 @@ Page({ @@ -13,6 +13,7 @@ Page({
13 phoneNumber:opt.phone, 13 phoneNumber:opt.phone,
14 bookInfo:opt 14 bookInfo:opt
15 }) 15 })
  16 + this.getDetail(opt.id);
16 wx.showShareMenu({ 17 wx.showShareMenu({
17 withShareTicket: true, 18 withShareTicket: true,
18 success:function(res){ 19 success:function(res){
@@ -22,69 +23,11 @@ Page({ @@ -22,69 +23,11 @@ Page({
22 this.chooseManagerInit(); 23 this.chooseManagerInit();
23 }, 24 },
24 onShow:function(){ 25 onShow:function(){
25 - this.getsellerInfo();  
26 - this.getdesklist();  
27 - var that=this;  
28 this.notice=this.selectComponent('#notice'); 26 this.notice=this.selectComponent('#notice');
29 - util.postSuccessFun=function(json,uri_code){  
30 - switch (uri_code) {  
31 - case uri.CGI__USER_GETSELLERBYID__CODE:  
32 - console.log(json)  
33 - if(json.ret==200){  
34 - that.setData({  
35 - storeInfo:json.data.data  
36 - })  
37 - }  
38 - break;  
39 - case uri.CGI_USER_GETTABLELIST__CODE:  
40 - var list=json.data;  
41 - var templist=[];  
42 - for(var key in list){  
43 - if(key!='typex' && key!='typey'){  
44 - list[key].list.forEach(function(v,i){  
45 - templist.push(v)  
46 - })  
47 -  
48 - }  
49 - }  
50 - var tables=that.data.bookInfo.tid.split(',');  
51 - var selecttable=[];  
52 - templist.forEach(function (v,i) {  
53 - tables.forEach(function(r,n){  
54 - if(r==v.id){  
55 - v.name=v.name.length>4 ? v.name.slice(0,3)+'...' : v.name;  
56 - selecttable.push(v)  
57 - }  
58 - })  
59 - })  
60 - console.log(selecttable)  
61 - that.setData({  
62 - selecttable:selecttable  
63 - })  
64 - break;  
65 - }  
66 - }  
67 }, 27 },
68 noticeCall:function(){ 28 noticeCall:function(){
69 this.notice.show(); 29 this.notice.show();
70 }, 30 },
71 - getsellerInfo:function(){  
72 - util.post(uri.CGI__USER_GETSELLERBYID,{sellerid:this.data.sellerid},uri.CGI__USER_GETSELLERBYID__CODE);  
73 - },  
74 - getdesklist:function(){  
75 - util.post(uri.CGI_USER_GETTABLELIST,{sid:this.data.sellerid,pnum:parseInt(this.data.bookInfo.pnum),rdate:this.data.bookInfo.rdate},uri.CGI_USER_GETTABLELIST__CODE)  
76 - },  
77 - lookLocation:function(){  
78 - wx.openLocation({  
79 - latitude:Number(this.data.storeInfo.lat),  
80 - longitude:Number(this.data.storeInfo.long),  
81 - scale:17,  
82 - address:this.data.storeInfo.map_address,  
83 - success:function (res) {  
84 - console.log(res)  
85 - }  
86 - })  
87 - },  
88 onShareAppMessage: function () { 31 onShareAppMessage: function () {
89 this.notice.close(); 32 this.notice.close();
90 var obj=this.data.bookInfo; 33 var obj=this.data.bookInfo;
@@ -153,4 +96,13 @@ Page({ @@ -153,4 +96,13 @@ Page({
153 console.log(e); 96 console.log(e);
154 } 97 }
155 }, 98 },
  99 + detailData:null,
  100 + getDetail(id){
  101 + App.Reserve.Detail({rid:id,openid:'1'}).then(res=>{
  102 + this.detailData=res.data;
  103 + this.setData({
  104 + tables:res.data.tables,
  105 + })
  106 + })
  107 + }
156 }) 108 })
1 -<nav>点餐商户端</nav>  
2 -<step step="2"></step>  
3 -<!--商家信息-->  
4 -<view class="flex-lr seller-info">  
5 - <view class="flex-ll">  
6 - <image src="{{storeInfo.seller_image}}" class="seller-image"></image>  
7 - <view class="flex-vl black-font">  
8 - <view class="font30r">{{storeInfo.sellername}}</view>  
9 - <view class="font24r gray-deep-font seller-address">{{storeInfo.map_address}}</view>  
10 - </view>  
11 - </view>  
12 - <view style="padding:20rpx 20rpx;" bindtap="lookLocation">  
13 - <image src="../image/gps-icon.png" class="seller-location"></image>  
14 - </view>  
15 -</view>  
16 - 1 +<nav>订座详情</nav>
17 <!--订单信息--> 2 <!--订单信息-->
18 <view class="order-info"> 3 <view class="order-info">
19 <view class="flex-lr order-detail"> 4 <view class="flex-lr order-detail">
@@ -22,13 +7,16 @@ @@ -22,13 +7,16 @@
22 </view> 7 </view>
23 <view class="flex-lr order-detail"> 8 <view class="flex-lr order-detail">
24 <view class="gray-deep-font font30r">用餐人数</view> 9 <view class="gray-deep-font font30r">用餐人数</view>
25 - <view class="black-font font34r">{{bookInfo.pnum}}人</view> 10 + <view class="black-font font34r">{{bookInfo.pnum_str}}人</view>
26 </view> 11 </view>
27 <view class="flex-lr order-desk"> 12 <view class="flex-lr order-desk">
28 <view class="gray-deep-font font30r">预定座位</view> 13 <view class="gray-deep-font font30r">预定座位</view>
29 - <image class="order-status" src="../image/order-mask-before.png"></image> 14 + <view class="black-font font34r">{{tables.length}}个</view>
  15 + </view>
  16 + <view class="flex-lr order-desk">
  17 + <view class="gray-deep-font font30r"></view>
30 <view class="flex-re" style="width:80%;flex-wrap:wrap;"> 18 <view class="flex-re" style="width:80%;flex-wrap:wrap;">
31 - <block wx:for="{{selecttable}}"> 19 + <block wx:for="{{tables}}">
32 <view class="order-desk-info"> 20 <view class="order-desk-info">
33 <view class="flex-vc order-desk-detail" style="height:{{item.tid==2 ? '90' : '120'}}rpx;"> 21 <view class="flex-vc order-desk-detail" style="height:{{item.tid==2 ? '90' : '120'}}rpx;">
34 <view class="font28r black-font smooth">{{item.name}}</view> 22 <view class="font28r black-font smooth">{{item.name}}</view>
@@ -47,7 +35,7 @@ @@ -47,7 +35,7 @@
47 </view> 35 </view>
48 <view class="flex-lr order-detail"> 36 <view class="flex-lr order-detail">
49 <view class="gray-deep-font font30r">手机号码</view> 37 <view class="gray-deep-font font30r">手机号码</view>
50 - <view class="black-font font34r" bindtap="getcall">{{bookInfo.phone}}</view> 38 + <view class="black-font font34r" bindtap="getcall">{{bookInfo.phone||''}}</view>
51 </view> 39 </view>
52 <block wx:if="{{bookInfo.cusdem!='' && bookInfo.cusdem!='null'}}"> 40 <block wx:if="{{bookInfo.cusdem!='' && bookInfo.cusdem!='null'}}">
53 <view class="flex-lr order-detail"> 41 <view class="flex-lr order-detail">
@@ -70,7 +58,7 @@ @@ -70,7 +58,7 @@
70 <view style="height: 160rpx;"></view> 58 <view style="height: 160rpx;"></view>
71 59
72 <!--通知预订人--> 60 <!--通知预订人-->
73 -<block wx:if="{{!bookInfo.code}}"> 61 +<block wx:if="{{bookInfo.code}}">
74 <view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view> 62 <view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view>
75 <noticeCall id="notice" phoneNumber="{{phoneNumber}}"></noticeCall> 63 <noticeCall id="notice" phoneNumber="{{phoneNumber}}"></noticeCall>
76 </block> 64 </block>
@@ -55,117 +55,15 @@ Page({ @@ -55,117 +55,15 @@ Page({
55 switch (uri_code) { 55 switch (uri_code) {
56 case uri.CGI_USER_GETRESERVELIST__CODE: 56 case uri.CGI_USER_GETRESERVELIST__CODE:
57 if(json.ret==200){ 57 if(json.ret==200){
  58 + var booklist=[];
58 if(json.data.length>0){ 59 if(json.data.length>0){
59 - var list=json.data;  
60 - var templist=[];  
61 - var temp=[]  
62 - if(list.length>0){  
63 -  
64 - }  
65 - list.forEach(function(v,i){  
66 - var thisobj=bookOrder.changedate(parseInt(v.rdate)*1000);  
67 - var thisdate=thisobj.year+'年'+thisobj.month+'月'+thisobj.day;  
68 - var ifdate=false  
69 - if(temp.length>0){  
70 - if(temp.indexOf(thisdate)==-1){  
71 - ifdate=true  
72 - }else{  
73 - ifdate=false  
74 - }  
75 - }else{  
76 - temp.push(thisdate);  
77 - if(thisobj.year==timeobj.year && thisobj.month==timeobj.month && timeobj.day==thisobj.day){  
78 - templist.push({  
79 - date:thisdate,  
80 - datemask:'今天',  
81 - list:[]  
82 - })  
83 - }else if(thisobj.year==afterobj.year && thisobj.month==afterobj.month && afterobj.day==thisobj.day){  
84 - templist.push({  
85 - date:thisdate,  
86 - datemask:'明天',  
87 - list:[]  
88 - })  
89 - }else{  
90 - var myDate = new Date(parseInt(v.rdate)*1000);  
91 - var title=bookOrder.getweek(myDate.getDay());  
92 - templist.push({  
93 - date:thisdate,  
94 - datemask:title,  
95 - list:[]  
96 - })  
97 - }  
98 - }  
99 - if(ifdate==true){  
100 - temp.push(thisdate);  
101 - if(thisobj.year==timeobj.year && thisobj.month==timeobj.month && timeobj.day==thisobj.day){  
102 - templist.push({  
103 - date:thisdate,  
104 - datemask:'今天',  
105 - list:[]  
106 - })  
107 - }else if(thisobj.year==afterobj.year && thisobj.month==afterobj.month && afterobj.day==thisobj.day){  
108 - templist.push({  
109 - date:thisdate,  
110 - datemask:'明天',  
111 - list:[]  
112 - })  
113 - }else{  
114 - var myDate = new Date(parseInt(v.rdate)*1000);  
115 - var title=bookOrder.getweek(myDate.getDay());  
116 - templist.push({  
117 - date:thisdate,  
118 - datemask:title,  
119 - list:[]  
120 - })  
121 - }  
122 - }  
123 - 60 + json.data.forEach(item=>{
  61 + item.order_time=util.unixtoTime(item.rdate,'HH:II')
  62 + booklist.push(item)
124 }) 63 })
125 - if(temp.length>0){  
126 - list.forEach(function(v,i){  
127 - var thisobj=bookOrder.changedate(parseInt(v.rdate)*1000);  
128 - console.log(thisobj)  
129 - var thisdate=thisobj.year+'年'+thisobj.month+'月'+thisobj.day;  
130 - templist.forEach(function(r,n) {  
131 - if (r.date == thisdate) {  
132 - v.order_date = thisobj.month + '月' + thisobj.day + '日';  
133 - v.order_time = thisobj.hour + ':' + (thisobj.minute == 0 ? thisobj.minute + '0' : thisobj.minute);  
134 - v.name=v.name.length>9 ? v.name.slice(0,9)+'等' : v.name;  
135 - r.list.push(v)  
136 - }  
137 -  
138 - })  
139 - })  
140 - }  
141 - if(that.data.bookList && that.data.pagex>1){  
142 - var booklist=that.data.bookList;  
143 - if(booklist[booklist.length-1].date==templist[0].date){  
144 - templist[0].list.forEach(function(v,i){  
145 - booklist[booklist.length-1].list.push(v)  
146 - })  
147 - templist.forEach(function(v,i){  
148 - if(i!=0){  
149 - booklist.push(v)  
150 - }  
151 -  
152 - })  
153 - }else{  
154 - templist.forEach(function(v,i){  
155 - booklist.push(v)  
156 - })  
157 - }  
158 - console.log(booklist)  
159 - that.setData({  
160 - bookList:booklist,  
161 - })  
162 - }else{  
163 - that.setData({  
164 - bookList:templist,  
165 - })  
166 - }  
167 } 64 }
168 that.setData({ 65 that.setData({
  66 + bookList:booklist,
169 isloading:true, 67 isloading:true,
170 currenlist:json.data 68 currenlist:json.data
171 }) 69 })
@@ -43,12 +43,7 @@ @@ -43,12 +43,7 @@
43 <scroll-view class="book-list" style="height:{{listHeight}}px;" scroll-y bindscroll="addbooklist"> 43 <scroll-view class="book-list" style="height:{{listHeight}}px;" scroll-y bindscroll="addbooklist">
44 <view class="book-list-body"> 44 <view class="book-list-body">
45 <block wx:for="{{bookList}}"> 45 <block wx:for="{{bookList}}">
46 - <block wx:for="{{item.list}}" wx:for-item="list">  
47 - <block wx:if="{{index!=0}}">  
48 - <view class="border-line"></view>  
49 - </block>  
50 - <bookList item="{{list}}"></bookList>  
51 - </block> 46 + <bookList item="{{item}}"></bookList>
52 </block> 47 </block>
53 </view> 48 </view>
54 </scroll-view> 49 </scroll-view>