|
|
@@ -165,7 +165,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="coupon-btn-box">
|
|
|
- <view class="coupon-btns" @click="handleReceiveCoupon">立即领取</view>
|
|
|
+ <button class="coupon-btns" :loading="receiveLoading" @click="handleReceiveCoupon">立即领取</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="coupon-close" @click="handleCloseCoupon">
|
|
|
@@ -217,7 +217,8 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
myCouponObj: {},
|
|
|
- query: []
|
|
|
+ query: [],
|
|
|
+ receiveLoading: false
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
@@ -236,14 +237,11 @@ export default {
|
|
|
this.getCoupon()
|
|
|
// 获取推荐数据
|
|
|
this.getRanking()
|
|
|
- // 获取优惠券
|
|
|
- if(this.query.shareType === 'COUPON') {
|
|
|
- this.showCoupons()
|
|
|
- }
|
|
|
},
|
|
|
onLoad(query) {
|
|
|
// 静默登录
|
|
|
this.query = query
|
|
|
+ console.log('参数', query)
|
|
|
// 1. 获取URL中的code和state参数
|
|
|
const urlParams = new URLSearchParams(window.location.search)
|
|
|
const code = urlParams.get('code')
|
|
|
@@ -258,6 +256,10 @@ export default {
|
|
|
window.location.replace(targetUrl)
|
|
|
}
|
|
|
if (query.code) this.onLogin(query.code)
|
|
|
+ // 获取优惠券
|
|
|
+ if(query.shareType === 'COUPON' && query.shareContentId) {
|
|
|
+ this.showCoupons()
|
|
|
+ }
|
|
|
|
|
|
// uni.setStorageSync('wx_copenid', 'o-HEJ6VP2YNi0HPeLaIHCQsQD69s')
|
|
|
// uni.setStorageSync('access-token', 'eyJhbGciOiJIUzUxMiJ9.eyJ0ZjoiOiJlNGNiNjY0ZS05Y2Q5LTRlOWItODU1Yy0zN2RlNjRiOGI3ZDIifQ.xj0ZBULLc7wYOaUgDQd_zbeynbJ8M3M-UQM6JPUKcV9rIWVlax8dJnU247om39nialcKnklKFZ8m8oerc-NY0A')
|
|
|
@@ -284,9 +286,12 @@ export default {
|
|
|
},
|
|
|
// 领取优惠券
|
|
|
handleReceiveCoupon() {
|
|
|
+ this.receiveLoading = true
|
|
|
+ if (!this.$utils.checkLogin({ type: 'modal' })) return;
|
|
|
receiveCoupon({
|
|
|
...this.myCouponObj
|
|
|
}).then(res => {
|
|
|
+ this.receiveLoading = false
|
|
|
if(res.data.code == 200) {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.popup.close()
|