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