Commit a5f1eeb8 authored by FE-安焕焕's avatar FE-安焕焕 👣

修改参数存储方式

parent cf17d062
import cookies from 'js-cookie'; import cookies from 'js-cookie';
const option = { const option = {
domain: window.location.host.indexOf('.q-gp.com') >= 0 ? '.q-gp.com' : '', domain: window.location.host.indexOf('.q-gp.com') >= 0 ? '.q-gp.com' : '',
expires: 365 expires: 1
}; };
const Cookies = { const Cookies = {
get(key) { get(key) {
......
import localStorage from '@/service/localStorage.service'; import cookies from '@/service/cookieStorage.service';
export const goUrlExtends = { export const goUrlExtends = {
methods: { methods: {
goHome() { goHome() {
...@@ -20,7 +20,7 @@ export const goUrlExtends = { ...@@ -20,7 +20,7 @@ export const goUrlExtends = {
}, },
goOrderDetail() { goOrderDetail() {
const returnUrl = this.getReturnUrl(); const returnUrl = this.getReturnUrl();
const orderNo = localStorage.get('orderNo')?.orderNo; const orderNo = cookies.get('orderNo')?.orderNo;
if (returnUrl) { if (returnUrl) {
window.location.replace(`${returnUrl}/orderDetail?orderNo=${orderNo}`); window.location.replace(`${returnUrl}/orderDetail?orderNo=${orderNo}`);
return; return;
...@@ -31,7 +31,7 @@ export const goUrlExtends = { ...@@ -31,7 +31,7 @@ export const goUrlExtends = {
}); });
}, },
getReturnUrl() { getReturnUrl() {
const returnUrl = localStorage.get('returnUrl', 'sessionStorage'); const returnUrl = cookies.get('returnUrl');
return returnUrl; return returnUrl;
} }
} }
......
...@@ -97,6 +97,7 @@ import { registeredEvents } from '@/service/sa.service'; ...@@ -97,6 +97,7 @@ import { registeredEvents } from '@/service/sa.service';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import { throttle } from '@/service/utils.service'; import { throttle } from '@/service/utils.service';
import { goUrlExtends } from './extends'; import { goUrlExtends } from './extends';
import cookies from '@/service/cookieStorage.service';
import { import {
codeArr, codeArr,
payTypeE, payTypeE,
...@@ -204,7 +205,7 @@ export default { ...@@ -204,7 +205,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.orderNo = this.$route.query.orderNo; this.orderNo = this.$route.query.orderNo || cookies.get('orderNo')?.orderNo;
this.queryPayInfo(); this.queryPayInfo();
this.getCouponList(this.orderNo); this.getCouponList(this.orderNo);
}, },
...@@ -397,7 +398,7 @@ export default { ...@@ -397,7 +398,7 @@ export default {
this.retrieveLink(); this.retrieveLink();
return; return;
} }
localStorage.set('orderNo', { orderNo: this.orderNo }); cookies.set('orderNo', { orderNo: this.orderNo });
const paramsData = { const paramsData = {
...params, ...params,
quitUrl: `${window.location.origin}/payWaiting`, quitUrl: `${window.location.origin}/payWaiting`,
...@@ -470,7 +471,7 @@ export default { ...@@ -470,7 +471,7 @@ export default {
? this.displayInfo.orderAmt || '0.00' ? this.displayInfo.orderAmt || '0.00'
: (this.displayInfo.orderAmt - this.selectedCoupon.faceValue || 0).toFixed(2); : (this.displayInfo.orderAmt - this.selectedCoupon.faceValue || 0).toFixed(2);
const freeAmount = this.showCoupon ? this.selectedCoupon.faceValue || '0.00' : '0.00'; const freeAmount = this.showCoupon ? this.selectedCoupon.faceValue || '0.00' : '0.00';
localStorage.set('amount', { finalAmt, freeAmount }); cookies.set('amount', { finalAmt, freeAmount });
/* 跳转支付结果页面 */ /* 跳转支付结果页面 */
this.$router.replace({ this.$router.replace({
name: `pay${type}`, name: `pay${type}`,
...@@ -534,12 +535,12 @@ export default { ...@@ -534,12 +535,12 @@ export default {
} }
const [{ url }] = await h5AppyUrl(); const [{ url }] = await h5AppyUrl();
if (!url) return; if (!url) return;
window.location.href = url; window.location.href = `${url}&returnUrl=${window.location.origin}/pay`;
}, },
async getKaGetNextUrl() { async getKaGetNextUrl() {
const [{ nextUrl }] = await kaGetNextUrl(); const [{ nextUrl }] = await kaGetNextUrl();
if (!nextUrl) return; if (!nextUrl) return;
window.location.href = `${nextUrl}&returnUrl=${window.location.href}`; window.location.href = `${nextUrl}&returnUrl=${window.location.origin}/pay`;
}, },
/* 走h5活体流程 */ /* 走h5活体流程 */
async goOcr() { async goOcr() {
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<script> <script>
import { registeredEvents } from '@/service/sa.service'; import { registeredEvents } from '@/service/sa.service';
import RecoGoods from '@/components/RecoGoods.vue'; import RecoGoods from '@/components/RecoGoods.vue';
import localStorage from '@/service/localStorage.service'; import cookies from '@/service/cookieStorage.service';
import { goUrlExtends } from './extends'; import { goUrlExtends } from './extends';
export default { export default {
components: { RecoGoods }, components: { RecoGoods },
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
created() { created() {
const { orderNo, reason } = this.$route.query; const { orderNo, reason } = this.$route.query;
const { success } = this.$route.meta; const { success } = this.$route.meta;
const amount = localStorage.get('amount'); const amount = cookies.get('amount');
this.money = amount.finalAmt; this.money = amount.finalAmt;
this.orderNo = orderNo; this.orderNo = orderNo;
this.reason = reason || ''; this.reason = reason || '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment