// pages/consolidatedAccount/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { userId : -1, mgrUserId : -1, currUser:{}, targetUser: {}, ishow:false, showbtn:true, }, onLoad : function(options) { app.load("加载中..."); var that = this; var scene = decodeURIComponent(options.scene); if(scene != '' && scene != null && scene != 'undefined') { var scenceArr = scene.split('A'); this.setData({ userId : scenceArr[0], mgrUserId: scenceArr[1], }); if (app.globalData.isLogin) { that.getUserInfo(); } else { app.userLoginCallback = res => { that.getUserInfo(); } } } }, getUserInfo: function () { var that = this; wx.request({ url: app.globalData.ip + '/user/mergeUser?userId=' + that.data.userId + "&mgrUserId=" + that.data.mgrUserId, data: {}, header: app.globalData.header, method: "GET", success: function (res) { app.hideLoad(); console.log(res.data); if (res.data.status == 200) { that.data.currUser = that.data.currUser; that.data.targetUser = that.data.targetUser; that.setData({ currUser: res.data.data.currUser, targetUser: res.data.data.targetUser, showbtn: res.data.data.currUser.id - res.data.data.targetUser.id == 0 ? false : true, ishow:true, }); wx.setNavigationBarTitleTitle({ title: '合并账号确认', }) } else if (res.data.status == 9999) { console.log("登录状态失效Line104"); app.dialogNotLogin(); } else if (res.data.status == 201) { wx.reLaunch({ url: '/pages/user/merge/err/error?type=1', }) } else { console.log("系统错误"); } } }) }, doMerge: function () { var that = this; wx.request({ url: app.globalData.ip + '/user/doMerge?userId=' + that.data.userId + "&mgrUserId=" + that.data.mgrUserId, data: {}, header: app.globalData.header, method: "GET", success: function (res) { console.log(res.data); app.hideLoad(); if (res.data.status == 200) {//可以合并 wx.navigateTo({ url: '../suc/success', }) } else if (res.data.status == 201) {//不可以合并,建档人非系统 wx.navigateTo({ url: '../err/error?type=1', }) } else if (res.data.status == 9999) { console.log("登录状态失效Line104"); app.dialogNotLogin(); } else { wx.navigateTo({ url: '../err/error?type=2', }) } } }) }, showDialog: function () { var that = this; app.dialogTwoBtn("提示", "确定两个账号信息均属本人吗?", "取消", "确定", function () { console.log(1); app.load("确认中..."); that.doMerge(); }) } })