|
@@ -204,25 +204,6 @@ export default {
|
|
this.$util.msg(error.msg, 2000)
|
|
this.$util.msg(error.msg, 2000)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- toPayCoupon(coupon) {
|
|
|
|
- // 点击购买优惠券,友盟埋点收集购买优惠券
|
|
|
|
- if (process.env.NODE_ENV != 'development') {
|
|
|
|
- this.$uma.trackEvent('Um_Event_userCouponCollectionBuy', {
|
|
|
|
- Um_Key_PageName: '领券中心',
|
|
|
|
- Um_Key_EvenName: '购买优惠券',
|
|
|
|
- Um_Key_CouponId: `${coupon.couponId}`,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if (this.hasLogin) {
|
|
|
|
- if (this.userIdentity === 1 || this.userIdentity === 3) {
|
|
|
|
- this.$util.msg('您的身份暂不支持领取优惠券', 2000)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- this.MiniWxPayFor(coupon)
|
|
|
|
- } else {
|
|
|
|
- this.$api.navigateTo('/pages/login/login')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
receiveCoupon(coupon) {
|
|
receiveCoupon(coupon) {
|
|
// 点击优惠券领取按钮,友盟埋点收集领取优惠券
|
|
// 点击优惠券领取按钮,友盟埋点收集领取优惠券
|
|
if (process.env.NODE_ENV != 'development') {
|
|
if (process.env.NODE_ENV != 'development') {
|
|
@@ -289,31 +270,65 @@ export default {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async MiniWxPayFor(coupon) {
|
|
|
|
|
|
+ toPayCoupon(coupon) {
|
|
|
|
+ // 点击购买优惠券,友盟埋点收集购买优惠券
|
|
|
|
+ if (process.env.NODE_ENV != 'development') {
|
|
|
|
+ this.$uma.trackEvent('Um_Event_userCouponCollectionBuy', {
|
|
|
|
+ Um_Key_PageName: '领券中心',
|
|
|
|
+ Um_Key_EvenName: '购买优惠券',
|
|
|
|
+ Um_Key_CouponId: `${coupon.couponId}`,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (this.hasLogin) {
|
|
|
|
+ if (this.userIdentity === 1 || this.userIdentity === 3) {
|
|
|
|
+ this.$util.msg('您的身份暂不支持领取优惠券', 2000)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.createCouponRecord(coupon)
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ this.$api.navigateTo('/pages/login/login')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ createCouponRecord(coupon){
|
|
|
|
+ // 生成购买优惠券记录Id
|
|
|
|
+ this.PayService.WeChatCouponRecord({
|
|
|
|
+ userId: this.listQuery.userId,
|
|
|
|
+ couponId: coupon.couponId
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.MiniWxPayFor(coupon,response.data.couponRecordId)
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ console.log(error)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ async MiniWxPayFor(coupon,couponRecordId) {
|
|
const wechatcode = await authorize.getCode('weixin')
|
|
const wechatcode = await authorize.getCode('weixin')
|
|
this.PayService.WeChatCouponMiniWxPay({
|
|
this.PayService.WeChatCouponMiniWxPay({
|
|
userId: this.listQuery.userId,
|
|
userId: this.listQuery.userId,
|
|
couponId: coupon.couponId,
|
|
couponId: coupon.couponId,
|
|
|
|
+ couponRecordId:couponRecordId,
|
|
payWay: 'WEIXIN',
|
|
payWay: 'WEIXIN',
|
|
code: wechatcode,
|
|
code: wechatcode,
|
|
source: 1 //支付来源 1 小程序 2 WWW
|
|
source: 1 //支付来源 1 小程序 2 WWW
|
|
})
|
|
})
|
|
- .then(response => {
|
|
|
|
- // 友盟埋点收集微信支付
|
|
|
|
- if (process.env.NODE_ENV != 'development') {
|
|
|
|
- this.$uma.trackEvent('Um_Event_userCouponCollectionPay', {
|
|
|
|
- Um_Key_PageName: '领券中心',
|
|
|
|
- Um_Key_SourcePage: '线上支付优惠券',
|
|
|
|
- Um_Key_CouponId: `${coupon.couponId}`,
|
|
|
|
- Um_Key_userId: `${this.userId}`
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- let PayInfo = JSON.parse(response.data.data.payInfo)
|
|
|
|
- this.WxRequestPayment(PayInfo)
|
|
|
|
- })
|
|
|
|
- .catch(error => {
|
|
|
|
- this.$util.msg(error.msg, 2000)
|
|
|
|
- })
|
|
|
|
|
|
+ .then(response => {
|
|
|
|
+ // 友盟埋点收集微信支付
|
|
|
|
+ if (process.env.NODE_ENV != 'development') {
|
|
|
|
+ this.$uma.trackEvent('Um_Event_userCouponCollectionPay', {
|
|
|
|
+ Um_Key_PageName: '领券中心',
|
|
|
|
+ Um_Key_SourcePage: '线上支付优惠券',
|
|
|
|
+ Um_Key_CouponId: `${coupon.couponId}`,
|
|
|
|
+ Um_Key_userId: `${this.userId}`
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ let PayInfo = JSON.parse(response.data.data.payInfo)
|
|
|
|
+ this.WxRequestPayment(PayInfo)
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$util.msg(error.msg, 2000)
|
|
|
|
+ })
|
|
},
|
|
},
|
|
WxRequestPayment(data) {
|
|
WxRequestPayment(data) {
|
|
let self = this
|
|
let self = this
|