import{t as e,o as t,j as s,w as a,h as o,i as u,I as p,z as n,l,f as c,s as d,B as i,u as r}from"./index-90c12cc1.js";import{r as y}from"./coupon.4c681b21.js";import{_ as f}from"./_plugin-vue_export-helper.1b428a4d.js";const _=f({__name:"CouponItem",props:{coupons:{type:Object,default:()=>({})},type:{type:String,default:"select"},tabType:{type:Number,default:0}},emits:["receiveCoupon"],setup(f,{emit:_}){const b=f,{push:m}=r(),{coupons:k}=e(b),T=async()=>{await y(k.value.id),_("receiveCoupon"),d({title:"领取成功",icon:"none",duration:2e3})};return(e,d)=>{const r=i;return t(),s(r,{class:"coupon-item"},{default:a((()=>[o(r,{class:"discount"},{default:a((()=>[1===u(k).couponType?(t(),s(r,{key:0,class:"unit pre-unit"},{default:a((()=>[p(" ￥ ")])),_:1})):n("",!0),p(" "+l(1==u(k).couponType?u(k).couponValue:u(k).discount)+" ",1),2===u(k).couponType?(t(),s(r,{key:1,class:"unit"},{default:a((()=>[p(" 折 ")])),_:1})):n("",!0)])),_:1}),o(r,{class:"info"},{default:a((()=>[o(r,{class:"row"},{default:a((()=>[p(l(1==u(k).couponType?"满减券":"折扣券"),1)])),_:1}),o(r,{class:"row tip"},{default:a((()=>[p(" (实付"+l(u(k).threshold)+"元使用) ",1)])),_:1})])),_:1}),"select"===f.type?(t(),s(r,{key:0},{default:a((()=>[0===f.tabType?(t(),s(r,{key:0,class:"button"},{default:a((()=>[c("span",{onClick:d[0]||(d[0]=e=>{return t=u(k),void m({url:"/pages/goodsList/goodsList"},{data:{couponId:t.id}});var t})},"去使用")])),_:1})):n("",!0),1===f.tabType?(t(),s(r,{key:1,class:"button disable"},{default:a((()=>[c("span",null,"已使用")])),_:1})):n("",!0),2===f.tabType?(t(),s(r,{key:2,class:"button expired"},{default:a((()=>[c("span",null,"已失效")])),_:1})):n("",!0)])),_:1})):n("",!0),"get"===f.type?(t(),s(r,{key:1,class:"button get-coupon",onClick:T},{default:a((()=>[p(" 领取 ")])),_:1})):n("",!0)])),_:1})}}},[["__scopeId","data-v-52d18deb"]]);export{_ as C};
