Files
2023-11-14 17:21:03 +08:00

84 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
@name: index
@author: kahu4
@date: 2023-10-31 11:05
@descriptionindex
@update: 2023-10-31 11:05
-->
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useRouter } from "@/hooks/useRouter";
const {goBack} = useRouter();
import { useDiscountCoupon } from "@/pages/discountCoupon/index.utils";
import CouponItem from "@/pages/discountCoupon/components/CouponItem.vue";
import Empty from "@/components/Empty/index.vue"
import emptyIcon from '@/static/icon/empty/优惠券.png'
const {
tabList,
tabCurrent,
handleTabsChange,
couponList,
showEmpty,
} = useDiscountCoupon()
</script>
<template>
<view class="discount-coupon">
<!-- tab -->
<view class="tabs-row">
<uv-tabs
:current="tabCurrent"
:list="tabList"
lineColor="#ee6d46"
:activeStyle="{color:'#ee6d46'}"
:itemStyle="{width:`calc( 100% / ${tabList.length} )`,'box-sizing':'border-box','height':'80rpx'}"
keyName="label"
@change="handleTabsChange"
/>
</view>
<!-- coupon list -->
<view class="coupon-box">
<template v-if="!showEmpty">
<template v-for="item in couponList">
<CouponItem
:coupons="item"
:tabType="tabCurrent"
/>
</template>
</template>
<Empty
:iconSrc="emptyIcon"
v-else
>
您暂时没有可使用的优惠券~
</Empty>
</view>
</view>
</template>
<style
scoped
lang="scss"
>
.discount-coupon {
.tabs-row {
width: 100%;
box-sizing: border-box;
background: #fff;
position: sticky;
top: 0;
}
.coupon-box {
padding: 35rpx;
box-sizing: border-box;
width: 100%;
}
}
</style>