Commit 1e85808b23fd8687d6065f72ebec094d303c3478

Authored by wangfan
1 parent 3c2fa24f

录入调整

// components/book/board/board.js
import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
... ... @@ -28,7 +31,47 @@ Component({
/**
* 组件的方法列表
*/
itemList:[],
methods: {
boardClick(){
this.boardOpt()
},
//桌位操作
boardOpt(){
let itemList=[]
if(this.data.board.reserve_id>0){
itemList.push('查看详情')
}
itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位')
this.itemList=itemList;
wx.showActionSheet({
itemList:this.itemList,
success:(res)=>{
console.log(res.tapIndex,this.itemList[res.tapIndex]);
if('启用桌位'==this.itemList[res.tapIndex]){
this.boardEnable(1)
}
if('停用桌位'==this.itemList[res.tapIndex]){
this.boardEnable(0)
}
if('查看详情'==this.itemList[res.tapIndex]){
wx.navigateTo({
url:'b_detail?id='+this.data.board.reserve_id,
});
}
},
})
},
//启停座位
boardEnable(status){
App.Reserve.SetSwitchStatus({
id:this.data.board.id,
status:status
}).then(()=>{
this.triggerEvent('boardEvent',{type:'boardEnable'})
})
},
}
})
... ...
<!--components/book/board/board.wxml-->
<view class="board flex-cc {{board.status_classname}}" style="width: {{width}}rpx;height: {{height}}rpx;">
<view class="board flex-cc {{board.status_classname}}"
style="width: {{width}}rpx;height: {{height}}rpx;"
bindtap="boardClick">
<view class="info">
<view class="name">{{board.name}}</view>
<view class="pnum">{{board.table_pnum}}人</view>
... ...
... ... @@ -48,13 +48,13 @@
font-size: 26rpx;
}
.board.highlight .status{
.board.highlight .status,.board.disabled-highlight .status{
background-color: #E95750;
}
.board.disabled {
.board.disabled,.board.disabled-highlight {
background-color: #E0E0E0;
}
.board.disabled .tid{
.board.disabled .tid,.board.disabled-highlight .tid{
background-color: #94BCD6;
}
\ No newline at end of file
... ...
... ... @@ -150,9 +150,15 @@ Page({
tb.status_str=now>tids[tb.id].rdate?'用餐中':'已预订';
tb.status_classname='highlight';
tb.reserve_id=tids[tb.id].id;
}else if(tb.enable!=1){
tb.status_str='已停用';
tb.status_classname='disabled';
}
if(tb.enable!=1){
if(tb.status_str){
tb.status_classname='disabled-highlight';
}else{
tb.status_str='已停用';
tb.status_classname='disabled';
}
}
})
regions.push(region);
... ... @@ -174,5 +180,14 @@ Page({
time:util.attr(e,'value')
})
this.getbooklist();
},
boardEvent(e){
console.log(e);
App.Tables.GetTableListsBySellerId({
sellerid:this.sellerid
},true).then((res)=>{
this.regions=res.data[0];
this.getbooklist();
})
}
})
\ No newline at end of file
... ...
... ... @@ -36,6 +36,7 @@
wx:if="{{regions_active==item.name}}">
<board width="160" height="160" board="{{item}}"
style="margin: 20rpx 0 0 20rpx"
bindboardEvent="boardEvent"
wx:for="{{item.list}}" wx:key="item.key" ></board>
</view>
</block>
... ...
... ... @@ -30,7 +30,7 @@
"list": []
},
"miniprogram": {
"current": 20,
"current": 15,
"list": [
{
"id": 0,
... ... @@ -155,7 +155,7 @@
"id": 15,
"name": "预定本详情",
"pathName": "pages/book/b_detail",
"query": "id=77"
"query": "id=329"
},
{
"id": -1,
... ... @@ -192,7 +192,8 @@
{
"id": -1,
"name": "桌位",
"pathName": "pages/book/b_setting"
"pathName": "pages/book/b_setting",
"query": ""
}
]
}
... ...
... ... @@ -57,6 +57,14 @@ export default {
//桌位列表
'App.Tables.GetTableListsBySellerId':{
cachetime:300,
}
},
// 修改当前预定状态 0:待确认,1:已定座,2:确认到店,3:用餐完成
'App.Reserve.SetReserveStatus':null,
//修改当前桌子是否启用 0:未启用,1:启用
'App.Reserve.SetSwitchStatus':{
silence:false,
},
}
\ No newline at end of file
... ...