Commit bed4bba2c129aff7032a2bf42a68b18487a6cded

Authored by vking
1 parent 94ab9002

运营接单

... ... @@ -7,6 +7,10 @@ Component({
type:String,
value:"",
},
hasPubSub:{
type:Boolean,
value:false
},
},
data: {},
methods: {
... ... @@ -14,29 +18,46 @@ Component({
var tebleid = e.currentTarget.dataset.id;
var tables = util.cache('tableid') ? util.cache('tableid') : [];
var list = this.data.list;
var pages = getCurrentPages();
var addnewPage=pages[pages.length - 2];
let checkedTids=this.data.checkedTids.split(',');
list.forEach(function (v, i) {
if (v.id == tebleid) {
console.log('click.board',v);
if(v.status_str && checkedTids._indexOf(v.id)<0) return util.toast('不能预订该桌位','none');
if (v.isselect == true) {
var thisindex = tables.indexOf(tebleid);
tables.splice(thisindex, 1)
delete addnewPage.checkedTables[tebleid]
} else {
tables.push(tebleid)
addnewPage.checkedTables[tebleid]=v.name;
if(this.data.hasPubSub){
let checkedTids=this.data.checkedTids.split(',');
list.forEach(function (v, i) {
if (v.id == tebleid) {
console.log('click.board',v);
if(v.status_str && checkedTids._indexOf(v.id)<0) return util.toast('不能预订该桌位','none');
if (v.isselect == true) {
var thisindex = tables.indexOf(tebleid);
tables.splice(thisindex, 1)
} else {
tables.push(tebleid)
}
v.isselect = !v.isselect
}
v.isselect = !v.isselect
}
})
addnewPage.data.form.tid = tables;
addnewPage.setData({
form: addnewPage.data.form
})
console.log('checkedTables',addnewPage.checkedTables);
})
}else{
var pages = getCurrentPages();
var addnewPage=pages[pages.length - 2];
let checkedTids=this.data.checkedTids.split(',');
list.forEach(function (v, i) {
if (v.id == tebleid) {
console.log('click.board',v);
if(v.status_str && checkedTids._indexOf(v.id)<0) return util.toast('不能预订该桌位','none');
if (v.isselect == true) {
var thisindex = tables.indexOf(tebleid);
tables.splice(thisindex, 1)
delete addnewPage.checkedTables[tebleid]
} else {
tables.push(tebleid)
addnewPage.checkedTables[tebleid]=v.name;
}
v.isselect = !v.isselect
}
})
addnewPage.data.form.tid = tables;
addnewPage.setData({
form: addnewPage.data.form
})
console.log('checkedTables',addnewPage.checkedTables);
}
util.cache('tableid', tables);
this.triggerEvent("changedesk");
this.setData({
... ...
import util from '../../../utils/util';
import comm from '../../../utils/bookCommon';
import App from '../../../utils/api';
import PubSub from '../../../utils/PubSub'
const {regeneratorRuntime} = global
Page({
data: {
... ... @@ -26,7 +27,8 @@ Page({
this.setData({
sellerid: this.sellerid,
opt: opt,
hasCheckedTable: this.checked_tids.length > 0
hasCheckedTable: this.checked_tids.length > 0,
hasPubSub:opt.hasPubSub
})
//this.getdesklist();
this.getDeskList();
... ... @@ -48,6 +50,15 @@ Page({
buttonClick: true
})
//wx.removeStorage({key:'tableid'})
if(this.data.hasPubSub){
if(this.checked_tids.length<1) return
wx.removeStorage({
key:'tableid'
})
PubSub.emit('arrangeDesk',{
tableid:this.checked_tids
})
}
wx.navigateBack();
},
getdesklist: function () {
... ...
... ... @@ -12,7 +12,7 @@
<view style="height: {{height-80}}px;overflow-y: auto;padding-bottom: 160rpx;overflow-x: hidden;width: 100%;">
<block wx:for="{{desklist}}" wx:key="desklist.key">
<orderDesk list="{{item.list}}" checkedTids="{{opt.checked_tids}}"
bind:changedesk="changedesk"
bind:changedesk="changedesk" hasPubSub="{{hasPubSub}}"
wx:if="{{item.name==menu_active_id}}"></orderDesk>
</block>
... ...
... ... @@ -2,6 +2,7 @@ var util = require('../../../utils/util.js')
var uri = require('../../../utils/uri.js')
import App from '../../../utils/api';
import RS from '../../../utils/reserveStatus'
import PubSub from '../../../utils/PubSub'
const {regeneratorRuntime} = global
import TP from '../../../utils/tpls';
... ... @@ -30,6 +31,9 @@ Page({
this.sc = (await App.Reserve.SellerInfo(this.enter_params)).data;
console.log('this.sc', this.sc);
this.chooseManagerInit();
PubSub.on('arrangeDesk',(desk)=>{
this.arrangeDesk(desk)
})
},
onShow: function () {
this.notice = this.selectComponent('#notice');
... ... @@ -205,4 +209,65 @@ Page({
}, '/pack-cookbook/pages/success')
});
},
refuseOrder(){
wx.showModal({
title: '确认拒绝订单吗?',
content: '如果包间类型已订满,请及时停用',
showCancel:true,
cancelText:'拒绝订单',
cancelColor:'',
confirmText:'去安排',
confirmColor:'',
success:(res)=>{
console.info(res)
if(res.cancel){
this.getDetail(this.data.bookInfo.id,true);
}else{//分配
this.arrangeOrder()
}
}
})
},
arrangeOrder(){
let bi=this.data.bookInfo
let checked_tids=''
//rdate=1568023200-1568041200&tid=0&pnum=6&checked_tids=&rid=&hasPubsub=1
wx.navigateTo({
url:util.http_build_query({
rdate:bi.rdate+'-'+bi.edate,
tid:0,
pnum:6,
checked_tids:checked_tids,
rid:'',
hasPubSub:1,
},'./b_desk')
})
},
arrangeDesk(res){
console.log('arrangeDesk',res.tableid)
//刷新
this.getDetail(this.data.bookInfo.id,true);
},
easyCall(e){
let bi=this.data.bookInfo
let phone=bi.phone
if(util.attr(e,'key')=='seller'){
phone=bi.seller.phone
if(bi.seller.seller_tel){
let seller_tel=bi.seller.seller_tel.split(',');
if(seller_tel.length>0){
phone=seller_tel[parseInt(Math.random()*seller_tel.length)]
}
}
}
phone=phone.replace(/[^\d]/g,'')
if(phone){
wx.makePhoneCall({
phoneNumber: phone
})
}else{
util.toast('号码为空','none')
}
},
})
\ No newline at end of file
... ...
... ... @@ -118,6 +118,25 @@
<view class="notice-opt" wx:if="{{bookInfo.status==2}}">
<formids class="notice-button white-font font34r flex-cc" bindclick="startDinner" data-status="3">客户就餐完毕</formids>
</view>
<!--操作在线预订-->
<view class="notice-opt" wx:if="{{bookInfo.status==0}}">
<view class="notice-button-border font34r flex-lr">
<view>
<formids bindclick="easyCall" data-key="seller">联系商家</formids>
</view>
<view>
<formids bindclick="easyCall" data-key="customer">联系顾客</formids>
</view>
</view>
<view class="notice-button-border font34r flex-lr">
<view>
<formids bindclick="refuseOrder">拒绝订单</formids>
</view>
<view>
<formids bindclick="arrangeOrder">安排包间</formids>
</view>
</view>
</view>
<noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall>
<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="flex-ll">
<block wx:for-items="{{actionSheetItems}}" wx:key="actionSheetItems.key">
... ...
... ... @@ -499,7 +499,7 @@
"id": 60,
"name": "pack-book/pages/book/b_detail",
"pathName": "pack-book/pages/book/b_detail",
"query": "id=32057",
"query": "id=33284",
"scene": null
}
]
... ...