From 81127f978cec1b4b9e0b03cba46d6ce31cc929a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=99=96?= Date: Mon, 18 Feb 2019 15:47:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E8=B5=A0=E9=A2=86=E5=8F=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 2 +- config/config.js | 13 +++++- pages/ConsumeDetail/ConsumeDetail.js | 6 +-- pages/coupon/detail/index.js | 68 ++++++++++++++++++++++++++-- pages/coupon/detail/index.wxml | 13 ++++-- pages/coupon/detail/index.wxss | 17 +++++++ pages/getuserinfo/index.js | 5 +- pages/index/index.js | 12 ++--- 8 files changed, 116 insertions(+), 20 deletions(-) diff --git a/app.json b/app.json index ee35fd2..3ecb17f 100644 --- a/app.json +++ b/app.json @@ -82,7 +82,7 @@ ] }, "window": { - "backgroundTextStyle": "red", + "backgroundTextStyle": "dark", "navigationBarBackgroundColor": "#02C0FF", "navigationBarTitleText": "", "navigationBarTextStyle": "white" diff --git a/config/config.js b/config/config.js index 54bdd9c..6dce31a 100755 --- a/config/config.js +++ b/config/config.js @@ -4,7 +4,8 @@ var config = { url: "https://ciformall.youlane.cn/C/api", // url:"https://c.malls.iformall.com/C/api", // url:'https://ctest.malls.iformall.com/C/api', - // url:'http://10.100.33.70:7000/C/api', + // url: 'http://10.100.33.70:7000/C/api', + // url:'http://10.100.35.202:7000/C/api', // url: 'http://202.165.179.86:4000/C/api', api: { /** @@ -215,7 +216,15 @@ var config = { /** * */ - getPressOrderStatus:"/press/getPressOrderStatus" + getPressOrderStatus:"/press/getPressOrderStatus", + /** + * 查询转赠卡状态 + */ + queryCardStatus:"/couponOrder/queryCardStatus", + /** + * 领取转赠卡 + */ + cardAccept:'/couponOrder/cardAccept' }, weapp: { AppId: "wxea71200db93d756b" diff --git a/pages/ConsumeDetail/ConsumeDetail.js b/pages/ConsumeDetail/ConsumeDetail.js index 2b1b381..0cf79bd 100644 --- a/pages/ConsumeDetail/ConsumeDetail.js +++ b/pages/ConsumeDetail/ConsumeDetail.js @@ -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 + '&userName=' + this.data.userName + '&avatarUrl=' + this.data.avatarUrl, + 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 + '&couponOrderId=' + this.data.cardDetail.id, imageUrl: this.data.cardDetail.coverImg, success: function (res) { // 转发成功 @@ -155,8 +155,8 @@ Page({ .then(res => { console.log(res) that.setData({ - userName: res.data.name, - avatarUrl: res.data.avatarUrl, + userName: res.data.nickName, + avatarUrl: res.data.avatarUrl }) }) }, diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 49a592c..7dd713b 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -49,7 +49,10 @@ Page({ display: "none", showbutton: false, cardData:null, - showCardOffer:false + showCardOffer:false, + isSamePeople:true, + statusText:'', + isReceived:false }, phone: function (e) { let that = this; @@ -57,8 +60,66 @@ Page({ phoneNumber: e.target.dataset.merchantlinkphone }); }, + //获取当前登录用户信息 + getUserInfo: function () { + let that = this; + // 获取用户信息 + Http.get({ + url: config.api.getScore, + data: {} + }) + .then(res => { + console.log(res) + that.getQueryCardStatus() + if (that.data.cardData.cuserId != res.data.id){ + console.log(2222,6666) + that.setData({ + isSamePeople:false + }) + } + }) + }, + //获取卡转赠状态 + getQueryCardStatus(){ + let that = this; + let param={ + id: this.data.cardData.couponOrderId, + couponId: this.data.cardData.couponChannelId, + cUserId: this.data.cardData.cuserId + } + Http.get({ + url: config.api.queryCardStatus, + data: param + }) + .then(res => { + console.log(res,333333333333) + }) + .catch(err => { + that.setData({ + isReceived: true, + statusText: err.message + }) + }) + + }, receiveCard(){ - + let param = { + id: this.data.cardData.couponOrderId, + cUserId: this.data.cardData.cuserId + } + Http.post({ + url: config.api.cardAccept, + data: param + }) + .then(res => { + console.log(res, 333333333333) + wx.showToast({ + title: '领取成功!', + icon: 'none', + duration: 2000, + mask: false + }); + }) }, closeAlert(){ this.setData({ @@ -247,7 +308,7 @@ Page({ cardData:options }) console.log(options,22222222222) - // this.getUserInfo() + this.getUserInfo() } that.setData({ couponChannelId: options.couponChannelId, @@ -378,6 +439,7 @@ Page({ }) .then(res => { console.log(666,'授权成功!') + that.receiveCard() }) .catch(err => { if (err.code == 11005) { diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index 95ccd8f..9252447 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -133,8 +133,15 @@ - {{cardData.userName+'送您一张消费卡'}} - - + {{cardData.userName}} + {{cardData.userName+'送您一张消费卡'}} + 等待好友领取 + {{cardData.userName}} + + + {{statusText}} + + + \ No newline at end of file diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index e801988..d76fc03 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -593,6 +593,7 @@ button::after{ border: none; } line-height:44rpx; } .a-img{ + position: relative; width: 80%; border-radius: 20rpx; height: 294rpx; @@ -600,6 +601,22 @@ button::after{ border: none; } text-align: center; margin: 30rpx auto 0; } +.a-received{ + position: absolute; + width: 100%; + height: 294rpx; + top: 0; + left: 0; + text-align: center; + line-height: 294rpx; + z-index: 320; + background:rgba(255,255,255,1); + border:0px solid rgba(151,57,117,1); + opacity:0.91; + font-size:36rpx; + color:rgba(255,51,50,1); + font-family:PingFang-SC-Medium; +} .a-img image{ width: 100%; height: 100%; diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js index e0551f7..d7eb2ef 100755 --- a/pages/getuserinfo/index.js +++ b/pages/getuserinfo/index.js @@ -30,7 +30,8 @@ Page({ cuserId: options.cuserId, coverImg: options.coverImg, userName: options.userName, - avatarUrl: options.avatarUrl + avatarUrl: options.avatarUrl, + couponOrderId: options.couponOrderId }) } if (options.path == 'index') { @@ -88,7 +89,7 @@ Page({ * 来自转赠 */ 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}` + 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}couponOrderId=${that.data.couponOrderId}` }); } else if (that.data.orderId) { wx.navigateTo({ diff --git a/pages/index/index.js b/pages/index/index.js index f3bc31f..1afd576 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -37,7 +37,7 @@ Page({ /** * 转赠判断 */ - that.userLogin(options.couponChannelId, options.couponId, null, options.cuserId, options.coverImg, options.userName, options.avatarUrl); + that.userLogin(options.couponChannelId, options.couponId, null, options.cuserId, options.coverImg, options.userName, options.avatarUrl, options.couponOrderId); }else{ that.userLogin(options.couponChannelId, options.couponId, options.orderId); } @@ -45,7 +45,7 @@ Page({ that.userLogin() } }, - checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl) { + checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl, couponOrderId) { let that = this; Http.post({ url: config.api.checkUserStatus, @@ -61,7 +61,7 @@ Page({ * 转赠判断 */ wx.redirectTo({ - url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}&userName=${userName}&avatarUrl=${avatarUrl}`, + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}&userName=${userName}&avatarUrl=${avatarUrl}&couponOrderId=${couponOrderId}`, }) } else if (orderId) { wx.redirectTo({ @@ -85,7 +85,7 @@ Page({ * 转赠判断 */ wx.redirectTo({ - url: `/pages/getuserinfo/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}&userName=${userName}&avatarUrl=${avatarUrl}` + url: `/pages/getuserinfo/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}&userName=${userName}&avatarUrl=${avatarUrl}&couponOrderId=${couponOrderId}` }); } else if (orderId) { wx.redirectTo({ @@ -102,7 +102,7 @@ Page({ /** * 用户登录 */ - userLogin: function (couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl) { + userLogin: function (couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl, couponOrderId) { var that = this; // 登录 wx.login({ @@ -145,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, userName, avatarUrl); + that.checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg, userName, avatarUrl, couponOrderId); }else{ that.checkuerstatus(); }