<route lang="json">
{ "style": { "navigationBarTitleText": "优惠券包", "navigationBarBackgroundColor": "#fff" } }
</route>
<script setup lang="ts">
import Card from '@/components/card.vue'
import { getCoupons } from '../../../core/libs/requests'
import PageHelper from '@/components/page-helper.vue'
import dayjs from 'dayjs'
import CouponCard from '@/pages/common/components/coupon-card.vue'

const tab = ref(2)
const tabs = ref([
  { label: '商品优惠券', value: 2 },
  { label: '销售积分券', value: 1 },
])
const query = computed(() => ({ couponType: tab.value, isUse: 0 }))
// const {data, run: set} = useRequest(() => getCoupons({}))
</script>
<template>
  <div class="flex-grow flex flex-col gap-4">
    <wd-tabs v-model="tab">
      <block v-for="({ label, value }, i) in tabs" :key="i">
        <wd-tab :title="label" :name="value"></wd-tab>
      </block>
    </wd-tabs>
    <PageHelper :request="getCoupons" :query="query">
      <template #default="{ source }">
        <div class="flex flex-col gap-4">
          <template v-for="(it, i) of source.list" :key="i">
            <CouponCard :options="it"></CouponCard>
          </template>
        </div>
      </template>
    </PageHelper>
  </div>
</template>
