1.支付优化
parent
ea6f8056b3
commit
5693f05d62
31
App.vue
31
App.vue
|
|
@ -1877,18 +1877,29 @@
|
|||
});
|
||||
},
|
||||
|
||||
// 更新url参数
|
||||
updateQueryStringParameter(uri, key, value) {
|
||||
if (!value) {
|
||||
return uri;
|
||||
}
|
||||
var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
||||
var separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
||||
if (uri.match(re)) {
|
||||
return uri.replace(re, '$1' + key + '=' + value + '$2');
|
||||
// 更新当前url参数
|
||||
// query:[{key:'',value:''}]
|
||||
updateQueryStringParameter(query = []) {
|
||||
// #ifdef H5
|
||||
let url = window.location.href;
|
||||
// 判断没有参数时
|
||||
if (query.length < 1) {
|
||||
//向当前url添加参数,没有历史记录
|
||||
window.history.replaceState({ path: url }, '', url);
|
||||
} else {
|
||||
return uri + separator + key + '=' + value;
|
||||
query.forEach((item) => {
|
||||
let re = new RegExp('([?&])' + item.key + '=.*?(&|$)', 'i');
|
||||
let separator = url.indexOf('?') !== -1 ? '&' : '?';
|
||||
if (url.match(re)) {
|
||||
url = url.replace(re, '$1' + item.key + '=' + item.value + '$2');
|
||||
} else {
|
||||
url += separator + item.key + '=' + item.value;
|
||||
}
|
||||
});
|
||||
//向当前url添加参数,没有历史记录
|
||||
window.history.replaceState({ path: url }, '', url);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
},
|
||||
// 初始化完成时触发(全局只触发一次)
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@
|
|||
<component-payment
|
||||
:prop-pay-url="pay_url"
|
||||
:prop-qrcode-url="qrcode_url"
|
||||
prop-pay-data-key="recharge_id"
|
||||
prop-pay-data-key="id"
|
||||
:prop-payment-list="payment_list"
|
||||
:prop-temp-pay-value="temp_pay_value"
|
||||
:prop-temp-pay-index="temp_pay_index"
|
||||
:prop-pay-price="pay_price"
|
||||
:prop-to-page="to_page"
|
||||
:propIsRedirectTo="true"
|
||||
:prop-to-fail-page="to_fail_page"
|
||||
:prop-is-show-payment="is_show_payment_popup"
|
||||
@close-payment-poupon="payment_popup_event_close"
|
||||
|
|
@ -102,11 +102,6 @@
|
|||
temp_pay_index: 0,
|
||||
is_show_payment_popup: false,
|
||||
pay_price: 0,
|
||||
// 前往页面携带的参数
|
||||
to_page: {
|
||||
title: '进入我的会员列表',
|
||||
page: 'pages/plugins/membershiplevelvip/user/user',
|
||||
},
|
||||
// 支付失败跳转的页面
|
||||
to_fail_page: 'pages/plugins/membershiplevelvip/order/order',
|
||||
};
|
||||
|
|
@ -241,7 +236,6 @@
|
|||
temp_pay_value: res.data.data.id,
|
||||
pay_price: res.data.data.price,
|
||||
});
|
||||
console.log(res.data);
|
||||
if (res.data.code == 0) {
|
||||
uni.setStorageSync(app.globalData.data.cache_page_pay_key, {
|
||||
order_ids: res.data.data.id,
|
||||
|
|
|
|||
|
|
@ -159,9 +159,7 @@
|
|||
this.setData({
|
||||
current: e.currentTarget.dataset.index || 0,
|
||||
});
|
||||
var newurl = app.globalData.updateQueryStringParameter(window.location.href.split('?')[0], 'type', e.currentTarget.dataset.index + '');
|
||||
//向当前url添加参数,没有历史记录
|
||||
window.history.replaceState({ path: newurl }, '', newurl);
|
||||
app.globalData.updateQueryStringParameter([{ key: 'type', value: e.currentTarget.dataset.index }]);
|
||||
},
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
:prop-temp-pay-value="temp_pay_value"
|
||||
:prop-pay-price="pay_price"
|
||||
:propIsRedirectTo="true"
|
||||
:prop-is-show-payment="is_show_payment_popup"
|
||||
@close-payment-poupon="payment_popup_event_close"
|
||||
></component-payment>
|
||||
</view>
|
||||
|
|
@ -149,7 +148,7 @@
|
|||
},
|
||||
});
|
||||
},
|
||||
order_item_pay_success_handle() {
|
||||
payment_popup_event_close() {
|
||||
this.setData({
|
||||
is_show_payment_popup: false,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -142,13 +142,14 @@
|
|||
|
||||
var ck = app.globalData.data.cache_page_pay_key;
|
||||
var pay_data = uni.getStorageSync(ck) || null;
|
||||
if (pay_data) {
|
||||
if (pay_data !== null) {
|
||||
uni.removeStorageSync(ck);
|
||||
this.setData({
|
||||
current: pay_data.type || 0,
|
||||
});
|
||||
var newurl = app.globalData.updateQueryStringParameter(window.location.href.split('?')[0], 'type', pay_data.type + '');
|
||||
//向当前url添加参数,没有历史记录
|
||||
window.history.replaceState({ path: newurl }, '', newurl);
|
||||
setTimeout(() => {
|
||||
app.globalData.updateQueryStringParameter([{ key: 'type', value: pay_data.type }]);
|
||||
}, 200);
|
||||
}
|
||||
this.init();
|
||||
},
|
||||
|
|
@ -242,9 +243,7 @@
|
|||
this.setData({
|
||||
current: e.currentTarget.dataset.index || 0,
|
||||
});
|
||||
var newurl = app.globalData.updateQueryStringParameter(window.location.href.split('?')[0], 'type', e.currentTarget.dataset.index + '');
|
||||
//向当前url添加参数,没有历史记录
|
||||
window.history.replaceState({ path: newurl }, '', newurl);
|
||||
app.globalData.updateQueryStringParameter([{ key: 'type', value: e.currentTarget.dataset.index }]);
|
||||
},
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue