2022-10-11 09:43:31 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
|
|
<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>
|
|
|
|
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
|
|
|
|
</script>
|
2024-04-10 23:11:41 +08:00
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api_test1.js?v=1000"></script>
|
2022-10-11 09:43:31 +08:00
|
|
|
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/myCoupon.css" />
|
2022-11-02 15:07:29 +08:00
|
|
|
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/tabbar.css">
|
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/tabbar.js"></script>
|
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/modelPop.js"></script>
|
2022-10-11 09:43:31 +08:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="app">
|
2022-10-13 15:03:42 +08:00
|
|
|
<img class="backPresTy" @click="backHandler" v-if="goodsCount<2"
|
2022-10-11 09:43:31 +08:00
|
|
|
src=" https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
|
2022-10-13 16:05:54 +08:00
|
|
|
<div class="nav">
|
|
|
|
<p class="nav-title">我的券</p>
|
|
|
|
<ul class="tab">
|
|
|
|
<li v-for="item in tabList" :key="item.id" @click="tabHandle(item)">
|
|
|
|
<span :class="tabActive===item.id?'tab_text tab_active':'tab_text'">{{item.text}}</span>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2022-10-11 09:43:31 +08:00
|
|
|
<div class="content">
|
|
|
|
<div v-for="(item,index) in couponList" :key="item.id"
|
|
|
|
:class="more===item.id?'content-item content-item-more':'content-item'">
|
|
|
|
<div class="content-box">
|
|
|
|
<div :class="item.status===3 ?'left-box left-boxs':'left-box'">
|
2022-10-11 14:54:58 +08:00
|
|
|
<p class="left-box-moneySign" :style="{fontSize:item.reduce.length>5?'0.24rem':'0.3rem'}">
|
2022-10-11 09:43:31 +08:00
|
|
|
<span class="left-box-money">¥</span>
|
|
|
|
{{item.reduce}}
|
|
|
|
</p>
|
|
|
|
<p class="left-box-full">满{{item.full}}元可用</p>
|
|
|
|
<p class="left-box-button" @click="goUse(item)">
|
|
|
|
{{item.status===1?'去使用':item.status===2?'已使用':"已失效"}}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="right-box">
|
|
|
|
<p class="right-box-title">满{{item.full}}元减{{item.reduce}}元券</p>
|
|
|
|
<p class="right-box-time">{{item.begin_time}} - {{item.end_time}}</p>
|
|
|
|
<div class="right-box-bottom"
|
2022-11-03 15:38:49 +08:00
|
|
|
:style="{borderBottom:(more===item.id?'0.01rem solid #f1f1f1':'0')}">
|
2022-10-11 09:43:31 +08:00
|
|
|
<span class="right-box-id">券编号 <span>{{item.id}}</span></span>
|
|
|
|
<p class="right-box-more" @click="moreHandle(item.id)">
|
|
|
|
{{more===item.id?'收起':'查看更多'}}
|
|
|
|
<img :class="more===item.id?'imgArrow':''"
|
|
|
|
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/arrow.png"
|
|
|
|
alt="">
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<img class="stand" v-show="item.status===3"
|
|
|
|
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/invalid.png" alt="">
|
|
|
|
<img class="stand" v-show="item.status===2"
|
|
|
|
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/use.png" alt="">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p class="text">
|
|
|
|
商品使用范围:{{item.productArray.map(item=>item.name).join('、')}}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<!-- 空状态 -->
|
|
|
|
<div class="empty" v-if="!couponList.length">
|
|
|
|
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/coupon-empty.png" alt="">
|
|
|
|
<p>暂无优惠券</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- tab组件 -->
|
|
|
|
<tab-component :current="3"></tab-component>
|
|
|
|
<!-- 弹出提示 -->
|
|
|
|
<model-pop :show.sync="popShow" :title="popTitle" :status="popStatus" :text="popText"
|
|
|
|
@backFunction="backFunction"></model-pop>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
new Vue({
|
|
|
|
el: "#app",
|
2024-04-10 23:11:41 +08:00
|
|
|
data() {
|
2022-10-11 09:43:31 +08:00
|
|
|
return {
|
|
|
|
tabList: [{
|
|
|
|
id: 1,
|
|
|
|
text: "待使用"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 2,
|
|
|
|
text: "已使用"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 3,
|
|
|
|
text: "已失效"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
tabActive: 1,
|
|
|
|
/* tab 选中下标 */
|
|
|
|
more: false,
|
|
|
|
/* 是否展示更多 状态 */
|
|
|
|
couponList: [],
|
|
|
|
/* 提示框状态 */
|
|
|
|
popShow: false,
|
|
|
|
popTitle: '',
|
|
|
|
popText: '',
|
|
|
|
popStatus: 1, /*1 成功 2提示 3失败 */
|
2022-10-13 15:03:42 +08:00
|
|
|
redirect: false,
|
|
|
|
goodsCount: 0 /* 商品数量 */
|
2022-11-18 18:05:01 +08:00
|
|
|
};
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
components: {
|
|
|
|
tabComponent,
|
|
|
|
modelPop
|
|
|
|
},
|
|
|
|
|
2024-04-10 23:11:41 +08:00
|
|
|
created() {
|
2022-10-13 15:03:42 +08:00
|
|
|
this.goodsCount = localStorage.getItem('goodsCount');
|
2022-11-18 18:05:01 +08:00
|
|
|
this.getCouponList();
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
/* 查看更多 */
|
2024-04-10 23:11:41 +08:00
|
|
|
moreHandle(id) {
|
2022-10-11 09:43:31 +08:00
|
|
|
if (id !== this.more) {
|
2022-11-18 18:05:01 +08:00
|
|
|
this.more = id;
|
2022-10-11 09:43:31 +08:00
|
|
|
} else {
|
2022-11-18 18:05:01 +08:00
|
|
|
this.more = null;
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* 返回 */
|
2024-04-10 23:11:41 +08:00
|
|
|
backHandler() {
|
2022-10-11 09:43:31 +08:00
|
|
|
window.location.replace('./couponCollection.html');
|
|
|
|
},
|
|
|
|
|
|
|
|
/* 去使用 */
|
2024-04-10 23:11:41 +08:00
|
|
|
goUse(item) {
|
2022-10-11 09:43:31 +08:00
|
|
|
if (item.status === 1) {
|
|
|
|
window.location.replace('./couponCollection.html');
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/* tab点击 */
|
2024-04-10 23:11:41 +08:00
|
|
|
tabHandle({
|
2022-10-11 09:43:31 +08:00
|
|
|
id
|
|
|
|
}) {
|
2022-11-18 18:05:01 +08:00
|
|
|
this.tabActive = id;
|
|
|
|
this.getCouponList();
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
/* 重定向 */
|
2024-04-10 23:11:41 +08:00
|
|
|
backFunction() {
|
2022-10-11 09:43:31 +08:00
|
|
|
if (this.redirect) {
|
2022-11-18 18:05:01 +08:00
|
|
|
this.delayedOut();
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-10-17 16:59:52 +08:00
|
|
|
/* 延时自动退出 */
|
2024-04-10 23:11:41 +08:00
|
|
|
delayedOut(time = 1) {
|
2022-10-17 16:59:52 +08:00
|
|
|
let entryLink = localStorage.getItem('entryLink');
|
|
|
|
setTimeout(() => {
|
|
|
|
window.location.replace(entryLink);
|
|
|
|
}, time * 1000);
|
|
|
|
},
|
|
|
|
|
2022-10-11 09:43:31 +08:00
|
|
|
/* 请求数据 */
|
2024-04-10 23:11:41 +08:00
|
|
|
getCouponList() {
|
2022-11-18 18:05:01 +08:00
|
|
|
const token = localStorage.getItem('token');
|
2022-10-11 09:43:31 +08:00
|
|
|
req.axiosGet('/key/coupon/list', {
|
|
|
|
token,
|
|
|
|
status: this.tabActive
|
|
|
|
}).then(({
|
|
|
|
data,
|
|
|
|
code,
|
|
|
|
message
|
|
|
|
}) => {
|
2022-10-17 11:23:00 +08:00
|
|
|
if (code === 403) {
|
2022-11-18 18:05:01 +08:00
|
|
|
this.popTitle = '温馨提示';
|
|
|
|
this.popText = message;
|
|
|
|
this.popStatus = 2;
|
|
|
|
this.popShow = true;
|
|
|
|
this.redirect = true;
|
|
|
|
this.delayedOut(3);
|
|
|
|
return;
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
|
|
|
if (code === 200) {
|
|
|
|
data.map((item, index) => {
|
2022-11-18 18:05:01 +08:00
|
|
|
const productArray = [];
|
|
|
|
item.id = String((item.id)).padStart(8, 0) + index;
|
2022-10-11 09:43:31 +08:00
|
|
|
item.product.legal.map(items => {
|
|
|
|
productArray.push({
|
|
|
|
name: items.product_name,
|
|
|
|
type: 1,
|
|
|
|
id: items.product_id
|
2022-11-18 18:05:01 +08:00
|
|
|
});
|
|
|
|
});
|
2022-10-11 09:43:31 +08:00
|
|
|
|
|
|
|
item.product.reduce.map(items => {
|
|
|
|
productArray.push({
|
|
|
|
name: items.batch_goods_name,
|
|
|
|
type: 2,
|
|
|
|
id: items.channel_activity_id
|
2022-11-18 18:05:01 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
item.status = this.tabActive;
|
|
|
|
item.productArray = productArray;
|
|
|
|
});
|
|
|
|
this.couponList = data;
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
2022-11-18 18:05:01 +08:00
|
|
|
});
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|