PageSourceSearch

https://zahit-pro-v2.pages.dev/assets/admin.shop.stores-BeVtkCiO.js

js zahit-pro-v2.pages.dev collected 2026-10-03 06:03:06 UTC 14,139 bytes, 1 lines download raw bytes

1import{j as e}from"./jsx-runtime-0DLF9kdB.js";import{G as b}from"./GlassCard-QGEypy6d.js";import{P as D}from"./PageTransition-d4Dnod-f.js";import{u as A,r as i}from"./index-DM-Ysix_.js";import"./i18n-context-DuXOzqEp.js";import{u as T}from"./hooks-ktRWiHiM.js";import{c as y}from"./cn-fNskMoFt.js";import{u as R,a as z,F as d}from"./components-C61DWoh4.js";import{A as h}from"./index-Dc83_iFP.js";import{m as n}from"./proxy-TcOPxGtH.js";import"./use-combine-values-xozz9E_C.js";function P(r){if(r.isActive)return"ACTIVE";switch(r.latestAuditAction){case"STORE_CREATED_PENDING":return"PENDING";case"STORE_REJECTED":return"REJECTED";case"STORE_DISABLED":return"DISABLED";default:return"INACTIVE"}}function K(){const{stores:r,members:N,agents:v}=R(),w=A();z(),T();const[k,o]=i.useState(!1),[c,u]=i.useState("all"),[p,x]=i.useState(null),[E,j]=i.useState(""),[g,m]=i.useState(null),[S,f]=i.useState(""),a=w.state==="submitting",l=i.useMemo(()=>{const t=r.map(s=>({...s,status:P(s)}));return{all:t,pending:t.filter(s=>s.status==="PENDING"),active:t.filter(s=>s.status==="ACTIVE"),inactive:t.filter(s=>s.status!=="PENDING"&&s.status!=="ACTIVE"),rejected:t.filter(s=>s.status==="REJECTED")}},[r]),C=c==="all"?l.all:c==="pending"?l.pending:c==="active"?l.active:l.inactive,I=t=>{switch(t){case"PENDING":return e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-amber-500/20 text-amber-400 border border-amber-500/30",children:"待啟用"});case"ACTIVE":return e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-green-500/20 text-green-400 border border-green-500/30",children:"已啟用"});case"DISABLED":return e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-zinc-500/20 text-zinc-300 border border-zinc-500/30",children:"已停用"});case"REJECTED":return e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-red-500/20 text-red-400 border border-red-500/30",children:"已拒絕"});case"INACTIVE":return e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-zinc-500/20 text-zinc-300 border border-zinc-500/30",children:"未啟用"})}};return e.jsxs(D,{children:[e.jsxs("div",{className:"mb-8 flex justify-between items-end",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-gray-500 uppercase tracking-widest",children:"B2B Management"}),e.jsx("h1",{className:"text-3xl font-black italic tracking-tighter text-white",children:"店家管理"})]}),e.jsxs("button",{onClick:()=>o(!0),className:"bg-white text-black px-6 py-3 rounded-xl font-bold text-sm hover:bg-gray-200 transition-all shadow-lg shadow-white/5 flex items-center gap-2",children:[e.jsx("span",{children:"+"})," 新增店家"]})]}),l.pending.length>0&&e.jsxs("div",{className:"mb-6 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:"⏳"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-amber-400 font-bold",children:["有 ",l.pending.length," 間店家待審核"]}),e.jsx("p",{className:"text-xs text-amber-500/80",children:"新建店家預設待啟用,核准後才可使用店家後台"})]})]}),e.jsx("button",{onClick:()=>u("pending"),className:"px-4 py-2 bg-amber-500 text-black rounded-lg font-bold text-sm hover:bg-amber-400 transition-all",children:"立即審核"})]}),e.jsx("div",{className:"flex gap-2 mb-6",children:[{key:"all",label:"全部",count:l.all.length},{key:"pending",label:"待啟用",count:l.pending.length},{key:"active",label:"已啟用",count:l.active.length},{key:"inactive",label:"停用 / 拒絕",count:l.inactive.length}].map(t=>e.jsxs("button",{onClick:()=>u(t.key),className:y("px-4 py-2 rounded-lg text-sm font-bold transition-all",c===t.key?"bg-white text-black":"bg-white/5 text-gray-400 hover:bg-white/10"),children:[t.label," (",t.count,")"]},t.key))}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:C.map(t=>e.jsxs(b,{className:y("p-6 group relative overflow-hidden",t.status==="PENDING"&&"border-amber-500/30"),intensity:"low",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-50 group-hover:opacity-100 transition-opacity",children:e.jsx("span",{className:"text-4xl",children:"🏪"})}),e.jsxs("div",{className:"relative z-10 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[I(t.status),e.jsx("span",{className:"text-xs font-mono text-gray-500",children:t.code})]}),e.jsx("h3",{className:"text-xl font-bold text-white",children:t.name})]}),e.jsxs("div",{className:"space-y-2 text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:"👤"}),e.jsx("span",{className:"text-white",children:t.owner.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:"📍"}),e.jsx("span",{className:"truncate",children:t.address})]}),t.recruiter&&e.jsxs("div",{className:"flex items-center gap-2 text-blue-400",children:[e.jsx("span",{children:"🤝"}),e.jsxs("span",{children:["開發業務: ",t.recruiter.name]})]})]}),e.jsxs("div",{className:"pt-4 border-t border-white/5",children:[e.jsx("div",{className:"flex justify-between items-center mb-3",children:e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"施工費率"}),e.jsxs("span",{className:"ml-2 font-mono text-white",children:[t.serviceFeeRate,"%"]})]})}),t.status==="PENDING"?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(d,{method:"post",className:"flex-1",children:[e.jsx("input",{type:"hidden",name:"intent",value:"approve-store"}),e.jsx("input",{type:"hidden",name:"storeId",value:t.id}),e.jsx("button",{disabled:a,className:"w-full py-2 rounded-lg bg-green-600 hover:bg-green-500 text-white text-xs font-bold transition-all disabled:opacity-50",children:"✓ 啟用"})]}),e.jsx("button",{onClick:()=>{x(t.id),j("")},disabled:a,className:"flex-1 py-2 rounded-lg bg-red-600/20 hover:bg-red-600/40 text-red-400 text-xs font-bold transition-all border border-red-500/30 disabled:opacity-50",children:"✕ 拒絕"})]}):t.isActive?e.jsx("button",{onClick:()=>{m(t.id),f("")},disabled:a,className:"w-full py-2 text-[10px] font-bold rounded-lg border border-red-500/30 text-red-400 hover:bg-red-500/10 transition-colors disabled:opacity-50",children:"停用店家"}):e.jsxs(d,{method:"post",children:[e.jsx("input",{type:"hidden",name:"intent",value:"activate-store"}),e.jsx("input",{type:"hidden",name:"storeId",value:t.id}),e.jsx("button",{disabled:a,className:"w-full py-2 text-[10px] font-bold rounded-lg border border-green-500/30 text-green-400 hover:bg-green-500/10 transition-colors disabled:opacity-50",children:"重新啟用"})]})]})]})]},t.id))}),e.jsx(h,{children:p&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(n.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},onClick:()=>x(null),className:"absolute inset-0 bg-black/80 backdrop-blur-sm"}),e.jsx(n.div,{initial:{scale:.95,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:20},className:"relative w-full max-w-md z-10",children:e.jsxs(b,{className:"p-8 border-red-500/30 shadow-2xl",intensity:"high",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-red-400",children:"⚠️"})," 拒絕店家申請"]}),e.jsxs(d,{method:"post",onSubmit:()=>x(null),children:[e.jsx("input",{type:"hidden",name:"intent",value:"reject-store"}),e.jsx("input",{type:"hidden",name:"storeId",value:p}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-2",children:"拒絕原因"}),e.jsx("textarea",{name:"reason",required:!0,value:E,onChange:t=>j(t.target.value),placeholder:"請填寫拒絕原因(會通知給店家)",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white text-sm focus:border-red-500/50 outline-none resize-none h-24"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:()=>x(null),className:"flex-1 py-3 rounded-xl border border-white/10 text-sm font-bold hover:bg-white/5",children:"取消"}),e.jsx("button",{type:"submit",disabled:a,className:"flex-1 py-3 rounded-xl bg-red-600 hover:bg-red-500 text-white text-sm font-bold",children:"確認拒絕"})]})]})]})})]})}),e.jsx(h,{children:g&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(n.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},onClick:()=>m(null),className:"absolute inset-0 bg-black/80 backdrop-blur-sm"}),e.jsx(n.div,{initial:{scale:.95,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:20},className:"relative w-full max-w-md z-10",children:e.jsxs(b,{className:"p-8 border-red-500/30 shadow-2xl",intensity:"high",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-red-400",children:"⚠️"})," 停用店家"]}),e.jsxs(d,{method:"post",onSubmit:()=>m(null),children:[e.jsx("input",{type:"hidden",name:"intent",value:"deactivate-store"}),e.jsx("input",{type:"hidden",name:"storeId",value:g}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-2",children:"停用原因"}),e.jsx("textarea",{name:"reason",required:!0,value:S,onChange:t=>f(t.target.value),placeholder:"請填寫停用原因(會通知給店家)",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white text-sm focus:border-red-500/50 outline-none resize-none h-24"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:()=>m(null),className:"flex-1 py-3 rounded-xl border border-white/10 text-sm font-bold hover:bg-white/5",children:"取消"}),e.jsx("button",{type:"submit",disabled:a,className:"flex-1 py-3 rounded-xl bg-red-600 hover:bg-red-500 text-white text-sm font-bold",children:"確認停用"})]})]})]})})]})}),e.jsx(h,{children:k&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(n.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},onClick:()=>o(!1),className:"absolute inset-0 bg-black/80 backdrop-blur-sm"}),e.jsx(n.div,{initial:{scale:.95,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:20},className:"relative w-full max-w-lg z-10",children:e.jsxs(b,{className:"p-8 border-white/20 shadow-2xl",intensity:"high",children:[e.jsx("h2",{className:"text-xl font-bold mb-6 text-white",children:"新增加盟店家"}),e.jsxs(d,{method:"post",className:"space-y-4",onSubmit:()=>o(!1),children:[e.jsx("input",{type:"hidden",name:"intent",value:"create-store"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"店家名稱"}),e.jsx("input",{name:"name",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none",placeholder:"台北旗艦店"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"店家代碼"}),e.jsx("input",{name:"code",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none",placeholder:"TPE001"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"店家負責人 (綁定會員)"}),e.jsxs("select",{name:"ownerMemberId",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none [&>option]:text-black",children:[e.jsx("option",{value:"",children:"選擇會員..."}),N.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.phone,")"]},t.id))]}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:"* 建立後為待啟用;總部核准後才可使用店家後台"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"開發業務 (B2B歸因)"}),e.jsxs("select",{name:"recruitedById",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none [&>option]:text-black",children:[e.jsx("option",{value:"",children:"無 (公司直營)"}),v.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.code,")"]},t.id))]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"聯絡電話"}),e.jsx("input",{name:"phone",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"施工費率 (%)"}),e.jsx("input",{type:"number",name:"serviceFeeRate",defaultValue:"10",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"地址"}),e.jsx("input",{name:"address",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2 text-sm text-white focus:border-white/30 outline-none",placeholder:"台北市..."})]}),e.jsxs("div",{className:"pt-4 flex gap-3",children:[e.jsx("button",{type:"button",onClick:()=>o(!1),className:"flex-1 py-3 rounded-xl border border-white/10 text-sm font-bold hover:bg-white/5",children:"取消"}),e.jsx("button",{type:"submit",disabled:a,className:"flex-1 py-3 rounded-xl bg-white text-black text-sm font-bold hover:bg-gray-200",children:a?"處理中...":"確認建立"})]})]})]})})]})})]})}export{K 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.