|
|
@@ -34,81 +34,54 @@ export default {
|
|
|
return {
|
|
|
swiperItemID: 'index',
|
|
|
page: '首页',
|
|
|
- user: {
|
|
|
- wechatBindUserid: 0,
|
|
|
- userName: ""
|
|
|
- },
|
|
|
- sa_storeid: 0
|
|
|
+ sa_storeid: 0,
|
|
|
+ funs: [],
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
if (options.wechatBindUserid) {
|
|
|
- this.user.wechatBindUserid = options.wechatBindUserid;
|
|
|
- this.user.userName = options.userName;
|
|
|
+ this.funs.push({
|
|
|
+ fun: this.wechatBind.bind(this),
|
|
|
+ value: {
|
|
|
+ wechatBindUserid: options.wechatBindUserid,
|
|
|
+ userName: options.userName,
|
|
|
+ }
|
|
|
+ })
|
|
|
} else if (options.sa_storeid) {
|
|
|
this.sa_storeid = options.sa_storeid;
|
|
|
}
|
|
|
if (options.q) {
|
|
|
let data = this.getUrlParams(options.q);
|
|
|
- if (data.wechatBindUserid) this.user = data;//绑定账号
|
|
|
- if (data.sa_storeid) this.sa_storeid = data.sa_storeid;//锁定门店
|
|
|
+ switch (data.funName) {
|
|
|
+ case 'wechatBind':
|
|
|
+ this.funs.push({
|
|
|
+ fun: this.wechatBind.bind(this),
|
|
|
+ value: data
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case 'getStore':
|
|
|
+ this.sa_storeid = data.sa_storeid;
|
|
|
+ break;
|
|
|
+ case 'BindSalesman':
|
|
|
+ this.funs.push({
|
|
|
+ fun: this.bindSalesman.bind(this),
|
|
|
+ value: data
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
onShow() {
|
|
|
this.isInitializeLogin(render.bind(this))
|
|
|
function render() {
|
|
|
- let that = this;
|
|
|
+ if (this.funs.length) this.funs.forEach(v => v.fun(v.value));
|
|
|
this.$Http.changePage = function (itemId, page, params) {
|
|
|
this.$refs.pages.onClick(itemId, page, false, params)
|
|
|
}.bind(this)
|
|
|
// #ifdef MP-WEIXIN
|
|
|
this.updatePageData(this.swiperItemID, this.page)
|
|
|
// #endif
|
|
|
- if (this.user.wechatBindUserid) {
|
|
|
- console.log("被邀请绑定账号", this.user);
|
|
|
- uni.showModal({
|
|
|
- title: '提醒',
|
|
|
- content: `账号"${this.user.userName}"是否与当前微信号绑定`,
|
|
|
- confirmText: '确定绑定',
|
|
|
- success: function ({ confirm }) {
|
|
|
- if (confirm) uni.login({
|
|
|
- success(res) {
|
|
|
- that.$Http.basic({
|
|
|
- "id": 20240516090402,
|
|
|
- "content": {
|
|
|
- "wechat_code": res.code,
|
|
|
- "isbinging": 1,
|
|
|
- "wechatuserinfo": "",
|
|
|
- "sys_enterprise_hrid": that.user.wechatBindUserid
|
|
|
- }
|
|
|
- }).then(s => {
|
|
|
- console.log("绑定账号", s)
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: s.msg == '成功' ? '绑定成功' : s.msg,
|
|
|
- showCancel: false,
|
|
|
- success: function ({ confirm }) {
|
|
|
- if (confirm) {
|
|
|
- if (s.msg == '成功') that.$Login.wechatLogin().then(() => {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/index/index'
|
|
|
- })
|
|
|
- that.user = {
|
|
|
- wechatBindUserid: 0,
|
|
|
- userName: ""
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log("this.user", this.user)
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -131,6 +104,71 @@ export default {
|
|
|
detail.callBack()
|
|
|
}
|
|
|
console.log("切换页面", detail)
|
|
|
+ },
|
|
|
+ wechatBind(user) {
|
|
|
+ console.log("被邀请绑定账号", user);
|
|
|
+ let that = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提醒',
|
|
|
+ content: `账号"${user.userName}"是否与当前微信号绑定`,
|
|
|
+ confirmText: '确定绑定',
|
|
|
+ success: function ({ confirm }) {
|
|
|
+ if (confirm) uni.login({
|
|
|
+ success(res) {
|
|
|
+ that.$Http.basic({
|
|
|
+ "id": 20240516090402,
|
|
|
+ "content": {
|
|
|
+ "wechat_code": res.code,
|
|
|
+ "isbinging": 1,
|
|
|
+ "wechatuserinfo": "",
|
|
|
+ "sys_enterprise_hrid": user.wechatBindUserid
|
|
|
+ }
|
|
|
+ }).then(s => {
|
|
|
+ console.log("绑定账号", s)
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: s.msg == '成功' ? '绑定成功' : s.msg,
|
|
|
+ showCancel: false,
|
|
|
+ success: function () {
|
|
|
+ that.$Login.wechatLogin().then(() => uni.reLaunch({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ bindSalesman(user) {
|
|
|
+ console.log("被邀请绑定业务员", user);
|
|
|
+ let that = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提醒',
|
|
|
+ content: `业务员账号"${user.userName}"是否与当前微信号绑定`,
|
|
|
+ confirmText: '确定绑定',
|
|
|
+ success: function ({ confirm }) {
|
|
|
+ if (confirm) that.$Http.basic({
|
|
|
+ "id": 20240524090002,
|
|
|
+ "content": {
|
|
|
+ "hrid": user.hrid
|
|
|
+ }
|
|
|
+ }).then(s => {
|
|
|
+ console.log("绑定账号", s)
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: s.msg == '成功' ? '绑定成功' : s.msg,
|
|
|
+ showCancel: false,
|
|
|
+ success: function () {
|
|
|
+ that.$Login.wechatLogin().then(() => uni.reLaunch({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|