<template> <view class="box"> <view style="height: 20rpx;"></view> <view class="line" v-for="(item,index) in list"> <view class="linetop"> <view class="lineTopleft"> <view class="lineTop1"> <view class="linemoney">¥ <span style="font-size: 40rpx;">{{item.actMoney}}</span> </view> <view class="lineTopName">{{item.actName}}</view> </view> <view class="linetop2"> <view class="mdsky">{{item.whereMoney!==0?'满'+item.whereMoney+'可用':'无限制'}}</view> <view class="endOffsetDays"> <span v-if="item.endOffsetDays">领取后{{item.endOffsetDays}}天有效</span> <span v-else>{{item.startTime|dateformat}}-{{item.endTime|dateformat}}</span> </view> </view> </view> <view class="receiveBtn1" @click="receive(item.id)">领取</view> </view> <view class="lineBottom"> <view>可用次数:{{item.avaQty}}</view> <view @click="goDetail(item.id)">查看详情></view> </view> </view> <nodata v-if="list.length==0"></nodata> </view> </template> <script> import nodata from '../../components/nodata/nodata.vue' export default { components: { nodata }, data() { return { list:'', themeColor:'', userInfo:'', stateMap: ['待审核', '审核通过', '审核拒绝'], bizUserId:'', discount:'', } }, onLoad(opt) { this.themeColor = uni.getStorageSync("themeColor"); this.userInfo = uni.getStorageSync("userInfo"); this.bizUserId=opt.bizUserId; this.discount=opt.discount; this.getList() }, onShow() { }, filters:{ dateformat(val){ return val.slice(0,10) } }, methods: { goDetail(id) { uni.navigateTo({ url: 'discountCardDetail?id=' + id+'&type=2' }) }, receive(id){ uni.showLoading({ title: '领取中' }) this.$http('opencoupon/getCoupons', { id: id, }, 'GET').then(res => { uni.hideLoading(); uni.showToast({ title: '领取成功', icon:'none', duration: 3000 }); //this.getList(); //var data=res.data.Items; //this.list=this.list.concat(data); //console.log('list+=', this.queryShopList); }) }, getList(){ uni.showLoading({ title: '加载中' }) if(this.discount!=2){ var params={ discount:this.discount } }else{ var params={ discount:this.discount, bizId:this.bizUserId } } this.$http('opencoupon/getCouponList', params, 'GET').then(res => { uni.hideLoading(); this.list = res.data; //var data=res.data.Items; //this.list=this.list.concat(data); //console.log('list+=', this.queryShopList); }) } }, onReachBottom(){ //this.page++; this.getList() //console.log("shanglas") }, onPullDownRefresh(){ //this.page=1; //this.list=[]; this.getList(); setTimeout(() => { uni.stopPullDownRefresh(); // 关闭下拉刷新 }, 2000); } } </script> <style scoped lang="less"> .box { width: 100vw; min-height: 100vh; background: #F4F5F7; } .receiveBtn1{ width: 144rpx; height: 56rpx; font-size: 28rpx; line-height: 56rpx; color: #D53533; border-radius: 36rpx; border: 2rpx solid #D53533; text-align: center; } .lineTop1{ display: flex; } .linetop2{ display: flex;font-size: 24rpx; padding-bottom: 39rpx; padding-top: 10rpx; } .mdsky{ color: #666666; } .endOffsetDays{ color: #666666; } .linemoney{ width: 260rpx; } .linetop{ display: flex; justify-content: space-between; } .mdsky{ width: 260rpx; } .lineBottom{ display: flex; justify-content: space-between; color: #999999; font-size: 24rpx; padding-top: 20rpx; border-top: 1px dashed #EEEEEE; } .linemoney{ color: #FF3B30;font-size: 26rpx; } .lineTopName{ font-size: 30rpx; font-family: PingFangSC-Medium, PingFang SC; font-weight: 500; color: #333333; } .line{ width: 662rpx; background: #FFFFFF; border-radius: 10rpx; margin-bottom: 20rpx; margin-left: 24rpx; padding: 30rpx 20rpx 20rpx 20rpx; } </style>