diff --git a/index/passCar.js b/index/passCar.js index 4e728e2..ac38fe7 100644 --- a/index/passCar.js +++ b/index/passCar.js @@ -253,8 +253,17 @@ Page({ }, gotomange: function () { - wx.navigateTo({ - url: '/pages/managelicenseplate/managelicenseplate', + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + wx.navigateTo({ + url: '/pages/managelicenseplate/managelicenseplate', + }) + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=passCar`, + }) }) }, bindfail: function (res) { @@ -283,14 +292,32 @@ Page({ } }, showquan: function () { - wx.navigateTo({ - url: '/pages/passCar/couponList/couponList', + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + wx.navigateTo({ + url: '/pages/passCar/couponList/couponList', + }) + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=passCar`, + }) }) }, showList: function () { - wx.navigateTo({ - url: '/pages/passCar/showList/showList', + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + wx.navigateTo({ + url: '/pages/passCar/showList/showList', + }) + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=passCar`, + }) }) }, @@ -302,66 +329,79 @@ Page({ }) }, onShow: function (options) { - this.setData({ - goHomeUrl: app.globalData.goHomeUrl - }) - if (typeof this.getTabBar === 'function' && - this.getTabBar()) { - this.getTabBar().setData({ - selected: 2 - }) - } var that = this; - that.setData({ - etcpAppId: extConfig.attr.car.etcp.etcpAppId, - carMiniVersion: extConfig.attr.car.version, - etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, - payPath: extConfig.attr.car.etcp.payPath, - ifHaveCarModular: extConfig.attr.ifHaveCarModular - }) - console.log(this.data.ifHaveCarModular, 'ifHaveCarModular'); - if (app.globalData.token) { - that.getList(); - that.init(); - } else { - that.init(); - } - /** - * 只有用户选择了优惠券 - * 才会进行券和车牌的绑定 - */ - /* if (wx.getStorageSync("chosed") && that.data.quanid) { - that.getStopFee(that.data.listCardNum); - that.bindCoupon(that.data.quanid); - wx.setStorage({ - key: 'chosed', - data: '', + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + this.setData({ + goHomeUrl: app.globalData.goHomeUrl }) - }; */ - if (app.globalData.token) { - // that.initUsrCarList(); - that.initUsrCarList("flags"); + if (typeof this.getTabBar === 'function' && + this.getTabBar()) { + this.getTabBar().setData({ + selected: 2 + }) + } + that.setData({ - current: 0 + etcpAppId: extConfig.attr.car.etcp.etcpAppId, + carMiniVersion: extConfig.attr.car.version, + etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, + payPath: extConfig.attr.car.etcp.payPath, + ifHaveCarModular: extConfig.attr.ifHaveCarModular }) - } - - if (that.data.addCar) { - // 绑车牌 - if (app.globalData.carLogin) { - that.bindCar(that.data.addCar); + console.log(this.data.ifHaveCarModular, 'ifHaveCarModular'); + if (app.globalData.token) { + that.getList(); + that.init(); } else { - that.bindCar(that.data.addCar); + that.init(); + } + /** + * 只有用户选择了优惠券 + * 才会进行券和车牌的绑定 + */ + /* if (wx.getStorageSync("chosed") && that.data.quanid) { + that.getStopFee(that.data.listCardNum); + that.bindCoupon(that.data.quanid); + wx.setStorage({ + key: 'chosed', + data: '', + }) + }; */ + if (app.globalData.token) { + // that.initUsrCarList(); + that.initUsrCarList("flags"); + that.setData({ + current: 0 + }) } - that.setData({ - addCar: null - }); - } - - this.getTicketList(0, 1); - + if (that.data.addCar) { + // 绑车牌 + if (app.globalData.carLogin) { + that.bindCar(that.data.addCar); + } else { + that.bindCar(that.data.addCar); + } + that.setData({ + addCar: null + }); + } + this.getTicketList(0, 1); + }).catch(err => { + that.setData({ + etcpAppId: extConfig.attr.car.etcp.etcpAppId, + carMiniVersion: extConfig.attr.car.version, + etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, + payPath: extConfig.attr.car.etcp.payPath, + ifHaveCarModular: extConfig.attr.ifHaveCarModular + }) + that.initPark(); + that.getParkStatus(); + }) }, cancelMove: function () { console.log(111) @@ -376,39 +416,45 @@ Page({ }) }, onLoad: function (options) { - var that = this; - /** - * 获得分享小程序的 - * title - * desc - */ + Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + /** + * 获得分享小程序的 + * title + * desc + */ + Http.get({ + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) + .then(res => { + let weapNote = JSON.parse(res.data.weapNote); + that.setData({ + desc: weapNote.carpage.desc, + title: weapNote.carpage.title + }) + }) + .catch(err => { + console.log(err); + }) + // 登录 + var scene = decodeURIComponent(options.scene); + that.setData({ + scene: scene + }); + if (app.globalData.token) { } else { + // app.getLocation(); + that.userLogin() } + }).catch(err => { + return }) - .then(res => { - let weapNote = JSON.parse(res.data.weapNote); - that.setData({ - desc: weapNote.carpage.desc, - title: weapNote.carpage.title - }) - }) - .catch(err => { - console.log(err); - }) - // 登录 - var scene = decodeURIComponent(options.scene); - that.setData({ - scene: scene - }); - if (app.globalData.token) { } else { - // app.getLocation(); - that.userLogin() - } - }, /** * 用户登录 @@ -499,9 +545,18 @@ Page({ .catch(err => { }) }, jumpToAdd: function () { - wx.navigateTo({ - url: `/pages/addPark/addPark?flags=managepalte` - }); + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + wx.navigateTo({ + url: `/pages/addPark/addPark?flags=managepalte` + }); + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=passCar`, + }) + }) }, passc: function () { wx.navigateTo({ diff --git a/index/user.js b/index/user.js index ea44edb..4af1f2e 100644 --- a/index/user.js +++ b/index/user.js @@ -13,7 +13,6 @@ Page({ * 页面的初始数据 */ data: { - mch_id: mch_id, businessSwitch: businessSwitch, goUrl: "", @@ -63,6 +62,7 @@ Page({ placeholder: '', userAvatarUrl: "", userName: "", + ifSetUserInfo: false }, suerService() { console.log("打开客服") @@ -107,14 +107,25 @@ Page({ url: config.api.checkPhoneStatus, data: {} }).then(res => { + that.setData({ + ifSetUserInfo: true + }) return }).catch(err => { - wx.setStorageSync('ifSetUserInfo', 1) //手机号未授权 - wx.navigateTo({ - url: `/pages/getphoneInfo/index?mineFlag=mine`, + that.setData({ + ifSetUserInfo: false }) + const ifSetUserInfo = wx.getStorageSync('ifSetUserInfo') + if (ifSetUserInfo != 2) { + wx.setStorageSync('ifSetUserInfo', 1) //手机号未授权 + } + + // wx.navigateTo({ + // url: `/pages/getphoneInfo/index?mineFlag=mine`, + // }) }) }, + /* 判断是否授权*/ userAuthorization() { Http.get({ @@ -138,15 +149,27 @@ Page({ * 跳转到成长值的页面 */ gotograde: function () { - wx.navigateTo({ - url: '/pages/czdetail/czdetail', - }) + if (this.data.ifSetUserInfo) { + wx.navigateTo({ + url: '/pages/czdetail/czdetail', + }) + } else { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=mine`, + }) + } }, gotointegralmall: function () { - wx.navigateTo({ - url: '/pages/integralmall/integraHistory/index', - }) + if (this.data.ifSetUserInfo) { + wx.navigateTo({ + url: '/pages/integralmall/integraHistory/index', + }) + } else { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=mine`, + }) + } }, /** @@ -265,11 +288,11 @@ Page({ console.log('cancel'); } if (res.confirm) { - wx.setStorageSync('ifSetUserInfo', 2) // 已完成手机号授权 wx.navigateTo({ url: '/pages3/setUserInfo/index', }) } + wx.setStorageSync('ifSetUserInfo', 2) // 已完成手机号授权 } }) } diff --git a/index/user.wxml b/index/user.wxml index 90a1c06..88d3aaa 100644 --- a/index/user.wxml +++ b/index/user.wxml @@ -13,12 +13,28 @@ - + - + + + + + + + + + +

登录成为会员

+ + +
+ +

{{userName}}

@@ -26,6 +42,7 @@ {{levelName}}
-->
+ @@ -44,11 +61,14 @@ - + + + + - 会员码:{{userId}} + 会员码:{{ifSetUserInfo ? userId : '加入会员查看会员码,享受更多折扣优惠'}} 我的成长值:{{score}} @@ -56,6 +76,7 @@ 更多成长值 + 我的积分:{{credit}} | diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index 7921956..d6dca73 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -231,6 +231,10 @@ Page({ wx.switchTab({ url: '/index/user' }); + } else if (that.data.mineFlag == 'passCar') { + wx.switchTab({ + url: '/index/passCar' + }); } else if (that.data.mineFlag == 'index') { wx.switchTab({ url: app.globalData.goHomeUrl @@ -243,7 +247,7 @@ Page({ wx.navigateTo({ url: `/pages/index/searchbar/detail/index?id=${that.data.id}` }) - } else { + }else { wx.showToast({ title: res.data.msg, icon: "success",