You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/pages/user/coupon/coupon.vue

650 lines
15 KiB

<template>
<view>
<view class="tabr" :style="{top:headerTop}">
<!-- ({{couponcout}}) -->
<view :class="{on:typeClass=='valid'}" @tap="switchType('valid')">待使用</view>
<view :class="{on:typeClass=='invalid'}" @tap="switchType('invalid')">已使用</view>
<view :class="{on:typeClass=='noinvalid'}" @tap="switchType('noinvalid')">已过期</view>
</view>
<scroll-view scroll-x='true' :style="{top:headerswiperTop}" class="srollview width100" scroll-with-animation>
<view class="conent" :class="[ordertypeid == index ? 'activeconent' : 'frontconent']"
v-for="(item,index) in orderTyplist" :key="index">{{item}}</view>
</scroll-view>
4 years ago
<view class="place"></view>
<view class="list">
<!-- 优惠券列表 -->
<view class="sub-list" v-if="typeClass == 'valid'">
<view class="tis" v-if="couponValidList.length==0">
3 years ago
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
</view>
<view class="row" v-for="(row,index) in couponValidList" :key="index" @click="jumpcoupons(row)">
<!-- content -->
4 years ago
<view class="carrier">
<view class="left">
<view class="alijusstart" style="margin-top: -7px;">
<view class="alijus font12 fotct fcorfff"
style="width: 70px;height: 20px;background-color: #3ecbb0;margin-right: 2px;">
<image src="../../../static/img/user/user15.png" mode="widthFix" class="icon12">
</image>
折扣券
</view>
</view>
<view class="title alijusstart">
<text class="height20 fotct fcorfff font11"
style="width: 50px;background-color: #347edd;border-radius: 20px;">话费券</text>
<view class="text1 width70">{{row.highDiscount.discountName}}</view>
</view>
<view class="term">
有效期:{{row.useEndTime | formatDate('-')}}
</view>
</view>
<view class="right">
<view class="ticket">
<view class="num" v-if="row.highDiscount.discountType == 3">
{{row.highDiscount.discountPrice * 10}}
</view>
<view class="num" v-else>
{{row.highDiscount.discountPrice}}
</view>
<view class="unit" v-if="row.highDiscount.discountType == 3">
</view>
<view class="unit" v-else>
</view>
</view>
<!-- <view class="criteria">
4 years ago
{{row.highDiscount.discountName}}
</view> -->
<view class="use">
去使用
</view>
</view>
</view>
</view>
</view>
<!-- //已使用 -->
<view class="sub-list" v-if="typeClass == 'invalid'">
<view class="tis" v-if="couponinvalidList.length==0">
3 years ago
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
</view>
4 years ago
<view class="row" v-for="(row,index) in couponinvalidList" :key="index">
<!-- content -->
4 years ago
<view class="carrier">
<view class="left">
<view class="title">
4 years ago
{{row.highDiscount.discountName}}
</view>
<view class="term">
使用时间:{{row.useTime | formatDate('-')}}
</view>
</view>
<view class="right invalid">
<view class="ticket">
<view class="num">
{{row.highDiscount.discountPrice}}
</view>
<view class="unit">
</view>
</view>
<view class="criteria">
{{row.highDiscount.discountName}}
</view>
<view class="use">
已使用
</view>
</view>
</view>
</view>
</view>
<!-- 已过期 -->
<view class="sub-list" v-if="typeClass == 'noinvalid'">
<view class="tis" v-if="couponnoinvalidList.length==0">
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
</view>
<view class="row" v-for="(row,index) in couponnoinvalidList" :key="index">
<!-- content -->
<view class="carrier">
<view class="left">
<view class="title">
{{row.highDiscount.discountName}}
</view>
<view class="term">
过期时间:{{row.useEndTime | formatDate('-')}}
</view>
</view>
<view class="right invalid">
<view class="ticket">
<view class="num">
4 years ago
{{row.highDiscount.discountPrice}}
</view>
<view class="unit">
</view>
</view>
<view class="criteria">
4 years ago
{{row.highDiscount.discountName}}
</view>
<view class="use">
已过期
</view>
</view>
</view>
</view>
</view>
</view>
4 years ago
</view>
</template>
<script>
4 years ago
import {
getUserDiscountList
} from '../../../Utils/Api.js';
3 years ago
let app = getApp();
export default {
data() {
return {
4 years ago
couponValidList: [],
couponinvalidList: [],
couponnoinvalidList: [],
3 years ago
imagewxUrl: app.globalData.imageWxImg,
imgadres: 'noorder.png',
headerTop: 0,
headerswiperTop:'45px',
//控制滑动效果
4 years ago
typeClass: 'valid',
subState: '',
theIndex: null,
oldIndex: null,
isStop: false,
pageNum: 1,
pageSize: 10,
isNoMoreData: false,
loadingText: '',
couponcout: 0,
orderTyplist: ['全部订单', '在线加油', '肯德基', '星巴克', '话费充值', '卡券订单'], //消息类型
ordertypeid: 1 //类型id
}
},
4 years ago
onPageScroll(e) {
},
//下拉刷新,需要自己在page.json文件中配置开启页面下拉刷新 "enablePullDownRefresh": true
onPullDownRefresh() {
4 years ago
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
onLoad() {
// #ifdef H5
this.headerTop = '44PX';
this.headerswiperTop = '89px';
// #endif
4 years ago
this.getUserDiscountList(1);
},
4 years ago
filters: {
//过滤器 用于格式化时间
formatDate: function(value, spe = '/') {
let data = new Date(value);
let year = data.getFullYear();
let month = data.getMonth() + 1;
let day = data.getDate();
let h = data.getHours();
let mm = data.getMinutes();
let s = data.getSeconds();
month = month >= 10 ? month : "0" + month;
day = day >= 10 ? day : "0" + day;
h = h >= 10 ? h : "0" + h;
mm = mm >= 10 ? mm : "0" + mm;
s = s >= 10 ? s : "0" + s;
4 years ago
return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
}
},
onReachBottom() {
if (this.typeClass == 'valid') {
this.getUserDiscountList(1);
} else if (this.typeClass == 'invalid') {
4 years ago
this.getUserDiscountList(2);
} else {
this.getUserDiscountList(0);
4 years ago
}
},
methods: {
4 years ago
//查询我的优惠券
getUserDiscountList(item) {
uni.showLoading({
title: '加载中...'
})
if (this.isNoMoreData) {
uni.hideLoading()
this.loadingText = '到底了';
return false;
}
let pagenum = this.pageNum;
let params = {
pageNum: pagenum,
status: item,
pageSize: this.pageSize
}
getUserDiscountList(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
if (res.return_data.total == (this.pageNum * this.pageSize)) {
this.isNoMoreData = true;
}
4 years ago
if (this.typeClass == 'valid') {
this.couponValidList = this.couponValidList.concat(res.return_data.list);
this.couponcout = res.return_data.total;
} else if (this.typeClass == 'invalid') {
4 years ago
this.couponinvalidList = this.couponinvalidList.concat(res.return_data.list);
} else {
this.couponnoinvalidList = this.couponnoinvalidList.concat(res.return_data.list);
4 years ago
}
this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
4 years ago
} else {
this.couponValidList = [];
this.couponinvalidList = [];
this.couponnoinvalidList = [];
4 years ago
uni.hideLoading()
}
})
},
//跳转详情
jumpcoupons(e) {
if (e.highDiscount.useScope == 3) {
uni.navigateTo({
url: '../../../subPages/recharge/recharge'
})
} else if (e.highDiscount.useScope == 4) {
app.globalData.distinguishid = 1;
uni.navigateTo({
url: '/qianzhu-KFC/buffet-order/buffet-order'
})
} else if (e.highDiscount.useScope == 5) {
app.globalData.distinguishid = 2;
uni.navigateTo({
url: '/qianzhu-KFC/buffet-order/buffet-order'
})
} else if (e.highDiscount.useScope == 6) {
uni.navigateTo({
url: '/member-Recharge/choicepage/choicepage'
})
} else if (e.highDiscount.useScope == 7) {
uni.navigateTo({
url: '../../goods/refuel/refuel'
})
} else {
uni.navigateTo({
url: '../mineCouponsDestails/mineCouponsDestails?id=' + e.id
})
}
4 years ago
},
switchType(type) {
if (this.typeClass == type) {
return;
}
uni.pageScrollTo({
4 years ago
scrollTop: 0,
duration: 0
})
this.typeClass = type;
4 years ago
this.subState = this.typeClass == '' ? '' : 'show' + type;
// setTimeout(() => {
// this.oldIndex = null;
// this.theIndex = null;
// this.subState = this.typeClass == 'valid' ? '' : this.subState;
// }, 200)
4 years ago
if (this.typeClass == 'valid') {
this.pageNum = 1;
this.couponValidList = []
this.isNoMoreData = false;
this.getUserDiscountList(1);
} else if (this.typeClass == 'invalid') {
4 years ago
this.pageNum = 1;
this.couponinvalidList = []
this.isNoMoreData = false;
this.getUserDiscountList(2);
} else {
this.pageNum = 1;
this.couponnoinvalidList = []
this.isNoMoreData = false;
this.getUserDiscountList(0);
4 years ago
}
}
}
}
</script>
<style lang="scss">
4 years ago
view {
display: flex;
flex-wrap: wrap;
4 years ago
}
4 years ago
.srollview {
position: fixed;
z-index: 9999;
height: 60px;
background-color: #ffffff;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
white-space: nowrap;
.conent {
height: 24px;
line-height: 24px;
margin-top: 15px;
padding-left: 10px;
font-size: 10px;
padding-right: 10px;
border-radius: 20px;
margin-left: 15px;
display: inline-flex;
flex-direction: column;
text-align: center;
position: relative;
}
}
.frontconent {
background-color: #eeeeee;
color: #333333;
}
.activeconent {
background-color: #e8eff4;
color: #009DFF;
}
4 years ago
page {
position: relative;
background-color: #f5f5f5;
}
.hidden {
display: none !important;
}
4 years ago
.place {
width: 100%;
height: 110px;
}
4 years ago
.tabr {
background-color: #fff;
width: 94%;
height: 95upx;
padding: 0 3%;
border-bottom: solid 1upx #dedede;
position: fixed;
top: 0;
z-index: 10;
4 years ago
view {
width: 33.3%;
height: 90upx;
justify-content: center;
align-items: center;
font-size: 32upx;
color: #999;
}
4 years ago
.on {
color: #0083f5;
border-bottom: 2px solid #0083f5;
}
4 years ago
}
4 years ago
.list {
width: 100%;
display: block;
position: relative;
}
4 years ago
@keyframes showValid {
4 years ago
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(0);
}
}
4 years ago
@keyframes showInvalid {
4 years ago
0% {
transform: translateX(0);
}
100% {
transform: translateX(-100%);
}
}
4 years ago
@keyframes shownoInvalid {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-200%);
}
}
4 years ago
.sub-list {
&.invalid {
position: absolute;
top: 0;
4 years ago
left: 100%;
display: none;
}
4 years ago
&.showvalid {
display: flex;
animation: showValid 0.20s linear both;
}
4 years ago
&.showinvalid {
display: flex;
animation: showInvalid 0.20s linear both;
}
4 years ago
&.shownoinvalid {
display: flex;
animation: shownoInvalid 0.20s linear both;
}
width: 100%;
padding: 20upx 0 120upx 0;
4 years ago
.tis {
width: 100%;
height: 60upx;
justify-content: center;
align-items: center;
font-size: 32upx;
}
4 years ago
.row {
width: 92%;
height: 27vw;
margin: 20upx auto 10upx auto;
border-radius: 8upx;
// box-shadow: 0upx 0 10upx rgba(0,0,0,0.1);
align-items: center;
position: relative;
overflow: hidden;
z-index: 4;
border: 0;
4 years ago
.menu {
.icon {
color: #fff;
4 years ago
font-size: 50upx;
}
4 years ago
position: absolute;
width: 28%;
height: 100%;
right: 0;
justify-content: center;
align-items: center;
background-color: red;
color: #fff;
z-index: 2;
}
4 years ago
.carrier {
@keyframes showMenu {
4 years ago
0% {
transform: translateX(0);
}
100% {
transform: translateX(-28%);
}
}
4 years ago
@keyframes closeMenu {
4 years ago
0% {
transform: translateX(-28%);
}
100% {
transform: translateX(0);
}
}
4 years ago
&.open {
animation: showMenu 0.25s linear both;
}
4 years ago
&.close {
animation: closeMenu 0.15s linear both;
}
4 years ago
position: absolute;
width: 100%;
padding: 0 0;
height: 100%;
z-index: 3;
flex-wrap: nowrap;
4 years ago
.left {
background-color: #fff;
width: 72%;
background-image: radial-gradient(6px at top right, #f5f5f5 50px, #ffffff);
4 years ago
.title {
width: 90%;
margin: 0 5%;
font-size: 36upx;
}
4 years ago
.term {
width: 95%;
background-image: radial-gradient(6px at bottom right, #f5f5f5 50px, #ffffff);
margin-left: 5%;
font-size: 26upx;
color: #999;
}
4 years ago
position: relative;
4 years ago
.gap-top,
.gap-bottom {
position: absolute;
width: 20upx;
height: 20upx;
right: -10upx;
border-radius: 100%;
background-color: #f5f5f5;
}
4 years ago
.gap-top {
top: -10upx;
}
4 years ago
.gap-bottom {
bottom: -10upx;
}
4 years ago
.shixiao {
position: absolute;
right: 20upx;
font-size: 150upx;
z-index: 6;
4 years ago
color: rgba(153, 153, 153, 0.2)
}
}
4 years ago
.right {
flex-shrink: 0;
width: 28%;
color: #fff;
background: linear-gradient(to right, #66c4ff, #009DFF);
background-image: radial-gradient(6px at bottom left, #f5f5f5 50px, #009DFF);
4 years ago
&.invalid {
background: linear-gradient(to right, #aaa, #999);
.use {
color: #aaa;
}
}
4 years ago
justify-content: center;
4 years ago
.ticket,
.criteria {
width: 100%;
}
.ticket {
background-image: radial-gradient(6px at top left, #f5f5f5 50px, #009DFF);
padding-top: 1vw;
justify-content: center;
align-items: baseline;
4 years ago
.num {
font-size: 60upx;
font-weight: 600;
}
4 years ago
.unit {
font-size: 28upx;
}
}
4 years ago
.criteria {
justify-content: center;
4 years ago
font-size: 28upx;
}
4 years ago
.use {
width: 70%;
height: 60rpx;
justify-content: center;
align-items: center;
font-size: 28rpx;
background-color: #fff;
color: #009DFF;
border-radius: 40rpx;
padding: 0 10rpx;
}
}
}
4 years ago
}
}
</style>