mobileclient/packkey/exchange.html

265 lines
11 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-22 14:05:53 +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-22 14:05:53 +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>
<div class="main">
<!-- 直充和卡密 -->
2024-02-22 14:05:53 +08:00
<div class="main-input">
2024-02-21 16:54:10 +08:00
<div class="input-style">
<span>账 号:</span>
2024-02-22 14:05:53 +08:00
<input type="text" :placeholder="state.placeholder" style="padding-left: 0.78rem;"
v-model="state.account" @input="inputChange" :maxlength="state.maxLen">
2024-02-21 16:54:10 +08:00
</div>
<div class="input-style">
<span>再次输入:</span>
2024-02-22 14:05:53 +08:00
<input type="text" :placeholder="state.placeholder" style="padding-left: 0.3rem;"
v-model="state.reAccount" @input="inputChange" :maxlength="state.maxLen">
2024-02-21 16:54:10 +08:00
</div>
</div>
2024-02-22 14:05:53 +08:00
<!-- <div class="card-pwd main-input" v-if="state.goodsType === 2">
2024-02-21 16:54:10 +08:00
<div class="input-style">
<span>卡密账号:</span>
<input type="text" style="padding-left: 0.3rem;" disabled="{{true}}" value="1256466161444644">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/bm-copy_btn.png" alt="">
</div>
<div class="input-style">
<span>卡密密码:</span>
<input type="text" style="padding-left: 0.3rem;" disabled="{{true}}"
value="dsfnog54er4twer7789q123">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/bm-copy_btn.png" alt="">
</div>
2024-02-22 14:05:53 +08:00
</div> -->
2024-02-21 16:54:10 +08:00
</div>
<!-- 说明 -->
<div class="use-marek">
2024-02-22 14:05:53 +08:00
<img :src="state.useMarkUrl" alt="">
2024-02-21 16:54:10 +08:00
</div>
<!-- 底部 -->
<footer class="footer">
2024-02-22 14:05:53 +08:00
<button type="button" class="footer-btn" :disabled="state.isDisabled" @click="submitBtn">立即兑换</button>
2024-02-21 16:54:10 +08:00
</footer>
2024-02-22 14:05:53 +08:00
<div class="prompt" :class="state.promtShow ? 'proactive':''">
{{state.tostTip}}
</div>
2024-02-21 16:54:10 +08:00
</div>
<script>
</script>
<script>
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 { createApp, ref, reactive, onMounted } = Vue
2024-02-21 16:54:10 +08:00
createApp({
setup() {
2024-02-22 14:05:53 +08:00
const state = reactive({
goodsInfo: {}, // 商品数据
goodsType: 1, // 1直充 2卡密 0无
describeUrl: [], // 商品列表图片
useMarkUrl: "",
placeholder: "",
maxLen: 50,
isDisabled: true,
account: "",
reAccount: "",
tostTip: "",
promtShow: false,
bmAuth: {}
})
2024-02-21 16:54:10 +08:00
onMounted(() => {
2024-02-22 14:05:53 +08:00
// 获取 包码结算数据
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 === 6) {
settlementFun(bm_obj_data.key, bm_obj_data.settlement_type);
}
// 1.获取 商品数据
let goodsInfo = JSON.parse(sessionStorage.getItem("bm_goodsInfo"));
state.goodsInfo = goodsInfo;
state.describeUrl = goodsInfo.entity.describe_url;
state.useMarkUrl = goodsInfo.entity.useMarkUrl;
// 2.判断商品类型 1直充 2卡密 0无
state.goodsType = goodsInfo.entity.product_type;
// 3.input placeholder
findPlaceholderText(goodsInfo.entity.account_type);
// 4.授权
let bm_data = sessionStorage.getItem("bm_auth");
if (bm_data) {
state.bmAuth = JSON.parse(bm_data)
}
2024-02-21 16:54:10 +08:00
// swiper
const swiper = new Swiper('.swiper', {
loop: true,
});
})
2024-02-22 14:05:53 +08:00
const findPlaceholderText = (accountType) => {
if (accountType == 0) {
state.placeholder = "请输入账号";
} else if (accountType == 1) {
state.placeholder = "请输入手机号";
state.maxLen = 11;
} else if (accountType == 2) {
state.placeholder = "请输入邮箱";
} else if (accountType == 3) {
state.placeholder = "请输入手机号或邮箱";
} else if (accountType == 4) {
state.placeholder = "请输入QQ号";
state.maxLen = 10;
} else if (accountType == 5) {
state.placeholder = "请输入手机号或QQ号";
state.maxLen = 11;
} else if (accountType == 6) {
state.placeholder = "请输入邮箱或QQ号";
} else if (accountType == 7) {
state.placeholder = "请输入手机号/邮箱/QQ号";
} else if (accountType == 8) {
state.placeholder = "请输入微信号";
state.maxLen = 20;
} else if (accountType == 9) {
state.placeholder = "请输入手机号或微信";
state.maxLen = 20;
} else if (accountType == 10) {
state.placeholder = "请输入邮箱或微信号";
} else if (accountType == 11) {
state.placeholder = "请输入手机号/邮箱/微信号";
} else if (accountType == 12) {
state.placeholder = "请输入QQ号或微信号";
state.maxLen = 20;
} else if (accountType == 13) {
state.placeholder = "请输入手机号/QQ号/微信号";
state.maxLen = 20;
} else if (accountType == 14) {
state.placeholder = "请输入邮箱/QQ号/微信号";
} else if (accountType == 99) {
state.placeholder = "请输入昵称";
} else {
state.placeholder = "请输入手机号/邮箱/QQ号/微信号";
}
}
const inputChange = (e) => {
if (state.account !== "" && state.reAccount !== "" && state.account === state.reAccount) {
state.isDisabled = false;
} else {
state.isDisabled = true;
}
}
const tostOpen = (msg) => {
if (state.promtShow) {
return
}
state.tostTip = msg
state.promtShow = true;
setTimeout(() => {
state.promtShow = false;
}, 3000)
}
const tostClose = () => {
state.promtShow = false;
}
// 提交
const submitBtn = () => {
state.isDisabled = true;
setTimeout(() => {
state.isDisabled = false;
}, 500);
let params = {
goods_id: state.goodsInfo.entity.goods_id,
account: state.account,
code_batch_id: state.goodsInfo.code_batch_id,
key: state.bmAuth.key,
token: state.bmAuth.token
};
req.axiosPost('/key/usage', params).then(res => {
tostOpen(res.message);
if (res.code === 200) {
}
console.log("res =>", res)
})
}
2024-02-21 16:54:10 +08:00
return {
2024-02-22 14:05:53 +08:00
state,
submitBtn,
inputChange
2024-02-21 16:54:10 +08:00
}
}
}).mount('#app')
</script>
</body>
</html>