123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <view class="coupon">
- <view class="tab-group">
- <view class="tab" :class="[query.status == 1?'active':'']" @click="handleTab(1)">
- 未使用
- </view>
- <view class="tab" :class="[query.status == 2?'active':'']" @click="handleTab(2)">
- 已使用
- </view>
- </view>
-
- <!-- 列表 -->
- <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
-
- <view class="discounts-item" v-for="(item,index) in list" :key="index" >
- <view class="card-content" :class="[query.status == 2?'card-bg':'']">
- <view class="info">
- <view class="title">
- {{item.goodsName}}
- </view>
- <view class="limit">
- {{item.useType | filterType(item)}}
- </view>
-
- <view class="desc" :class="[open == index?'open':'']" @click="handleOpen(index,'open')">
- 展开详情 <image class="jiantou" src="../../static/jiantou-icon.png" mode=""></image>
- </view>
- </view>
- <view class="btn-box">
- <view class="btn" >
- {{query.status == 2?'已使用':'未使用'}}
- </view>
- </view>
- <view class="num" v-if="item.buySet == 2">
- 剩余领取次数:{{item.useCount}}次
- </view>
- </view>
- <view class="card-desc" v-show="open == index">
- <view class="time">
- {{item.validType | filterType1(item)}}
- </view>
- <view class="desc" v-html="item.goodsDescribe">
- {{item.goodsDescribe}}
- </view>
- </view>
- </view>
- </zs-list>
-
-
- </view>
- </template>
- <script>
- import {getWhetherCoupon} from '@/api/goods.js'
- export default {
- data() {
- return {
- active: 1,
- open:999,
- status:'more',
- query:{
- currentPage:1,
- pageSize:10,
- status:1,//
- setMealId:JSON.parse(uni.getStorageSync('userInfo')).setMealId,
- userId: JSON.parse(uni.getStorageSync('userInfo')).userId
- },
- list:[]
- }
- },
- filters: {
- filterUseTime: function(val) {
- if(val.useType == 0){
- return '无限制'
- }else if(val.useType == 1){
- return val.useStartTime + '-' + val.useEndTime +'可使用'
- }else if(val.useType == 2){
- return '每周'+val.day
- }else if(val.useType == 3){
- return '每月'+val.day +'日'
- }
- },
- filterTime: function(val) {
- if(val.validType == 1){
- return '永久有效'
- }else {
- return val.validStartTime + '-' + val.validEndTime
- }
- },
- filterType: function(val,item) {
- if(val == 1){
- return '无使用限制'
- }else if(val == 2){
- return '使用期至' + item.useEndTime
- }else if(val == 3){
- return '每周'+ item.day +'可用'
- }else if(val == 4){
- return '每月'+ item.day +'可用'
- }
- },
- filterType1: function(val,item) {
- if(val == 1){
- return '有效期:无限制'
- }else if(val == 2){
- return '有效期:' + item.validStartTime + '-' + item.validEndTime
- }
- }
- },
- methods: {
- handleOpen(val,open){
- if(val === this[open]){
- this[open] = 999
- }else{
- this[open] = val
- }
- },
- handleTab(val) {
- this.query.status = val
- this.list = []
- this.status = 'more'
- this.query.currentPage = 1
- this.getWhetherCoupon()
- },
- loadMore(){
- this.getWhetherCoupon()
- },
- getWhetherCoupon(){
- this.status = 'loading'
- getWhetherCoupon(this.query).then(res=>{
- if(res.state == 'Success'){
- this.list = this.list.concat(res.content.records)
- this.list.length>= res.content.total?this.status = 'noMore':this.status = 'more'
- this.query.currentPage++
- }
- })
- }
- },
- created() {
- let info = JSON.parse(uni.getStorageSync('userInfo'))
- this.query.userId = info.userId
- this.query.setMealId = info.setMealId
- }
- }
- </script>
- <style lang="scss" scoped>
- .coupon{
- background: #f5f5f5;
- height: 100vh;
- padding-top: 80rpx;
- .tab-group{
- display: flex;
- align-items: center;
- background: #fff;
- position: fixed;
- height: 80rpx;
- top: 0%;
- left: 0%;
- width: 100%;
- z-index: 9;
- .tab{
- width: 150rpx;
- padding: 15rpx 30rpx;
- text-align: center;
- color: #999999;
- font-size: 28rpx;
- }
- .active{
- font-weight: bold;
- font-size: 32rpx;
- position: relative;
- color: #222222;
- &::before{
- display: block;
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0%;
- transform: translateX(-50%);
- width: 40rpx;
- height: 8rpx;
- background: linear-gradient(265deg, #FF4A39 0%, #FC8B45 100%);
- box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- }
-
- }
- }
-
- .discounts-item {
- margin: 0 32rpx;
- .card-content.card-bg{
- background: url('../../static/used-card-bg.png') no-repeat;
- background-size: 100% 144rpx;
- }
- .card-content{
- display: flex;
- align-items: center;
- justify-content: space-between;
- background-color: rgb(239, 239, 239);
- background: url('../../static/card.png') no-repeat;
- background-repeat: no-repeat;
- background-size: 100% 144rpx;
- border-radius: 16rpx;
- height: 144rpx;
- padding: 0 30rpx 0 48rpx;
- margin-top: 20rpx;
- position: relative;
- .info {
- .title {
- color: #0F0F0F;
- font-size: 30rpx;
- }
- .desc{
- display: flex;
- align-items: center;
- font-size: 20rpx;
- color: #AAAAAA;
- .jiantou{
- width: 20rpx;
- height: 20rpx;
- transform: rotateZ(90deg);
- display: block;
- margin-left: 10rpx;
- transition: transform .3s;
- }
- }
- .open{
- .jiantou{
- transform: rotateZ(270deg)!important;
- }
- }
- .red{
- color: $uni-text-primary!important;
- }
- .limit{
- font-size: 20rpx;
- color: #AAAAAA;
- margin:10rpx 0;
- }
- .time {
- color: #9a9a9a;
- font-size: 24rpx;
- margin-top: 15rpx;
- }
- }
- .btn-box{
- .btn {
- width: 118rpx;
- height: 48rpx;
- line-height: 48rpx;
- text-align: center;
- font-size: 24rpx;
- background: linear-gradient(90deg, #FEFBF2 0%, #F7D188 100%);
- border-radius: 35rpx;
- color: #E5452C;
- margin-top: 15rpx;
- }
-
- }
- .num{
- position: absolute;
- white-space: nowrap;
- bottom: 10rpx;
- right: 10rpx;
- font-size: 18rpx;
- color: #FFFFFF;
- }
- }
- .card-desc{
- font-size: 20rpx;
- color: #AAAAAA;
- padding: 20rpx 10rpx;
- background: #FFFFFF;
- border-radius: 0rpx 0rpx 16rpx 16rpx;
- .time{
-
- }
- .desc{
- margin-top: 22rpx;
- }
- }
- }
-
- .item{
- display: flex;
- align-items: center;
- margin: 30rpx;
- background: url('../../static/card.png') no-repeat;
- background-size: 100% 100%;
- width: 690rpx;
- height: 160rpx;
- box-sizing: border-box;
- padding: 30rpx;
- .info{
- display: flex;
- .left{
- width: 160rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- .price{
- font-weight: bold;
- color: #222222;
- font-size: 36rpx;
- }
- .limit{
- color: #999999;
- font-size: 24rpx;
- margin-top: 10rpx;
- }
- }
- .right{
- padding-left: 30rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .title{
- font-size: 28rpx;
- color: #222222;
- }
- .time{
-
- font-size: 24rpx;
- color: #999999;
- margin-top: 10rpx;
- }
- }
- }
- }
- }
- </style>
|