| xqd
@@ -168,6 +168,7 @@
|
|
|
var wxpayH5 = {$is_h5_wechat_payment_switch? 'true': 'false'};
|
|
|
var now_money = {$now_money};
|
|
|
var isMember = {$is_member};
|
|
|
+ var callback_url = '{$callback_url}';
|
|
|
// 站点名称
|
|
|
var site_name = '{$Auth_site_name}';
|
|
|
var app = new Vue({
|
| xqd
@@ -196,6 +197,7 @@
|
|
|
wxpayH5:wxpayH5,
|
|
|
isMember:isMember,
|
|
|
site_name:site_name,
|
|
|
+ orderId:'',
|
|
|
},
|
|
|
mounted: function () {
|
|
|
this.$nextTick(function () {
|
| xqd
@@ -249,21 +251,81 @@
|
|
|
var value = opt.value || '';
|
|
|
this[action] && this[action](value);
|
|
|
},
|
|
|
+ pay_order: function (data) {
|
|
|
+ this.orderId = data.data.result.orderId || '';
|
|
|
+ switch (data.data.status) {
|
|
|
+ case "PAY_ERROR":
|
|
|
+ case 'ORDER_EXIST':
|
|
|
+ case 'ORDER_ERROR':
|
|
|
+ this.extendOrder(data.msg);
|
|
|
+ break;
|
|
|
+ case 'WECHAT_PAY':
|
|
|
+ this.wechatPay(data.data.result.jsConfig);
|
|
|
+ break;
|
|
|
+ case 'WECHAT_H5_PAY':
|
|
|
+ this.payDialogOpen = false;
|
|
|
+ var callbackUrl = callback_url + '?type=9&id=' + this.planinfo.id;
|
|
|
+ var mwebUrl = data.data.result.jsConfig.mweb_url + '&redirect_url=' + encodeURIComponent(callbackUrl);
|
|
|
+ window.location.href = mwebUrl;
|
|
|
+ break;
|
|
|
+ case 'SUCCESS':
|
|
|
+ this.successOrder(data.msg);
|
|
|
+ break;
|
|
|
+ case 'ZHIFUBAO_PAY':
|
|
|
+ window.location.href = $h.U({
|
|
|
+ m: 'wap',
|
|
|
+ c: 'alipay',
|
|
|
+ a: 'index',
|
|
|
+ q: {info: data.data.result, params: 'plan'}
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ successOrder: function (msg) {
|
|
|
+ var that = this;
|
|
|
+ $h.showMsg({
|
|
|
+ title: msg ? msg : '支付成功',
|
|
|
+ icon: 'success',
|
|
|
+ success: function () {
|
|
|
+ that.paid = true;
|
|
|
+ that.is_pay = true;
|
|
|
+ that.payDialogOpen = false;
|
|
|
+ var opt = {
|
|
|
+ c: 'studyplan',
|
|
|
+ a: 'details',
|
|
|
+ q: {
|
|
|
+ id: that.planinfo.id
|
|
|
+ }
|
|
|
+ };
|
|
|
+ window.location.assign($h.U(opt));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ extendOrder: function (msg) {
|
|
|
+ var that = this;
|
|
|
+ if (typeof msg === 'object') {
|
|
|
+ if (msg.errMsg === 'chooseWXPay:cancel') {
|
|
|
+ msg = '微信支付取消';
|
|
|
+ } else {
|
|
|
+ msg = '支付失败';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ msg = '支付失败';
|
|
|
+ }
|
|
|
+ $h.pushMsg(msg, function () {
|
|
|
+ that.payDialogOpen = false;
|
|
|
+ if (that.orderId) {
|
|
|
+ app.baseGet($h.U({c: 'plan', a: 'del_order', q: {orderId: that.orderId}}));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//打开支付插件,并检测登录状态,没有登录,打开登录插件
|
|
|
OpenPay: function () {
|
|
|
var vm = this;
|
|
|
store.baseGet($h.U({c: 'index', a: 'user_login'}), function (res) {
|
|
|
this.money = this.money;
|
|
|
this.payDialogOpen = true;
|
|
|
- // $h.pushMsg('支付成功');
|
|
|
- // var opt = {
|
|
|
- // c: 'studyplan',
|
|
|
- // a: 'details',
|
|
|
- // q: {
|
|
|
- // id: this.planinfo.id
|
|
|
- // }
|
|
|
- // };
|
|
|
- // window.location.assign($h.U(opt));
|
|
|
}.bind(this), function () {
|
|
|
vm.loginShow = true;
|
|
|
});
|