fix: 修复包码

This commit is contained in:
zhangds 2024-02-22 19:48:36 +08:00
parent d45ccfb88f
commit bdccdfd674
4 changed files with 16 additions and 14 deletions

View File

@ -224,7 +224,7 @@
// 第一步:判断是否为包码
if (data.settlement_data.settlement_type > 0) {
// 存储数据
localStorage.setItem("bm_auth", JSON.stringify(data));
sessionStorage.setItem("bm_auth", JSON.stringify(data));
// 跳转包码页面
window.location.href = './packkey/goods-index.html';
return

View File

@ -70,7 +70,7 @@
const { createApp, ref, onMounted, computed } = Vue;
createApp({
setup () {
setup() {
const goods = ref({});
const toast = ref(false);
const clr = ref(null);
@ -82,8 +82,10 @@
});
/* 获取详情 */
function getInfo () {
function getInfo() {
const orderNumber = sessionStorage.getItem('orderNumber');
console.log("orderNumber =>", orderNumber)
return
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (res.code == 200) {
const { product_name, update_time, status, show_url, account, create_time, use_coupon } = res.data;
@ -93,7 +95,7 @@
}
/* 重新兑换 */
function toHome () {
function toHome() {
if (goods.value.use_coupon === 2) {
window.location.replace('../homepage.html');
} else {
@ -103,7 +105,7 @@
/* 复制 */
function copyFunction (number) {
function copyFunction(number) {
var aux = document.createElement("input");
aux.setAttribute("value", number);
document.body.appendChild(aux);
@ -132,7 +134,7 @@
}
});
function backHandler () {
function backHandler() {
history.go(-1);
}

View File

@ -97,7 +97,7 @@
</script>
<script>
// 获取 包码结算数据
const bm_obj_data = localStorage.getItem("bm_auth") ? JSON.parse(localStorage.getItem("bm_auth")) : null;
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
const { createApp, ref, reactive, onMounted } = Vue
createApp({
@ -124,7 +124,7 @@
}
// 1.获取 商品数据
let goodsInfo = JSON.parse(localStorage.getItem("bm_goodsInfo"));
let goodsInfo = JSON.parse(sessionStorage.getItem("bm_goodsInfo"));
state.goodsInfo = goodsInfo;
state.describeUrl = goodsInfo.entity.describe_url;
state.useMarkUrl = goodsInfo.entity.detail_url;
@ -136,7 +136,7 @@
findPlaceholderText(goodsInfo.entity.account_type);
// 4.授权
let bm_data = localStorage.getItem("bm_auth");
let bm_data = sessionStorage.getItem("bm_auth");
if (bm_data) {
state.bmAuth = JSON.parse(bm_data)
}
@ -245,7 +245,7 @@
}
if (res.code === 200) {
localStorage.setItem('orderNumber', res.data.order_number);
sessionStorage.setItem('orderNumber', res.data.order_number);
/* product_type:2 卡密
* card_show:2 线上查看卡密信息
* backAble是否多个商品

View File

@ -63,10 +63,10 @@
// settlement_type: 2, // 结算类型
// }
// }
// localStorage.setItem("bm_auth", JSON.stringify(bm_gold_obj));
// sessionStorage.setItem("bm_auth", JSON.stringify(bm_gold_obj));
// 获取 包码结算数据-打开结算
const bm_obj_data = localStorage.getItem("bm_auth") ? JSON.parse(localStorage.getItem("bm_auth")) : null;
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 2) {
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
}
@ -101,7 +101,7 @@
let res = await req.axiosPost('/key/products', params);
if (res.code === 200) {
// 注意:只能是一个商品
localStorage.setItem("bm_goodsInfo", JSON.stringify(res.data[0]));
sessionStorage.setItem("bm_goodsInfo", JSON.stringify(res.data[0]));
state.describeUrl = res.data[0].entity.describe_url;
state.useMarkUrl = res.data[0].entity.detail_url;
}
@ -113,7 +113,7 @@
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
}
let bm_data = localStorage.getItem("bm_auth");
let bm_data = sessionStorage.getItem("bm_auth");
if (bm_data) {
state.bmAuth = JSON.parse(bm_data)
}