| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { pay } from '@/common/pay.js'; |
| | | import PointsForm from './points'; // 积分选择弹窗 |
| | | export default { |
| | | components: { |
| | |
| | | activityData: {}, |
| | | isOpenPoints: false, // 是否打开积分弹窗 |
| | | validate: false, |
| | | payData: [], // 半屏小程序相关 |
| | | isFirst: false, |
| | | }; |
| | | }, |
| | | props: ['isOpenReg', 'in_radius'], |
| | | |
| | | onLoad() {}, |
| | | onShow() { |
| | | let self = this; |
| | | let options = wx.getEnterOptionsSync(); |
| | | // 从半屏小程序返回时执行 |
| | | if (options.scene == '1038' && self.isFirst == true) { |
| | | self.isFirst = false; |
| | | self.onPayResult(options.referrerInfo.extraData); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | }, |
| | |
| | | } |
| | | }, |
| | | |
| | | // 半屏小程序返回 |
| | | onPayResult(e) { |
| | | let self = this; |
| | | self.loading = false; |
| | | uni.hideLoading(); |
| | | self.isFirst = false; |
| | | if (e.pay_result == 'success') { |
| | | self.paySuccess(self.payData); |
| | | } else { |
| | | if(self.order_id > 0){ |
| | | //兼容重新付款 |
| | | }else{ |
| | | self.payError(self.payData); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | paySuccess(result) { |
| | | let self = this; |
| | | self.showSuccess("支付成功", function() { |
| | | self.$emit('close', 1); |
| | | }) |
| | | |
| | | }, |
| | | payError(result) { |
| | | let self = this; |
| | | self.showSuccess("支付成功", function() { |
| | | self.$emit('close', 2); |
| | | }) |
| | | }, |
| | | |
| | | // 是否使用余额支付 |
| | | onUseBalance(e) { |
| | | if (e.target.value == true) { |
| | |
| | | in_radius: self.in_radius ? 1 : 0 // 如果为1,报名成功后直接签到 |
| | | }) |
| | | ) |
| | | }, function(result) { |
| | | }, function(res) { |
| | | uni.hideLoading(); |
| | | if (result.data.online_money) { |
| | | pay(result, self, function() { |
| | | |
| | | }, function() { |
| | | reg_success = 2; // 失败 |
| | | }); |
| | | } else if (result.code != 1) { |
| | | if (res.data.online_money) { |
| | | // 半屏小程序支付 by lyzflash |
| | | if (res.data.payment.is_embed) { |
| | | // console.log(res.data.payment); |
| | | self.isFirst = true; |
| | | uni.openEmbeddedMiniProgram({ |
| | | appId: res.data.payment.embed_app_id, |
| | | path: res.data.payment.embed_path, |
| | | extraData: res.data.payment.extraData, |
| | | envVersion: 'release', // develop开发版 trial体验版 release正式版 |
| | | success:function() { |
| | | console.log('打开半屏小程序成功'); |
| | | }, |
| | | fail:function() { |
| | | console.log('打开半屏小程序失败'); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | pay(res, self, self.paySuccess, self.payError); |
| | | } else if (res.code != 1) { |
| | | reg_success = 2; // 失败 |
| | | } |
| | | self.$emit('close', reg_success); |