<template>
	<view class="flex-col justify-start relative page" :style="{ backgroundImage: 'url(' + bkgUrl + ')' }">
	  <view class="shrink-0 section" :style="{ backgroundImage: 'url(' + bkgUrl + ')' }"></view>
	  <view class="flex-col justify-start items-center text-wrapper pos"><text class="font text">我的优惠券</text></view>
	  <text class="font_2 text_2 pos_2">优惠券</text>
	  <view class="flex-col pos_3">
	    <view class="flex-col relative list-item mt-15" v-for="(item, index) in overDueCouponList" :key="index">
	      <view class="flex-row justify-between items-center">
	        <view class="flex-row items-center">
	          <view class="group">
	            <text class="font_3">{{ item.couponVO.conditionAmount }}</text>
	            <text class="font_2 text_3">元</text>
	          </view>
	          <text class="ml-54 font_4">{{ item.couponVO.name }}</text>
	        </view>
	        <text class="font_5 text_4">已过期</text>
	      </view>
	      <view class="mt-14 flex-row">
	        <text class="shrink-0 self-start font_5">满{{ item.couponVO.standardAmount }}元使用</text>
	        <text class="flex-1 font_6 ml-27">{{ item.couponVO.startTime.substr(0, 16) }}至{{ item.couponVO.endTime.substr(0, 16) }}</text>
	      </view>
	    </view>
	  </view>
	  <view @click="jumpToMall" class="flex-col justify-start items-center text-wrapper pos_4"><text class="font text">兑换优惠券</text></view>
	</view>
</template>

<script setup lang="ts">
	import {onMounted, ref} from 'vue'
	import { baseUrl } from '../../../api/request';
	import { onLoad } from "@dcloudio/uni-app";
	import { getFonts } from '../../../common/globalFont';
	import { couponUrl } from '../../../common/globalImagesUrl';
	const bkgUrl = ref(couponUrl + '/OverDueCoupon/bkg.png')
	onLoad(() => {
		getFonts()
	})
	
	const cookie = wx.getStorageSync("cookie")  //请求头
	onMounted(() => {
		getOverDueCouponList()
	})
	
	const overDueCouponList = ref([])
	
	const getOverDueCouponList = async () => {
		const res = await uni.request({
			url: baseUrl + '/coupon/list/my',
			method: 'POST',
			header: {
				cookie
			},
			data: {
				type: '已过期'
			}
		})
		overDueCouponList.value = res.data.data
		console.log(overDueCouponList.value)
	}
	
	const jumpToMall = () => {
		uni.navigateTo({
			url: '../CouponMall/CouponMall'
		})
	}
	
</script>

<style scoped lang="scss">
.mt-15 {
  margin-top: 28.13rpx;
}
.ml-27 {
  margin-left: 50.63rpx;
}
.page {
  overflow: hidden;
  background-image: url(https://carbon2.obs.cn-north-4.myhuaweicloud.com/feiyi/miniProgram/coupon/OverDueCoupon/bkg.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}
.section {
  background-image: url(https://carbon2.obs.cn-north-4.myhuaweicloud.com/feiyi/miniProgram/coupon/OverDueCoupon/bkg.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  width: 750rpx;
  height: 1400rpx;
}
.text-wrapper {
  padding: 45rpx 0;
  background-color: #ffffff;
}
.pos {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}
.font {
  font-size: 30rpx;
  font-family: FZSongKeBenXiuKaiS-R-GB;
  line-height: 29.42rpx;
  color: #000000;
}
.text {
  line-height: 29.18rpx;
}
.font_2 {
  font-size: 37.5rpx;
  font-family: FZSongKeBenXiuKaiS-R-GB;
  line-height: 29.42rpx;
  color: #818181;
}
.text_2 {
  color: #000000;
  line-height: 36.47rpx;
}
.pos_2 {
  position: absolute;
  left: 53.08rpx;
  top: 146.49rpx;
}
.pos_3 {
  position: absolute;
  left: 52.5rpx;
  right: 50.63rpx;
  top: 221.25rpx;
  height: 1100rpx;
  padding-bottom: 40rpx;
  overflow-y: auto;
}

/* 隐藏所有滚动条 */
::-webkit-scrollbar {
  display: none;
}

.list-item {
  padding: 30rpx 22.5rpx 30rpx 48.75rpx;
  background-color: #ffffff;
  border-radius: 18.75rpx;
  box-shadow: 0rpx 7.5rpx 7.5rpx #00000040;
}
.list-item:first-child {
  margin-top: 0;
}
.group {
  height: 43.22rpx;
}
.font_3 {
  font-size: 60rpx;
  font-family: FZSongKeBenXiuKaiS-R-GB;
  line-height: 40.09rpx;
  color: #818181;
}
.text_3 {
  line-height: 29.31rpx;
}
.font_4 {
  font-size: 30rpx;
  font-family: FZSongKeBenXiuKaiS-R-GB;
  line-height: 29.42rpx;
  color: #818181;
}
.font_5 {
  font-size: 26.25rpx;
  font-family: FZSongKeBenXiuKaiS-R-GB;
  line-height: 24.62rpx;
  color: #818181;
}
.text_4 {
  margin-right: 11.25rpx;
  line-height: 24.3rpx;
}
.font_6 {
  font-size: 26.25rpx;
  font-family: FZSongKeBenXiuKaiS-R-GB;
  line-height: 31.88rpx;
  color: #818181;
}
.pos_4 {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
}
@import url(../../../common/css/global.css);
</style>
