fix: 修复直充

This commit is contained in:
zhangds 2024-02-22 19:28:16 +08:00
parent f645f5675b
commit 565986a8b4
5 changed files with 38 additions and 73 deletions

View File

@ -32,3 +32,9 @@ exchange.html 兑换页面
1、chargerOrder.html 直充订单详情 1、chargerOrder.html 直充订单详情
2、cardOrder.html 卡密订单详情 2、cardOrder.html 卡密订单详情
# 包码目录 packkey
- goods-index.html 商品入口页面
- goods-exchange.html 商品兑换页面
- libs.js 埋点 js
-

View File

@ -10,6 +10,7 @@
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/vue3.global.js"></script> <script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/vue3.global.js"></script>
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js"></script> <script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script> <script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js"></script>
</head> </head>
<body> <body>
@ -68,28 +69,6 @@
// 获取 包码结算数据 // 获取 包码结算数据
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null; const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
/**
* 结算 埋点方法
* @param {string} key
* @param {number} settlementType
*/
const settlementFun = (key, settlementType) => {
let params = {
key,
type: settlementType
}
req.axiosPost('/key/settlement/create', params).then(res => {
console.log("点 =>", res);
if (res.code === 200) {
// 接口请求成功后,就不能再请求接口了
let obj_sy = JSON.parse(sessionStorage.getItem("bm_auth"));
obj_sy.settlement_data.is_settlement = true;
sessionStorage.setItem("bm_auth", JSON.stringify(obj_sy));
}
});
}
const { createApp, ref, onMounted, computed } = Vue; const { createApp, ref, onMounted, computed } = Vue;
createApp({ createApp({
setup() { setup() {
@ -127,7 +106,7 @@
function copyFunction(number) { function copyFunction(number) {
// 使用结算 卡密7 // 使用结算 卡密7
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 7) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 7) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_type);
} }
var aux = document.createElement("input"); var aux = document.createElement("input");

View File

@ -26,6 +26,7 @@
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322"> <script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
</script> </script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script> <script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js"></script>
<link rel="stylesheet" href="./style.css"> <link rel="stylesheet" href="./style.css">
</head> </head>
@ -98,27 +99,6 @@
// 获取 包码结算数据 // 获取 包码结算数据
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null; const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
/**
* 结算 埋点方法
* @param {string} key
* @param {number} settlementType
*/
const settlementFun = (key, settlementType) => {
let params = {
key,
type: settlementType
}
req.axiosPost('/key/settlement/create', params).then(res => {
if (res.code === 200) {
// 接口请求成功后,就不能再请求接口了
let obj_sy = JSON.parse(sessionStorage.getItem("bm_auth"));
obj_sy.settlement_data.is_settlement = true;
sessionStorage.setItem("bm_auth", JSON.stringify(obj_sy));
}
console.log("点 =>", res);
});
}
const { createApp, ref, reactive, onMounted } = Vue const { createApp, ref, reactive, onMounted } = Vue
createApp({ createApp({
setup() { setup() {
@ -140,7 +120,7 @@
onMounted(() => { onMounted(() => {
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
} }
// 1.获取 商品数据 // 1.获取 商品数据
@ -260,7 +240,7 @@
// 使用结算7 // 使用结算7
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 6) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 6) {
if (state.goodsInfo.product_type !== 2) { if (state.goodsInfo.product_type !== 2) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_type);
} }
} }

View File

@ -26,6 +26,7 @@
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322"> <script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
</script> </script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script> <script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js"></script>
<link rel="stylesheet" href="./style.css"> <link rel="stylesheet" href="./style.css">
</head> </head>
@ -53,10 +54,10 @@
</footer> </footer>
</div> </div>
<script> <script>
// 模拟数据 // // 模拟数据
// let bm_gold_obj = { // let bm_gold_obj = {
// token: "0d9d1a4365939377bb20336d72cd555e", // token: "24583c708a3ac83580bb4863f92f5e4f",
// key: "AAABuYxwxrLe4EZv", // // key: "AAABud5ZKbLWfcQR", //
// settlement_data: { // settlement_data: {
// is_settlement: true, // 是否结算 // is_settlement: true, // 是否结算
// settlement_type: 2, // 结算类型 // settlement_type: 2, // 结算类型
@ -64,31 +65,10 @@
// } // }
// sessionStorage.setItem("bm_auth", JSON.stringify(bm_gold_obj)); // sessionStorage.setItem("bm_auth", JSON.stringify(bm_gold_obj));
/**
* 结算 埋点方法
* @param {string} key
* @param {number} settlementType
*/
const settlementFun = (key, settlementType) => {
let params = {
key,
type: settlementType
}
req.axiosPost('/key/settlement/create', params).then(res => {
if (res.code === 200) {
// 接口请求成功后,就不能再请求接口了
let obj_sy = JSON.parse(sessionStorage.getItem("bm_auth"));
obj_sy.settlement_data.is_settlement = true;
sessionStorage.setItem("bm_auth", JSON.stringify(obj_sy));
}
console.log("点 =>", res)
});
}
// 获取 包码结算数据-打开结算 // 获取 包码结算数据-打开结算
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.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) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 2) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
} }
const { createApp, ref, reactive, onMounted } = Vue; const { createApp, ref, reactive, onMounted } = Vue;
@ -106,7 +86,7 @@
const goToExchange = () => { const goToExchange = () => {
// 领取结算 // 领取结算
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 4) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 4) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
} }
window.location.href = './goods-exchange.html' window.location.href = './goods-exchange.html'
@ -130,7 +110,7 @@
onMounted(() => { onMounted(() => {
// 领取结算 // 领取结算
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 3) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 3) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
} }
let bm_data = sessionStorage.getItem("bm_auth"); let bm_data = sessionStorage.getItem("bm_auth");

20
packkey/libs.js Normal file
View File

@ -0,0 +1,20 @@
/**
* 结算 埋点方法
* @param {string} key
* @param {number} settlementType
*/
const settlementFun = (token, settlementType) => {
let params = {
token,
type: settlementType
};
req.axiosPost("/key/settlement/create", params).then((res) => {
if (res.code === 200) {
// 接口请求成功后,就不能再请求接口了
let obj_sy = JSON.parse(sessionStorage.getItem("bm_auth"));
obj_sy.settlement_data.is_settlement = true;
sessionStorage.setItem("bm_auth", JSON.stringify(obj_sy));
}
console.log("点 =>", res);
});
};