| @@ -72,7 +72,7 @@ Page({ | |||
| let _this = this; | |||
| return { | |||
| title: '领取卡', | |||
| path: '/pages/index/index?couponChannelId=' + this.data.cardDetail.couponChannelId + '&cuserId=' + this.data.cardDetail.cuserId + '&couponId=' + this.data.cardDetail.couponId + '&coverImg' + this.data.cardDetail.coverImg, | |||
| path: '/pages/index/index?couponChannelId=' + this.data.cardDetail.couponChannelId + '&cuserId=' + this.data.cardDetail.cuserId + '&couponId=' + this.data.cardDetail.couponId + '&coverImg=' + this.data.cardDetail.coverImg + '&userName=' + this.data.userName + '&avatarUrl=' + this.data.avatarUrl, | |||
| imageUrl: this.data.cardDetail.coverImg, | |||
| success: function (res) { | |||
| // 转发成功 | |||
| @@ -145,6 +145,21 @@ Page({ | |||
| }); | |||
| }) | |||
| }, | |||
| getUserInfo: function () { | |||
| let that = this; | |||
| // 获取用户信息 | |||
| Http.get({ | |||
| url: config.api.getScore, | |||
| data: {} | |||
| }) | |||
| .then(res => { | |||
| console.log(res) | |||
| that.setData({ | |||
| userName: res.data.name, | |||
| avatarUrl: res.data.avatarUrl, | |||
| }) | |||
| }) | |||
| }, | |||
| cardDetail: function(couponOrderId) { | |||
| let that = this; | |||
| Http.get({ | |||
| @@ -162,6 +177,12 @@ Page({ | |||
| cardDetail: res.data, | |||
| supportTransfer: res.data.supportTransfer | |||
| }) | |||
| /** | |||
| * 若可转赠获取用户头像信息 | |||
| */ | |||
| if (res.data.supportTransfer){ | |||
| that.getUserInfo() | |||
| } | |||
| if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length<=4){ | |||
| that.setData({ | |||
| height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx', | |||
| @@ -12,6 +12,7 @@ Page({ | |||
| quesGouUrl: imgurl.ques_gou.url, | |||
| headbgUrl: imgurl.headbg.url, | |||
| quesBgUrl: imgurl.ques_bg.url, | |||
| close02: imgurl.close02.url, | |||
| data: { | |||
| title: null | |||
| }, | |||
| @@ -46,7 +47,9 @@ Page({ | |||
| queueData: null, | |||
| zIndex: 11, | |||
| display: "none", | |||
| showbutton: false | |||
| showbutton: false, | |||
| cardData:null, | |||
| showCardOffer:false | |||
| }, | |||
| phone: function (e) { | |||
| let that = this; | |||
| @@ -54,6 +57,14 @@ Page({ | |||
| phoneNumber: e.target.dataset.merchantlinkphone | |||
| }); | |||
| }, | |||
| receiveCard(){ | |||
| }, | |||
| closeAlert(){ | |||
| this.setData({ | |||
| showCardOffer:false | |||
| }) | |||
| }, | |||
| goback: function () { | |||
| wx.switchTab({ | |||
| url: '/pages/login/index', | |||
| @@ -219,6 +230,9 @@ Page({ | |||
| d1: sec | |||
| } | |||
| }, | |||
| /** | |||
| * 获取用户信息 | |||
| */ | |||
| onLoad(options) { | |||
| let that = this; | |||
| wx.showLoading({ | |||
| @@ -228,7 +242,12 @@ Page({ | |||
| * 转赠判断 | |||
| */ | |||
| if (options.cuserId){ | |||
| this.setData({ | |||
| showCardOffer:true, | |||
| cardData:options | |||
| }) | |||
| console.log(options,22222222222) | |||
| // this.getUserInfo() | |||
| } | |||
| that.setData({ | |||
| couponChannelId: options.couponChannelId, | |||
| @@ -348,6 +367,43 @@ Page({ | |||
| } | |||
| }) | |||
| }, | |||
| /** | |||
| * | |||
| */ | |||
| checkPhoneStatus: function () { | |||
| let that = this; | |||
| Http.post({ | |||
| url: config.api.checkPhoneStatus, | |||
| data: {} | |||
| }) | |||
| .then(res => { | |||
| console.log(666,'授权成功!') | |||
| }) | |||
| .catch(err => { | |||
| if (err.code == 11005) { | |||
| // 用户手机未授权 | |||
| /** | |||
| * 将值传到用户手机号授权的页面 | |||
| * | |||
| */ | |||
| wx.redirectTo({ | |||
| url: "/pages/getphoneInfo/index?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&couponId=" + that.data.cardData.couponId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl, | |||
| }); | |||
| } else if (err.code == 11006) { | |||
| // 用户手机已加密 | |||
| wx.redirectTo({ | |||
| url: "/pages/phoneinput/phoneinput?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&couponId=" + that.data.cardData.couponId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl, | |||
| }); | |||
| } else { | |||
| wx.showToast({ | |||
| title: err.message, | |||
| icon: 'none', | |||
| duration: 2000, | |||
| mask: false | |||
| }); | |||
| } | |||
| }) | |||
| }, | |||
| /** | |||
| * 发起支付 | |||
| */ | |||
| @@ -128,4 +128,13 @@ | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <!-- 卡转赠领取弹出框 --> | |||
| <view class='shaddow' bindtap='closeAlert' wx:if='{{showCardOffer}}'></view> | |||
| <view class='alert-box' wx:if='{{showCardOffer}}'> | |||
| <view class='user-img'><image src='{{cardData.avatarUrl}}'></image></view> | |||
| <view class='close' bindtap='closeAlert'><image src='{{close02}}'></image></view> | |||
| <view class='a-title'>{{cardData.userName+'送您一张消费卡'}}</view> | |||
| <view class='a-img'><image src='{{cardData.coverImg}}'></image></view> | |||
| <button type="primary" class='support-tansfer' bindtap='checkPhoneStatus'>领取</button> | |||
| </view> | |||
| </view> | |||
| @@ -527,3 +527,80 @@ button::after{ border: none; } | |||
| background:rgba(236,59,45,1); | |||
| box-shadow:0px 8px 8px 1px rgba(246,93,51,0.32); | |||
| } | |||
| .support-tansfer{ | |||
| width: 60%; | |||
| border-radius: 50rpx; | |||
| margin-top: 30rpx; | |||
| background: #02C0FF!important; | |||
| } | |||
| .shaddow{ | |||
| z-index: 100; | |||
| position:fixed; | |||
| width:100%; | |||
| height:100%; | |||
| top:0px; | |||
| background:rgba(0,0,0,0.8); | |||
| overflow:hidden; | |||
| } | |||
| .alert-box{ | |||
| position: fixed; | |||
| top: 200rpx; | |||
| left: 10%; | |||
| width: 80%; | |||
| height: auto; | |||
| padding-bottom: 20rpx; | |||
| background: #fff; | |||
| z-index: 200; | |||
| border-radius: 20rpx; | |||
| } | |||
| .user-img{ | |||
| position: absolute; | |||
| top: -50rpx; | |||
| left: 250rpx; | |||
| /* margin-left: -50rpx; */ | |||
| width: 100rpx; | |||
| height: 100rpx; | |||
| z-index: 300; | |||
| border-radius: 50rpx; | |||
| background: #fff; | |||
| overflow: hidden; | |||
| } | |||
| .user-img image{ | |||
| width: 100rpx; | |||
| height: 100rpx; | |||
| } | |||
| .close{ | |||
| position: absolute; | |||
| z-index: 300; | |||
| right: 26rpx; | |||
| top: 26rpx; | |||
| width: 26rpx; | |||
| height: 26rpx; | |||
| overflow: hidden; | |||
| } | |||
| .close image{ | |||
| display: block; | |||
| width: 26rpx; | |||
| height: 26rpx; | |||
| } | |||
| .a-title{ | |||
| text-align: center; | |||
| margin-top: 76rpx; | |||
| font-size:36rpx; | |||
| font-family:PingFang-SC-Medium; | |||
| font-weight:500; | |||
| color:rgba(51,51,51,1); | |||
| line-height:44rpx; | |||
| } | |||
| .a-img{ | |||
| width: 80%; | |||
| border-radius: 20rpx; | |||
| height: 294rpx; | |||
| overflow: hidden; | |||
| text-align: center; | |||
| margin: 30rpx auto 0; | |||
| } | |||
| .a-img image{ | |||
| width: 100%; | |||
| height: 100%; | |||
| } | |||
| @@ -64,13 +64,13 @@ Page({ | |||
| /** | |||
| * fromId若存在来自卡转赠 | |||
| */ | |||
| if (that.path == 'index' && !that.data.paramData.fromId) { | |||
| if (that.path == 'index' && !that.data.paramData.cuserId) { | |||
| wx.redirectTo({ | |||
| url: "/pages/game/index?url=" + that.data.paramData.url + "&id=" + that.data.paramData.id + "&gameId=" + that.data.paramData.gameId, | |||
| }) | |||
| } else if (that.path == 'index' && that.data.paramData.fromId){ | |||
| wx.redirectTo({ | |||
| url: "pages/discountCardList/discountCardList?fromId=" + that.data.paramData.fromId | |||
| } else if (that.path == 'index' && that.data.paramData.cuserId){ | |||
| wx.reLaunch({ | |||
| url: "/pages/coupon/detail/index?cuserId=" + that.data.paramData.cuserId + '&couponChannelId='+that.data.paramData.couponChannelId + '&couponId=' + that.data.paramData.couponId + '&coverImg=' +that.data.paramData.coverImg + '&avatarUrl=' + that.data.paramData.avatarUrl + '&userName=' +that.data.paramData.userName | |||
| }) | |||
| } else { | |||
| wx.showToast({ | |||
| @@ -7,16 +7,32 @@ Page({ | |||
| path:null, | |||
| couponChannelId: null, | |||
| couponId:null, | |||
| cuserId:null, | |||
| coverImg:null | |||
| }, | |||
| onLoad: function(options) { | |||
| var that = this; | |||
| if (options.couponChannelId && options.couponId||options.orderId) { | |||
| if (options.couponChannelId && options.couponId && !options.cuserId||options.orderId) { | |||
| that.setData({ | |||
| couponChannelId: options.couponChannelId, | |||
| couponId: options.couponId, | |||
| orderId:options.orderId | |||
| }) | |||
| } | |||
| /** | |||
| * 来自转赠 | |||
| */ | |||
| if (options.couponChannelId && options.cuserId){ | |||
| console.log(1231231231) | |||
| that.setData({ | |||
| couponChannelId: options.couponChannelId, | |||
| couponId: options.couponId, | |||
| cuserId: options.cuserId, | |||
| coverImg: options.coverImg, | |||
| userName: options.userName, | |||
| avatarUrl: options.avatarUrl | |||
| }) | |||
| } | |||
| if (options.path == 'index') { | |||
| that.path = options.path | |||
| } | |||
| @@ -63,11 +79,18 @@ Page({ | |||
| }); | |||
| } else { | |||
| //返回主页 | |||
| if (that.data.couponChannelId && that.data.couponId) { | |||
| if (that.data.couponChannelId && that.data.couponId && !that.data.cuserId) { | |||
| wx.navigateTo({ | |||
| url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.couponId}` | |||
| }); | |||
| } else if (that.data.orderId) { | |||
| } else if (that.data.couponChannelId && that.data.couponId && that.data.cuserId) { | |||
| /** | |||
| * 来自转赠 | |||
| */ | |||
| wx.reLaunch({ | |||
| url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.couponId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}` | |||
| }); | |||
| } else if (that.data.orderId) { | |||
| wx.navigateTo({ | |||
| url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.orderId}&from=${"friend"}` | |||
| }); | |||
| @@ -13,6 +13,7 @@ Page({ | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function(options) { | |||
| console.log(options) | |||
| let that = this; | |||
| wx.showToast({ | |||
| title: '加载中', | |||
| @@ -36,7 +37,7 @@ Page({ | |||
| /** | |||
| * 转赠判断 | |||
| */ | |||
| that.userLogin(options.couponChannelId, options.couponId, null, options.cuserId, options.coverImg); | |||
| that.userLogin(options.couponChannelId, options.couponId, null, options.cuserId, options.coverImg, options.userName, options.avatarUrl); | |||
| }else{ | |||
| that.userLogin(options.couponChannelId, options.couponId, options.orderId); | |||
| } | |||
| @@ -44,7 +45,7 @@ Page({ | |||
| that.userLogin() | |||
| } | |||
| }, | |||
| checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg) { | |||
| checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl) { | |||
| let that = this; | |||
| Http.post({ | |||
| url: config.api.checkUserStatus, | |||
| @@ -60,7 +61,7 @@ Page({ | |||
| * 转赠判断 | |||
| */ | |||
| wx.redirectTo({ | |||
| url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}`, | |||
| url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}&userName=${userName}&avatarUrl=${avatarUrl}`, | |||
| }) | |||
| } else if (orderId) { | |||
| wx.redirectTo({ | |||
| @@ -75,10 +76,17 @@ Page({ | |||
| .catch(err => { | |||
| if (err.code == 11004) { | |||
| // 用户昵称未授权 | |||
| if (couponChannelId && couponId) { | |||
| if (couponChannelId && couponId && !cuserId) { | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?couponChannelId=${couponChannelId}&couponId=${couponId}` | |||
| }); | |||
| } else if (couponChannelId && couponId && cuserId){ | |||
| /** | |||
| * 转赠判断 | |||
| */ | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}&userName=${userName}&avatarUrl=${avatarUrl}` | |||
| }); | |||
| } else if (orderId) { | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?orderId=${orderId}&from='${"discount"}` | |||
| @@ -94,7 +102,7 @@ Page({ | |||
| /** | |||
| * 用户登录 | |||
| */ | |||
| userLogin: function (couponChannelId, couponId, orderId, cuserId) { | |||
| userLogin: function (couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl) { | |||
| var that = this; | |||
| // 登录 | |||
| wx.login({ | |||
| @@ -137,7 +145,7 @@ Page({ | |||
| app.globalData.token = res.data.token; | |||
| Http.setToken(res.data.token); | |||
| if (couponChannelId&&couponId || orderId){ | |||
| that.checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg); | |||
| that.checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl); | |||
| }else{ | |||
| that.checkuerstatus(); | |||
| } | |||
| @@ -51,11 +51,11 @@ Page({ | |||
| }) | |||
| }else{ | |||
| /** | |||
| * fromId若存在来自卡转赠 | |||
| * cuserId若存在来自卡转赠 | |||
| */ | |||
| if (this.data.paramData.fromId){ | |||
| wx.redirectTo({ | |||
| url: "pages/discountCardList/discountCardList?fromId=" + that.data.paramData.fromId | |||
| if (this.data.paramData.cuserId){ | |||
| wx.reLaunch({ | |||
| url: "/pages/coupon/detail/index?cuserId=" + that.data.paramData.cuserId + '&couponChannelId=' + + that.data.paramData.couponChannelId + '&couponId=' + + that.data.paramData.couponId + '&coverImg=' + + that.data.paramData.coverImg + '&avatarUrl=' + + that.data.paramData.avatarUrl + '&userName=' + + that.data.paramData.userName | |||
| }) | |||
| }else{ | |||
| wx.redirectTo({ | |||
| @@ -348,4 +348,8 @@ module.exports = { | |||
| 'url': baseUrl + 'weixin-title.png', | |||
| 'name': '微信图标' | |||
| }, | |||
| 'close02': { | |||
| 'url': baseUrl + 'close02.png', | |||
| 'name': '关闭图标' | |||
| }, | |||
| } | |||