Showing
7 changed files
with
81 additions
and
11 deletions
| 1 | // components/book/board/board.js | 1 | // components/book/board/board.js |
| 2 | +import util from '../../../utils/util'; | ||
| 3 | +import App from '../../../utils/api'; | ||
| 4 | +const {regeneratorRuntime} = global | ||
| 2 | Component({ | 5 | Component({ |
| 3 | /** | 6 | /** |
| 4 | * 组件的属性列表 | 7 | * 组件的属性列表 |
| @@ -28,7 +31,47 @@ Component({ | @@ -28,7 +31,47 @@ Component({ | ||
| 28 | /** | 31 | /** |
| 29 | * 组件的方法列表 | 32 | * 组件的方法列表 |
| 30 | */ | 33 | */ |
| 34 | + itemList:[], | ||
| 31 | methods: { | 35 | methods: { |
| 36 | + boardClick(){ | ||
| 37 | + this.boardOpt() | ||
| 38 | + }, | ||
| 39 | + //桌位操作 | ||
| 40 | + boardOpt(){ | ||
| 41 | + let itemList=[] | ||
| 42 | + if(this.data.board.reserve_id>0){ | ||
| 43 | + itemList.push('查看详情') | ||
| 44 | + } | ||
| 45 | + itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位') | ||
| 46 | + this.itemList=itemList; | ||
| 47 | + wx.showActionSheet({ | ||
| 48 | + itemList:this.itemList, | ||
| 49 | + success:(res)=>{ | ||
| 50 | + console.log(res.tapIndex,this.itemList[res.tapIndex]); | ||
| 51 | + if('启用桌位'==this.itemList[res.tapIndex]){ | ||
| 52 | + this.boardEnable(1) | ||
| 53 | + } | ||
| 54 | + if('停用桌位'==this.itemList[res.tapIndex]){ | ||
| 55 | + this.boardEnable(0) | ||
| 56 | + } | ||
| 57 | + if('查看详情'==this.itemList[res.tapIndex]){ | ||
| 58 | + wx.navigateTo({ | ||
| 59 | + url:'b_detail?id='+this.data.board.reserve_id, | ||
| 60 | + }); | ||
| 61 | + } | ||
| 62 | + }, | ||
| 63 | + }) | ||
| 64 | + | ||
| 32 | 65 | ||
| 66 | + }, | ||
| 67 | + //启停座位 | ||
| 68 | + boardEnable(status){ | ||
| 69 | + App.Reserve.SetSwitchStatus({ | ||
| 70 | + id:this.data.board.id, | ||
| 71 | + status:status | ||
| 72 | + }).then(()=>{ | ||
| 73 | + this.triggerEvent('boardEvent',{type:'boardEnable'}) | ||
| 74 | + }) | ||
| 75 | + }, | ||
| 33 | } | 76 | } |
| 34 | }) | 77 | }) |
| 1 | <!--components/book/board/board.wxml--> | 1 | <!--components/book/board/board.wxml--> |
| 2 | -<view class="board flex-cc {{board.status_classname}}" style="width: {{width}}rpx;height: {{height}}rpx;"> | 2 | +<view class="board flex-cc {{board.status_classname}}" |
| 3 | + style="width: {{width}}rpx;height: {{height}}rpx;" | ||
| 4 | + bindtap="boardClick"> | ||
| 3 | <view class="info"> | 5 | <view class="info"> |
| 4 | <view class="name">{{board.name}}</view> | 6 | <view class="name">{{board.name}}</view> |
| 5 | <view class="pnum">{{board.table_pnum}}人</view> | 7 | <view class="pnum">{{board.table_pnum}}人</view> |
| @@ -48,13 +48,13 @@ | @@ -48,13 +48,13 @@ | ||
| 48 | font-size: 26rpx; | 48 | font-size: 26rpx; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | -.board.highlight .status{ | 51 | +.board.highlight .status,.board.disabled-highlight .status{ |
| 52 | background-color: #E95750; | 52 | background-color: #E95750; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | -.board.disabled { | 55 | +.board.disabled,.board.disabled-highlight { |
| 56 | background-color: #E0E0E0; | 56 | background-color: #E0E0E0; |
| 57 | } | 57 | } |
| 58 | -.board.disabled .tid{ | 58 | +.board.disabled .tid,.board.disabled-highlight .tid{ |
| 59 | background-color: #94BCD6; | 59 | background-color: #94BCD6; |
| 60 | } | 60 | } |
| @@ -150,9 +150,15 @@ Page({ | @@ -150,9 +150,15 @@ Page({ | ||
| 150 | tb.status_str=now>tids[tb.id].rdate?'用餐中':'已预订'; | 150 | tb.status_str=now>tids[tb.id].rdate?'用餐中':'已预订'; |
| 151 | tb.status_classname='highlight'; | 151 | tb.status_classname='highlight'; |
| 152 | tb.reserve_id=tids[tb.id].id; | 152 | tb.reserve_id=tids[tb.id].id; |
| 153 | - }else if(tb.enable!=1){ | ||
| 154 | - tb.status_str='已停用'; | ||
| 155 | - tb.status_classname='disabled'; | 153 | + } |
| 154 | + if(tb.enable!=1){ | ||
| 155 | + if(tb.status_str){ | ||
| 156 | + tb.status_classname='disabled-highlight'; | ||
| 157 | + }else{ | ||
| 158 | + tb.status_str='已停用'; | ||
| 159 | + tb.status_classname='disabled'; | ||
| 160 | + } | ||
| 161 | + | ||
| 156 | } | 162 | } |
| 157 | }) | 163 | }) |
| 158 | regions.push(region); | 164 | regions.push(region); |
| @@ -174,5 +180,14 @@ Page({ | @@ -174,5 +180,14 @@ Page({ | ||
| 174 | time:util.attr(e,'value') | 180 | time:util.attr(e,'value') |
| 175 | }) | 181 | }) |
| 176 | this.getbooklist(); | 182 | this.getbooklist(); |
| 183 | + }, | ||
| 184 | + boardEvent(e){ | ||
| 185 | + console.log(e); | ||
| 186 | + App.Tables.GetTableListsBySellerId({ | ||
| 187 | + sellerid:this.sellerid | ||
| 188 | + },true).then((res)=>{ | ||
| 189 | + this.regions=res.data[0]; | ||
| 190 | + this.getbooklist(); | ||
| 191 | + }) | ||
| 177 | } | 192 | } |
| 178 | }) | 193 | }) |
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | wx:if="{{regions_active==item.name}}"> | 36 | wx:if="{{regions_active==item.name}}"> |
| 37 | <board width="160" height="160" board="{{item}}" | 37 | <board width="160" height="160" board="{{item}}" |
| 38 | style="margin: 20rpx 0 0 20rpx" | 38 | style="margin: 20rpx 0 0 20rpx" |
| 39 | + bindboardEvent="boardEvent" | ||
| 39 | wx:for="{{item.list}}" wx:key="item.key" ></board> | 40 | wx:for="{{item.list}}" wx:key="item.key" ></board> |
| 40 | </view> | 41 | </view> |
| 41 | </block> | 42 | </block> |
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | "list": [] | 30 | "list": [] |
| 31 | }, | 31 | }, |
| 32 | "miniprogram": { | 32 | "miniprogram": { |
| 33 | - "current": 20, | 33 | + "current": 15, |
| 34 | "list": [ | 34 | "list": [ |
| 35 | { | 35 | { |
| 36 | "id": 0, | 36 | "id": 0, |
| @@ -155,7 +155,7 @@ | @@ -155,7 +155,7 @@ | ||
| 155 | "id": 15, | 155 | "id": 15, |
| 156 | "name": "预定本详情", | 156 | "name": "预定本详情", |
| 157 | "pathName": "pages/book/b_detail", | 157 | "pathName": "pages/book/b_detail", |
| 158 | - "query": "id=77" | 158 | + "query": "id=329" |
| 159 | }, | 159 | }, |
| 160 | { | 160 | { |
| 161 | "id": -1, | 161 | "id": -1, |
| @@ -192,7 +192,8 @@ | @@ -192,7 +192,8 @@ | ||
| 192 | { | 192 | { |
| 193 | "id": -1, | 193 | "id": -1, |
| 194 | "name": "桌位", | 194 | "name": "桌位", |
| 195 | - "pathName": "pages/book/b_setting" | 195 | + "pathName": "pages/book/b_setting", |
| 196 | + "query": "" | ||
| 196 | } | 197 | } |
| 197 | ] | 198 | ] |
| 198 | } | 199 | } |
| @@ -57,6 +57,14 @@ export default { | @@ -57,6 +57,14 @@ export default { | ||
| 57 | //桌位列表 | 57 | //桌位列表 |
| 58 | 'App.Tables.GetTableListsBySellerId':{ | 58 | 'App.Tables.GetTableListsBySellerId':{ |
| 59 | cachetime:300, | 59 | cachetime:300, |
| 60 | - } | 60 | + }, |
| 61 | + | ||
| 62 | + // 修改当前预定状态 0:待确认,1:已定座,2:确认到店,3:用餐完成 | ||
| 63 | + 'App.Reserve.SetReserveStatus':null, | ||
| 64 | + | ||
| 65 | + //修改当前桌子是否启用 0:未启用,1:启用 | ||
| 66 | + 'App.Reserve.SetSwitchStatus':{ | ||
| 67 | + silence:false, | ||
| 68 | + }, | ||
| 61 | 69 | ||
| 62 | } | 70 | } |
-
Please register or login to post a comment