|
@@ -41,6 +41,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
+ console.log("options", options)
|
|
|
if (options.wechatBindUserid) {
|
|
|
this.funs.push({
|
|
|
fun: this.wechatBind.bind(this),
|
|
@@ -76,7 +77,7 @@ export default {
|
|
|
onShow() {
|
|
|
this.isInitializeLogin(render.bind(this))
|
|
|
function render() {
|
|
|
- if (this.funs.length) this.funs.forEach(v => v.fun(v.value));
|
|
|
+ if (this.funs.length) Promise.all(this.funs.map(v => v.fun(v.value))).then(() => this.funs = [])
|
|
|
this.$Http.changePage = function (itemId, page, params) {
|
|
|
this.$refs.pages.onClick(itemId, page, false, params)
|
|
|
}.bind(this)
|
|
@@ -107,68 +108,74 @@ export default {
|
|
|
},
|
|
|
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 () {
|
|
|
- if (s.msg == '成功') that.$Login.wechatLogin().then(() => uni.reLaunch({
|
|
|
- url: '/pages/index/index?q=""'
|
|
|
- }))
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ 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 () {
|
|
|
+ resolve()
|
|
|
+ if (s.msg == '成功') that.$Login.wechatLogin().then(() => uni.reLaunch({
|
|
|
+ url: '/pages/index/index?q=""'
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
},
|
|
|
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 () {
|
|
|
- if (s.msg == '成功') that.$Login.wechatLogin().then(() => uni.reLaunch({
|
|
|
- url: '/pages/index/index?q=""'
|
|
|
- }))
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ 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 => {
|
|
|
+ resolve()
|
|
|
+ console.log("绑定账号", s)
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: s.msg == '成功' ? '绑定成功' : s.msg,
|
|
|
+ showCancel: false,
|
|
|
+ success: function () {
|
|
|
+ if (s.msg == '成功') that.$Login.wechatLogin().then(() => uni.reLaunch({
|
|
|
+ url: '/pages/index/index?q=""'
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|