diff --git a/pages/mine/coupon/my-coupon.vue b/pages/mine/coupon/my-coupon.vue index b75e6d6..5d1994f 100644 --- a/pages/mine/coupon/my-coupon.vue +++ b/pages/mine/coupon/my-coupon.vue @@ -82,7 +82,8 @@ import { saveOrder, getOrderList, - prepayment + prepayment, + getMemberCoupon } from '@/api/business/member.js' import { toast @@ -127,7 +128,6 @@ }, onLoad(option) { this.menuIndex = option.index || 0 - this.coupon = option.coupon || 0 this.initCoupon(); this.initOrder() //获取url中的search @@ -143,9 +143,10 @@ let that = this getWebAccessTokenAndOpenid(result.code).then(res => { that.$store.dispatch('GzhLogin', res).then(() => { - this.initCoupon(); - this.initOrder() + that.initCoupon(); + that.initOrder() that.loginSuccess() + that.initMyCoupon() }).catch((e) => { uni.showToast({ icon: 'error', @@ -159,7 +160,17 @@ } } }, + onShow(){ + if (getToken()){ + this.initMyCoupon() + } + }, methods: { + initMyCoupon(){ + getMemberCoupon().then(res=>{ + this.coupon = res.data + }) + }, openVip() { // 在你想触发跳转的地方 wx.openOfficialAccountProfile({