|
|
@@ -33,6 +33,7 @@ import { retroConfirm } from '@/lib/dialog';
|
|
|
import SettlementPeriodDetailModal from './SettlementPeriodDetailModal';
|
|
|
import LocalTime from '@/components/common/LocalTime';
|
|
|
import AdminUserSelect from '@/components/common/AdminUserSelect';
|
|
|
+import { getCurrencySymbol } from '@/lib/currency';
|
|
|
|
|
|
export default function SettlementEngineTab() {
|
|
|
// Preset State: 'current_month' | 'last_month' | 'custom'
|
|
|
@@ -426,7 +427,11 @@ export default function SettlementEngineTab() {
|
|
|
<div className="bg-white border-2 border-black p-4 shadow-[3px_3px_0px_#000]">
|
|
|
<span className="text-[10px] text-neutral-500 uppercase font-black block">订单实收总营业额</span>
|
|
|
<div className="text-xl font-black text-black mt-1">
|
|
|
- ¥{(previewResult.total_revenue / 100).toFixed(2)}
|
|
|
+ {previewResult.revenue_by_currency && Object.keys(previewResult.revenue_by_currency).length > 0
|
|
|
+ ? Object.entries(previewResult.revenue_by_currency)
|
|
|
+ .map(([curr, amt]) => `${getCurrencySymbol(curr)}${(amt / 100).toFixed(2)}`)
|
|
|
+ .join(' + ')
|
|
|
+ : `¥${(previewResult.total_revenue / 100).toFixed(2)}`}
|
|
|
</div>
|
|
|
<span className="text-[9px] text-neutral-400 block mt-0.5">合伙公账统一收入</span>
|
|
|
</div>
|
|
|
@@ -444,13 +449,17 @@ export default function SettlementEngineTab() {
|
|
|
<div className="text-xl font-black text-amber-700 mt-1">
|
|
|
¥{(previewResult.avg_cost / 100).toFixed(2)}
|
|
|
</div>
|
|
|
- <span className="text-[9px] text-neutral-400 block mt-0.5">每单均摊成本</span>
|
|
|
+ <span className="text-[9px] text-neutral-400 block mt-0.5">CNY订单每单均摊</span>
|
|
|
</div>
|
|
|
|
|
|
<div className="bg-amber-100 border-2 border-black p-4 shadow-[3px_3px_0px_#000] col-span-2 sm:col-span-1">
|
|
|
<span className="text-[10px] text-neutral-600 uppercase font-black block">全平台可分配净毛利</span>
|
|
|
<div className="text-xl font-black text-black mt-1">
|
|
|
- ¥{(previewResult.net_profit / 100).toFixed(2)}
|
|
|
+ {previewResult.profit_by_currency && Object.keys(previewResult.profit_by_currency).length > 0
|
|
|
+ ? Object.entries(previewResult.profit_by_currency)
|
|
|
+ .map(([curr, amt]) => `${getCurrencySymbol(curr)}${(amt / 100).toFixed(2)}`)
|
|
|
+ .join(' + ')
|
|
|
+ : `¥${(previewResult.net_profit / 100).toFixed(2)}`}
|
|
|
</div>
|
|
|
<span className="text-[9px] text-neutral-700 font-bold block mt-0.5">实收 - 耗材</span>
|
|
|
</div>
|
|
|
@@ -518,13 +527,13 @@ export default function SettlementEngineTab() {
|
|
|
{p.role_description}
|
|
|
</td>
|
|
|
<td className="px-4 py-3 font-bold font-mono">
|
|
|
- ¥{(p.gross_amount / 100).toFixed(2)}
|
|
|
+ {getCurrencySymbol(p.currency || 'CNY')}{(p.gross_amount / 100).toFixed(2)}
|
|
|
</td>
|
|
|
<td className="px-4 py-3 font-bold font-mono text-rose-600">
|
|
|
- {p.fault_penalty > 0 ? `-¥${(p.fault_penalty / 100).toFixed(2)}` : '¥0.00'}
|
|
|
+ {p.fault_penalty > 0 ? `-${getCurrencySymbol(p.currency || 'CNY')}${(p.fault_penalty / 100).toFixed(2)}` : `${getCurrencySymbol(p.currency || 'CNY')}0.00`}
|
|
|
</td>
|
|
|
<td className="px-4 py-3 font-black font-mono text-emerald-800 bg-amber-50 text-sm">
|
|
|
- ¥{(p.net_payout / 100).toFixed(2)}
|
|
|
+ {getCurrencySymbol(p.currency || 'CNY')}{(p.net_payout / 100).toFixed(2)}
|
|
|
</td>
|
|
|
</tr>
|
|
|
);
|
|
|
@@ -585,47 +594,60 @@ export default function SettlementEngineTab() {
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody className="bg-white divide-y border-neutral-200">
|
|
|
- {previewResult.details.map((d) => (
|
|
|
- <tr key={d.order_id} className="hover:bg-amber-50/50">
|
|
|
- <td className="px-3 py-2 font-bold">#{d.order_id}</td>
|
|
|
- <td className="px-3 py-2">
|
|
|
- <span className="px-1 py-0.2 bg-neutral-100 border border-black text-[10px]">
|
|
|
- {d.channel_type === 'agency' ? '中介' : d.channel_type === 'website' ? '公海' : '直客'}
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- <td className="px-3 py-2 text-neutral-700">
|
|
|
- {d.handler_name ? (
|
|
|
- <span>
|
|
|
- <strong className="text-black">{d.handler_name}</strong>
|
|
|
- <span className="text-[10px] text-neutral-400 block font-mono">
|
|
|
- {d.handler_id}
|
|
|
- </span>
|
|
|
+ {previewResult.details.map((d) => {
|
|
|
+ const sym = getCurrencySymbol(d.currency || 'CNY');
|
|
|
+ return (
|
|
|
+ <tr key={d.order_id} className="hover:bg-amber-50/50">
|
|
|
+ <td className="px-3 py-2 font-bold">#{d.order_id}</td>
|
|
|
+ <td className="px-3 py-2">
|
|
|
+ <span className="px-1 py-0.2 bg-neutral-100 border border-black text-[10px]">
|
|
|
+ {d.channel_type === 'agency' ? '中介' : d.channel_type === 'website' ? '公海' : '直客'}
|
|
|
</span>
|
|
|
- ) : (
|
|
|
- d.handler_id || '-'
|
|
|
- )}
|
|
|
- </td>
|
|
|
- <td className="px-3 py-2 text-neutral-700">
|
|
|
- {d.developer_name ? (
|
|
|
- <span>
|
|
|
- <strong className="text-emerald-800">{d.developer_name}</strong>
|
|
|
- <span className="text-[10px] text-neutral-400 block font-mono">
|
|
|
- {d.developer_id}
|
|
|
+ </td>
|
|
|
+ <td className="px-3 py-2 text-neutral-700">
|
|
|
+ {d.handler_name ? (
|
|
|
+ <span>
|
|
|
+ <strong className="text-black">{d.handler_name}</strong>
|
|
|
+ <span className="text-[10px] text-neutral-400 block font-mono">
|
|
|
+ {d.handler_id}
|
|
|
+ </span>
|
|
|
</span>
|
|
|
- </span>
|
|
|
- ) : (
|
|
|
- d.developer_id || '-'
|
|
|
- )}
|
|
|
- </td>
|
|
|
- <td className="px-3 py-2 font-bold">¥{(d.order_amount / 100).toFixed(2)}</td>
|
|
|
- <td className="px-3 py-2 text-rose-600">-¥{(d.avg_cost / 100).toFixed(2)}</td>
|
|
|
- <td className="px-3 py-2 font-black text-black">¥{(d.net_profit / 100).toFixed(2)}</td>
|
|
|
- <td className="px-3 py-2 text-blue-700">¥{(d.tech_fee / 100).toFixed(2)}</td>
|
|
|
- <td className="px-3 py-2 text-purple-700">¥{(d.sales_fee / 100).toFixed(2)}</td>
|
|
|
- <td className="px-3 py-2 text-amber-700">¥{(d.partner_a_amount / 100).toFixed(2)}</td>
|
|
|
- <td className="px-3 py-2 text-amber-700">¥{(d.partner_b_amount / 100).toFixed(2)}</td>
|
|
|
- </tr>
|
|
|
- ))}
|
|
|
+ ) : (
|
|
|
+ d.handler_id || '-'
|
|
|
+ )}
|
|
|
+ </td>
|
|
|
+ <td className="px-3 py-2 text-neutral-700">
|
|
|
+ {d.developer_name ? (
|
|
|
+ <span>
|
|
|
+ <strong className="text-emerald-800">{d.developer_name}</strong>
|
|
|
+ <span className="text-[10px] text-neutral-400 block font-mono">
|
|
|
+ {d.developer_id}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ ) : (
|
|
|
+ d.developer_id || '-'
|
|
|
+ )}
|
|
|
+ </td>
|
|
|
+ <td className="px-3 py-2 font-bold font-mono">
|
|
|
+ {sym}{(d.order_amount / 100).toFixed(2)}
|
|
|
+ </td>
|
|
|
+ <td className="px-3 py-2 text-rose-600 font-mono">-{sym}{(d.avg_cost / 100).toFixed(2)}</td>
|
|
|
+ <td className="px-3 py-2 font-black text-black font-mono">{sym}{(d.net_profit / 100).toFixed(2)}</td>
|
|
|
+ <td className="px-3 py-2 text-blue-700 font-mono">{sym}{(d.tech_fee / 100).toFixed(2)}</td>
|
|
|
+ <td className="px-3 py-2 text-purple-700 font-mono">
|
|
|
+ {d.handler_id ? (
|
|
|
+ `${sym}${(d.sales_fee / 100).toFixed(2)}`
|
|
|
+ ) : (
|
|
|
+ <span className="text-[10px] text-purple-700 bg-purple-50 px-1.5 py-0.5 border border-purple-300 font-bold">
|
|
|
+ 平分甲乙
|
|
|
+ </span>
|
|
|
+ )}
|
|
|
+ </td>
|
|
|
+ <td className="px-3 py-2 text-amber-700 font-bold font-mono">{sym}{(d.partner_a_amount / 100).toFixed(2)}</td>
|
|
|
+ <td className="px-3 py-2 text-amber-700 font-bold font-mono">{sym}{(d.partner_b_amount / 100).toFixed(2)}</td>
|
|
|
+ </tr>
|
|
|
+ );
|
|
|
+ })}
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|