mobileclient/homepage.html

578 lines
22 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">
2023-12-23 19:51:51 +08:00
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/homepage2_0.css?v=3">
2021-11-28 17:20:17 +08:00
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/loading.css">
2022-06-13 16:49:06 +08:00
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/loading.js"></script>
2023-07-08 02:08:46 +08:00
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
2023-08-09 14:45:27 +08:00
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/tabs.js"></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;
2023-08-09 14:45:27 +08:00
height: 100%;
2021-11-26 14:40:45 +08:00
}
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">
2022-06-13 16:49:06 +08:00
<preload-component />
2021-11-28 17:20:17 +08:00
</div>
2022-01-14 13:48:14 +08:00
<div v-show="!loading&&!suspension" class="main-body">
2021-11-28 17:20:17 +08:00
<!-- 轮播 -->
<div id="rotation" v-if="layout=='2'">
<!-- 顶部banner -->
<div class="topBanner">
<img class="backpresty" @click="backgoodsFn" v-if="goodsShow&&!iskey"
2022-01-14 13:48:14 +08:00
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img :src="topImg" alt="" @click="bannerTo">
2021-11-28 17:20:17 +08:00
</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-30 16:30:29 +08:00
<div class="swiper-container" :class="swiperDataList.length>1?'':'oneItem'">
2021-11-28 17:20:17 +08:00
<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="[4,9].includes(item.available)"
2021-11-28 17:20:17 +08:00
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==11"
2021-11-28 17:20:17 +08:00
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">
2022-06-13 16:49:06 +08:00
<!-- type :1 兑换码 2:立减金,channel:1支付宝2微信 -->
<img class="le-img" :src="distinguishLogo(item)" :class="statusFun(item)?'':'changegray'"></img>
2021-11-28 17:20:17 +08:00
</div>
<div class="item-name" :class="statusFun(item)?'':'changegray'">
2023-06-29 16:03:24 +08:00
{{item.type==1?item.entity.product_name:item.entity.batch_goods_name}}
2023-12-22 11:58:12 +08:00
<span v-if="item.entity.send_num>1&&item.type===2" class="send_num"> x{{item.entity.send_num}}</span>
2021-11-28 17:20:17 +08:00
</div>
2021-11-26 14:40:45 +08:00
</div>
</div>
</div>
</div>
2021-11-28 17:20:17 +08:00
<!-- 立即兑换 -->
2023-06-29 16:03:24 +08:00
<div class="exchangeBtn"
:class="(gstatus===1||(exchangeCommity.type===3&&gstatus===8))?'':'bottomBtn noexchangeBtn'"
2022-01-18 17:37:45 +08:00
:style="{'background': bgcolor,'color':ftcolor}" @click="exchangeBtn()">
2021-11-28 17:20:17 +08:00
立即兑换
</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">
2022-04-18 15:01:12 +08:00
<img class="backpresty" @click="backgoodsFn" v-if="goodsShow&&!iskey"
2022-01-14 13:48:14 +08:00
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img :src="topImg" alt="" @click="bannerTo">
2021-11-28 17:20:17 +08:00
</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">
2022-01-14 13:48:14 +08:00
<li v-for="(item,i) in swiperDataList" :key="i" @click="exchangeBtn(item)">
2021-11-26 14:40:45 +08:00
<div>
<img :src="distinguishLogo(item)" alt="" :class="statusFun(item)?'':'changegray'">
<font :class="statusFun(item)?'':'changegray'">
2023-12-22 11:58:12 +08:00
{{item.type==1?item.entity.product_name:item.entity.batch_goods_name}}
<span v-if="item.entity.send_num>1&&item.type===2" class="send_num"> x{{item.entity.send_num}}</span>
</font>
2021-11-26 14:40:45 +08:00
</div>
<span class="goodsStatus">
<img v-if="[4,9].includes(item.available)"
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==11"
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>
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">
2022-04-18 15:01:12 +08:00
<img class="backpresty" @click="backgoodsFn" v-if="goodsShow&&!iskey"
2022-01-14 13:48:14 +08:00
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img :src="topImg" alt="" @click="bannerTo">
2021-11-29 20:24:57 +08:00
2021-11-28 17:20:17 +08:00
</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">
<li :class="statusFun(item)?'':'changegray'" v-for="(item,i) in swiperDataList" :key="i"
@click="exchangeBtn(item)">
2021-11-28 17:20:17 +08:00
<div>
<span class="goodsIcon">
<img v-if="[4,9].includes(item.available)"
2021-11-28 17:20:17 +08:00
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==11"
2021-11-28 17:20:17 +08:00
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="distinguishLogo(item)" alt="" />
2021-11-28 17:20:17 +08:00
</div>
2023-12-22 11:58:12 +08:00
<font>
{{item.type==1?item.entity.product_name:item.entity.batch_goods_name}}
<span v-if="item.entity.send_num>1&&item.type===2" class="send_num"> x{{item.entity.send_num}}</span>
</font>
2021-11-28 17:20:17 +08:00
</li>
</ul>
</div>
2022-01-18 17:37:45 +08:00
<div class="bottom" id="bottom" :class="layout==2?'tipset':''" v-show="describe.type">
2022-01-14 13:48:14 +08:00
<img :src="describe.bg_image" v-show="describe.type==1&&describe.bg_image">
<div v-html="describe.content" class="goodsTip" v-show="describe.type==3&&describe.content"></div>
</div>
2021-11-26 14:40:45 +08:00
</div>
2023-08-09 14:45:27 +08:00
<tab-static-component :current="1"></tab-static-component>
2022-01-18 17:37:45 +08:00
<!-- 悬浮提示 -->
2022-01-14 13:48:14 +08:00
<div v-if="suspension" class="suspensionDom">
2022-01-18 17:37:45 +08:00
<img @click="closeTip" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png"
alt="">
2022-01-14 13:48:14 +08:00
<h4>活动规则</h4>
<div v-html="describe.content">
2021-11-28 17:20:17 +08:00
2022-01-14 13:48:14 +08:00
</div>
</div>
2021-11-26 14:40:45 +08:00
<!-- 弹出框 -->
2022-06-13 16:49:06 +08:00
<div class="mask" v-if="maskshow"></div>
2022-01-18 17:37:45 +08:00
<img class="susTip" @click="susTipFn" v-if="describe.type==2&&describe.content&&!suspension&&!loading"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/acticeTextTip.png" alt="">
2021-11-26 14:40:45 +08:00
<!-- 单条弹出框 -->
<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>
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"
src="https://lsxd-customcard-h5.oss-cn-hangzhou.aliyuncs.com/cardpwd/img/commimgs/close.png" alt=""
2021-11-28 17:20:17 +08:00
@click="closeBtn()">
</div>
2021-11-26 14:40:45 +08:00
</body>
<script>
2023-06-29 16:03:24 +08:00
/***************************** type 1:直冲 2:立减金 3:红包 *****************************/
2021-11-26 14:40:45 +08:00
new Vue({
el: '#homepage',
data () {
2021-11-26 14:40:45 +08:00
return {
swiperDataList: [], //轮播
2021-12-29 11:51:28 +08:00
layout: 1,
2021-11-28 17:20:17 +08:00
maskshow: false,
promtshow: false,
promttip: '',
loading: true,
2022-01-14 13:48:14 +08:00
lastid: 0,
2021-11-28 17:20:17 +08:00
gstatus: 1,
2022-01-21 19:17:24 +08:00
suspension: false,
2021-11-28 17:20:17 +08:00
popboxshow: false,
popboxtype: '兑换',
topImg: '',
2022-01-14 13:48:14 +08:00
goodsShow: true,
2021-11-28 20:14:54 +08:00
goodsNum: false,
2021-11-28 17:20:17 +08:00
exchangeCommity: {}, //兑换选择的商品
bgcolor: '',
2022-01-14 13:48:14 +08:00
describe: {},
ftcolor: '',
2022-04-18 15:01:12 +08:00
iskey: true,
2022-01-18 17:37:45 +08:00
allgoods: [],
2022-04-18 15:01:12 +08:00
showType: 0,
2021-11-28 17:20:17 +08:00
tiptext: '还没开始哟兑换时间为2021-12-05 12:12:12至2021-01-01 12:12:12',
2023-08-09 14:45:27 +08:00
successTip: '兑换成功到账信息请关注官方APP',
2023-03-01 15:04:19 +08:00
};
2021-11-26 14:40:45 +08:00
},
2023-08-09 14:45:27 +08:00
components: {
tabStaticComponent
},
created () {
2021-12-02 15:11:56 +08:00
this.getGoods();
let productConfig = JSON.parse(localStorage.getItem('product_list'));
2022-01-14 13:48:14 +08:00
this.bgcolor = productConfig.button_color;
this.ftcolor = productConfig.font_color;
this.topImg = productConfig.top_image;
document.title = localStorage.getItem('title');
2022-01-21 19:17:24 +08:00
this.layout = productConfig.list;
this.iskey = localStorage.getItem('haskey');
2022-01-14 13:48:14 +08:00
this.describe = productConfig.describe;
2023-08-30 16:41:53 +08:00
this.bannerUrl = productConfig.bannerUrl;
2021-11-26 14:40:45 +08:00
},
methods: {
closeTip () {
2022-01-18 17:37:45 +08:00
this.suspension = false;
2022-01-14 13:48:14 +08:00
},
susTipFn () {
2022-01-18 17:37:45 +08:00
this.suspension = true;
2022-01-14 13:48:14 +08:00
},
onSelected (item) {
2021-11-28 17:20:17 +08:00
this.exchangeCommity = item;
this.gstatus = item.available;
2021-11-26 14:40:45 +08:00
},
backgoodsFn () {
2022-04-18 15:01:12 +08:00
let backUrl = window.history.length;
if (window.history.length) {
history.go(-backUrl + 1);
}
},
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 = '';
2023-03-01 15:04:19 +08:00
}, 3000);
2021-11-28 17:20:17 +08:00
},
//根据token获取商品信息
async getGoods () {
2021-11-28 17:20:17 +08:00
let self = this;
let showType = localStorage.getItem('showType');
2022-04-18 15:01:12 +08:00
this.showType = showType;
2021-11-28 17:20:17 +08:00
let data = {
"last_product_id": localStorage.getItem('lastid') | 0,
2023-03-01 15:04:19 +08:00
};
2022-01-18 17:37:45 +08:00
if (showType == 1) { //白名单
let tokenList = JSON.parse(localStorage.getItem('getTokenList'));
2022-01-18 17:37:45 +08:00
let goodsList = [];
for (item of tokenList) {
let goodsItem = [];
data.token = item;
2022-06-13 16:49:06 +08:00
let waitGoods = await req.axiosPost('/key/products', data).then(res => {
2022-01-18 17:37:45 +08:00
if (res.code == 200) {
res.data.forEach(it => {
2022-01-21 19:17:24 +08:00
it.token = item;
2022-01-18 17:37:45 +08:00
});
goodsItem = res.data;
2022-04-18 15:01:12 +08:00
} else {
self.maskshow = true;
self.popboxtype = '提示';
self.popboxshow = true;
self.tiptext = res.message;
if (res.code == 403) {
2022-04-18 15:01:12 +08:00
setTimeout(() => {
window.location.href = localStorage.getItem('white_link');
2022-04-18 15:01:12 +08:00
}, 3000);
}
2022-01-18 17:37:45 +08:00
}
});
goodsList = goodsList.concat(goodsItem);
};
let duplicate = []; //去重
let goodsArr = []; //最终的商品集合
goodsList.forEach(item => {
if (duplicate.indexOf(item.product_id) == -1) {
duplicate.push(item.product_id);
}
2022-01-18 17:37:45 +08:00
});
2023-03-01 15:04:19 +08:00
let similar = [];
2022-01-18 17:37:45 +08:00
duplicate.forEach(it => {
similar = goodsList.filter(iten => { //goodshow为去重后的数据
return iten.product_id == it;
});
let flag = [1, 2, 6, 8, 7, 5, 9, 4, 11, 3, 10, 20, 21]; //显示的avarivble规则
2022-01-18 17:37:45 +08:00
let minIndex = 7;
similar.forEach(item => {
let flagIndex = flag.indexOf(item.available);
if (flagIndex > -1) {
if (flagIndex < minIndex)
minIndex = flagIndex;
}
2023-03-01 15:04:19 +08:00
});
2022-01-18 17:37:45 +08:00
let obj = similar.find((o) => {
2023-03-01 15:04:19 +08:00
return o.available == flag[minIndex];
});
2022-01-18 17:37:45 +08:00
goodsArr.push(obj);
});
/*商品自定义排序0-100降序排列100第一个展示0最后一个展示*/
var objectArraySort = (keyName) => {
return (objectN, objectM) => {
2023-03-01 15:04:19 +08:00
var valueN = objectN[keyName];
var valueM = objectM[keyName];
if (valueN < valueM) return 1;
else if (valueN > valueM) return -1;
else return 0;
};
};
goodsArr.sort(objectArraySort('weight'));
2022-01-18 17:37:45 +08:00
self.swiperDataList = goodsArr;
self.goodsShow = goodsArr.length > 1;
2022-01-22 15:50:40 +08:00
sessionStorage.setItem('goodsCount', goodsArr.length);
2022-04-18 15:01:12 +08:00
if (goodsArr && goodsArr.length == 1 && goodsArr[0].available == 1) {
2022-01-21 19:17:24 +08:00
sessionStorage.setItem('goodsInfo', JSON.stringify(goodsArr[0]));
localStorage.setItem('key', goodsArr[0].key);
localStorage.setItem('token', goodsArr[0].token);
this.toPage(goodsArr[0]);
2022-01-18 17:37:45 +08:00
return false;
2022-04-18 15:01:12 +08:00
} else if (goodsArr && goodsArr.length >= 1) {
2022-01-18 17:37:45 +08:00
self.goodsNum = true;
2023-03-01 15:04:19 +08:00
self.onSelected(goodsArr[0]);
2022-01-18 17:37:45 +08:00
self.$nextTick(function () {
var swiper = new Swiper('.swiper-container', {
slidesPerView: "auto",
loopAdditionalSlides: 1000,
centeredSlides: true,
observer: true,
observeParents: true,
loop: self.goodsShow,
onSlideChangeEnd: function (swiper) {
let row = goodsArr[swiper.realIndex];
2023-03-01 15:04:19 +08:00
self.onSelected(goodsArr[swiper.realIndex]);
2022-01-18 17:37:45 +08:00
}
2023-03-01 15:04:19 +08:00
});
});
2022-01-18 17:37:45 +08:00
setTimeout(() => {
self.loading = false;
}, 100);
2021-11-28 17:20:17 +08:00
} else {
2022-01-18 17:37:45 +08:00
self.goodsNum = false;
setTimeout(() => {
self.maskshow = true;
self.popboxtype = '提示';
self.popboxshow = true;
self.tiptext = '暂无可兑换码商品';
2023-03-01 15:04:19 +08:00
}, 1000);
2022-01-18 17:37:45 +08:00
}
2022-04-18 15:01:12 +08:00
} else { //兑换码
2023-03-01 15:04:19 +08:00
data.token = localStorage.getItem('token');
2022-06-13 16:49:06 +08:00
req.axiosPost('/key/products', data).then(res => {
2022-01-18 17:37:45 +08:00
if (res.code == 200) {
self.swiperDataList = res.data;
2022-04-18 15:01:12 +08:00
sessionStorage.setItem('goodsCount', res.data.length);
2022-01-18 17:37:45 +08:00
self.goodsShow = res.data.length > 1;
2023-07-14 18:46:35 +08:00
let ua = window.navigator.userAgent.toLowerCase();/* 判断是否web-view打开 */
if ((res.data && res.data.length == 1) || /miniProgram/i.test(ua)) {//单个商品直接进入详情页面
2022-04-18 15:01:12 +08:00
sessionStorage.setItem('goodsInfo', JSON.stringify(res.data[0]));
this.toPage(res.data[0]);
2022-04-18 15:01:12 +08:00
return false;
} else if (res.data && res.data.length >= 1) {
2022-01-18 17:37:45 +08:00
self.goodsNum = true;
2023-03-01 15:04:19 +08:00
self.onSelected(res.data[0]);
2022-01-18 17:37:45 +08:00
self.$nextTick(function () {
var swiper = new Swiper('.swiper-container', {
slidesPerView: "auto",
loopAdditionalSlides: 1000,
centeredSlides: true,
observer: true,
observeParents: true,
loop: self.goodsShow,
onSlideChangeEnd: function (swiper) {
let row = res.data[swiper.realIndex];
2023-03-01 15:04:19 +08:00
self.onSelected(res.data[swiper.realIndex]);
2022-01-18 17:37:45 +08:00
}
2023-03-01 15:04:19 +08:00
});
});
setTimeout(() => {
2022-01-18 17:37:45 +08:00
self.loading = false;
}, 100);
} else {
setTimeout(() => {
self.maskshow = true;
self.popboxtype = '提示';
self.popboxshow = true;
self.tiptext = '暂无可兑换码商品';
2023-03-01 15:04:19 +08:00
}, 1000);
2022-01-18 17:37:45 +08:00
}
} else {
self.maskshow = true;
self.popboxtype = '提示';
self.popboxshow = true;
self.tiptext = res.message;
if (res.code == 403) {
let haskey = localStorage.getItem('haskey');
2022-01-18 17:37:45 +08:00
if (haskey) {
setTimeout(() => {
window.history.back();
}, 3000);
} else {
setTimeout(() => {
2022-11-02 10:09:56 +08:00
window.location.href = "./index.html?id=" + localStorage.getItem('linkId');
2022-01-18 17:37:45 +08:00
}, 3000);
}
}
2021-11-28 20:14:54 +08:00
}
2022-01-18 17:37:45 +08:00
}).catch(err => {
});
}
2021-11-27 19:05:52 +08:00
},
2023-06-29 16:03:24 +08:00
2021-11-27 19:05:52 +08:00
//选择商品点击兑换
exchangeBtn (row = this.exchangeCommity) {
2021-11-28 17:20:17 +08:00
let gstatus = row.available;
this.gstatus = gstatus;
2023-06-29 16:03:24 +08:00
/* 直冲、立减金商品状态为 1 时可兑换。
* 红包商品状态为 1 8 时也可兑换
*/
if (gstatus == 1 || (row.type === 3 && [1, 8].includes(row.available))) {
2021-12-29 11:51:28 +08:00
// 跳转商品详情页面
2022-04-18 15:01:12 +08:00
if (this.showType == 1) { //白名单
localStorage.setItem('token', row.token);
localStorage.setItem('key', row.key);
2022-01-21 19:17:24 +08:00
}
2022-01-14 13:48:14 +08:00
sessionStorage.setItem('goodsInfo', JSON.stringify(row));
this.toPage(row);
2021-11-28 17:20:17 +08:00
} else {
this.maskshow = true;
this.popboxshow = true;
this.popboxtype = '提示';
this.tiptext = product_status(gstatus, row);
2021-11-27 19:05:52 +08:00
}
2021-11-26 14:40:45 +08:00
},
2023-06-29 16:03:24 +08:00
2021-11-28 17:20:17 +08:00
//关闭,关闭弹框
closeBtn () {
2021-11-28 17:20:17 +08:00
this.popboxshow = false;
this.maskshow = false;
2022-01-14 13:48:14 +08:00
if (this.gstatus == 8) {
2021-12-02 11:02:50 +08:00
window.history.go(0);
}
2021-11-26 14:40:45 +08:00
},
2021-11-28 17:20:17 +08:00
//关闭弹出框,仅关闭弹框
successchangeBtn () {
2021-11-28 17:20:17 +08:00
this.maskshow = false;
this.popboxshow = false;
2022-01-14 13:48:14 +08:00
if (this.gstatus == 8) {
2021-12-02 11:02:50 +08:00
window.history.go(0);
}
if (this.tiptext === '暂无可兑换码商品') {
setTimeout(() => {
window.location.href = "../index.html?id=" + localStorage.getItem('linkId');
}, 1000);
}
2021-11-28 17:20:17 +08:00
},
//刷新页面
successchangeBtnFn () {
2021-11-28 17:20:17 +08:00
window.history.go(0);
},
/* 区分红包商品logo 路径 */
distinguishLogo ({ type, entity }) {
const { channel } = entity;
/* NOTE: type 1 兑换码 2 立减金 3 红包 */
/* NOTE: channel 1 支付宝 2 微信 */
if (type == 1) {
return entity.show_url;
}
if (type == 2) {
if (channel === 1) {
return 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/commonproductlogo/zfbreduce.png';
2023-07-25 11:47:15 +08:00
} else if (channel === 2) {
return 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/commonproductlogo/wxreduce.png';
2023-07-25 11:47:15 +08:00
} else if (channel === 3) {
return 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/logo_ysf.png';
}
}
if (type == 3) {
if (channel === 1) {
return 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/redPacktes/alipay_icon.png';
} else if (channel === 2) {
return 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/redPacktes/wechat_icon.png';
} else if (channel === 3) {
return 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/logo_ysf.png';
}
}
},
/* 区分状态 */
statusFun (item) {
if (item.available === 1) {
return true;
} else if (item.available === 8) {
if (item.type === 3) {
return true;
} else {
return false;
}
} else {
return false;
}
},
/* 集中跳转 */
toPage ({ type, entity }) {
/*
* type: 1 兑换码 2 立减金 3 红包
* receive_mode: 1 支付宝 2 H5
*/
if (type == 1) {
window.location.replace("./exchange.html");
}
if (type == 2) {
2023-07-25 11:47:15 +08:00
if (entity.channel === 3) {
2023-08-01 09:08:26 +08:00
window.location.replace("./ysf-reduce.html");
} else if (entity.channel === 1 && entity.receive_mode === 2) {
window.location.replace("./zfb-reduce.html");
2023-07-25 11:47:15 +08:00
} else {
window.location.replace("./reduce.html");
}
}
if (type == 3) {
if (entity.channel === 3) {
window.location.replace("./ysf.html");
} else if (entity.channel === 1 && entity.receive_mode === 2) {
window.location.replace("./zfb-redPackets.html");
} else {
window.location.replace("./redPackets.html");
}
}
2023-06-29 16:03:24 +08:00
},
/* banner外链跳转 */
bannerTo () {
if (this.bannerUrl) {
location.href = this.bannerUrl;
}
}
2021-12-02 15:11:56 +08:00
}
})
2021-11-26 14:40:45 +08:00
</script>
2022-01-14 13:48:14 +08:00
2021-11-26 14:40:45 +08:00
</html>