mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
235 lines
5.9 KiB
Vue
235 lines
5.9 KiB
Vue
<template>
|
|
<div class="allmain">
|
|
|
|
<Myheader></Myheader>
|
|
<!-- <tabs></tabs> -->
|
|
<div class="rc-top"></div>
|
|
<tabs :crumbs="crumbs"></tabs>
|
|
<div class="rc-usermain">
|
|
|
|
<div class="rc rc-column">
|
|
<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" :style='usercolor'>
|
|
<div>
|
|
<i v-if="(item.couponTypeId!='4' && item.couponAmount>0)">
|
|
¥
|
|
</i>
|
|
<span>
|
|
{{ item.couponAmount?item.couponAmount:(parseInt((item.discount)*10)+'折') }}
|
|
</span>
|
|
</div>
|
|
<strong>{{ item.couponName }}</strong>
|
|
</div>
|
|
<div class="rc-right">
|
|
<i :style='usercolor'>
|
|
{{ item.couponDesc }}
|
|
</i>
|
|
<div class="rc-userfont">
|
|
<strong>有效期</strong>
|
|
<span>{{item.validFrom}}至</span>
|
|
<em>{{item.validTo}}</em>
|
|
</div>
|
|
<nuxt-link :to="`/productdetails/productlist`" v-if="activeIndex==0">
|
|
<div class="ts-standard-btn">
|
|
立即使用
|
|
</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 {
|
|
crumbs:[
|
|
{
|
|
path:'/personal/mypersonal/',
|
|
},
|
|
{
|
|
path:'/personal/discount/',
|
|
}
|
|
],
|
|
userload: true,
|
|
pastdue: false,
|
|
unused: false,
|
|
usercolor:{color:'#e1001a'},
|
|
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"),
|
|
},
|
|
],
|
|
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;
|
|
this.newlist.forEach(element=>{
|
|
element.validFrom=element.validFrom.slice(0,10)
|
|
element.validTo=element.validTo.slice(0,10)
|
|
})
|
|
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
|
|
console.log(this.$refs.userleft);
|
|
this.usercolor={color:'white'}
|
|
|
|
|
|
this.userdraw(this.usermessage.data.mobile,1)
|
|
}
|
|
if (this.activeIndex == 0) {
|
|
this.userload = true;
|
|
this.pastdue = false;
|
|
this.userdraw(this.usermessage.data.mobile,0)
|
|
this.usercolor={color:'#e1001a'}
|
|
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,2)
|
|
this.userstates=2
|
|
this.usercolor={color:'white'}
|
|
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);
|
|
// }
|
|
},
|
|
|
|
directives: {
|
|
'color': {
|
|
bind: function(el, binding){
|
|
el.style.color = binding.value
|
|
},
|
|
inserted: function(el){
|
|
|
|
}
|
|
},
|
|
|
|
},
|
|
mounted() {
|
|
if(this.usermessage!=='' ||this.usermessage.data!==undefined){
|
|
this.usermessage= JSON.parse(localStorage.getItem("userInfo"));
|
|
|
|
}
|
|
|
|
this.userdraw(this.usermessage.data.mobile,);
|
|
},
|
|
components: {
|
|
Myheader,
|
|
tabs
|
|
},
|
|
};
|
|
import Myheader from "~/components/header.vue";
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
// 手机端
|
|
@import url("../../assets/css/discount.less");
|
|
</style> |