smart-admin/rc-busness/pages/personal/discount.vue
952108534@qq.com 30a6381d0e 更改优惠券
2022-01-13 21:21:01 +08:00

265 lines
7.1 KiB
Vue

<template>
<div class="allmain">
<Myheader></Myheader>
<div class="online bold rc-md-down" id="fixed-catbar-seperator"></div>
<!-- <tabs></tabs> -->
<div class="rc-top"></div>
<div class="rc-usermain">
<div class="online bold"></div>
<div class="rc">
<span
v-for="(item, index) in discountlist"
:key="index"
@click="selectGoods(item, index)"
:class="activeIndex == index ? 'active' : 'unactive'"
>
{{ item.title }}
</span>
<!-- <span @click="tanchu()">弹出</span> -->
</div>
<div class="online bold"></div>
<div class="rs-dis">
<div
class="rc-discount"
v-for="(item, index) in newlist"
:key="index"
>
<img :src="userimage" alt="" />
<div class="rc-contair">
<div class="rc-left" ref="userleft" id="userleft">
<div>
<i>¥</i><span>{{ item.couponAmount }}</span>
</div>
<strong>{{ item.couponName }}</strong>
</div>
<div class="rc-right">
<i>
{{ item.couponName }}
</i>
<div class="rc-userfont">
<strong>有效期</strong>
<span>{{item.validFrom}}至</span>
<em>{{ item.validTo }}</em>
</div>
<nuxt-link :to="`/productdetails/productlist`">
<div v-if="userload" class="ts-stand">
<span @click="usertiao()" class="ts-standard-btn">立即使用</span>
</div>
</nuxt-link>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import {allConfig,getdraw} from "../../ajax/getData";
// import tabs from "@/components/tabs.vue";
export default {
// middleware: 'metaTitle',
// // middleware: 'metaTitle',
// meta: {title: '优惠券'},
data() {
return {
userload: true,
pastdue: false,
unused: false,
usermessage:[],
userstates:0,
userimage: require("../../assets/image/unused.png"),
newlist: [
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
catimage: require("../../assets/image/unused.png"),
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
catimage: require("../../assets/image/unused.png"),
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
catimage: require("../../assets/image/unused.png"),
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
],
discountlist: [
{
title: "未使用",
},
{
title: "已使用",
},
{
title: "已过期",
},
],
preferential: [
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
{
price: "30",
pricestype: "新客优惠券",
special: "全场每满299-30",
period: "有效期",
starttime: "2021.11.29-2022.01.28",
},
],
userdiscount:[],
activeIndex: 0,
};
},
methods: {
//获取用户领取的优惠券
async userdraw(mobile,states) {
let data = await getdraw(mobile,states);
if(data){
console.log(data);
this.newlist=data.data;
console.log(this.newlist);
}
},
selectGoods(item, index) {
this.activeIndex = index;
if (this.activeIndex == 1) {
this.userload = false;
this.pastdue = true;
this.userimage = require("../../assets/image/hasused.png");
this.userstates=1
this.userdraw(this.usermessage.data.mobile,0)
}
if (this.activeIndex == 0) {
this.userload = true;
this.pastdue = false;
this.userdraw(this.usermessage.data.mobile,0)
this.userstates=0
this.userimage = require("../../assets/image/unused.png");
}
if (this.activeIndex == 2) {
this.userload = false;
this.pastdue = true;
this.userdraw(this.usermessage.data.mobile,0)
this.userstates=2
this.userimage = require("../../assets/image/expired.png");
}
console.log(index);
},
usertiao(){
this.$router.push({ name: "productdetails-productlist",
})
},
// tanchu() {
// console.log('---')
// var option = {
// customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
// }
// dis_livchat(option);
// }
},
mounted() {
if(this.usermessage!=='' ||this.usermessage.data!==undefined){
this.usermessage= JSON.parse(localStorage.getItem("userInfo"));
}
this.userdraw(this.usermessage.data.mobile,);
},
components: {
Myheader,
},
};
import Myheader from "~/components/header.vue";
</script>
<style lang="less" scoped>
// 手机端
@import url("../../assets/css/global.less");
@import url("../../assets/css/discount.less");
</style>