mobileclient/coupon/lookCard.html

162 lines
7.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,viewport-fit=cover" />
<title>查看卡密</title>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/vue.min.js?v=1367936144322" type="text/javascript"
charset="utf-8"></script>
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/lookCard.css">
<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>
</head>
<body>
<div id="app">
<!-- 单条弹出框 -->
<div class="prompt" :class="toastShow?'proactive':''">
{{this.toastTip}}
</div>
<div v-show="!loading">
<img class="backPresTy" @click="backHandler" v-if="!backShow"
src=" https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<p class="nav-title">卡密</p>
<div class="topBox">
<img :src="cardData.show_url" alt="">
<p class="product_name">{{cardData.product_name}}</p>
<p class="end_time">
卡密有效期至:{{cardData.goods.end_time}}
</p>
</div>
<div class="bottomBox">
<div>
<p class="cardInformation">卡密信息</p>
<template v-if="cardData.card_number">
<div class="item item-margin">
<p class="title">卡号:</p>
<template v-if="cardData.card_number">
<p class="number">{{cardData.card_number}}</p>
<p class="copy" @click="copyFunction(cardData.card_number)">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/copyNumber.png"
alt="">
复制卡号
</p>
</template>
<div v-else class="generate">
<p>{{cardData.status===3?'卡密兑换失败,请重新兑换':'卡密正在生成中,请稍后刷新再查看'}} </p>
<span @click="backHandler" v-if="cardData.status===3">重新兑换</span>
<span @click="getInfo()" v-else>点击刷新</span>
</div>
</div>
<div class="item">
<p class="title">密码:</p>
<template v-if="cardData.card_password">
<p class="number">{{cardData.card_password}}</p>
<p class="copy" @click="copyFunction(cardData.card_password)">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/copyNumber.png"
alt="">
复制密码
</p>
</template>
<div v-else class="generate">
<p>{{cardData.status===3?'卡密兑换失败,请重新兑换':'卡密正在生成中,请稍后刷新再查看'}} </p>
<span @click="backHandler" v-if="cardData.status===3">重新兑换</span>
<span @click="getInfo()" v-else>点击刷新</span>
</div>
</div>
</template>
<template v-else>
<div class="item item-margin">
<p class="title">卡密:</p>
<template v-if="cardData.card_password">
<p class="number">{{cardData.card_password}}</p>
<p class="copy" @click="copyFunction(cardData.card_password)">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/copyNumber.png"
alt="">
复制卡密
</p>
</template>
<div v-else class="generate">
<p>{{cardData.status===3?'卡密兑换失败,请重新兑换':'卡密正在生成中,请稍后刷新再查看'}} </p>
<span @click="backHandler" v-if="cardData.status===3">重新兑换</span>
<span @click="getInfo()" v-else>点击刷新</span>
</div>
</div>
</template>
</div>
</div>
</>
</div>
<script>
new Vue({
el: "#app",
data () {
return {
cardData: {
goods: {},
card_password: null,
card_number: null,
product_name: null,
show_url: null,
},
toastShow: false,
toastTip: '',
loading: true,
backShow: sessionStorage.getItem('backShow')
};
},
created () {
this.getInfo(true);
},
methods: {
/* 复制 */
copyFunction (number) {
var aux = document.createElement("input");
aux.setAttribute("value", number);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
this.openDialog('复制成功');
},
getInfo (loading = false) {
const orderNumber = sessionStorage.getItem('orderNumber');
this.loading = loading;
/* 获取卡密详情 */
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (res.code == 200) {
this.cardData = res.data;
this.loading = false;
}
});
},
// 单条弹框
openDialog (tip) {
this.toastShow = true;
this.toastTip = tip;
setTimeout(() => {
this.toastShow = false;
this.toastTip = '';
}, 3000);
},
backHandler () {
history.go(-1);
},
}
})
</script>
</body>
</html>