PageSourceSearch

https://www.placet.kr/_nuxt/EJ3Tejd7.js

js placet.kr collected 2026-10-02 02:00:36 UTC 8,421 bytes, 1 lines download raw bytes

1import{S as T}from"./BWH0oPSg.js";import{$ as _,k as H,z as f,q as g,e as P,g as x,c,o as i,B as w,a as e,p as S,t as m,n as l,_ as B,F as M,A as $,l as z,f as E,b as L,w as F}from"./DnFarWxx.js";import"./BX_HfxGs.js";const I=()=>({getPaymentMethods:async o=>(await _("/api/payments/methods")).data??[],setDefaultPaymentMethod:async(o,a)=>{await _(`/api/payments/methods/${a}/default`,{method:"POST"})},deletePaymentMethod:async(o,a)=>{await _(`/api/payments/methods/${a}`,{method:"DELETE"})},getPaymentHistory:async(o,a=20)=>(await _(`/api/payments/history?limit=${a}`)).data??[]}),N=()=>{const{user:t}=H(),d=I(),s=g([]),p=g([]),o=g(!1),a=g(null),h=f(()=>s.value.find(u=>u.isDefault)??null),k=f(()=>s.value.length>0),r=async()=>{if(t.value?.id){o.value=!0,a.value=null;try{s.value=await d.getPaymentMethods(t.value.id)}catch(u){console.error("fetchPaymentMethods error:",u),a.value=u instanceof Error?u.message:"결제 수단을 불러오지 못했습니다."}finally{o.value=!1}}},y=async u=>{if(t.value?.id){o.value=!0,a.value=null;try{p.value=await d.getPaymentHistory(t.value.id,u)}catch(n){console.error("fetchPaymentHistory error:",n),a.value=n instanceof Error?n.message:"결제 내역을 불러오지 못했습니다."}finally{o.value=!1}}},b=async u=>{if(!t.value?.id)throw new Error("로그인이 필요합니다.");a.value=null;try{await d.setDefaultPaymentMethod(t.value.id,u),s.value=s.value.map(n=>({...n,isDefault:n.id===u}))}catch(n){throw console.error("setDefaultMethod error:",n),a.value=n instanceof Error?n.message:"기본 결제 수단 설정에 실패했습니다.",n}},D=async u=>{if(!t.value?.id)throw new Error("로그인이 필요합니다.");const n=[...s.value];s.value=s.value.filter(v=>v.id!==u),a.value=null;try{await d.deletePaymentMethod(t.value.id,u)}catch(v){throw s.value=n,console.error("deleteMethod error:",v),a.value=v instanceof Error?v.message:"결제 수단 삭제에 실패했습니다.",v}},C=async()=>{await Promise.all([r(),y()])};return{paymentMethods:f(()=>s.value),history:f(()=>p.value),defaultMethod:h,hasPaymentMethods:k,loading:f(()=>o.value),error:f(()=>a.value),fetchPaymentMethods:r,fetchPaymentHistory:y,setDefaultMethod:b,deleteMethod:D,initialize:C}},V={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},A={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},K={key:2,viewBox:"0 0 24 24","aria-hidden":"true"},R={class:"method-info"},q={class:"method-name"},O={key:0,class:"default-badge"},W={class:"method-type"},j={class:"method-actions"},G=["disabled"],J=["disabled"],Q=P({__name:"PaymentMethodCard",props:{method:{},disabled:{type:Boolean}},emits:["set-default","delete"],setup(t,{emit:d}){const s=t,p=d,{t:o}=x(),a=f(()=>s.method.displayName?s.method.displayName:s.method.cardCompany&&s.method.cardLastFour?`${s.method.cardCompany} ****${s.method.cardLastFour}`:o(`settings.payment.methodType.${s.method.methodType}`)),h=f(()=>o(`settings.payment.methodType.${s.method.methodType}`));return(k,r)=>(i(),c("div",{class:w(["payment-method-card",{default:t.method.isDefault}])},[e("div",{class:w(["method-icon",t.method.methodType])},[t.method.methodType==="card"?(i(),c("svg",V,[...r[2]||(r[2]=[e("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",stroke:"currentColor","stroke-width":"2",fill:"none"},null,-1),e("path",{d:"M2 10h20",stroke:"currentColor","stroke-width":"2"},null,-1)])])):t.method.methodType==="kakao"?(i(),c("svg",A,[...r[3]||(r[3]=[e("path",{d:"M12 3C6.48 3 2 6.58 2 11c0 2.84 1.87 5.33 4.67 6.71l-.95 3.54c-.08.29.25.54.51.38l4.24-2.83c.5.06 1.01.1 1.53.1 5.52 0 10-3.58 10-8s-4.48-8-10-8z",fill:"currentColor"},null,-1)])])):(i(),c("svg",K,[...r[4]||(r[4]=[e("path",{d:"M12 2L2 7l10 5 10-5-10-5z",stroke:"currentColor","stroke-width":"2",fill:"none"},null,-1),e("path",{d:"M2 17l10 5 10-5",stroke:"currentColor","stroke-width":"2",fill:"none"},null,-1),e("path",{d:"M2 12l10 5 10-5",stroke:"currentColor","stroke-width":"2",fill:"none"},null,-1)])]))],2),e("div",R,[e("div",q,[e("span",null,m(l(a)),1),t.method.isDefault?(i(),c("span",O,m(l(o)("settings.payment.default")),1)):S("",!0)]),e("div",W,m(l(h)),1)]),e("div",j,[t.method.isDefault?S("",!0):(i(),c("button",{key:0,t
1ype:"button",class:"action-btn set-default",disabled:t.disabled,onClick:r[0]||(r[0]=y=>p("set-default",t.method.id))},m(l(o)("settings.payment.setDefault")),9,G)),e("button",{type:"button",class:"action-btn delete",disabled:t.disabled,onClick:r[1]||(r[1]=y=>p("delete",t.method.id))},m(l(o)("settings.payment.delete")),9,J)])],2))}}),U=B(Q,[["__scopeId","data-v-15295fd5"]]),X={class:"payment-history-list"},Y={key:0,class:"history-loading"},Z={key:1,class:"history-empty"},ee={class:"item-info"},te={class:"item-description"},se={class:"item-date"},ae={class:"item-details"},oe={class:"item-amount"},ne=P({__name:"PaymentHistoryList",props:{history:{},loading:{type:Boolean}},setup(t){const{t:d}=x(),s=o=>new Date(o).toLocaleDateString("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit"}),p=o=>`₩${o.toLocaleString("ko-KR")}`;return(o,a)=>(i(),c("div",X,[t.loading?(i(),c("div",Y,[(i(),c(M,null,$(3,h=>e("div",{key:`skeleton-${h}`,class:"skeleton-item skeleton"},[...a[0]||(a[0]=[e("div",{class:"skeleton-shimmer",style:{width:"60%",height:"14px"}},null,-1),e("div",{class:"skeleton-shimmer",style:{width:"40%",height:"12px"}},null,-1)])])),64))])):t.history.length===0?(i(),c("div",Z,[e("p",null,m(l(d)("settings.payment.historyEmpty")),1)])):(i(!0),c(M,{key:2},$(t.history,h=>(i(),c("div",{key:h.id,class:"history-item"},[e("div",ee,[e("div",te,m(h.description??"결제"),1),e("div",se,m(s(h.createdAt)),1)]),e("div",ae,[e("div",oe,m(p(h.amount)),1),e("div",{class:w(["item-status",h.status])},m(l(d)(`settings.payment.status.${h.status}`)),3)])]))),128))]))}}),le=B(ne,[["__scopeId","data-v-9bc11057"]]),ie={class:"payment-settings-view"},de={class:"settings-section"},re={class:"section-title"},ce={key:0,class:"methods-loading"},ue={key:1,class:"methods-empty"},he={key:2,class:"methods-list"},me={type:"button",class:"add-method-btn",disabled:"",title:"준비 중입니다"},ye={class:"settings-section"},pe={class:"section-title"},ve=P({__name:"PaymentSettingsView",setup(t){const{t:d}=x(),{paymentMethods:s,history:p,loading:o,initialize:a,setDefaultMethod:h,deleteMethod:k}=N(),r=g(!1),y=g(null),b=()=>{y.value=null},D=async u=>{r.value=!0,y.value=null;try{await h(u)}catch{y.value={type:"error",text:d("settings.payment.deleteFailed")}}finally{r.value=!1}},C=async u=>{r.value=!0,y.value=null;try{await k(u),y.value={type:"success",text:d("settings.payment.deleteSuccess")}}catch{y.value={type:"error",text:d("settings.payment.deleteFailed")}}finally{r.value=!1}};return z(()=>{a()}),(u,n)=>(i(),c("div",ie,[e("section",de,[e("h3",re,m(l(d)("settings.payment.methods")),1),l(o)&&l(s).length===0?(i(),c("div",ce,[(i(),c(M,null,$(2,v=>e("div",{key:`skeleton-${v}`,class:"skeleton-card skeleton"},[...n[0]||(n[0]=[e("div",{class:"skeleton-shimmer",style:{width:"40px",height:"40px","border-radius":"8px"}},null,-1),e("div",{style:{flex:"1"}},[e("div",{class:"skeleton-shimmer",style:{width:"60%",height:"14px"}}),e("div",{class:"skeleton-shimmer",style:{width:"40%",height:"12px","margin-top":"6px"}})],-1)])])),64))])):l(s).length===0?(i(),c("div",ue,[e("p",null,m(l(d)("settings.payment.methodsEmpty")),1)])):(i(),c("div",he,[(i(!0),c(M,null,$(l(s),v=>(i(),E(U,{key:v.id,method:v,disabled:l(r),onSetDefault:D,onDelete:C},null,8,["method","disabled"]))),128))])),e("button",me,[n[1]||(n[1]=e("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[e("path",{d:"M12 5v14M5 12h14",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)),e("span",null,m(l(d)("settings.payment.addMethod")),1)])]),n[3]||(n[3]=e("div",{class:"divider"},null,-1)),e("section",ye,[e("h3",pe,m(l(d)("settings.payment.history")),1),L(le,{history:l(p),loading:l(o)},null,8,["history","loading"])]),l(y)?(i(),c("div",{key:0,class:w(["message",l(y).type])},[e("span",null,m(l(y).text),1),e("button",{type:"button",class:"message-close",onClick:b},[...n[2]||(n[2]=[e("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[e("path",{d:"M6 6l12 12M18 6l-12 12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)])])],2)):S("",!0)]))}}),fe=B(ve,[["__scopeId","data-v-ea2ce7c3"]]),we=P({__name:"payment",setup(t){const{t:d}=x();return(s,p)=>(i(),E(T,{title:l(d)("settings.payment.title")},{default:F(()=>[L(fe)]),_:1},8,["title"]))}});
1export{we as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.