276 lines
12 KiB
HTML
276 lines
12 KiB
HTML
<!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>
|
||
<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>
|
||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js"></script>
|
||
<link rel="stylesheet" href="./style.css">
|
||
|
||
</head>
|
||
|
||
<body ontouchstart="">
|
||
<div id="app">
|
||
<!-- 轮播 -->
|
||
<div class="swiper">
|
||
<div class="swiper-wrapper">
|
||
<div class="swiper-slide" v-for="(item, index) in state.describeUrl" :key="index">
|
||
<img :src="item" alt="">
|
||
</div>
|
||
</div>
|
||
<div class="swiper-pagination"></div>
|
||
</div>
|
||
|
||
<div class="main">
|
||
<!-- 直充和卡密 -->
|
||
<div class="main-input">
|
||
<div class="input-style">
|
||
<span>账 号:</span>
|
||
<input type="text" :placeholder="state.placeholder" style="padding-left: 0.78rem;"
|
||
v-model="state.account" @input="inputChange" :maxlength="state.maxLen">
|
||
</div>
|
||
|
||
<div class="input-style">
|
||
<span>再次输入:</span>
|
||
<input type="text" :placeholder="state.placeholder" style="padding-left: 0.3rem;"
|
||
v-model="state.reAccount" @input="inputChange" :maxlength="state.maxLen">
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <div class="card-pwd main-input" v-if="state.goodsType === 2">
|
||
<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>
|
||
</div> -->
|
||
</div>
|
||
|
||
|
||
<!-- 说明 -->
|
||
<div class="use-mark">
|
||
<img :src="state.useMarkUrl" alt="">
|
||
</div>
|
||
|
||
<!-- 底部 -->
|
||
<footer class="footer">
|
||
<button type="button" class="footer-btn" :disabled="state.isDisabled" @click="submitBtn">立即兑换</button>
|
||
</footer>
|
||
|
||
<div class="prompt" :class="state.promtShow ? 'proactive':''">
|
||
{{state.tostTip}}
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
|
||
</script>
|
||
<script>
|
||
// 获取 包码结算数据
|
||
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
|
||
|
||
const { createApp, ref, reactive, onMounted } = Vue
|
||
createApp({
|
||
setup() {
|
||
const state = reactive({
|
||
goodsInfo: {}, // 商品数据
|
||
goodsType: 1, // 1直充 2卡密 0无
|
||
describeUrl: [], // 商品列表图片
|
||
useMarkUrl: "",
|
||
placeholder: "",
|
||
maxLen: 50,
|
||
isDisabled: true,
|
||
account: "",
|
||
reAccount: "",
|
||
tostTip: "",
|
||
promtShow: false,
|
||
bmAuth: {}
|
||
})
|
||
|
||
onMounted(() => {
|
||
|
||
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) {
|
||
settlementFun(bm_obj_data.token, bm_obj_data.settlement_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.detail_url;
|
||
|
||
// 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)
|
||
}
|
||
|
||
// swiper
|
||
const swiper = new Swiper('.swiper', {
|
||
loop: true,
|
||
pagination: {
|
||
el: '.swiper-pagination',
|
||
}
|
||
});
|
||
})
|
||
|
||
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);
|
||
|
||
// 使用结算7
|
||
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) {
|
||
settlementFun(bm_obj_data.token, bm_obj_data.settlement_type);
|
||
}
|
||
}
|
||
|
||
if (res.code === 200) {
|
||
sessionStorage.setItem('orderNumber', res.data.order_number);
|
||
/* product_type:2 卡密
|
||
* card_show:2 线上查看卡密信息
|
||
* backAble:是否多个商品
|
||
*/
|
||
const clr = setTimeout(() => {
|
||
if (state.goodsInfo.product_type === 2) {
|
||
window.location.href = './orderDetails/cardOrder.html';
|
||
} else {
|
||
window.location.href = './orderDetails/chargerOrder.html';
|
||
}
|
||
clearTimeout(clr);
|
||
}, 1000);
|
||
}
|
||
})
|
||
}
|
||
|
||
return {
|
||
state,
|
||
submitBtn,
|
||
inputChange
|
||
}
|
||
}
|
||
}).mount('#app')
|
||
</script>
|
||
</body>
|
||
|
||
|
||
</html> |