247 lines
5.8 KiB
JavaScript
247 lines
5.8 KiB
JavaScript
import _ from '../../commons/js/commons'
|
|
const app = getApp()
|
|
Page({
|
|
data: {
|
|
imgUrl: _.config.imgUrl,
|
|
isShowAddStaff: false,
|
|
name: '',
|
|
mobile: '',
|
|
isShowProfile: true, //是否显示授权用户信息按钮
|
|
isShowSwitchingRoles: false,
|
|
biz_type_4s: 5 //门店类型4s店
|
|
},
|
|
onLoad: function (options) {
|
|
for (let key in options) {
|
|
this.setData({
|
|
[key]: options[key]
|
|
})
|
|
}
|
|
|
|
let list = []
|
|
if (this.data.source == 'channel') {
|
|
list = [
|
|
// {
|
|
// icon:'https://qs.liche.cn/lichebao/mine/icon-zichan2.png',
|
|
// title:'我的资产',
|
|
// url:'',
|
|
// },
|
|
{
|
|
icon: 'https://qs.liche.cn/lichebao/mine/icon-sezhi2.png',
|
|
title: '账户设置',
|
|
url: '/pages/mine/install/index',
|
|
},
|
|
]
|
|
} else if (this.data.source == 'shop') {
|
|
list = [
|
|
// {
|
|
// icon:'https://qs.liche.cn/lichebao/mine/icon-zichan2.png',
|
|
// title:'我的资产',
|
|
// url:'',
|
|
// },
|
|
// {
|
|
// icon:'https://qs.liche.cn/lichebao/mine/icon-sucai2.png',
|
|
// title:'签到码',
|
|
// url:'/pages/signup/code',
|
|
// },
|
|
{
|
|
icon: 'https://qs.liche.cn/lichebao/mine/icon-sezhi2.png',
|
|
title: '账户设置',
|
|
url: '/pages/mine/install/index',
|
|
},
|
|
// {
|
|
// icon:'https://qs.liche.cn/lichebao/mine/icon-siyutong2.png',
|
|
// title:'私域通',
|
|
// url:'/pages/siyutong/index',
|
|
// },
|
|
]
|
|
} else {
|
|
list = [
|
|
// {
|
|
// icon:'https://qs.liche.cn/lichebao/mine/icon-sucai2.png',
|
|
// title:'签到码',
|
|
// url:'/pages/signup/code',
|
|
// }
|
|
]
|
|
}
|
|
// 20250624
|
|
// let mock_data = [{
|
|
// icon:'https://img.liche.cn/lichebao/menu-1.png',
|
|
// title:'积分余额',
|
|
// tip:'7999',
|
|
// url:'/pages/customer/score/index'
|
|
// },{
|
|
// icon:'https://img.liche.cn/lichebao/menu-2.png',
|
|
// title:'核销记录',
|
|
// url:'/pages/customer/score/exchange'
|
|
// },{
|
|
// icon:'https://img.liche.cn/lichebao/menu-3.png',
|
|
// title:'联系客服',
|
|
// type:1,
|
|
// url:'13455556666'
|
|
// }]
|
|
// let menu_list = mock_data.concat(list)
|
|
// this.setData({
|
|
// list: menu_list,
|
|
// })
|
|
this.setData({
|
|
list: list,
|
|
})
|
|
this.otherMenu()
|
|
this.getUserInfo()
|
|
console.log(this.data)
|
|
wx.getSystemInfo({
|
|
success(res) {
|
|
if (res.system.indexOf('Android') > -1) {
|
|
wx.setBackgroundColor({
|
|
backgroundColor: '#34ac9f',
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
//消息通讯 是否显示授权用户信息按钮
|
|
_.eventBus.on("isShowProfile", this, function (res) {
|
|
this.setData({
|
|
isShowProfile: res,
|
|
})
|
|
})
|
|
|
|
},
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
//生命周期函数--监听页面卸载
|
|
onUnload: function () {
|
|
//卸载消息通讯 是否显示授权用户信息
|
|
_.eventBus.remove('isShowProfile', this);
|
|
},
|
|
|
|
//获取用户信息
|
|
getUserInfo() {
|
|
_.apiQuery.getUserInfo().then(res => {
|
|
this.setData({
|
|
userInfo: res
|
|
})
|
|
// let list = this.data.list
|
|
// if (res.group_id != 4) {
|
|
// list.push({
|
|
// icon: 'https://qs.liche.cn/lichebao/mine/icon-sucai2.png',
|
|
// title: '签到码',
|
|
// url: '/pages/signup/code',
|
|
// })
|
|
// this.setData({
|
|
// list,
|
|
// })
|
|
// }
|
|
});
|
|
},
|
|
|
|
//退出登录
|
|
logout() {
|
|
wx.clearStorage()
|
|
wx.reLaunch({
|
|
url: '/pages/login/index'
|
|
})
|
|
},
|
|
|
|
//推送链接
|
|
pushLink(e) {
|
|
if (e.currentTarget.dataset.url) {
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
}
|
|
},
|
|
|
|
//推送链接-敬请期待
|
|
pushLinkMsg(e) {
|
|
// 20250624
|
|
if(e.currentTarget.dataset.type == 1){
|
|
wx.makePhoneCall({
|
|
phoneNumber: e.currentTarget.dataset.url,
|
|
})
|
|
}else if (e.currentTarget.dataset.url) {
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
} else {
|
|
wx.showToast({
|
|
title: '开发中,敬请期待!',
|
|
icon: "none"
|
|
});
|
|
}
|
|
},
|
|
|
|
//切换角色
|
|
putAppResetgroupid(e) {
|
|
let params = {};
|
|
params['group_id'] = e.currentTarget.dataset.key;
|
|
_.apiQuery.putAppResetgroupid(params).then(res => {
|
|
_.apiQuery.getUserInfo().then(res => {
|
|
// if(res.biz_type==4){
|
|
// wx.reLaunch({
|
|
// url: '/pages/allot/index',
|
|
// })
|
|
// }else
|
|
if (res.group_id == 4) {
|
|
wx.reLaunch({
|
|
url: '/pages/channel/index',
|
|
})
|
|
} else {
|
|
wx.reLaunch({
|
|
url: '/pages/index/index',
|
|
})
|
|
}
|
|
});
|
|
})
|
|
},
|
|
|
|
//显示切换角色
|
|
switchingRoles() {
|
|
this.setData({
|
|
isShowSwitchingRoles: !this.data.isShowSwitchingRoles,
|
|
})
|
|
},
|
|
|
|
//20250624 扫码
|
|
bindScanCode(){
|
|
wx.scanCode({
|
|
success(res) {
|
|
let params = {
|
|
'sid':res.result
|
|
}
|
|
_.apiQuery.postAppCusorderDestroy(params).then(res => {
|
|
if (res.code == 200) {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
}else{
|
|
wx.showToast({
|
|
title: res.msg,
|
|
duration: 2000
|
|
})
|
|
}
|
|
});
|
|
},
|
|
fail(err) {
|
|
wx.showToast({
|
|
title: '扫描失败,请重试',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
},
|
|
|
|
})
|
|
},
|
|
//其他菜单
|
|
otherMenu(){
|
|
_.apiQuery.getUserMenu().then(res => {
|
|
let list = res.data
|
|
if(list){
|
|
let menu_list = this.data.list.concat(list)
|
|
this.setData({
|
|
list: menu_list
|
|
})
|
|
}
|
|
});
|
|
}
|
|
}) |