CaiWuXiTong/modules/EcommerceFinance/Services/CourierPayableFinalRegistry.php
renshen 813e956df5 应付款终版目录接入独立按表数据
两个「终版」目录(供应商应付(终版)、快递应付(终版))改为独立数据:
保留原有导入、导出、查询、重置、编辑按钮和导入模板,数据初始为空、按表独立存放,
不再借用基础目录的页面与数据。

- 终版目录拥有自己的同名子页面与横向页签
- 新增终版按表数据的独立导入/导出/模板/编辑接口(数据集键 final:<目录>:<页面>)
- 供应商终版 13 个页面、快递终版 4 个页面已接入
- 终版导入模板统一增加“月份”列,记录标识列改为选填
2026-09-29 11:06:41 +08:00

74 lines
5.0 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) {
'bookkeeping-details' => [
'started_at' => $text('发起时间'), 'work_order_no' => $text('工单编号'), 'initiator' => $text('发起人'),
'bookkeeping_reason' => $text('记账原因'), 'reason_level_1' => $text('记账原因-一级选项'),
'reason_level_2' => $text('记账原因-二级选项'), 'reason_level_3' => $text('记账原因-三级选项'),
'bookkeeping_type' => $text('记账类型'), 'executor' => $text('执行人'), 'source' => $text('记账来源'),
'amount' => $money('记账金额'), 'remark' => $text('记账备注说明'), 'attachment' => $text('上传附件'),
'attachment_preview' => $text('上传附件(预览)'), 'online_order_no' => $text('线上订单号'),
'internal_order_no' => $text('内部单号'), 'actual_paid_amount' => $money('实付金额'),
'carrier' => $text('物流公司'), 'tracking_no' => $text('物流单号'), 'shop_name' => $text('店铺名称'),
'platform' => $text('平台'), 'shipping_warehouse' => $text('订单发货仓库'),
'processing_status' => $text('记账处理状态'), 'counterparty_agreed' => $text('被记账方是否同意记账'),
'counterparty_note' => $text('被记账方处理说明'), 'specialist_result' => $text('专员记账判定结果'),
'specialist_note' => $text('专员处理说明'), 'updated_at' => $text('修改时间'),
'work_order_type' => $text('工单类型'), 'product_image' => $text('商品图片'),
'product_code' => $text('商品编码'), 'style_code' => $text('款式编码'),
'other_attribute_6' => $text('其它属性6'), 'product_name' => $text('商品名称'),
'platform_sku_id' => $text('平台商品skuid'), 'platform_product_id' => $text('平台商品id'),
'product_quantity' => $money('商品数量'), 'product_price' => $money('商品价格'),
'product_amount' => $money('商品金额'), 'buyer_paid_amount' => $money('买家实付'),
'supplier' => $text('供应商'), 'accepting_department' => $text('受理部门'),
'order_shipped_at' => $text('订单发货时间'), 'work_order_remark' => $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' => '不支持该快递应付页面。']),
};
}
}