diff --git a/api/common.js b/api/common.js index 4fe928d..9b2eace 100644 --- a/api/common.js +++ b/api/common.js @@ -10,7 +10,8 @@ module.exports = { logout, checkUpdateAvatar, updateAvatar, - getCustomId + getCustomId, + getUserinfobycode } function getToken(wxCode) { @@ -62,4 +63,12 @@ function updateAvatar(avatar) { */ function getCustomId () { return fly.get("plugins/workLog/getCustomId") +} + +/** + * 扫描兑换码获取用户信息接口 2022.03.07 + * @param qrCodeId 二维码中的qrCodeId + */ +function getUserinfobycode(params) { + return fly.post('work/pointsverification/getuserinfobycode', params) } \ No newline at end of file diff --git a/app.json b/app.json index 3629731..a840025 100644 --- a/app.json +++ b/app.json @@ -20,6 +20,14 @@ "pages/user_moudle/userManageList/userManageList" ], "subpackages": [ + { + "root": "subpages/pointManagement", + "name": "pointManagement", + "pages": [ + "pages/pointClear/pointClear", + "pages/pointList/pointList" + ] + }, { "root": "subpages/clerkOnline", "name": "clerkOnline", diff --git a/pages/index/index.js b/pages/index/index.js index af6c3d3..896ae97 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -18,7 +18,8 @@ Page({ userInfo: '', propagation: true, joinFlag: true, - buttonName:'',//获取点击按钮的名字 + buttonName:'', // 获取点击按钮的名字 + qrCodeId: '', }, onLoad: function() { // this.checkUpdateAvatar() @@ -230,6 +231,13 @@ Page({ }) } break + case 'tmp-8': + if (navCode == '10081') { + this.toPointClear() + } else if (navCode == '10082') { + this.toPointList() + } + break default: let c_childNav = []; for (let i = 0; i < this.data.panel.length; i++) { @@ -496,5 +504,55 @@ Page({ console.log(err) } }) + }, + // 前往 积分核销 + toPointClear () { + wx.scanCode({ + onlyFromCamera: false, + scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'], + success: res => { + if (res.errMsg == 'scanCode:ok') { + this.setData({ + qrCodeId: res.result + }) + this.getUserinfobycode() + } + }, + fail: res => { + // 接口调用失败 + // wx.showToast({ + // icon: 'none', + // title: '接口调用失败!' + // }) + }, + complete: res => { + // 接口调用结束 + console.log(res) + } + }); + }, + getUserinfobycode() { + let para = { + qrCodeId: this.data.qrCodeId + } + api.getUserinfobycode(para).then(function (res) { + let { + faceImg, + points, + realName, + userId + } = res.data + wx.navigateTo({ + url: `/subpages/pointManagement/pages/pointClear/pointClear?faceImg=${faceImg}&points=${points}&realName=${realName}&userId=${userId}` + }) + }).catch(err => { + console.log(err) + }) + }, + // 前往 核销记录 + toPointList () { + wx.navigateTo({ + url: '/subpages/pointManagement/pages/pointList/pointList' + }) } }) \ No newline at end of file