import{l as e,o as t,c as s,w as a,a as o,u,h as p,m as n,t as l,k as c,D as r,d as i}from"./index-d76b1e7a.js";import{r as d}from"./api.9246a192.js";import{u as y}from"./useRouter.2bdb47a0.js";import{_ as f}from"./_plugin-vue_export-helper.1b428a4d.js";const _="/assets/优惠券-1b7354fa.png",g=e=>d.get(`/product/coupon/relation/searchUserCoupon/${e}`,{},{login:!1}),b=e=>d.get(`/product/coupon/receive-list/${e}`,{},{login:!1}),m=e=>d.get(`/cart/coupon/?cartIds=${e}`,{},{login:!1}),k=f({__name:"CouponItem",props:{coupons:{type:Object,default:()=>({})},type:{type:String,default:"select"},tabType:{type:Number,default:0}},setup(f){const _=f,{push:g}=y(),{coupons:b}=e(_),m=async()=>{var e;await(e=b.value.id,d.get(`/product/coupon/relation/receive/${e}`,{},{login:!1})),r({title:"领取成功",icon:"none",duration:2e3})},k=()=>{g({url:"/pages/goodsList/goodsList"})};return(e,r)=>{const d=i;return t(),s(d,{class:"coupon-item"},{default:a((()=>[o(d,{class:"discount"},{default:a((()=>[1===u(b).couponType?(t(),s(d,{key:0,class:"unit pre-unit"},{default:a((()=>[p(" ￥ ")])),_:1})):n("",!0),p(" "+l(1==u(b).couponType?u(b).couponValue:u(b).discount)+" ",1),2===u(b).couponType?(t(),s(d,{key:1,class:"unit"},{default:a((()=>[p(" 折 ")])),_:1})):n("",!0)])),_:1}),o(d,{class:"info"},{default:a((()=>[o(d,{class:"row"},{default:a((()=>[p(l(1==u(b).couponType?"满减券":"折扣券"),1)])),_:1}),o(d,{class:"row tip"},{default:a((()=>[p(" (实付"+l(u(b).threshold)+"元使用) ",1)])),_:1})])),_:1}),"select"===f.type?(t(),s(d,{key:0},{default:a((()=>[0===f.tabType?(t(),s(d,{key:0,class:"button"},{default:a((()=>[c("span",{onClick:k},"去使用")])),_:1})):n("",!0),1===f.tabType?(t(),s(d,{key:1,class:"button disable"},{default:a((()=>[c("span",null,"已使用")])),_:1})):n("",!0),2===f.tabType?(t(),s(d,{key:2,class:"button expired"},{default:a((()=>[c("span",null,"已失效")])),_:1})):n("",!0)])),_:1})):n("",!0),"get"===f.type?(t(),s(d,{key:1,class:"button get-coupon",onClick:m},{default:a((()=>[p(" 领取 ")])),_:1})):n("",!0)])),_:1})}}},[["__scopeId","data-v-909d3763"]]);export{k as C,b as a,g as b,_ as e,m as g};
