@@ -82,7 +82,7 @@ | |||
] | |||
}, | |||
"window": { | |||
"backgroundTextStyle": "red", | |||
"backgroundTextStyle": "dark", | |||
"navigationBarBackgroundColor": "#02C0FF", | |||
"navigationBarTitleText": "", | |||
"navigationBarTextStyle": "white" | |||
@@ -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" | |||
@@ -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 | |||
}) | |||
}) | |||
}, | |||
@@ -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) { | |||
@@ -133,8 +133,15 @@ | |||
<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 class='a-title' wx:if='{{!isSamePeople&&isReceived}}'>{{cardData.userName}}</view> | |||
<view class='a-title' wx:if='{{!isSamePeople&&!isReceived}}'>{{cardData.userName+'送您一张消费卡'}}</view> | |||
<view class='a-title' wx:if='{{isSamePeople&&!isReceived}}'>等待好友领取</view> | |||
<view class='a-title' wx:if='{{isSamePeople&&isReceived}}'>{{cardData.userName}}</view> | |||
<view class='a-img'> | |||
<image src='{{cardData.coverImg}}'></image> | |||
<view class='a-received' wx:if="{{isReceived}}">{{statusText}}</view> | |||
</view> | |||
<button type="primary" wx:if='{{!isSamePeople&&!isReceived}}' class='support-tansfer' bindtap='checkPhoneStatus'>领取</button> | |||
<button type="primary" wx:if='{{isSamePeople||isReceived}}' class='support-tansfer' bindtap='closeAlert'>关闭</button> | |||
</view> | |||
</view> |
@@ -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%; |
@@ -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({ | |||
@@ -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(); | |||
} | |||