@@ -28,8 +28,6 @@ function fmtMoney(n: number) {
|
|||||||
export default function CenterPage({ variant = 'primary', roleLabel }: CenterPageProps) {
|
export default function CenterPage({ variant = 'primary', roleLabel }: CenterPageProps) {
|
||||||
const { account, logout, refresh, applySession } = usePartnerSession();
|
const { account, logout, refresh, applySession } = usePartnerSession();
|
||||||
const isPrimary = variant === 'primary' && isPrimaryAccount(account);
|
const isPrimary = variant === 'primary' && isPrimaryAccount(account);
|
||||||
const [name, setName] = useState(account?.name ?? '');
|
|
||||||
const [saving, setSaving] = useState(false);
|
|
||||||
const [authorizing, setAuthorizing] = useState(false);
|
const [authorizing, setAuthorizing] = useState(false);
|
||||||
const [bills, setBills] = useState<PartnerBillDto[]>([]);
|
const [bills, setBills] = useState<PartnerBillDto[]>([]);
|
||||||
const [staffCount, setStaffCount] = useState(0);
|
const [staffCount, setStaffCount] = useState(0);
|
||||||
@@ -38,10 +36,6 @@ export default function CenterPage({ variant = 'primary', roleLabel }: CenterPag
|
|||||||
document.title = isPrimary ? '合伙人中心' : '个人中心';
|
document.title = isPrimary ? '合伙人中心' : '个人中心';
|
||||||
}, [isPrimary]);
|
}, [isPrimary]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setName(account?.name ?? '');
|
|
||||||
}, [account?.name]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isPrimary) return;
|
if (!isPrimary) return;
|
||||||
void request<PartnerBillDto[]>('PARTNER_H5', '/partner/settlement/bills')
|
void request<PartnerBillDto[]>('PARTNER_H5', '/partner/settlement/bills')
|
||||||
@@ -69,25 +63,6 @@ export default function CenterPage({ variant = 'primary', roleLabel }: CenterPag
|
|||||||
};
|
};
|
||||||
}, [bills]);
|
}, [bills]);
|
||||||
|
|
||||||
async function handleSave() {
|
|
||||||
const trimmed = name.trim();
|
|
||||||
if (!trimmed) {
|
|
||||||
toastError('请输入姓名');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (trimmed === account?.name) return;
|
|
||||||
setSaving(true);
|
|
||||||
try {
|
|
||||||
await request('PARTNER_H5', '/partner/me', {
|
|
||||||
method: 'PUT',
|
|
||||||
body: JSON.stringify({ name: trimmed }),
|
|
||||||
});
|
|
||||||
await refresh();
|
|
||||||
} finally {
|
|
||||||
setSaving(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleContactPartner() {
|
function handleContactPartner() {
|
||||||
if (isPrimary) {
|
if (isPrimary) {
|
||||||
if (!contactSupport()) toastError('暂无客服电话');
|
if (!contactSupport()) toastError('暂无客服电话');
|
||||||
@@ -255,59 +230,43 @@ export default function CenterPage({ variant = 'primary', roleLabel }: CenterPag
|
|||||||
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-menu-item"
|
||||||
|
onClick={() => { if (!contactSupport()) toastError('暂无客服电话'); }}
|
||||||
|
>
|
||||||
|
<div className="partner-menu-item-left">
|
||||||
|
<div className="partner-menu-icon">
|
||||||
|
<span className="material-symbols-outlined">support_agent</span>
|
||||||
|
</div>
|
||||||
|
<span className="body-md" style={{ fontSize: 16 }}>联系客服</span>
|
||||||
|
</div>
|
||||||
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isPrimary && (
|
{!isPrimary && (
|
||||||
<>
|
<section className="partner-menu-section">
|
||||||
<section className="partner-menu-section">
|
<div className="partner-menu-card">
|
||||||
<h3 className="headline-md" style={{ marginBottom: 8 }}>个人信息设置</h3>
|
<button type="button" className="partner-menu-item" onClick={() => { if (!contactSupport()) toastError('暂无客服电话'); }}>
|
||||||
<div className="partner-menu-card" style={{ padding: '16px' }}>
|
<div className="partner-menu-item-left">
|
||||||
<label className="partner-form-label" htmlFor="center-name">姓名</label>
|
<div className="partner-menu-icon"><span className="material-symbols-outlined">support_agent</span></div>
|
||||||
<input
|
<span className="body-md" style={{ fontSize: 16 }}>联系客服</span>
|
||||||
id="center-name"
|
</div>
|
||||||
className="partner-form-input"
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
value={name}
|
</button>
|
||||||
onChange={(e) => setName(e.target.value)}
|
<button type="button" className="partner-menu-item" onClick={handleContactPartner}>
|
||||||
placeholder="请输入姓名"
|
<div className="partner-menu-item-left">
|
||||||
maxLength={32}
|
<div className="partner-menu-icon"><span className="material-symbols-outlined">call</span></div>
|
||||||
/>
|
<span className="body-md" style={{ fontSize: 16 }}>联系合伙人</span>
|
||||||
<label className="partner-form-label" style={{ marginTop: 16 }}>手机号</label>
|
</div>
|
||||||
<input className="partner-form-input" value={account?.phone ?? ''} readOnly disabled />
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
<p className="label-md text-muted" style={{ marginTop: 4 }}>手机号由管理员维护,如需修改请联系总部</p>
|
</button>
|
||||||
<button
|
</div>
|
||||||
type="button"
|
</section>
|
||||||
className="partner-btn-primary"
|
|
||||||
style={{ width: '100%', marginTop: 16 }}
|
|
||||||
disabled={saving}
|
|
||||||
onClick={() => void handleSave()}
|
|
||||||
>
|
|
||||||
{saving ? '保存中…' : '保存资料'}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="partner-menu-section">
|
|
||||||
<div className="partner-menu-card">
|
|
||||||
<button type="button" className="partner-menu-item" onClick={() => { if (!contactSupport()) toastError('暂无客服电话'); }}>
|
|
||||||
<div className="partner-menu-item-left">
|
|
||||||
<div className="partner-menu-icon"><span className="material-symbols-outlined">support_agent</span></div>
|
|
||||||
<span className="body-md" style={{ fontSize: 16 }}>联系客服</span>
|
|
||||||
</div>
|
|
||||||
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
|
||||||
</button>
|
|
||||||
<button type="button" className="partner-menu-item" onClick={handleContactPartner}>
|
|
||||||
<div className="partner-menu-item-left">
|
|
||||||
<div className="partner-menu-icon"><span className="material-symbols-outlined">call</span></div>
|
|
||||||
<span className="body-md" style={{ fontSize: 16 }}>联系合伙人</span>
|
|
||||||
</div>
|
|
||||||
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<button type="button" className="partner-logout-btn" onClick={logout}>
|
<button type="button" className="partner-logout-btn" onClick={logout}>
|
||||||
|
|||||||
@@ -2713,14 +2713,28 @@ nav.app-tabbar .app-tabbar-label {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
border: none;
|
||||||
border-bottom: 1px solid var(--color-surface-container);
|
border-bottom: 1px solid var(--color-surface-container);
|
||||||
|
border-radius: 0;
|
||||||
|
background: transparent;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
font: inherit;
|
||||||
|
text-align: left;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.partner-menu-item:last-child { border-bottom: none; }
|
.partner-menu-item:last-child { border-bottom: none; }
|
||||||
|
|
||||||
|
.partner-menu-item:active {
|
||||||
|
background: rgba(166, 29, 36, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
.partner-menu-item-left {
|
.partner-menu-item-left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user