Commit dddb3ce4bd2675eec223deaa7739d6ed1b5b8f09

Authored by pengye
1 parent 1603bcef

包间置满未显示问题处理

... ... @@ -19,7 +19,8 @@ Component({
}
},
data:{
roomlist:[],
roomlist:[],
ddate_solt:'',
},
observers: {
'date,section': function(newdate,newsection) {
... ... @@ -28,7 +29,7 @@ Component({
roomlist:[]
})
if(newdate && newsection){
this.getroomtype();
this.getLocalLunchTime()
}
}
},
... ... @@ -36,11 +37,62 @@ Component({
console.log('初次进入详情页---小米8测试',this.data.date ? this.data.date : '没有日期','openid:',getApp().openid)
},
methods:{
getroomtype(){
//获取日期对应的多时段
getLocalLunchTime(){
App.Seller.getMealSectionByDay({
sellerid: this.data.seller.id,
day: this.data.date,
}).then(res => {
let data = res.data;
let lunchDinnerList = [];
if (data.length <= 3 && !data[0].ddate_solt) {
data.forEach(i => {
if (i.mname == '早餐') {
lunchDinnerList.push({
mname: "早餐",
mdate: i.mdate,
ddate_solt: 1,
})
}
if (i.mname == '午餐') {
lunchDinnerList.push({
mname: "午餐",
mdate: i.mdate,
ddate_solt: 2,
})
}
if (i.mname == '晚餐') {
lunchDinnerList.push({
mname: "晚餐",
mdate: i.mdate,
ddate_solt: 3,
})
}
})
} else {
lunchDinnerList = data;
}
lunchDinnerList.forEach((item,index)=>{
item.section = 'ket'+index
})
let obj=lunchDinnerList.filter(item=>{return item.section == this.data.section});
let ddate_solt = '';
if(obj && obj[0]){
ddate_solt = obj[0].ddate_solt;
}
this.setData({
ddate_solt
})
this.getroomtype(ddate_solt)
}).catch(res => {
console.log(res, '获取多时段失败');
})
},
getroomtype(ddate_solt){
let parmdata={
sellerid:this.data.seller.id,
day:util.timetouUnix(this.data.date+' 00:00:00'),
interval:dur.indexOf(this.data.section)+1
interval:ddate_solt,
}
console.log('参数',this.data.date,parmdata);
App.Seller.GetSellerTableClass(parmdata).then((json)=>{
... ... @@ -55,7 +107,7 @@ Component({
}
this.setData({
roomlist:json.data
})
})
if(this.data.seletroomlist.length>0){
this.changestyle();
}
... ... @@ -72,7 +124,7 @@ Component({
act:'reserve',
seller:this.data.seller.sellername,
date:this.data.date,
section:this.data.section,
section:this.data.section,
room:this.data.roomlist[_target.index].name
}
// this.selectComponent('#qiang').show(obj);
... ... @@ -101,7 +153,7 @@ Component({
let parmdata={
classid:_target.id,
day:util.timetouUnix(this.data.date+' 00:00:00'),
interval:dur.indexOf(this.data.section)+1
interval:this.ddate_solt
}
if(_target.fid){
parmdata.id=_target.fid;
... ... @@ -110,7 +162,7 @@ Component({
console.log(json)
if(json.ret==200){
this.triggerEvent('changeroom',{id:_target.id,action:parmdata.id ? 'cancel' : 'confirm'})
this.getroomtype();
this.getLocalLunchTime();
}
})
}
... ... @@ -128,7 +180,7 @@ Component({
})
},
changestyle(){
let seletroomlist=this.data.seletroomlist;
let seletroomlist=this.data.seletroomlist;
let roomlist=this.data.roomlist;
seletroomlist.forEach((v,i)=>{
roomlist.forEach((r,n)=>{
... ...
... ... @@ -2,7 +2,7 @@
<view class="select-rooms-title black-font font-bold font36r flex-ll">已选包间</view>
<block wx:for="{{seletroomlist}}" wx:key="{{index}}">
<view class="select-rooms-item flex-vc" data-index="{{index}}" data-id="{{item.id}}" catchtap="cancelroom">
<view class="font-bold font30r" style="width:100%;block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;text-align:center; color:#42A5FF;">{{item.name}}</view>
<view class="font-bold font30r" style="width:100%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;text-align:center; color:#42A5FF;">{{item.name}}</view>
<image src="http://nosqn.colorcun.com/detail/x%20%2814%29.png" class="select-rooms-close"></image>
</view>
</block>
... ...