Commit 3309e3c8fe7dc1238fa5d8fc397e9c3a8ea028f3

Authored by liuxuqinfhp1220
1 parent bdc67407

no message

... ... @@ -12,6 +12,10 @@ Component({
usecondition:{
type:String,
value:'custom'
},
seletroomlist:{
type:Array,
value:[]
}
},
data:{
... ... @@ -20,20 +24,8 @@ Component({
observers: {
'date,section': function(newdate,newsection) {
console.log('room',newdate,newsection)
console.log('old',this.date,this.section)
if(newdate && newsection){
if(this.date && this.section){
console.log(this.date=!newdate || this.section!=newsection)
if(this.date=!newdate || this.section!=newsection){
this.getroomtype();
this.date=newdate;
this.section=newsection;
}
}else{
this.getroomtype();
this.date=newdate;
this.section=newsection;
}
this.getroomtype();
}
}
},
... ... @@ -41,7 +33,7 @@ Component({
getroomtype(){
let parmdata={
sellerid:this.data.seller.id,
day:util.timetouUnix(this.data.date,'-'),
day:new Date(this.data.date+' 00:00:00')/1000,
interval:dur.indexOf(this.data.section)+1
}
App.Seller.GetSellerTableClass(parmdata).then((json)=>{
... ... @@ -57,6 +49,9 @@ Component({
this.setData({
roomlist:json.data
})
if(this.data.seletroomlist.length>0){
this.changestyle();
}
}
})
},
... ... @@ -77,9 +72,9 @@ Component({
//////
console.log('置满')
let parmdata={
classid:_target.id,
day:util.timetouUnix(this.data.date,'-'),
interval:dur.indexOf(this.data.section)+1
classid:_target.id,
day:new Date(this.data.date+' 00:00:00')/1000,
interval:dur.indexOf(this.data.section)+1
}
if(_target.fid){
parmdata.id=_target.fid;
... ... @@ -104,5 +99,19 @@ Component({
}
})
},
changestyle(){
let seletroomlist=this.data.seletroomlist;
let roomlist=this.data.roomlist;
seletroomlist.forEach((v,i)=>{
roomlist.forEach((r,n)=>{
if(v.id==r.id){
r.selectnum+=1;
}
})
})
this.setData({
roomlist:roomlist
})
},
}
})
\ No newline at end of file
... ...
import util from '../../../utils/util';
import App from '../../../utils/api';
let dur=['morning','noon','night','midnight']
Component({
properties:{
seller:Object,
... ... @@ -7,7 +8,8 @@ Component({
date:{
type:String,
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),
}
},
section:String
},
attached(){
},
... ... @@ -21,16 +23,20 @@ Component({
if(today==newdate){
this.markoversection();
}else{
this.changesectionstyle(this.data.sectionlist[0].section);
if(this.data.section){
this.changesectionstyle(this.data.section);
}else{
this.changesectionstyle(this.data.sectionlist[0].section);
}
let obj={
section:this.data.sectionlist[0].section,
section:this.data.section ? this.data.section : this.data.sectionlist[0].section,
action:'defalut',
time:this.data.sectionlist[0].sectiondur.split('-')[0]
}
this.triggerEvent('selectsection',obj)
}
}
}
},
},
ready(){
... ...
... ... @@ -8,34 +8,17 @@ Component({
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD')
},
section:String,
seletroomlist:{
type:Array,
value:[]
}
},
data:{
seletroomlist:[]
},
attached(){
this.room=this.selectComponent('#room');
console.log('xxxxx',this.data.seller);
},
observers: {
'date,section': function(newdate,newsection) {
console.log('room',newdate,newsection)
if(newdate && newsection){
if(this.date && this.section){
if(newdate!=this.date || this.section!=newsection){
this.setData({
seletroomlist:[]
})
this.date=newdate;
this.section=newsection;
}
}else{
this.date=newdate;
this.section=newsection;
}
}
}
},
methods:{
selectroom(e){
console.log(e)
... ...
... ... @@ -9,4 +9,4 @@
</view>
</block>
</view>
<room bindselectroom="selectroom" seller="{{seller}}" date="{{date}}" section="{{section}}" id="room"></room>
\ No newline at end of file
<room bindselectroom="selectroom" seller="{{seller}}" date="{{date}}" section="{{section}}" id="room" seletroomlist="{{seletroomlist}}"></room>
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
<block wx:if="{{seller && seller.id}}">
<calendar seller="{{seller}}" date="{{reserveDate}}" bindtellselectdate="selectdate" setroom="{{reserveRoom}}"></calendar>
<view style="height:40rpx;"></view>
<section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection"></section>
<section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection" section="{{reserveSection}}"></section>
<view style="height:80rpx;"></view>
<select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" usecondition="seller" bindchangeroom="setroom"></select-room>
</block>
\ No newline at end of file
... ...
... ... @@ -279,8 +279,9 @@ Page({
let t=setTimeout(()=>{
this.setData({
reserveSection:e.detail.section,
seletroomlist:e.detail.action=='click' ? [] : this.data.seletroomlist,
})
this.reserve.selectroom=[];
this.reserve.selectroom=e.detail.action=='click' ? [] : this.reserve.selectroom;
clearTimeout(t);
},0)
... ... @@ -290,6 +291,9 @@ Page({
//包间类型改变
selectroom(e){
console.log(e)
this.setData({
seletroomlist:e.detail.selectroom
})
this.reserve.selectroom=e.detail.selectroom;
},
complete(){
... ... @@ -333,10 +337,12 @@ Page({
})
}
this.reserve.date=e.detail.date;
this.reserve.selectroom=[];
this.reserve.selectroom=e.detail.action=='click' ? [] : this.reserve.selectroom;
this.setData({
reserveDate:e.detail.date,
seletroomlist:e.detail.action=='click' ? [] : this.data.seletroomlist,
hasFullHouse:false,
reserveSection:e.detail.action=='click' ? null : this.data.reserveSection,
fullHouseMsg:'今日所有包间已订满',
})
}
... ...
... ... @@ -213,8 +213,8 @@
<view class="olreserve bg_white">
<calendar seller="{{seller}}" bindselectdate="selectdate"></calendar>
<view class="reserve-time Semibold">预订时段</view>
<section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection"></section>
<select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" bindchangeroom="selectroom"></select-room>
<section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection" section="{{reserveSection}}"></section>
<select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" seletroomlist="{{seletroomlist}}" bindchangeroom="selectroom"></select-room>
</view>
<view class="white-font font32r reserve-button flex-cc" catchtap="complete">选好了</view>
</view>
... ...
... ... @@ -471,7 +471,7 @@
"id": 56,
"name": "测试组件",
"pathName": "pages/reserve/detail",
"query": "id=154",
"query": "id=48",
"scene": null
},
{
... ...