From 39ccc82b5382bac20febde308582d214801c26b1 Mon Sep 17 00:00:00 2001 From: chenshengle <954534408@qq.com> Date: Mon, 20 Jun 2022 14:35:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/coupon/confirmation/confirmation.js | 52 ++++++++++------------- pages/coupon/detail/index.js | 8 +++- pages/getPhone/getPhone.js | 8 ++++ pages/getuserinfo/getuserinfo.js | 30 +++++++++---- project.config.json | 8 ++-- 5 files changed, 64 insertions(+), 42 deletions(-) diff --git a/pages/coupon/confirmation/confirmation.js b/pages/coupon/confirmation/confirmation.js index e74273a..fd7ff04 100644 --- a/pages/coupon/confirmation/confirmation.js +++ b/pages/coupon/confirmation/confirmation.js @@ -20,30 +20,20 @@ Page({ }); let that = this if (app.globalData.token){ - if (options && (options.couponChannelId || options.couponIds)) { - if (options.couponIds) { - this.setData({ - couponIds: options.couponIds + if (options && options.couponChannelId ) { + that.setData({ + couponChannelId:options.couponChannelId }) - that.getDetail(options.couponIds, 'notendclock'); - } else { - that.getDetail(options.couponChannelId, 'notendclock'); - that.getSupId(options.couponChannelId) - } + that.getDetail(options.couponChannelId, 'notendclock'); } }else{ app.tokenCallback = token => { - - if (options && (options.couponChannelId || options.couponIds)) { - if (options.couponIds) { - this.setData({ - couponIds: options.couponIds - }) - that.getDetail(options.couponIds, 'notendclock'); - } else { + that.setData({ + couponChannelId:options.couponChannelId + }) + if (options && options.couponChannelId ) { that.getDetail(options.couponChannelId, 'notendclock'); - // that.getSupId(options.couponChannelId) - } + } } } @@ -568,6 +558,7 @@ Page({ } }).catch(err => { + tt.hideLoading() that.setData({ showbutton: false, @@ -634,16 +625,14 @@ Page({ /** * 将值传到用户手机号授权的页面 * - */ - tt.redirectTo({ - url: "/pages/getphoneInfo/index?couponChannelId=" + - that.data.couponChannelId + */ + tt.navigateTo({ + url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` }); } else if (err.code == 11006) { // 用户手机已加密 - tt.redirectTo({ - url: "/pages/phoneinput/phoneinput?couponChannelId=" + - that.data.couponChannelId + tt.navigateTo({ + url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` }); } else { tt.showToast({ @@ -655,12 +644,17 @@ Page({ } }) }).catch(err => { - console.log(err) + tt.hideLoading() + that.setData({ + showbutton: false, + }) + console.log(err) if (err.code == 11004) { - tt.redirectTo({ - url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`, + tt.navigateTo({ + url: `/pages/getuserinfo/getuserinfo?fromflag=confirmation&confirmationFlag=${that.data.couponChannelId}`, }) } else { + tt.showToast({ title: err.message, icon: "none", diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 3f4ddf5..3d8b5ad 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -226,7 +226,7 @@ Page({ if (err.code == 11004) { // 用户昵称未授权 tt.redirectTo({ - url: `/pages/getuserinfo/index?couponChannelId=${that.data.data.id}&fromflag=poster` + url: `/pages/getuserinfo/getuserinfo?couponChannelId=${that.data.data.id}&fromflag=poster` }) } }) @@ -416,6 +416,10 @@ Page({ }, gotopay: function (e) { + tt.navigateTo({ + url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`, + }) + return let that = this; app.globalData.previewFlag = true /* 判断是否授权*/ @@ -1378,7 +1382,7 @@ Page({ console.log(err) if (err.code == 11004) { tt.redirectTo({ - url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`, + url: `/pages/getuserinfo/getuserinfo?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`, }) } else { tt.showToast({ diff --git a/pages/getPhone/getPhone.js b/pages/getPhone/getPhone.js index 2e4051b..35825b9 100644 --- a/pages/getPhone/getPhone.js +++ b/pages/getPhone/getPhone.js @@ -106,6 +106,7 @@ Page({ }) }, backHome(){ + console.log("我调用的返回"); tt.navigateBack({ delta: 1, success: (res) => { @@ -136,6 +137,7 @@ Page({ iv: iv } }).then(res => { + app.globalData.phone = res.data.phone; if (that.data.skipUrl == '1') { console.log(app.globalData.skip, app.globalData.skipUrl, "跳转地址") @@ -166,6 +168,12 @@ Page({ return; } } + //确认订单 + if (that.data.path == "qr") { + tt.redirectTo({ + url: `/pages/coupon/confirmation/confirmation?couponChannelId=${that.data.couponChannelId}` + }) + } //线上配送 if (that.data.path == "fi") { tt.redirectTo({ diff --git a/pages/getuserinfo/getuserinfo.js b/pages/getuserinfo/getuserinfo.js index c05c1d9..33d824f 100644 --- a/pages/getuserinfo/getuserinfo.js +++ b/pages/getuserinfo/getuserinfo.js @@ -13,6 +13,7 @@ Page({ optionData: null, fromflag: '', couponChannelIdflag: '', + confirmationFlag:'', wjId: "", composeOrderType: "", fillIndentId: "", @@ -87,7 +88,7 @@ Page({ }) }, onLoad: function (options) { - + console.log(app.globalData.skip, app.globalData.skipUrl, app.globalData.type, "跳转地址") var that = this; // options.fromflag == 'coupondetail'; @@ -117,12 +118,18 @@ Page({ couponId: options.couponId }) } - // 来自优惠券列表券详情页面的 couponChannelId + // 来自优惠券列表券详情页面的 couponChannelId if (options && options.couponChannelIdflag) { that.setData({ couponChannelIdflag: options.couponChannelIdflag }) } + //确定订单 + if (options && options.confirmationFlag) { + that.setData({ + confirmationFlag: options.confirmationFlag + }) + } //调查问卷 if (options && !options.wjId || options.wjId) { this.setData({ @@ -228,14 +235,16 @@ Page({ }, bindGetUserInfo(e) { //session_key 未过期,并且在本生命周期一直有效 - tt.getUserProfile({ - title: '温馨提示', - desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + tt.getUserInfo({ + withCredentials: true, + // title: '温馨提示', + // desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 success: (res) => { let that = this; var iv = res.iv; var encryptedData = res.encryptedData; - + // console.log(res,"数据"); + // return Http.post({ url: config.api.getUserInfo, data: { @@ -243,7 +252,6 @@ Page({ iv: iv } }).then(res => { - if (app.globalData.type == 'gm' && that.data.id && that.data.gameId && that.data.url) {//游戏页面 app.globalData.skipUrl = '/pages/game/index?url=' + that.data.url + "&id=" + that.data.id + "&gameId=" + that.data.gameId, app.globalData.skip = 'redirectTo' @@ -433,7 +441,13 @@ Page({ app.globalData.skipUrl = '/index/searchbar', app.globalData.skip = 'redirectTo' that.judgePhonelngo() - } else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag) { + } else if (that.data.fromflag == 'confirmation' && that.data.confirmationFlag) { + //订单确认 confirmation + app.globalData.skipUrl = `/pages/coupon/confirmation/confirmation?couponChannelId=${that.data.confirmationFlag}`, + app.globalData.skip = 'redirectTo' + that.judgePhonelngo() + } + else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag) { app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelIdflag}`, app.globalData.skip = 'redirectTo' that.judgePhonelngo() diff --git a/project.config.json b/project.config.json index 7f21281..d011720 100644 --- a/project.config.json +++ b/project.config.json @@ -4,17 +4,19 @@ "es6": true, "newFeature": false, "postcss": false, - "mockUpdate": false, + "mockUpdate": true, "minified": false, "autoPush": false, "scripts": false, - "mockLogin": false + "mockLogin": false, + "autoCompile": true, + "localPlugins": false }, "appid": "ttde7ca8c141425a2301", "projectname": "tt富茂C", "condition": { "miniprogram": { - "current": 1649905362371, + "current": -1, "list": [ { "id": 1650610427387,