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

修改参数存储方式

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