mobileclient/homepage.html

453 lines
16 KiB
HTML
Raw Normal View History

2021-11-26 14:40:45 +08:00
<!DOCTYPE html>
<html>
<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>
2021-11-28 17:20:17 +08:00
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
</script>
2021-11-26 14:40:45 +08:00
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/siteqiexchange/js/swiper.min.js"></script>
<link href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/siteqiexchange/css/swiper.min.css" rel="stylesheet">
2021-11-28 17:20:17 +08:00
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/homepage.css?v=1">
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/loading.css">
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api.js?v=1"></script>
2021-11-26 14:40:45 +08:00
</head>
<style scoped>
* {
margin: 0 auto;
padding: 0;
font-family: HYQiHei;
}
html {
font-size: 26.66666667vw;
}
body {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
</style>
<body>
<div id="homepage">
2021-11-28 17:20:17 +08:00
<div v-show="loading">
<div class="spinner">
<div class="spinner-container container1">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container2">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container3">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
2021-11-26 14:40:45 +08:00
</div>
2021-11-28 17:20:17 +08:00
</div>
<div v-show="!loading">
<!-- 轮播 -->
<div id="rotation" v-if="layout=='2'">
<!-- 顶部banner -->
<div class="topBanner">
<img :src="topImg" alt="">
<h2>权益兑换</h2>
</div>
<!-- //轮播 -->
2021-11-28 20:14:54 +08:00
<div class="saleNull" v-if="!goodsNum">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/saleNull.png" alt="">
</div>
<div class="commodity" v-if="goodsNum">
2021-11-28 17:20:17 +08:00
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide" v-for="(item,index) in swiperDataList" :key="index">
<div class="imgitemMask" v-if="item.available!=1">
<span>
<img v-if="item.available==4"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/yet.png" alt="">
<img v-if="item.available==2"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/future.png" alt="">
<img v-if="item.available==3"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/overdue.png" alt="">
<img v-if="item.available==6"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/empty.png" alt="">
</span>
</div>
<div class="imgbox">
<img class="le-img" :src="item.show_url" :class="item.stock&&item.stock<0?'changegray':''"></img>
</div>
<div class="item-name" v-html="item.product_name" :class="item.stock&&item.stock<0?'changegray':''">
</div>
2021-11-26 14:40:45 +08:00
</div>
</div>
</div>
</div>
2021-11-28 17:20:17 +08:00
<!-- 立即兑换 -->
<div class="exchangeBtn" :class="gstatus!=1?'noexchangeBtn':''" :style="{'background': bgcolor,'color':'#fff'}"
@click="exchangeBtn()">
立即兑换
</div>
2021-11-26 14:40:45 +08:00
</div>
2021-11-28 17:20:17 +08:00
<!-- 列表 -->
<div id="list" v-if="layout=='1'">
<div class="topBanner">
<img :src="topImg" alt="">
<h2>权益兑换</h2>
</div>
2021-11-28 20:14:54 +08:00
<div class="saleNull" v-if="!goodsNum">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/saleNull.png" alt="">
</div>
<ul class="listcommity" v-if="goodsNum">
2021-11-26 14:40:45 +08:00
<li v-for="(item,i) in swiperDataList" :key="i">
<div>
<img :src="item.show_url" alt="" :class="item.stock&&item.stock<0?'changegray':''">
2021-11-28 17:20:17 +08:00
<font :class="item.stock&&item.stock<0?'changegray':''">{{item.product_name}}</font>
2021-11-26 14:40:45 +08:00
</div>
2021-11-28 17:20:17 +08:00
<span v-if="item.available==1" :style="{'background':bgcolor?bgcolor:'#F98F5B'}"
2021-11-29 14:14:27 +08:00
@click="exchangeBtn(item)" >兑换</span>
<span v-if="item.available!=1" class="bindexchange" :class="item.available==2?'begin':''"
2021-11-28 17:20:17 +08:00
@click="exchangeBtn(item)">{{item.available==2?'即将开始':item.available==3?'已过期':item.available==4?'已兑换':'已兑完'}}</span>
2021-11-26 14:40:45 +08:00
</li>
</ul>
2021-11-28 17:20:17 +08:00
</div>
<!-- 矩阵 -->
<div id="matrix" v-if="layout=='3'">
2021-11-26 14:40:45 +08:00
<div class="topBanner">
2021-11-28 17:20:17 +08:00
<img :src="topImg" alt="">
<h2>权益兑换</h2>
</div>
2021-11-28 20:14:54 +08:00
<div class="saleNull" v-if="!goodsNum">
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/saleNull.png" alt="">
</div>
<ul class="listcommity" v-if="goodsNum">
2021-11-29 14:14:27 +08:00
<li :class="item.stock&&item.stock<0||item.available!=1?'changegray':''" v-for="(item,i) in swiperDataList" :key="i"
2021-11-28 17:20:17 +08:00
@click="exchangeBtn(item)">
<div>
<span class="goodsIcon">
<img v-if="item.available==4"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/yet.png" alt="">
<img v-if="item.available==2"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/future.png" alt="">
<img v-if="item.available==3"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/overdue.png" alt="">
<img v-if="item.available==6"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/empty.png" alt="">
</span>
<img :src="item.show_url" alt="">
</div>
<font>{{item.product_name}}</font>
</li>
</ul>
</div>
2021-11-26 14:40:45 +08:00
</div>
2021-11-28 17:20:17 +08:00
2021-11-26 14:40:45 +08:00
<!-- 弹出框 -->
<div class="mask" v-if="maskshow">
</div>
<div class="ipt_frame" :class="maskshow?'active':' '" v-if="iptshow">
<h3>{{this.proname}}</h3>
2021-11-28 17:20:17 +08:00
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/cance.png" alt=""
@click="cancelBtn()">
2021-11-26 14:40:45 +08:00
<div>
2021-11-28 17:20:17 +08:00
<input type="tel" onkeyup="this.value=this.value.replace(/\D/g,'')"
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" maxlength="11" v-model="account"
:placeholder="placeholder">
<input type="tel" onkeyup="this.value=this.value.replace(/\D/g,'')"
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" maxlength="11" v-model="reaccount"
placeholder="请再次确认账号">
2021-11-26 14:40:45 +08:00
</div>
2021-11-28 17:20:17 +08:00
<span class="sureBtn" @click="defineBtn()" :style="{'background':'bgcolor'}">确认</span>
2021-11-26 14:40:45 +08:00
</div>
<!-- 单条弹出框 -->
<div class="prompt" :class="promtshow?'proactive':''">
2021-11-28 17:20:17 +08:00
{{this.promttip}}
2021-11-26 14:40:45 +08:00
</div>
<!-- 弹出框 -->
<!-- 询问 -->
<div class="popboxshow" v-if="popboxshow&&popboxtype=='兑换'" :class="popboxshow?'active':''">
2021-11-28 17:20:17 +08:00
<div>
2021-11-26 14:40:45 +08:00
<p>是否为账号{{this.account}}兑换{{this.proname}}会员?</p>
<span @click="surexchangeBtn">确认兑换</span>
</div>
</div>
2021-11-27 19:05:52 +08:00
<!-- 弹出提示 -->
<div class="popboxshow" v-if="popboxshow&&popboxtype=='提示'" :class="popboxshow?'active':''">
<div class="tip">
<p :class="gstatus==4||gstatus==6?'yettip':''">{{tiptext}}</p>
<span @click="successchangeBtn" :class="gstatus==4||gstatus==6?'yetexchange':''">知道了</span>
</div>
</div>
2021-11-28 17:20:17 +08:00
<!-- 成功 -->
2021-11-26 14:40:45 +08:00
<div class="popboxshow successbox" v-if="popboxshow&&popboxtype=='成功'" :class="popboxshow?'active':''">
2021-11-28 17:20:17 +08:00
<div>
<p>{{this.successTip}}</p>
<span @click="successchangeBtnFn">我知道啦</span>
2021-11-26 14:40:45 +08:00
</div>
2021-11-28 17:20:17 +08:00
</div>
2021-11-28 19:09:30 +08:00
<img v-if="popboxshow&&popboxtype!='成功'" class="closed"
2021-11-28 17:20:17 +08:00
src="http://lsxd-customcard-h5.oss-cn-hangzhou.aliyuncs.com/cardpwd/img/commimgs/close.png" alt=""
@click="closeBtn()">
</div>
2021-11-26 14:40:45 +08:00
</body>
<script>
new Vue({
el: '#homepage',
data() {
return {
swiperDataList: [], //轮播
2021-11-29 14:14:27 +08:00
layout: 1,
2021-11-28 17:20:17 +08:00
maskshow: false,
proname: '黄金爱奇艺',
promtshow: false,
promttip: '',
codebid: '',
account: '',
reaccount: '',
product_id: '',
productType: 1,
placeholder: '请输入手机号',
iptshow: false,
orderNo: '',
loading: true,
2021-11-29 14:14:27 +08:00
lastid:0,
2021-11-28 17:20:17 +08:00
gstatus: 1,
popboxshow: false,
popboxtype: '兑换',
topImg: '',
2021-11-28 20:14:54 +08:00
goodsNum: false,
2021-11-28 17:20:17 +08:00
exchangeCommity: {}, //兑换选择的商品
bgcolor: '',
tiptext: '还没开始哟兑换时间为2021-12-05 12:12:12至2021-01-01 12:12:12',
successTip: '兑换成功,请关注短信通知!'
}
2021-11-26 14:40:45 +08:00
},
created() {
2021-11-28 17:20:17 +08:00
this.bgcolor = sessionStorage.getItem('bcolor');
this.topImg = sessionStorage.getItem('top_img');
2021-11-28 17:28:23 +08:00
this.layout = sessionStorage.getItem('showTyle');
2021-11-28 17:20:17 +08:00
this.getGoods();
2021-11-26 14:40:45 +08:00
},
methods: {
onSelected(item) {
2021-11-28 17:20:17 +08:00
this.proname = item.product_name;
this.product_id = item.product_id;
this.exchangeCommity = item;
this.gstatus = item.available;
2021-11-26 14:40:45 +08:00
},
// 单条弹框
openDialog() {
2021-11-28 17:20:17 +08:00
this.promtshow = true;
setTimeout(() => {
this.promtshow = false;
this.promttip = '';
}, 3000)
},
//根据token获取商品信息
getGoods() {
let self = this;
let data = {
2021-11-29 14:14:27 +08:00
"token": sessionStorage.getItem('token'),
"last_product_id":sessionStorage.getItem('lastid')|0,
2021-11-28 17:20:17 +08:00
}
req.axiosPostproducts('/key/products', data).then(res => {
if (res.code == 200) {
self.swiperDataList = res.data;
2021-11-28 20:26:07 +08:00
if (res.data&&res.data.length>0) {
self.goodsNum = true;
2021-11-28 20:14:54 +08:00
self.onSelected(res.data[0])
self.$nextTick(function () {
var swiper = new Swiper('.swiper-container', {
slidesPerView: "auto",
loopAdditionalSlides: 1000,
centeredSlides: true,
observer: true,
observeParents: true,
loop: true,
onSlideChangeEnd: function (swiper) {
let row = res.data[swiper.realIndex];
self.onSelected(res.data[swiper.realIndex])
}
})
2021-11-28 17:20:17 +08:00
})
2021-11-28 20:14:54 +08:00
setTimeout(() => {
self.loading = false;
}, 100);
2021-11-28 20:26:07 +08:00
} else {
self.goodsNum = false;
2021-11-28 20:14:54 +08:00
}
2021-11-28 17:20:17 +08:00
} else {
self.maskshow = true;
self.popboxtype = '提示';
self.popboxshow = true;
self.tiptext = res.message;
2021-11-28 20:14:54 +08:00
if (res.code == -1) {
setTimeout(() => {
window.location.href = "./index.html?id=" + sessionStorage.getItem('linkId');
sessionStorage.clear();
}, 1000);
}
2021-11-28 17:20:17 +08:00
}
2021-11-28 17:28:23 +08:00
}).catch(err => {
2021-11-28 20:14:54 +08:00
2021-11-28 17:28:23 +08:00
});
2021-11-27 19:05:52 +08:00
},
//选择商品点击兑换
2021-11-28 17:20:17 +08:00
exchangeBtn(row = this.exchangeCommity) {
this.codebid = row.code_batch_id;
let gstatus = row.available;
this.gstatus = gstatus;
if (gstatus == 1) {
this.maskshow = true;
this.iptshow = true;
this.proname = row.product_name;
this.product_id = row.product_id;
this.productType = row.product_type;
} else {
this.maskshow = true;
this.popboxshow = true;
this.popboxtype = '提示';
this.iptshow = false;
if (gstatus == 2) { //未开始
this.tiptext = '还没开始哟,兑换时间为' + row.begin_time + '至' + row.end_time;
} else if (gstatus == 3) { //已结束
this.tiptext = '兑换已过期,兑换时间为' + row.begin_time + '至' + row.end_time;
} else if (gstatus == 4) { //仅兑换一次
this.tiptext = '亲,仅可兑换一次哦!';
} else if (gstatus == 6) { //无库存
this.tiptext = '暂无库存,看看其他商品吧~';
2021-11-29 14:14:27 +08:00
}else if (gstatus == 7) { //其他商品处于兑换中
this.tiptext = '当前商品不可兑换';
}else if (gstatus == 8) { //已兑换次数
this.tiptext = '当前商品不可兑换';
2021-11-27 19:05:52 +08:00
}
}
2021-11-26 14:40:45 +08:00
},
2021-11-28 17:20:17 +08:00
//取消,点击叉叉
cancelBtn() {
this.maskshow = false;
this.account = "";
this.reaccount = "";
2021-11-26 14:40:45 +08:00
},
2021-11-28 17:20:17 +08:00
//确定,点击兑换按钮
defineBtn() {
if (!this.account) {
this.promttip = '请输入兑换账号!'
2021-11-26 14:40:45 +08:00
this.openDialog();
return false;
} else {
2021-11-28 17:20:17 +08:00
let reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.account) || /^[1-9][0-9]{4,9}$/.test(this.account);
let phonereg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.account);
let qqreg = /^[1-9][0-9]{4,9}$/.test(this.account);
let regflag = true;
if (this.productType == 1) {
regflag = phonereg;
} else if (this.productType == 2) {
regflag = qqreg;
} else if (this.productType == 4) {
regflag = reg;
}
if (!regflag) {
this.promttip = "充值账号格式不正确!"
this.openDialog();
return false;
}
}
if (this.reaccount == "") {
this.promttip = "请再次确认账号!";
this.openDialog();
return false;
}
if (this.account != this.reaccount) {
this.promttip = "两次输入的账号必须一致!";
this.reaccount == ""
this.openDialog();
return false;
}
//验证码
this.maskshow = true;
this.popboxshow = true;
2021-11-28 20:14:54 +08:00
this.popboxtype = '兑换';
2021-11-28 17:20:17 +08:00
this.iptshow = false;
2021-11-26 14:40:45 +08:00
},
2021-11-28 17:20:17 +08:00
//关闭,关闭弹框
closeBtn() {
this.popboxshow = false;
this.maskshow = false;
this.account = "";
this.reaccount = "";
2021-11-26 14:40:45 +08:00
},
2021-11-28 17:20:17 +08:00
//确定兑换
surexchangeBtn() {
2021-11-28 20:14:54 +08:00
let self = this;
2021-11-28 17:20:17 +08:00
let data = {
"key": sessionStorage.getItem('key'),
"product_id": this.product_id,
"account": this.account,
2021-11-28 20:52:51 +08:00
"code_batch_id": this.codebid,
"token":sessionStorage.getItem('token')
2021-11-26 14:40:45 +08:00
}
2021-11-28 17:20:17 +08:00
req.axiosPostusage('/key/usage', data).then(res => {
2021-11-29 14:14:27 +08:00
sessionStorage.setItem('lastid',self.product_id);
2021-11-28 17:20:17 +08:00
if (res.code == 200) {
// 查询订单接口
2021-11-28 19:09:30 +08:00
this.popboxtype = '成功';
2021-11-28 20:14:54 +08:00
this.popboxshow = true;
2021-11-29 14:14:27 +08:00
2021-11-28 20:14:54 +08:00
this.successTip = '兑换成功,请关注短信通知!';
2021-11-28 17:20:17 +08:00
} else {
this.popboxtype = '提示';
2021-11-28 20:14:54 +08:00
this.popboxshow = true;
2021-11-28 17:20:17 +08:00
this.tiptext = res.message;
2021-11-29 15:13:57 +08:00
if (res.code == -1) {
setTimeout(() => {
window.location.href = "./index.html?id=" + sessionStorage.getItem('linkId');
sessionStorage.clear();
}, 2000);
}
2021-11-26 14:40:45 +08:00
}
2021-11-28 17:20:17 +08:00
}).catch(err => {
2021-11-26 14:40:45 +08:00
});
},
2021-11-28 17:20:17 +08:00
//关闭弹出框,仅关闭弹框
successchangeBtn() {
this.maskshow = false;
this.popboxshow = false;
2021-11-28 20:14:54 +08:00
this.account = "";
this.reaccount = "";
2021-11-28 17:20:17 +08:00
},
//刷新页面
successchangeBtnFn() {
window.history.go(0);
2021-11-26 14:40:45 +08:00
}
},
2021-11-28 17:20:17 +08:00
watch: {
productType() {
if (this.productType == 1) {
this.placeholder = "请输入手机号";
} else if (this.productType == 2) {
this.placeholder = "请输入QQ号";
} else {
this.placeholder = "请输入手机号或QQ号";
}
2021-11-27 19:05:52 +08:00
},
2021-11-28 17:20:17 +08:00
},
2021-11-26 14:40:45 +08:00
});
</script>
</html>