import { defineStore } from 'pinia'
import { getCouponList } from '@/api/home'

export const useCouponStore = defineStore('coupon', {
    state: () => ({
        discountVoucherList: [], // 折扣券
        couponList: [], // 满减券
    }),
    actions: {
        async getCouponListByType() {
            const res = await getCouponList()
            this.discountVoucherList = (res.discountCoupon || []).slice(0, 3)
            this.couponList = (res.fullReduceCoupon || []).slice(0, 3)
        }
    }
})
