Commit 72af175581a468863e48fb38a45bdfcae3cd3bbe

Authored by vking
1 parent 34ce49ec

编辑查看模式

... ... @@ -2,6 +2,7 @@
import util from '../../../../utils/util';
import App from '../../../../utils/api';
const {regeneratorRuntime} = global
import gl from '../../../global'
Component({
/**
* 组件的属性列表
... ... @@ -44,6 +45,10 @@ Component({
* 组件的方法列表
*/
itemList:[],
ready(){
this.hasEditorFlag=false;
this.hasEditor();
},
methods: {
boardClick(){
if(!this.data.event) return;
... ... @@ -76,27 +81,39 @@ Component({
//桌位操作
boardOpt(){
let itemList=[]
if(!this.data.board.reserve_id && this.data.board.enable==1){
if(this.data.ddate){
let t=new Date()/1000;
//console.log('this.data.ddate.substr(11,10)',this.data.ddate.substr(11,10))
//if(parseInt(this.data.ddate.substr(11,10))>t){
itemList.push('订座')
//}
}
if(this.hasEditorFlag){
if(!this.data.board.reserve_id && this.data.board.enable==1){
if(this.data.ddate){
let t=new Date()/1000;
//console.log('this.data.ddate.substr(11,10)',this.data.ddate.substr(11,10))
//if(parseInt(this.data.ddate.substr(11,10))>t){
itemList.push('订座')
//}
}
}
if(this.data.board.reserve_id>0){
itemList.push('查看详情')
}
itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位')
//console.log(getApp().system)
this.itemList=itemList;
this.setData({
itemList:itemList,
})
this.selectComponent('#boardas').show();
console.log('this.data.board',this.data.board)
}else{
if(this.data.board.reserve_id>0){
itemList.push('查看详情')
this.itemList=itemList;
this.setData({
itemList:itemList,
})
this.selectComponent('#boardas').show();
}
}
if(this.data.board.reserve_id>0){
itemList.push('查看详情')
}
itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位')
//console.log(getApp().system)
this.itemList=itemList;
this.setData({
itemList:itemList,
})
this.selectComponent('#boardas').show();
console.log('this.data.board',this.data.board)
},
//桌位选择
boardChoose(){
... ... @@ -111,5 +128,11 @@ Component({
this.triggerEvent('boardEvent',{type:'boardEnable'})
})
},
//是否可以编辑
hasEditor(){
gl.getHasEditorFlag().then(()=>{
this.hasEditorFlag=true
}).catch(()=>{})
},
}
})
... ...
// components/book/tabBar/tabBar.js
import util from '../../../../utils/util'
import App from '../../../../utils/api';
import gl from '../../../global'
const {regeneratorRuntime} = global
Component({
/**
... ... @@ -14,6 +15,7 @@ Component({
data: {
pi: 0,
dot:0,
hasEditorFlag:false,
},
attached(){
let pages = getCurrentPages();
... ... @@ -31,6 +33,7 @@ Component({
},
ready(){
this.hasDot()
this.hasEditor();
},
/**
* 组件的方法列表
... ... @@ -54,6 +57,13 @@ Component({
})
this.triggerEvent('NewCustomer',{total:dot})
});
}
},
hasEditor(){
gl.getHasEditorFlag().then(()=>{
this.setData({
hasEditorFlag:true,
})
}).catch(()=>{})
},
}
})
... ...
<!--components/book/tabBar/tabBar.wxml-->
<view class="tabBar flex-cc">
<formids class="item flex-vc" bindtap="redirectTo" data-url="/pack-book/pages/book/b_addnew">
<formids wx:if="{{hasEditorFlag}}" class="item flex-vc" bindtap="redirectTo" data-url="/pack-book/pages/book/b_addnew">
<view class="flex-vc {{pi==0?'checked':''}}" >
<view class="icon reserve"></view>
<view class="text">订座</view>
... ...
import App from '../utils/api'
import util from '../utils/util'
const {regeneratorRuntime} = global
module.exports ={
getHasEditorFlag(){
return new Promise(async function(success,fail){
let enter_params=util.cache('enter_params');
let res=await App.Reserve.SellerInfo(enter_params)
if(res.data.config.is_auth==1){
success()
}else{
fail()
}
})
},
}
\ No newline at end of file
... ...
var util = require('../../../utils/util.js')
var uri=require('../../../utils/uri.js')
var uri = require('../../../utils/uri.js')
import App from '../../../utils/api';
const {regeneratorRuntime} = global
import TP from '../../../utils/tpls';
import gl from '../../global';
Page({
data:{
actionSheetHidden:true,
actionSheetItems:['客户取消','客户行程改变']
},
sc:{},
tpls:TP.tpls(),
enter_params:{},
onLoad:async function (opt) {
util.setBarTitle('预订详情');
console.log(opt)
this.getDetail(opt.id);
wx.showShareMenu({
withShareTicket: true,
success:function(res){
console.log(res)
}
})
this.enter_params=util.cache('enter_params');
this.sc=(await App.Reserve.SellerInfo(this.enter_params)).data;
console.log('this.sc',this.sc);
this.chooseManagerInit();
},
onShow:function(){
this.notice=this.selectComponent('#notice');
},
noticeCall:function(){
this.selectComponent('#notice').show();
},
onShareAppMessage: function () {
this.selectComponent('#notice').close();
var obj=this.data.bookInfo;
let path=util.http_build_query({
id:this.data.bookInfo.id,
fromid:getApp().openid,
hasSellerShare:1,
hasInvitation:1,
tplid:1
},'/pages/customer/index')
return {
//title: (nickname||'')+'给你发送了一个订座信息,点击查看详情',
title: this.tpls[0].shareFirstTitle,
path: path,
imageUrl:this.tpls[0].shareFirstImage,
success: function (res) {
console.log(res,666666)
},
fail:function(){
console.log('ccccc')
},
complete:function(){
console.log('ccccc')
}
};
},
getcall:function(){
if(!this.detailData.hasOwner){
return util.toast('只有记录人可以拨打','none');
data: {
actionSheetHidden: true,
actionSheetItems: ['客户取消', '客户行程改变'],
hasEditorFlag: false,
},
sc: {},
tpls: TP.tpls(),
enter_params: {},
onLoad: async function (opt) {
util.setBarTitle('预订详情');
console.log(opt)
this.getDetail(opt.id);
wx.showShareMenu({
withShareTicket: true,
success: function (res) {
console.log(res)
}
if(this.data.bookInfo.phone.length<3){
return util.toast('号码错误','none');
})
this.enter_params = util.cache('enter_params');
this.sc = (await App.Reserve.SellerInfo(this.enter_params)).data;
console.log('this.sc', this.sc);
this.chooseManagerInit();
},
onShow: function () {
this.notice = this.selectComponent('#notice');
gl.getHasEditorFlag().then(() => {
this.setData({
hasEditorFlag: true,
})
}).catch(()=>{})
},
noticeCall: function () {
this.selectComponent('#notice').show();
},
onShareAppMessage: function () {
this.selectComponent('#notice').close();
var obj = this.data.bookInfo;
let path = util.http_build_query({
id: this.data.bookInfo.id,
fromid: getApp().openid,
hasSellerShare: 1,
hasInvitation: 1,
tplid: 1
}, '/pages/customer/index')
return {
//title: (nickname||'')+'给你发送了一个订座信息,点击查看详情',
title: this.tpls[0].shareFirstTitle,
path: path,
imageUrl: this.tpls[0].shareFirstImage,
success: function (res) {
console.log(res, 666666)
},
fail: function () {
console.log('ccccc')
},
complete: function () {
console.log('ccccc')
}
wx.makePhoneCall({
phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码
complete:()=>{
this.selectComponent('#notice').close();
}
};
},
getcall: function () {
if (!this.detailData.hasOwner) {
return util.toast('只有记录人可以拨打', 'none');
}
if (this.data.bookInfo.phone.length < 3) {
return util.toast('号码错误', 'none');
}
wx.makePhoneCall({
phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码
complete: () => {
this.selectComponent('#notice').close();
}
})
},
chooseManagerInit() {
try {
let managers = this.sc.manager;
let mans = [];
let mans_role = [];
// let space='';
// for(let i=0;i<50;i++){
// space+=' ';
// }
if (managers.length > 0) {
managers.forEach(man => {
let nickname = man.nick_name || man.user_name;
mans.push(nickname);
//mans_role.push('     ['+man.role_name+'] -- '+man.user_name+space);
mans_role.push('[' + man.role_name + '] -- ' + nickname);
})
},
chooseManagerInit(){
try{
let managers=this.sc.manager;
let mans=[];
let mans_role=[];
// let space='';
// for(let i=0;i<50;i++){
// space+=' ';
// }
if(managers.length>0){
managers.forEach(man=>{
let nickname=man.nick_name||man.user_name;
mans.push(nickname);
//mans_role.push('     ['+man.role_name+'] -- '+man.user_name+space);
mans_role.push('['+man.role_name+'] -- '+nickname);
})
}
this.setData({mans:mans,mans_role:mans_role})
}catch(e){
wx.showToast({
title:'无客户经理',
icon:'none'
});
}
},
chooseManager(e){
let mansIndex=util.val(e);
this.setData({mansIndex:mansIndex});
try{
let managers=this.sc.manager;
let man=managers[mansIndex];
if(man){
App.Reserve.SetReserveCusman({
rid:this.data.bookInfo.id,
cusman_id:man.id,
cusman:man.nick_name||man.user_name,
cusman_phone:man.user_phone?man.user_phone:'',
cusman_account:man.user_wechat?man.user_wechat:'',
cusman_openid:man.seat_openid?man.seat_openid:''
}).then(()=>{
this.getDetail(this.data.bookInfo.id,true);
});
}
}catch(e){
console.log(e);
}
},
flushSellerInfo(){
App.Reserve.SellerInfo(util.cache('enter_params'),true);
},
detailData:null,
async getDetail(id,force=false){
let res=await App.Reserve.Detail({rid:id,openid:''},force);
res.data.rdateStr=util.unixtoTime(res.data.ddate,"MM月DD日 HH:II")
res.data.phoneStr=res.data.phone||'';
let enter_params=util.cache('enter_params');
let sc=(await App.Reserve.SellerInfo(enter_params)).data
let note_openid=enter_params.seller_openid;
res.data.hasOwner=false;
if(note_openid==res.data.note_openid || sc.seller_user.role_name=='管理员'){
res.data.hasOwner=true;
}
if(!res.data.hasOwner){
res.data.phoneStr=res.data.phoneStr.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){
return $1+'**'+$3;
})
}
if(res.data.status==4 && res.data.cancel){
res.data.cancel.cdateStr=util.unixtoTime(res.data.cancel.cdate,"YYYY.MM.DD HH:II")
}
this.detailData=res.data;
this.setData({mans: mans, mans_role: mans_role})
} catch (e) {
wx.showToast({
title: '无客户经理',
icon: 'none'
});
}
},
chooseManager(e) {
let mansIndex = util.val(e);
this.setData({mansIndex: mansIndex});
try {
let managers = this.sc.manager;
let man = managers[mansIndex];
if (man) {
App.Reserve.SetReserveCusman({
rid: this.data.bookInfo.id,
cusman_id: man.id,
cusman: man.nick_name || man.user_name,
cusman_phone: man.user_phone ? man.user_phone : '',
cusman_account: man.user_wechat ? man.user_wechat : '',
cusman_openid: man.seat_openid ? man.seat_openid : ''
}).then(() => {
this.getDetail(this.data.bookInfo.id, true);
});
}
} catch (e) {
console.log(e);
}
this.setData({
tables:res.data.tables,
bookInfo:res.data,
})
},
gotoModify(){
wx.redirectTo({
url:'./b_addnew?id='+this.data.bookInfo.id
})
},
cancelReserve(){
},
flushSellerInfo() {
App.Reserve.SellerInfo(util.cache('enter_params'), true);
},
detailData: null,
async getDetail(id, force = false) {
let res = await App.Reserve.Detail({rid: id, openid: ''}, force);
res.data.rdateStr = util.unixtoTime(res.data.ddate, "MM月DD日 HH:II")
res.data.phoneStr = res.data.phone || '';
let enter_params = util.cache('enter_params');
let sc = (await App.Reserve.SellerInfo(enter_params)).data
let note_openid = enter_params.seller_openid;
res.data.hasOwner = false;
if (note_openid == res.data.note_openid || sc.seller_user.role_name == '管理员') {
res.data.hasOwner = true;
}
if (!res.data.hasOwner) {
res.data.phoneStr = res.data.phoneStr.replace(/(\d{2})(.{5})(\d{3})/, function ($0, $1, $2, $3) {
return $1 + '**' + $3;
})
}
if (res.data.status == 4 && res.data.cancel) {
res.data.cancel.cdateStr = util.unixtoTime(res.data.cancel.cdate, "YYYY.MM.DD HH:II")
}
this.detailData = res.data;
this.setData({
tables: res.data.tables,
bookInfo: res.data,
})
},
gotoModify() {
wx.redirectTo({
url: './b_addnew?id=' + this.data.bookInfo.id
})
},
cancelReserve() {
this.selectComponent('#cancel').show();
},
reserveCancel(e){
console.log('reserveCancel',e.detail);
this.getDetail(this.data.bookInfo.id,true);
reserveCancel(e) {
console.log('reserveCancel', e.detail);
this.getDetail(this.data.bookInfo.id, true);
},
actionSheetChange(e){
actionSheetChange(e) {
this.setData({
actionSheetHidden:true
actionSheetHidden: true
})
},
async startDinner(e){
let cause={};
let enter_params=util.cache('enter_params');
let sc=(await App.Reserve.SellerInfo(enter_params)).data
cause={desc:""}
if(enter_params){
cause.uid=enter_params.manager_id;
async startDinner(e) {
let cause = {};
let enter_params = util.cache('enter_params');
let sc = (await App.Reserve.SellerInfo(enter_params)).data
cause = {desc: ""}
if (enter_params) {
cause.uid = enter_params.manager_id;
}
if(sc.seller_user){
cause.uname=(sc.seller_user.nick_name||sc.seller_user.nickname)
if (sc.seller_user) {
cause.uname = (sc.seller_user.nick_name || sc.seller_user.nickname)
}
App.Reserve.SetReserveStatus({
rid:this.data.bookInfo.id,
status:util.attr(e,'status'),
cause:JSON.stringify(cause),
}).then(()=>{
this.getDetail(this.data.bookInfo.id,true);
rid: this.data.bookInfo.id,
status: util.attr(e, 'status'),
cause: JSON.stringify(cause),
}).then(() => {
this.getDetail(this.data.bookInfo.id, true);
});
},
showOrder(){
showOrder() {
wx.navigateTo({
url:util.http_build_query({rid:this.data.bookInfo.id,oid:this.data.bookInfo.orderid,identity:2},'/pack-cookbook/pages/success')
url: util.http_build_query({
rid: this.data.bookInfo.id,
oid: this.data.bookInfo.orderid,
identity: 2
}, '/pack-cookbook/pages/success')
});
},
})
\ No newline at end of file
... ...
... ... @@ -43,12 +43,17 @@
<view class="order-info">
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">客户经理</view>
<view class="flex-lr black-font font34r" style=" border-bottom: 2rpx solid #999;">
<picker bindchange="chooseManager" catchtap="flushSellerInfo" value="{{mansIndex}}" range="{{mans_role}}">
<view class="picker">
<view class="flex-lr black-font font34r">
<picker bindchange="chooseManager" catchtap="flushSellerInfo"
wx:if="{{hasEditorFlag}}"
value="{{mansIndex}}" range="{{mans_role}}">
<view class="picker" style="border-bottom:2rpx solid #999;">
{{mans[mansIndex]?mans[mansIndex]:bookInfo.cusman?bookInfo.cusman:'请选择'}}
</view>
</picker>
<view class="picker" wx:else="">
{{mans[mansIndex]?mans[mansIndex]:bookInfo.cusman?bookInfo.cusman:'无'}}
</view>
</view>
</view>
<view class="flex-lr order-detail">
... ... @@ -85,7 +90,7 @@
<formids bindclick="showOrder">查看菜品</formids>
</view>
</view>
<view class="notice-button-border font34r flex-lr">
<view class="notice-button-border font34r flex-lr" wx:if="{{hasEditorFlag}}">
<view>
<formids bindclick="gotoModify">变更预订</formids>
</view>
... ...