Showing
6 changed files
with
141 additions
and
25 deletions
| @@ -7,6 +7,10 @@ Component({ | @@ -7,6 +7,10 @@ Component({ | ||
| 7 | type:String, | 7 | type:String, |
| 8 | value:"", | 8 | value:"", |
| 9 | }, | 9 | }, |
| 10 | + hasPubSub:{ | ||
| 11 | + type:Boolean, | ||
| 12 | + value:false | ||
| 13 | + }, | ||
| 10 | }, | 14 | }, |
| 11 | data: {}, | 15 | data: {}, |
| 12 | methods: { | 16 | methods: { |
| @@ -14,29 +18,46 @@ Component({ | @@ -14,29 +18,46 @@ Component({ | ||
| 14 | var tebleid = e.currentTarget.dataset.id; | 18 | var tebleid = e.currentTarget.dataset.id; |
| 15 | var tables = util.cache('tableid') ? util.cache('tableid') : []; | 19 | var tables = util.cache('tableid') ? util.cache('tableid') : []; |
| 16 | var list = this.data.list; | 20 | var list = this.data.list; |
| 17 | - var pages = getCurrentPages(); | ||
| 18 | - var addnewPage=pages[pages.length - 2]; | ||
| 19 | - let checkedTids=this.data.checkedTids.split(','); | ||
| 20 | - list.forEach(function (v, i) { | ||
| 21 | - if (v.id == tebleid) { | ||
| 22 | - console.log('click.board',v); | ||
| 23 | - if(v.status_str && checkedTids._indexOf(v.id)<0) return util.toast('不能预订该桌位','none'); | ||
| 24 | - if (v.isselect == true) { | ||
| 25 | - var thisindex = tables.indexOf(tebleid); | ||
| 26 | - tables.splice(thisindex, 1) | ||
| 27 | - delete addnewPage.checkedTables[tebleid] | ||
| 28 | - } else { | ||
| 29 | - tables.push(tebleid) | ||
| 30 | - addnewPage.checkedTables[tebleid]=v.name; | 21 | + if(this.data.hasPubSub){ |
| 22 | + let checkedTids=this.data.checkedTids.split(','); | ||
| 23 | + list.forEach(function (v, i) { | ||
| 24 | + if (v.id == tebleid) { | ||
| 25 | + console.log('click.board',v); | ||
| 26 | + if(v.status_str && checkedTids._indexOf(v.id)<0) return util.toast('不能预订该桌位','none'); | ||
| 27 | + if (v.isselect == true) { | ||
| 28 | + var thisindex = tables.indexOf(tebleid); | ||
| 29 | + tables.splice(thisindex, 1) | ||
| 30 | + } else { | ||
| 31 | + tables.push(tebleid) | ||
| 32 | + } | ||
| 33 | + v.isselect = !v.isselect | ||
| 31 | } | 34 | } |
| 32 | - v.isselect = !v.isselect | ||
| 33 | - } | ||
| 34 | - }) | ||
| 35 | - addnewPage.data.form.tid = tables; | ||
| 36 | - addnewPage.setData({ | ||
| 37 | - form: addnewPage.data.form | ||
| 38 | - }) | ||
| 39 | - console.log('checkedTables',addnewPage.checkedTables); | 35 | + }) |
| 36 | + }else{ | ||
| 37 | + var pages = getCurrentPages(); | ||
| 38 | + var addnewPage=pages[pages.length - 2]; | ||
| 39 | + let checkedTids=this.data.checkedTids.split(','); | ||
| 40 | + list.forEach(function (v, i) { | ||
| 41 | + if (v.id == tebleid) { | ||
| 42 | + console.log('click.board',v); | ||
| 43 | + if(v.status_str && checkedTids._indexOf(v.id)<0) return util.toast('不能预订该桌位','none'); | ||
| 44 | + if (v.isselect == true) { | ||
| 45 | + var thisindex = tables.indexOf(tebleid); | ||
| 46 | + tables.splice(thisindex, 1) | ||
| 47 | + delete addnewPage.checkedTables[tebleid] | ||
| 48 | + } else { | ||
| 49 | + tables.push(tebleid) | ||
| 50 | + addnewPage.checkedTables[tebleid]=v.name; | ||
| 51 | + } | ||
| 52 | + v.isselect = !v.isselect | ||
| 53 | + } | ||
| 54 | + }) | ||
| 55 | + addnewPage.data.form.tid = tables; | ||
| 56 | + addnewPage.setData({ | ||
| 57 | + form: addnewPage.data.form | ||
| 58 | + }) | ||
| 59 | + console.log('checkedTables',addnewPage.checkedTables); | ||
| 60 | + } | ||
| 40 | util.cache('tableid', tables); | 61 | util.cache('tableid', tables); |
| 41 | this.triggerEvent("changedesk"); | 62 | this.triggerEvent("changedesk"); |
| 42 | this.setData({ | 63 | this.setData({ |
| 1 | import util from '../../../utils/util'; | 1 | import util from '../../../utils/util'; |
| 2 | import comm from '../../../utils/bookCommon'; | 2 | import comm from '../../../utils/bookCommon'; |
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | +import PubSub from '../../../utils/PubSub' | ||
| 4 | const {regeneratorRuntime} = global | 5 | const {regeneratorRuntime} = global |
| 5 | Page({ | 6 | Page({ |
| 6 | data: { | 7 | data: { |
| @@ -26,7 +27,8 @@ Page({ | @@ -26,7 +27,8 @@ Page({ | ||
| 26 | this.setData({ | 27 | this.setData({ |
| 27 | sellerid: this.sellerid, | 28 | sellerid: this.sellerid, |
| 28 | opt: opt, | 29 | opt: opt, |
| 29 | - hasCheckedTable: this.checked_tids.length > 0 | 30 | + hasCheckedTable: this.checked_tids.length > 0, |
| 31 | + hasPubSub:opt.hasPubSub | ||
| 30 | }) | 32 | }) |
| 31 | //this.getdesklist(); | 33 | //this.getdesklist(); |
| 32 | this.getDeskList(); | 34 | this.getDeskList(); |
| @@ -48,6 +50,15 @@ Page({ | @@ -48,6 +50,15 @@ Page({ | ||
| 48 | buttonClick: true | 50 | buttonClick: true |
| 49 | }) | 51 | }) |
| 50 | //wx.removeStorage({key:'tableid'}) | 52 | //wx.removeStorage({key:'tableid'}) |
| 53 | + if(this.data.hasPubSub){ | ||
| 54 | + if(this.checked_tids.length<1) return | ||
| 55 | + wx.removeStorage({ | ||
| 56 | + key:'tableid' | ||
| 57 | + }) | ||
| 58 | + PubSub.emit('arrangeDesk',{ | ||
| 59 | + tableid:this.checked_tids | ||
| 60 | + }) | ||
| 61 | + } | ||
| 51 | wx.navigateBack(); | 62 | wx.navigateBack(); |
| 52 | }, | 63 | }, |
| 53 | getdesklist: function () { | 64 | getdesklist: function () { |
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | <view style="height: {{height-80}}px;overflow-y: auto;padding-bottom: 160rpx;overflow-x: hidden;width: 100%;"> | 12 | <view style="height: {{height-80}}px;overflow-y: auto;padding-bottom: 160rpx;overflow-x: hidden;width: 100%;"> |
| 13 | <block wx:for="{{desklist}}" wx:key="desklist.key"> | 13 | <block wx:for="{{desklist}}" wx:key="desklist.key"> |
| 14 | <orderDesk list="{{item.list}}" checkedTids="{{opt.checked_tids}}" | 14 | <orderDesk list="{{item.list}}" checkedTids="{{opt.checked_tids}}" |
| 15 | - bind:changedesk="changedesk" | 15 | + bind:changedesk="changedesk" hasPubSub="{{hasPubSub}}" |
| 16 | wx:if="{{item.name==menu_active_id}}"></orderDesk> | 16 | wx:if="{{item.name==menu_active_id}}"></orderDesk> |
| 17 | </block> | 17 | </block> |
| 18 | 18 |
| @@ -2,6 +2,7 @@ var util = require('../../../utils/util.js') | @@ -2,6 +2,7 @@ var util = require('../../../utils/util.js') | ||
| 2 | var uri = require('../../../utils/uri.js') | 2 | var uri = require('../../../utils/uri.js') |
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | import RS from '../../../utils/reserveStatus' | 4 | import RS from '../../../utils/reserveStatus' |
| 5 | +import PubSub from '../../../utils/PubSub' | ||
| 5 | 6 | ||
| 6 | const {regeneratorRuntime} = global | 7 | const {regeneratorRuntime} = global |
| 7 | import TP from '../../../utils/tpls'; | 8 | import TP from '../../../utils/tpls'; |
| @@ -30,6 +31,9 @@ Page({ | @@ -30,6 +31,9 @@ Page({ | ||
| 30 | this.sc = (await App.Reserve.SellerInfo(this.enter_params)).data; | 31 | this.sc = (await App.Reserve.SellerInfo(this.enter_params)).data; |
| 31 | console.log('this.sc', this.sc); | 32 | console.log('this.sc', this.sc); |
| 32 | this.chooseManagerInit(); | 33 | this.chooseManagerInit(); |
| 34 | + PubSub.on('arrangeDesk',(desk)=>{ | ||
| 35 | + this.arrangeDesk(desk) | ||
| 36 | + }) | ||
| 33 | }, | 37 | }, |
| 34 | onShow: function () { | 38 | onShow: function () { |
| 35 | this.notice = this.selectComponent('#notice'); | 39 | this.notice = this.selectComponent('#notice'); |
| @@ -205,4 +209,65 @@ Page({ | @@ -205,4 +209,65 @@ Page({ | ||
| 205 | }, '/pack-cookbook/pages/success') | 209 | }, '/pack-cookbook/pages/success') |
| 206 | }); | 210 | }); |
| 207 | }, | 211 | }, |
| 212 | + refuseOrder(){ | ||
| 213 | + wx.showModal({ | ||
| 214 | + title: '确认拒绝订单吗?', | ||
| 215 | + content: '如果包间类型已订满,请及时停用', | ||
| 216 | + showCancel:true, | ||
| 217 | + cancelText:'拒绝订单', | ||
| 218 | + cancelColor:'', | ||
| 219 | + confirmText:'去安排', | ||
| 220 | + confirmColor:'', | ||
| 221 | + success:(res)=>{ | ||
| 222 | + console.info(res) | ||
| 223 | + if(res.cancel){ | ||
| 224 | + this.getDetail(this.data.bookInfo.id,true); | ||
| 225 | + }else{//分配 | ||
| 226 | + this.arrangeOrder() | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + }) | ||
| 230 | + }, | ||
| 231 | + arrangeOrder(){ | ||
| 232 | + let bi=this.data.bookInfo | ||
| 233 | + let checked_tids='' | ||
| 234 | + //rdate=1568023200-1568041200&tid=0&pnum=6&checked_tids=&rid=&hasPubsub=1 | ||
| 235 | + wx.navigateTo({ | ||
| 236 | + url:util.http_build_query({ | ||
| 237 | + rdate:bi.rdate+'-'+bi.edate, | ||
| 238 | + tid:0, | ||
| 239 | + pnum:6, | ||
| 240 | + checked_tids:checked_tids, | ||
| 241 | + rid:'', | ||
| 242 | + hasPubSub:1, | ||
| 243 | + },'./b_desk') | ||
| 244 | + }) | ||
| 245 | + }, | ||
| 246 | + arrangeDesk(res){ | ||
| 247 | + console.log('arrangeDesk',res.tableid) | ||
| 248 | + | ||
| 249 | + //刷新 | ||
| 250 | + this.getDetail(this.data.bookInfo.id,true); | ||
| 251 | + }, | ||
| 252 | + easyCall(e){ | ||
| 253 | + let bi=this.data.bookInfo | ||
| 254 | + let phone=bi.phone | ||
| 255 | + if(util.attr(e,'key')=='seller'){ | ||
| 256 | + phone=bi.seller.phone | ||
| 257 | + if(bi.seller.seller_tel){ | ||
| 258 | + let seller_tel=bi.seller.seller_tel.split(','); | ||
| 259 | + if(seller_tel.length>0){ | ||
| 260 | + phone=seller_tel[parseInt(Math.random()*seller_tel.length)] | ||
| 261 | + } | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + phone=phone.replace(/[^\d]/g,'') | ||
| 265 | + if(phone){ | ||
| 266 | + wx.makePhoneCall({ | ||
| 267 | + phoneNumber: phone | ||
| 268 | + }) | ||
| 269 | + }else{ | ||
| 270 | + util.toast('号码为空','none') | ||
| 271 | + } | ||
| 272 | + }, | ||
| 208 | }) | 273 | }) |
| @@ -118,6 +118,25 @@ | @@ -118,6 +118,25 @@ | ||
| 118 | <view class="notice-opt" wx:if="{{bookInfo.status==2}}"> | 118 | <view class="notice-opt" wx:if="{{bookInfo.status==2}}"> |
| 119 | <formids class="notice-button white-font font34r flex-cc" bindclick="startDinner" data-status="3">客户就餐完毕</formids> | 119 | <formids class="notice-button white-font font34r flex-cc" bindclick="startDinner" data-status="3">客户就餐完毕</formids> |
| 120 | </view> | 120 | </view> |
| 121 | +<!--操作在线预订--> | ||
| 122 | +<view class="notice-opt" wx:if="{{bookInfo.status==0}}"> | ||
| 123 | + <view class="notice-button-border font34r flex-lr"> | ||
| 124 | + <view> | ||
| 125 | + <formids bindclick="easyCall" data-key="seller">联系商家</formids> | ||
| 126 | + </view> | ||
| 127 | + <view> | ||
| 128 | + <formids bindclick="easyCall" data-key="customer">联系顾客</formids> | ||
| 129 | + </view> | ||
| 130 | + </view> | ||
| 131 | + <view class="notice-button-border font34r flex-lr"> | ||
| 132 | + <view> | ||
| 133 | + <formids bindclick="refuseOrder">拒绝订单</formids> | ||
| 134 | + </view> | ||
| 135 | + <view> | ||
| 136 | + <formids bindclick="arrangeOrder">安排包间</formids> | ||
| 137 | + </view> | ||
| 138 | + </view> | ||
| 139 | +</view> | ||
| 121 | <noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall> | 140 | <noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall> |
| 122 | <action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="flex-ll"> | 141 | <action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="flex-ll"> |
| 123 | <block wx:for-items="{{actionSheetItems}}" wx:key="actionSheetItems.key"> | 142 | <block wx:for-items="{{actionSheetItems}}" wx:key="actionSheetItems.key"> |
| @@ -499,7 +499,7 @@ | @@ -499,7 +499,7 @@ | ||
| 499 | "id": 60, | 499 | "id": 60, |
| 500 | "name": "pack-book/pages/book/b_detail", | 500 | "name": "pack-book/pages/book/b_detail", |
| 501 | "pathName": "pack-book/pages/book/b_detail", | 501 | "pathName": "pack-book/pages/book/b_detail", |
| 502 | - "query": "id=32057", | 502 | + "query": "id=33284", |
| 503 | "scene": null | 503 | "scene": null |
| 504 | } | 504 | } |
| 505 | ] | 505 | ] |
-
Please register or login to post a comment