Commit fc6778821a4f9b50e51e6f2a63a081e77672d807

Authored by pengye
1 parent b06748ed

邀请函无法进入问题处理

Showing 1 changed file with 247 additions and 245 deletions
... ... @@ -6,16 +6,16 @@ import util from '../../utils/util'
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
loadHidden: false,
},
/**
* 页面的初始数据
*/
data: {
loadHidden: false,
},
/**
* 生命周期函数--监听页面加载
*/
/**
* 生命周期函数--监听页面加载
*/
islove: '',//用户在哪端
enter_params: '',//商户入口参数
isInvitation: false,//客户经理
... ... @@ -24,109 +24,110 @@ Page({
//转化场景值到opt
this.selectComponent("#network").debug(opt, 'opt');
if (opt.scene) {//扫码进入
let query = decodeURIComponent(opt.scene);
query.split('&').forEach(q => {
let _q = q.split('=');
opt[_q[0]] = _q[1];
})
this.selectComponent("#network").debug(opt, 'scene');
}
if (opt.act == 'tobook') {//消息跳入运营处理预订
delete opt.act
console.log('optopt',opt);
return this.redirectTo({url: util.http_build_query(opt, '/pack-book/pages/book/b_index')});
}
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": opt, //渠道分析
});
opt.openid = await this.getOpenid();
if (!opt.openid) {
console.log('App.Orders.CheckOrder no openid');
this.selectComponent("#network").refresh();
return;
}
if(opt.act=='coupon'){
return wx.redirectTo({
url:'../me/coupon_news'
})
}
if(opt.act=='order'){
return wx.redirectTo({
url:'../me/list'
})
}
if (opt.islove) {
util.cache('islove', opt.islove);
this.islove = opt.islove
} else {
this.islove = await util.cache('islove')
}
this.usi = {data: {seller: {}, invitation: {}}}
try {
this.usi = await App.Invitation.UserIdentity({openid: opt.openid});
} catch (e) {
console.log('App.Invitation.UserIdentity no usi');
}
this.options = opt
setTimeout(() => {
this.initRun();
}, 2000)
},
async initRun() {
let opt = this.options
let usi=this.usi
if (usi.data.seller.flag) {//商户
util.cache('sellerid',usi.data.data.seller_id)
//获得商户数据
//this.enter_params=await this.SellerForOpenid(opt.openid);
this.enter_params = usi.data.data;
util.cache('enter_params',this.enter_params)
}
if (usi.data.invitation.flag) {//已是客户经理
this.isInvitation = true;
}
//console.log('this.enter_params',this.enter_params)
let url = '/pages/reserve/index_new';
if (opt.id > 0 || opt.sms_code) {
if (opt.invite_name) {
let invite_names = wx.getStorageSync('invite_names') || {};
invite_names[opt.id] = opt.invite_name;
wx.setStorage({
key: 'invite_names',
data: invite_names
let query = decodeURIComponent(opt.scene);
query.split('&').forEach(q => {
let _q = q.split('=');
opt[_q[0]] = _q[1];
})
this.selectComponent("#network").debug(opt, 'scene');
}
if (opt.act == 'tobook') {//消息跳入运营处理预订
delete opt.act
console.log('optopt',opt);
return this.redirectTo({url: util.http_build_query(opt, '/pack-book/pages/book/b_index')});
}
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": opt, //渠道分析
});
}
let param = {
openid: opt.openid,
}
if (opt.sms_code) {
param.code = opt.sms_code;
} else {
param.rid = opt.id
}
App.Reserve.Detail(param).then(res => {
console.log(res.data.note_openid, this.enter_params.seller_openid)
if (this.enter_params) {//商户
//if(res.data.sid==this.enter_params.seller_id && opt.hasSellerShare==1){//不是客户端分享,且是同一个店的
if (res.data.note_openid == this.enter_params.seller_openid && opt.hasSellerShare == 1) {//不是客户端分享,且是记录人
util.cache('enter_params', this.enter_params)
//url = '/pages/book/b_detail';
url = '/pack-book/pages/book/b_invitation';
}
opt.openid = await this.getOpenid();
if (!opt.openid) {
console.log('App.Orders.CheckOrder no openid');
this.selectComponent("#network").refresh();
return;
}
if(opt.act=='coupon'){
return wx.redirectTo({
url:'../me/coupon_news'
})
}
if(opt.act=='order'){
return wx.redirectTo({
url:'../me/list'
})
}
if (opt.islove) {
util.cache('islove', opt.islove);
this.islove = opt.islove
} else {
this.islove = await util.cache('islove')
}
if (url != '/pack-book/pages/book/b_invitation') {
//设置关系
App.Reserve.SetRelaOpenid({
rid: res.data.id,
openid: opt.openid,
fromid: opt.fromid ? opt.fromid : ''
})
this.usi = {data: {seller: {}, invitation: {}}}
try {
this.usi = await App.Invitation.UserIdentity({openid: opt.openid});
} catch (e) {
console.log('App.Invitation.UserIdentity no usi');
}
this.options = opt
setTimeout(() => {
this.initRun();
}, 2000)
},
async initRun() {
let opt = this.options
let usi=this.usi
if (usi.data.seller.flag) {//商户
util.cache('sellerid',usi.data.data.seller_id)
//获得商户数据
//this.enter_params=await this.SellerForOpenid(opt.openid);
this.enter_params = usi.data.data;
util.cache('enter_params',this.enter_params)
}
if (usi.data.invitation.flag) {//已是客户经理
this.isInvitation = true;
}
//console.log('this.enter_params',this.enter_params)
let url = '/pages/reserve/index_new';
if (opt.id > 0 || opt.sms_code) {
if (opt.invite_name) {
let invite_names = wx.getStorageSync('invite_names') || {};
invite_names[opt.id] = opt.invite_name;
wx.setStorage({
key: 'invite_names',
data: invite_names
});
}
let param = {
openid: opt.openid,
}
if (opt.sms_code) {
param.code = opt.sms_code;
} else {
param.rid = opt.id
}
App.Reserve.Detail(param).then(res => {
let configType = res.data.seller.temp_config_type
console.log(res.data.note_openid, this.enter_params.seller_openid)
if (this.enter_params) {//商户
//if(res.data.sid==this.enter_params.seller_id && opt.hasSellerShare==1){//不是客户端分享,且是同一个店的
if (res.data.note_openid == this.enter_params.seller_openid && opt.hasSellerShare == 1) {//不是客户端分享,且是记录人
util.cache('enter_params', this.enter_params)
//url = '/pages/book/b_detail';
url = '/pack-book/pages/book/b_invitation';
}
}
if (url != '/pack-book/pages/book/b_invitation') {
//设置关系
App.Reserve.SetRelaOpenid({
rid: res.data.id,
openid: opt.openid,
fromid: opt.fromid ? opt.fromid : ''
})
if(opt.uid && opt.uid!=''){
App.Activity.SetRelation({
uid:opt.uid,
... ... @@ -144,157 +145,158 @@ Page({
console.log('type',res.data.seller.temp_config_type);
let configType=res.data.seller.temp_config_type
console.log('configType',configType);
let arr = [9, 10, 11, 12, 13, 14, 15, 16, 17];
if (!res.data.openid) {//无预订人
if (opt.hasInvitation == 1 && configType) {
let style =arr.includes(parseInt(configType))
if (!style) {
url = '/pack-invitation/pages/detail_owner_invitation' + configType;
} else {
url = '/pack-invitation/pages/detail_owner_invitation9';
}
if(configType == '18' || configType == '21') url = '/pack-invitation/pages/detail_owner_invitation11';
if(configType == '19' || configType == '22') url = '/pack-invitation/pages/detail_owner_invitation12';
if(configType == '20') url = '/pack-invitation/pages/detail_owner_invitation10';
} else {
url = '/pack-invitation/pages/detail_owner_invitation1';
let arr = [9, 10, 11, 12, 13, 14, 15, 16, 17];
if (!res.data.openid) {//无预订人
if (opt.hasInvitation == 1 && configType) {
let style =arr.includes(parseInt(configType))
if (!style) {
url = '/pack-invitation/pages/detail_owner_invitation' + configType;
} else {
url = '/pack-invitation/pages/detail_owner_invitation9';
}
if(configType == '18' || configType == '21') url = '/pack-invitation/pages/detail_owner_invitation11';
if(configType == '19' || configType == '22') url = '/pack-invitation/pages/detail_owner_invitation12';
if(configType == '20') url = '/pack-invitation/pages/detail_owner_invitation10';
} else {
url = '/pack-invitation/pages/detail_owner_invitation1';
}
} else {
if (opt.hasInvitation == 1 && configType) {
let style =arr.includes(parseInt(configType))
if (!style) {
url = '/pack-invitation/pages/detail_owner_invitation' + configType;
} else {
url = '/pack-invitation/pages/detail_owner_invitation9';
}
if (configType == '18' || configType == '21') url = '/pack-invitation/pages/detail_owner_invitation11';
if (configType == '19' || configType == '22') url = '/pack-invitation/pages/detail_owner_invitation12';
if (configType == '20') url = '/pack-invitation/pages/detail_owner_invitation10';
} else if (res.data.openid == opt.openid) {
url = '/pages/customer/detail_owner';
} else {
url = '/pages/customer/detail_invitation';
}
}
}
if (!opt.tplid || typeof opt.tplid == 'undefined' || opt.tplid == 'undefined') {
opt.tplid = 1
}
console.log(opt,'hhhhh')
url += '?id=' + res.data.id + '&tplid=' + opt.tplid;
if(opt.uid && opt.uid!=''){
url+='&uid='+opt.uid;
}
if(configType == '18' || configType == '19') url += '&bookType=1';
if(configType == '21' || configType == '22') url += '&bookType=2';
console.log('wx.redirectTo', url, res);
this.redirectTo({url: url});
})
} else {
if (this.enter_params && this.islove != 'customer' && this.islove != 'invitation') {
//商户且未手动切换到顾客端或客户经理
wx.reLaunch({
url: util.http_build_query(this.enter_params, '/pack-book/pages/reservation/reservation')
})
return;
}
} else {
if (opt.hasInvitation == 1 && configType) {
let style =arr.includes(parseInt(configType))
if (!style) {
url = '/pack-invitation/pages/detail_owner_invitation' + configType;
} else {
url = '/pack-invitation/pages/detail_owner_invitation9';
}
} else if (res.data.openid == opt.openid) {
url = '/pages/customer/detail_owner';
} else {
url = '/pages/customer/detail_invitation';
if (this.isInvitation && this.islove != 'customer' && this.islove != 'book') {
//客户经理且未手动切换到顾客端或商户
wx.reLaunch({
url: '/pages/manager-invitation/review'
})
return;
}
}
console.log('url', url);
this.redirectTo({url: url});
}
if (!opt.tplid || typeof opt.tplid == 'undefined' || opt.tplid == 'undefined') {
opt.tplid = 1
},
redirectTo(red) {
console.log('this.redirectTo', red);
if (red.url.indexOf('me/list') > 0
|| red.url.indexOf('reserve/search') > 0
|| red.url.indexOf('reserve/index_new') > 0) {
wx.redirectTo(red);
} else {
wx.redirectTo(red);
}
console.log(opt,'hhhhh')
url += '?id=' + res.data.id + '&tplid=' + opt.tplid;
if(opt.uid && opt.uid!=''){
url+='&uid='+opt.uid;
}
if(configType == '18' || configType == '19') url += '&bookType=1';
if(configType == '21' || configType == '22') url += '&bookType=2';
console.log('wx.redirectTo', url, res);
this.redirectTo({url: url});
}).catch(res => {
this.redirectTo({url: url});
})
} else {
if (this.enter_params && this.islove != 'customer' && this.islove != 'invitation') {
//商户且未手动切换到顾客端或客户经理
wx.reLaunch({
url: util.http_build_query(this.enter_params, '/pack-book/pages/reservation/reservation')
})
return;
}
if (this.isInvitation && this.islove != 'customer' && this.islove != 'book') {
//客户经理且未手动切换到顾客端或商户
wx.reLaunch({
url: '/pages/manager-invitation/review'
})
return;
}
console.log('url', url);
this.redirectTo({url: url});
}
},
redirectTo(red) {
console.log('this.redirectTo', red);
if (red.url.indexOf('me/list') > 0
|| red.url.indexOf('reserve/search') > 0
|| red.url.indexOf('reserve/index_new') > 0) {
wx.redirectTo(red);
} else {
wx.redirectTo(red);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
async getOpenid() {
let openid = await getApp().getOpenid();
return openid;
},
async SellerForOpenid(openid) {
let enter_params = '';
let res = await App.Reserve.SellerForOpenid({openid: openid});
if (res.data && res.data.seller_id) {
enter_params = res.data;
}
if (enter_params) {
return enter_params;
}
// if(enter_params) {
// console.log('seller_enter_params', enter_params)
// wx.reLaunch({
// url:util.http_build_query(enter_params,'/pages/book/b_index')
// })
// return true
// }
return false
},
networkEvent(e) {
console.log('networkEvent', e.detail);
if (!e.detail.hasWork) {
this.setData({
loadHidden: true,
})
}
},
async getOpenid() {
let openid = await getApp().getOpenid();
return openid;
},
async SellerForOpenid(openid) {
let enter_params = '';
let res = await App.Reserve.SellerForOpenid({openid: openid});
if (res.data && res.data.seller_id) {
enter_params = res.data;
}
if (enter_params) {
return enter_params;
}
// if(enter_params) {
// console.log('seller_enter_params', enter_params)
// wx.reLaunch({
// url:util.http_build_query(enter_params,'/pages/book/b_index')
// })
// return true
// }
return false
},
networkEvent(e) {
console.log('networkEvent', e.detail);
if (!e.detail.hasWork) {
this.setData({
loadHidden: true,
})
}
},
},
})
\ No newline at end of file
... ...