feat: 支持京东白条账单上传和清洗
This commit is contained in:
@@ -42,7 +42,7 @@ export async function checkHealth(): Promise<boolean> {
|
||||
}
|
||||
|
||||
// 类型定义
|
||||
export type BillType = 'alipay' | 'wechat';
|
||||
export type BillType = 'alipay' | 'wechat' | 'jd';
|
||||
|
||||
export interface UploadData {
|
||||
bill_type: BillType;
|
||||
|
||||
@@ -213,6 +213,8 @@
|
||||
selectedType = 'alipay';
|
||||
} else if (fileName.includes('微信') || fileName.includes('wechat')) {
|
||||
selectedType = 'wechat';
|
||||
} else if (fileName.includes('京东') || fileName.includes('jd')) {
|
||||
selectedType = 'jd';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +265,7 @@
|
||||
<!-- 页面标题 -->
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold tracking-tight">账单管理</h1>
|
||||
<p class="text-muted-foreground">上传并分析您的支付宝、微信账单</p>
|
||||
<p class="text-muted-foreground">上传并分析您的支付宝、微信、京东账单</p>
|
||||
</div>
|
||||
|
||||
<!-- 统计卡片 -->
|
||||
@@ -297,7 +299,7 @@
|
||||
<Card.Header class="flex flex-row items-center justify-between space-y-0">
|
||||
<div>
|
||||
<Card.Title>上传账单</Card.Title>
|
||||
<Card.Description>支持支付宝、微信账单 CSV、XLSX 或 ZIP 文件</Card.Description>
|
||||
<Card.Description>支持支付宝、微信、京东账单 CSV、XLSX 或 ZIP 文件</Card.Description>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" onclick={() => goto('/bills?tab=manual')}>
|
||||
<Plus class="mr-2 h-4 w-4" />
|
||||
@@ -397,6 +399,13 @@
|
||||
>
|
||||
微信
|
||||
</Button>
|
||||
<Button
|
||||
variant={selectedType === 'jd' ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
onclick={() => selectedType = 'jd'}
|
||||
>
|
||||
京东
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -438,7 +447,7 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-sm text-muted-foreground">账单类型</span>
|
||||
<Badge variant="secondary">
|
||||
{uploadResult.data?.bill_type === 'alipay' ? '支付宝' : '微信'}
|
||||
{uploadResult.data?.bill_type === 'alipay' ? '支付宝' : uploadResult.data?.bill_type === 'wechat' ? '微信' : '京东'}
|
||||
</Badge>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
|
||||
@@ -380,13 +380,14 @@
|
||||
<Label class="text-xs">来源</Label>
|
||||
<Select.Root type="single" value={filterBillType || undefined} onValueChange={handleBillTypeChange}>
|
||||
<Select.Trigger class="h-9 w-full">
|
||||
<span class="text-sm">{filterBillType === 'alipay' ? '支付宝' : filterBillType === 'wechat' ? '微信' : filterBillType === 'manual' ? '手动' : '全部'}</span>
|
||||
<span class="text-sm">{filterBillType === 'alipay' ? '支付宝' : filterBillType === 'wechat' ? '微信' : filterBillType === 'jd' ? '京东' : filterBillType === 'manual' ? '手动' : '全部'}</span>
|
||||
</Select.Trigger>
|
||||
<Select.Portal>
|
||||
<Select.Content>
|
||||
<Select.Item value="">全部</Select.Item>
|
||||
<Select.Item value="alipay">支付宝</Select.Item>
|
||||
<Select.Item value="wechat">微信</Select.Item>
|
||||
<Select.Item value="jd">京东</Select.Item>
|
||||
<Select.Item value="manual">手动</Select.Item>
|
||||
</Select.Content>
|
||||
</Select.Portal>
|
||||
@@ -438,8 +439,8 @@
|
||||
{formatDateTime(record.time)}
|
||||
</Table.Cell>
|
||||
<Table.Cell class="hidden xl:table-cell">
|
||||
<Badge variant={record.bill_type === 'manual' ? 'outline' : (record.bill_type === 'alipay' ? 'default' : 'secondary')}>
|
||||
{record.bill_type === 'manual' ? '手动输入' : (record.bill_type === 'alipay' ? '支付宝' : '微信')}
|
||||
<Badge variant={record.bill_type === 'manual' ? 'outline' : (record.bill_type === 'alipay' ? 'default' : (record.bill_type === 'jd' ? 'destructive' : 'secondary'))}>
|
||||
{record.bill_type === 'manual' ? '手动输入' : (record.bill_type === 'alipay' ? '支付宝' : (record.bill_type === 'jd' ? '京东' : '微信'))}
|
||||
</Badge>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Reference in New Issue
Block a user