66 lines
4.3 KiB
PHP
66 lines
4.3 KiB
PHP
<?php
|
||
|
||
namespace Modules\EcommerceFinance\Services;
|
||
|
||
use Illuminate\Validation\ValidationException;
|
||
|
||
/** 「快递应付(终版)」按表数据:列与页面上现有表格一致,主要用于导入/导出自己的数据。 */
|
||
class CourierPayableFinalRegistry
|
||
{
|
||
/** @return array<string,string> */
|
||
public function titles(): array
|
||
{
|
||
return [
|
||
'bookkeeping-details' => '记账明细',
|
||
'compensation-details' => '赔偿明细',
|
||
'advance-details' => '借支明细',
|
||
'other-adjustments' => '其他扣款补款',
|
||
];
|
||
}
|
||
|
||
/** @return array<string,array{label:string,type:string}> */
|
||
public function fields(string $dataset): array
|
||
{
|
||
$money = static fn (string $label): array => ['label' => $label, 'type' => 'number'];
|
||
$text = static fn (string $label): array => ['label' => $label, 'type' => 'text'];
|
||
$date = static fn (string $label): array => ['label' => $label, 'type' => 'date'];
|
||
$month = static fn (string $label): array => ['label' => $label, 'type' => 'month'];
|
||
|
||
return match ($dataset) {
|
||
// 表头照财务手工「记账」表(2026 年 10 月起)
|
||
'bookkeeping-details' => [
|
||
'tracking_no' => $text('物流单号'), 'tracking_no_clean' => $text('快递单号整理'), 'carrier' => $text('物流公司'),
|
||
'online_order_no' => $text('线上订单号'), 'bookkeeping_reason' => $text('记账原因'), 'product_code' => $text('商品编码'),
|
||
'product_name' => $text('商品名称'), 'amount' => $money('记账金额'), 'bookkeeping_data' => $text('记账数据'),
|
||
'receiver' => $text('收货人'), 'initiator' => $text('发起人'), 'started_at' => $text('发起时间'),
|
||
'shop_name' => $text('店铺名称'), 'buyer_nick' => $text('买家昵称'), 'province' => $text('省份'),
|
||
'deducted_at' => $text('扣单时间'), 'cost' => $money('成本'), 'weight' => $money('重量'), 'loss' => $money('损耗'),
|
||
'owner' => $text('负责人'), 'platform_product_id' => $text('平台商品id'), 'shipping_warehouse' => $text('订单发货仓库'),
|
||
'supplier' => $text('供应商'), 'unshipped' => $text('未发出'), 'return_no' => $text('退回单号'), 'scrapped' => $text('报废'),
|
||
'cost_bookkeeping' => $money('成本记账'), 'settle_bookkeeping' => $money('结算记账'), 'settle_freight' => $money('结算运费'),
|
||
'analysis' => $text('记账分析'), 'dropship' => $text('是否代发'), 'courier_feedback' => $text('快递反馈'),
|
||
'cs_reply' => $text('客服回复'), 'cause' => $text('原因'),
|
||
],
|
||
'compensation-details' => [
|
||
'paid_at' => $date('赔付日期'), 'carrier' => $text('承运商'), 'tracking_no' => $text('快递单号'),
|
||
'amount' => $money('赔付金额'), 'reason' => $text('赔付原因'), 'remark' => $text('备注'),
|
||
],
|
||
'advance-details' => [
|
||
'carrier' => $text('快递名称'), 'agreement_name' => $text('协议签订名称'),
|
||
'agreement_amount' => $money('借支金额-借款协议'), 'actual_paid_amount' => $money('实际打款金额'),
|
||
'monthly_deduction' => $money('本月扣款金额'), 'deduction_start_month' => $month('分期起始扣款月份'),
|
||
'deduction_end_month' => $month('分期最后次扣款月份'), 'remaining_periods' => $money('分期剩余期数'),
|
||
'advanced_at' => $date('借支日期'), 'loan_term' => $text('借款期限'), 'remark' => $text('备注'),
|
||
'payment_status' => $text('是否打款'), 'payment_month' => $month('打款月份'),
|
||
'serial_no' => $text('流水号'), 'agreement_file' => $text('借支协议'), 'reviewer' => $text('审核人'),
|
||
],
|
||
'other-adjustments' => [
|
||
'project' => $text('项目'), 'adjusted_at' => $date('日期'), 'carrier' => $text('承运商'),
|
||
'amount' => $money('补款金额'), 'reason' => $text('补款原因'), 'remark' => $text('备注'),
|
||
'remark_2' => $text('备注2'),
|
||
],
|
||
default => throw ValidationException::withMessages(['dataset' => '不支持该快递应付页面。']),
|
||
};
|
||
}
|
||
}
|