Commit 352c5b4221ce7763c53da3238e076c4987e20d64

Authored by wangfan
1 parent 2c232e8c

v2 book list

... ... @@ -10,9 +10,12 @@ Component({
attached(){
let item=this.data.item;
item.table_ids=item.tid.split(',');
item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){
return $1+'**'+$3;
})
item.phone_mask='';
if(item.phone){
item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){
return $1+'**'+$3;
})
}
this.setData({vitem:item})
},
methods:{
... ...
... ... @@ -5,7 +5,7 @@
</view>
<view class="book-list-td flex-vc">
<view class="Medium">{{vitem.rname}}</view>
<view class="Medium">{{vitem.phone_mask}}</view>
<view class="Medium">{{vitem.phone_mask||''}}</view>
</view>
<view class="book-list-td flex-cc">{{vitem.order_time}}</view>
<view class="book-list-td flex-rr green-font">通知订座人</view>
... ...
... ... @@ -108,7 +108,7 @@
bindblur="selectedValue"
bindconfirm="selectedValue"
data-key="phone"
value="{{phone}}" style="color:{{reminder ? '#E14553' : '#353535'}};width:{{reminder ? 400 : 680}}rpx;"/>
value="{{form.phone}}" style="color:{{reminder ? '#E14553' : '#353535'}};width:{{reminder ? 400 : 680}}rpx;"/>
<block wx:if="{{reminder}}">
<view class="flex-rr" style="height:100rpx;">
<view style="color:#E14553;" class="font28r">{{reminder}}</view>
... ...
... ... @@ -13,6 +13,7 @@ Page({
phoneNumber:opt.phone,
bookInfo:opt
})
this.getDetail(opt.id);
wx.showShareMenu({
withShareTicket: true,
success:function(res){
... ... @@ -22,69 +23,11 @@ Page({
this.chooseManagerInit();
},
onShow:function(){
this.getsellerInfo();
this.getdesklist();
var that=this;
this.notice=this.selectComponent('#notice');
util.postSuccessFun=function(json,uri_code){
switch (uri_code) {
case uri.CGI__USER_GETSELLERBYID__CODE:
console.log(json)
if(json.ret==200){
that.setData({
storeInfo:json.data.data
})
}
break;
case uri.CGI_USER_GETTABLELIST__CODE:
var list=json.data;
var templist=[];
for(var key in list){
if(key!='typex' && key!='typey'){
list[key].list.forEach(function(v,i){
templist.push(v)
})
}
}
var tables=that.data.bookInfo.tid.split(',');
var selecttable=[];
templist.forEach(function (v,i) {
tables.forEach(function(r,n){
if(r==v.id){
v.name=v.name.length>4 ? v.name.slice(0,3)+'...' : v.name;
selecttable.push(v)
}
})
})
console.log(selecttable)
that.setData({
selecttable:selecttable
})
break;
}
}
},
noticeCall:function(){
this.notice.show();
},
getsellerInfo:function(){
util.post(uri.CGI__USER_GETSELLERBYID,{sellerid:this.data.sellerid},uri.CGI__USER_GETSELLERBYID__CODE);
},
getdesklist:function(){
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)
},
lookLocation:function(){
wx.openLocation({
latitude:Number(this.data.storeInfo.lat),
longitude:Number(this.data.storeInfo.long),
scale:17,
address:this.data.storeInfo.map_address,
success:function (res) {
console.log(res)
}
})
},
onShareAppMessage: function () {
this.notice.close();
var obj=this.data.bookInfo;
... ... @@ -153,4 +96,13 @@ Page({
console.log(e);
}
},
detailData:null,
getDetail(id){
App.Reserve.Detail({rid:id,openid:'1'}).then(res=>{
this.detailData=res.data;
this.setData({
tables:res.data.tables,
})
})
}
})
\ No newline at end of file
... ...
<nav>点餐商户端</nav>
<step step="2"></step>
<!--商家信息-->
<view class="flex-lr seller-info">
<view class="flex-ll">
<image src="{{storeInfo.seller_image}}" class="seller-image"></image>
<view class="flex-vl black-font">
<view class="font30r">{{storeInfo.sellername}}</view>
<view class="font24r gray-deep-font seller-address">{{storeInfo.map_address}}</view>
</view>
</view>
<view style="padding:20rpx 20rpx;" bindtap="lookLocation">
<image src="../image/gps-icon.png" class="seller-location"></image>
</view>
</view>
<nav>订座详情</nav>
<!--订单信息-->
<view class="order-info">
<view class="flex-lr order-detail">
... ... @@ -22,13 +7,16 @@
</view>
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">用餐人数</view>
<view class="black-font font34r">{{bookInfo.pnum}}人</view>
<view class="black-font font34r">{{bookInfo.pnum_str}}人</view>
</view>
<view class="flex-lr order-desk">
<view class="gray-deep-font font30r">预定座位</view>
<image class="order-status" src="../image/order-mask-before.png"></image>
<view class="black-font font34r">{{tables.length}}个</view>
</view>
<view class="flex-lr order-desk">
<view class="gray-deep-font font30r"></view>
<view class="flex-re" style="width:80%;flex-wrap:wrap;">
<block wx:for="{{selecttable}}">
<block wx:for="{{tables}}">
<view class="order-desk-info">
<view class="flex-vc order-desk-detail" style="height:{{item.tid==2 ? '90' : '120'}}rpx;">
<view class="font28r black-font smooth">{{item.name}}</view>
... ... @@ -47,7 +35,7 @@
</view>
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">手机号码</view>
<view class="black-font font34r" bindtap="getcall">{{bookInfo.phone}}</view>
<view class="black-font font34r" bindtap="getcall">{{bookInfo.phone||''}}</view>
</view>
<block wx:if="{{bookInfo.cusdem!='' && bookInfo.cusdem!='null'}}">
<view class="flex-lr order-detail">
... ... @@ -70,7 +58,7 @@
<view style="height: 160rpx;"></view>
<!--通知预订人-->
<block wx:if="{{!bookInfo.code}}">
<block wx:if="{{bookInfo.code}}">
<view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view>
<noticeCall id="notice" phoneNumber="{{phoneNumber}}"></noticeCall>
</block>
... ...
... ... @@ -55,117 +55,15 @@ Page({
switch (uri_code) {
case uri.CGI_USER_GETRESERVELIST__CODE:
if(json.ret==200){
var booklist=[];
if(json.data.length>0){
var list=json.data;
var templist=[];
var temp=[]
if(list.length>0){
}
list.forEach(function(v,i){
var thisobj=bookOrder.changedate(parseInt(v.rdate)*1000);
var thisdate=thisobj.year+'年'+thisobj.month+'月'+thisobj.day;
var ifdate=false
if(temp.length>0){
if(temp.indexOf(thisdate)==-1){
ifdate=true
}else{
ifdate=false
}
}else{
temp.push(thisdate);
if(thisobj.year==timeobj.year && thisobj.month==timeobj.month && timeobj.day==thisobj.day){
templist.push({
date:thisdate,
datemask:'今天',
list:[]
})
}else if(thisobj.year==afterobj.year && thisobj.month==afterobj.month && afterobj.day==thisobj.day){
templist.push({
date:thisdate,
datemask:'明天',
list:[]
})
}else{
var myDate = new Date(parseInt(v.rdate)*1000);
var title=bookOrder.getweek(myDate.getDay());
templist.push({
date:thisdate,
datemask:title,
list:[]
})
}
}
if(ifdate==true){
temp.push(thisdate);
if(thisobj.year==timeobj.year && thisobj.month==timeobj.month && timeobj.day==thisobj.day){
templist.push({
date:thisdate,
datemask:'今天',
list:[]
})
}else if(thisobj.year==afterobj.year && thisobj.month==afterobj.month && afterobj.day==thisobj.day){
templist.push({
date:thisdate,
datemask:'明天',
list:[]
})
}else{
var myDate = new Date(parseInt(v.rdate)*1000);
var title=bookOrder.getweek(myDate.getDay());
templist.push({
date:thisdate,
datemask:title,
list:[]
})
}
}
json.data.forEach(item=>{
item.order_time=util.unixtoTime(item.rdate,'HH:II')
booklist.push(item)
})
if(temp.length>0){
list.forEach(function(v,i){
var thisobj=bookOrder.changedate(parseInt(v.rdate)*1000);
console.log(thisobj)
var thisdate=thisobj.year+'年'+thisobj.month+'月'+thisobj.day;
templist.forEach(function(r,n) {
if (r.date == thisdate) {
v.order_date = thisobj.month + '月' + thisobj.day + '日';
v.order_time = thisobj.hour + ':' + (thisobj.minute == 0 ? thisobj.minute + '0' : thisobj.minute);
v.name=v.name.length>9 ? v.name.slice(0,9)+'等' : v.name;
r.list.push(v)
}
})
})
}
if(that.data.bookList && that.data.pagex>1){
var booklist=that.data.bookList;
if(booklist[booklist.length-1].date==templist[0].date){
templist[0].list.forEach(function(v,i){
booklist[booklist.length-1].list.push(v)
})
templist.forEach(function(v,i){
if(i!=0){
booklist.push(v)
}
})
}else{
templist.forEach(function(v,i){
booklist.push(v)
})
}
console.log(booklist)
that.setData({
bookList:booklist,
})
}else{
that.setData({
bookList:templist,
})
}
}
that.setData({
bookList:booklist,
isloading:true,
currenlist:json.data
})
... ...
... ... @@ -43,12 +43,7 @@
<scroll-view class="book-list" style="height:{{listHeight}}px;" scroll-y bindscroll="addbooklist">
<view class="book-list-body">
<block wx:for="{{bookList}}">
<block wx:for="{{item.list}}" wx:for-item="list">
<block wx:if="{{index!=0}}">
<view class="border-line"></view>
</block>
<bookList item="{{list}}"></bookList>
</block>
<bookList item="{{item}}"></bookList>
</block>
</view>
</scroll-view>
... ...