mobileclient/packkey/index.html

149 lines
5.5 KiB
HTML
Raw Normal View History

2024-02-21 16:54:10 +08:00
<!DOCTYPE html>
<!-- A11Y注意设置页面的 lang 属性 -->
<html lang="zh">
<head>
<meta charset="utf-8" />
<!-- A11Y打开页面时屏幕阅读器会首先阅读 title 的内容,确保 title 准确描述页面 -->
<title>领取详情</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no, email=no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script>
var docEl = document.documentElement;
docEl.style.fontSize = 100 / 750 * docEl.clientWidth + 'px';
window.addEventListener('resize', function () {
docEl.style.fontSize = 100 / 750 * docEl.clientWidth + 'px';
});
</script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/libs/vue.global.js"></script>
<link rel="stylesheet"
href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/libs/swiper-bundle.min.css" />
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/libs/swiper-bundle.min.js"></script>
2024-02-21 19:18:50 +08:00
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
</script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
2024-02-21 16:54:10 +08:00
<link rel="stylesheet" href="./style.css">
</head>
<body ontouchstart="">
<div id="app">
<!-- 轮播 -->
<div class="swiper">
<div class="swiper-wrapper">
2024-02-21 19:18:50 +08:00
<div class="swiper-slide" v-for="item in state.describeUrl">
<img :src="item" alt="">
2024-02-21 16:54:10 +08:00
</div>
</div>
</div>
<!-- 说明 -->
2024-02-21 19:18:50 +08:00
<div class="use-mark">
<img :src="state.useMarkUrl" alt="">
2024-02-21 16:54:10 +08:00
</div>
<!-- 底部 -->
<footer class="footer">
<button type="button" class="footer-btn" @click="goToExchange">立即领取</button>
</footer>
</div>
<script>
2024-02-22 14:05:53 +08:00
// 模拟数据
let bm_gold_obj = {
token: "2641a70c4ff6cca979f273da0987b0c7",
key: "AAABuUYRJJ2fsCUm", //
is_settlement: true, // 是否结算
settlement_type: 1 // 结算类型
2024-02-21 19:18:50 +08:00
}
2024-02-22 14:05:53 +08:00
sessionStorage.setItem("bm_auth", JSON.stringify(bm_gold_obj));
2024-02-21 16:54:10 +08:00
2024-02-22 14:05:53 +08:00
/**
* 结算 埋点方法
* @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)
});
}
// 获取 包码结算数据
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
console.log("包码数据 1 =>", bm_obj_data);
if (bm_obj_data && !bm_obj_data.is_settlement && bm_obj_data.settlement_type === 3) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_type);
}
const { createApp, ref, reactive, onMounted } = Vue;
2024-02-21 16:54:10 +08:00
createApp({
setup() {
2024-02-22 14:05:53 +08:00
2024-02-21 19:18:50 +08:00
// 参数
const state = reactive({
describeUrl: [], // 商品列表图片
useMarkUrl: "",
2024-02-22 14:05:53 +08:00
bmAuth: {}
2024-02-21 19:18:50 +08:00
})
// 兑换
const goToExchange = () => {
2024-02-22 14:05:53 +08:00
if (bm_obj_data && !bm_obj_data.is_settlement && bm_obj_data.settlement_type === 5) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_type);
2024-02-21 19:18:50 +08:00
}
2024-02-22 14:05:53 +08:00
window.location.href = './exchange.html'
2024-02-21 19:18:50 +08:00
}
// 获取商品信息
const getProducts = async () => {
let params = {
last_product_id: 0,
2024-02-22 14:05:53 +08:00
token: state.bmAuth.token
2024-02-21 19:18:50 +08:00
}
let res = await req.axiosPost('/key/products', params);
if (res.code === 200) {
// 注意:只能是一个商品
2024-02-22 14:05:53 +08:00
sessionStorage.setItem("bm_goodsInfo", JSON.stringify(res.data[0]));
2024-02-21 19:18:50 +08:00
state.describeUrl = res.data[0].entity.describe_url;
state.useMarkUrl = res.data[0].entity.detail_url;
}
console.log("第一步:获取商品信息 =>", res);
}
2024-02-21 16:54:10 +08:00
onMounted(() => {
2024-02-22 14:05:53 +08:00
if (bm_obj_data && !bm_obj_data.is_settlement && bm_obj_data.settlement_type === 4) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_type);
}
let bm_data = sessionStorage.getItem("bm_auth");
if (bm_data) {
state.bmAuth = JSON.parse(bm_data)
}
2024-02-21 16:54:10 +08:00
const swiper = new Swiper('.swiper', {
loop: true,
});
2024-02-21 19:18:50 +08:00
getProducts();
2024-02-21 16:54:10 +08:00
})
return {
2024-02-21 19:18:50 +08:00
goToExchange,
state
2024-02-21 16:54:10 +08:00
}
}
}).mount('#app')
</script>
</body>
</html>