Files

92 lines
2.0 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 { useRouter } from "@/hooks/useRouter";
import { useDiscountCoupon } from "@/pages/discountCoupon/index.utils";
import CouponItem from "@/pages/discountCoupon/components/CouponItem.vue";
import Empty from "@/components/Empty/index.vue"
import { emptyCouponIcon } from "@/utils/images";
import ReturnTop from "@/components/ReturnTop/index.vue";
import { useScroll } from "@/hooks/useScroll";
const {goBack} = useRouter();
const {scrollTop} = useScroll()
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">
<view
class="coupon-list"
v-for="item in couponList">
<CouponItem
:coupons="item"
:tabType="tabCurrent"
/>
</view>
</template>
<Empty
:iconSrc="emptyCouponIcon"
v-else
>
您暂时没有可使用的优惠券~
</Empty>
</view>
<ReturnTop :scroll-top="scrollTop" />
</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%;
.coupon-list {
margin-bottom: 24rpx;
}
}
}
</style>