第6项:统一业务控件、主题与移动布局,保留原生输入和焦点契约
This commit is contained in:
1 parent
ff8b05973a
commit
cb705d296e
74 files changed
+3548
-2442
No files matched your search
@@ -3,6 +3,7 @@ import { type LedgerClient } from '../../lib/api';
|
||||
import { Calc, Fees, type MemberRow } from '../../shared';
|
||||
import { Button, Choice, Dialog, Field } from './controls';
|
||||
import { errorText, memberOptions, readForm, type Notice, type Shop } from './settingsModel';
|
||||
import { LedgerButton, LedgerDataTable, LedgerInput } from '../../components/BusinessControls';
|
||||
|
||||
interface Cost {
|
||||
name: string;
|
||||
@@ -108,7 +109,7 @@ export function Costs({
|
||||
</div>
|
||||
<label className="shop-cost-search">
|
||||
搜索成本
|
||||
<input
|
||||
<LedgerInput
|
||||
type="search"
|
||||
id="shop-cost-search"
|
||||
placeholder="输入成本名称"
|
||||
@@ -120,52 +121,50 @@ export function Costs({
|
||||
<div id="shop-cost-list">
|
||||
{visible.length ? (
|
||||
<div className="table-wrap">
|
||||
<table className="shop-cost-table">
|
||||
<thead>
|
||||
<tr>
|
||||
{['成本名称', '金额/单价', '付款人', '计费方式', '状态', '操作'].map(text => (
|
||||
<th key={text}>{text}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{visible.map(([kind, row]) => (
|
||||
<tr key={kind} data-cost-row={kind}>
|
||||
<td>
|
||||
<strong>{row.name}</strong>
|
||||
</td>
|
||||
<td>¥{row.amount}</td>
|
||||
<td>
|
||||
{row.payer === 'order'
|
||||
? '订单归属人'
|
||||
: members.find(m => m.member === row.payer)?.label || '待确认'}
|
||||
</td>
|
||||
<td>{row.byQuantity ? '单价 × 数量' : '每单一次'}</td>
|
||||
<td>{row.enabled ? '启用' : '停用'}</td>
|
||||
<td>
|
||||
<div className="actions">
|
||||
<Button
|
||||
action="shop-cost-edit"
|
||||
className="quiet"
|
||||
data-kind={kind}
|
||||
onClick={() => open('edit', kind)}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
action="shop-cost-delete"
|
||||
className="danger"
|
||||
data-kind={kind}
|
||||
onClick={() => open('delete', kind)}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
<LedgerDataTable
|
||||
className="shop-cost-table"
|
||||
columns={[
|
||||
{ title: '成本名称' },
|
||||
{ title: '金额/单价' },
|
||||
{ title: '付款人' },
|
||||
{ title: '计费方式' },
|
||||
{ title: '状态' },
|
||||
{ title: '操作' },
|
||||
]}
|
||||
rows={visible.map(([kind, row]) => ({
|
||||
key: kind,
|
||||
attributes: { 'data-cost-row': kind },
|
||||
cells: [
|
||||
<>
|
||||
<strong>{row.name}</strong>
|
||||
</>,
|
||||
<>¥{row.amount}</>,
|
||||
row.payer === 'order' ? '订单归属人' : members.find(m => m.member === row.payer)?.label || '待确认',
|
||||
row.byQuantity ? '单价 × 数量' : '每单一次',
|
||||
row.enabled ? '启用' : '停用',
|
||||
<>
|
||||
<div className="actions">
|
||||
<Button
|
||||
action="shop-cost-edit"
|
||||
className="quiet"
|
||||
data-kind={kind}
|
||||
onClick={() => open('edit', kind)}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
action="shop-cost-delete"
|
||||
className="danger"
|
||||
data-kind={kind}
|
||||
onClick={() => open('delete', kind)}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</div>
|
||||
</>,
|
||||
],
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<p className="empty">
|
||||
@@ -251,9 +250,13 @@ export function Costs({
|
||||
<Button action="shop-cost-close" className="quiet" onClick={close} disabled={saving}>
|
||||
取消
|
||||
</Button>
|
||||
<button type="submit" className={editor.action === 'delete' ? 'danger' : 'primary'} disabled={saving}>
|
||||
<LedgerButton
|
||||
type="submit"
|
||||
className={editor.action === 'delete' ? 'danger' : 'primary'}
|
||||
disabled={saving}
|
||||
>
|
||||
{editor.action === 'delete' ? '确认删除' : '保存成本'}
|
||||
</button>
|
||||
</LedgerButton>
|
||||
</div>
|
||||
</form>
|
||||
</Dialog>
|
||||
|
||||
Reference in new issue
Block a user