diff --git a/app/Http/Controllers/Business/AccountMappingActions.php b/app/Http/Controllers/Business/AccountMappingActions.php index 9e6618c4..9a171536 100644 --- a/app/Http/Controllers/Business/AccountMappingActions.php +++ b/app/Http/Controllers/Business/AccountMappingActions.php @@ -42,6 +42,7 @@ class AccountMappingActions extends Controller 'memo' => '财务备注', 'invoice' => '票据口径', 'category' => '大类', + 'feeMemo' => '费用备注', 'dAcct' => '借方科目', 'dSub' => '借方二级', 'cAcct' => '贷方科目', @@ -353,8 +354,8 @@ class AccountMappingActions extends Controller public function template(): StreamedResponse { $samples = [ - ['得物', '平台服务费', '平台服务费', '0.06', '费用', '销售费用', '平台佣金', '其他货币资金', '', '支出基准'], - ['淘宝', '交易收入', '订单', '-', '收入', '其他货币资金', '', '主营业务收入', '', '收入基准'], + ['得物', '平台服务费', '平台服务费', '-', '0.06', '费用', '平台服务费', '销售费用', '平台服务费', '其他货币资金', '', '支出基准'], + ['淘宝', '交易收入', '订单', '-', '-', '收入', '收入', '其他货币资金', '', '主营业务收入', '', '收入基准'], ]; return response()->streamDownload(function () use ($samples): void { diff --git a/database/migrations/2026_10_19_150000_add_fee_memo_to_account_mapping_rules.php b/database/migrations/2026_10_19_150000_add_fee_memo_to_account_mapping_rules.php new file mode 100644 index 00000000..994a0542 --- /dev/null +++ b/database/migrations/2026_10_19_150000_add_fee_memo_to_account_mapping_rules.php @@ -0,0 +1,22 @@ +string('fee_memo', 191)->default('')->after('category'); + }); + } + + public function down(): void + { + Schema::table('ec_account_mapping_rules', function (Blueprint $table): void { + $table->dropColumn('fee_memo'); + }); + } +}; diff --git a/modules/EcommerceFinance/Services/AccountMappingStore.php b/modules/EcommerceFinance/Services/AccountMappingStore.php index 1b58ee5b..d982e9c0 100644 --- a/modules/EcommerceFinance/Services/AccountMappingStore.php +++ b/modules/EcommerceFinance/Services/AccountMappingStore.php @@ -34,7 +34,7 @@ class AccountMappingStore public const EVENTS_TABLE = 'ec_account_mapping_events'; /** 可维护字段(顺序即导出/模板列顺序) */ - public const FIELDS = ['platform', 'item', 'memo', 'goods', 'invoice', 'category', 'dAcct', 'dSub', 'cAcct', 'cSub', 'basis']; + public const FIELDS = ['platform', 'item', 'memo', 'goods', 'invoice', 'category', 'feeMemo', 'dAcct', 'dSub', 'cAcct', 'cSub', 'basis']; public const LABELS = [ 'platform' => '平台', @@ -43,6 +43,7 @@ class AccountMappingStore 'goods' => '商品名称关键词', 'invoice' => '票据口径', 'category' => '财务类型', + 'feeMemo' => '费用备注', 'dAcct' => '借方科目', 'dSub' => '借方二级', 'cAcct' => '贷方科目', @@ -626,6 +627,7 @@ class AccountMappingStore 'goods' => (string) $row->goods, 'invoice' => (string) $row->invoice, 'category' => (string) $row->category, + 'feeMemo' => (string) ($row->fee_memo ?? ''), 'dAcct' => (string) $row->d_acct, 'dSub' => (string) $row->d_sub, 'cAcct' => (string) $row->c_acct, @@ -648,6 +650,7 @@ class AccountMappingStore 'goods' => $rule['goods'], 'invoice' => $rule['invoice'], 'category' => $rule['category'], + 'fee_memo' => $rule['feeMemo'], 'd_acct' => $rule['dAcct'], 'd_sub' => $rule['dSub'], 'c_acct' => $rule['cAcct'], diff --git a/modules/EcommerceFinance/Services/AccountMappingWorkbookImporter.php b/modules/EcommerceFinance/Services/AccountMappingWorkbookImporter.php index 6e02675b..d8f17f55 100644 --- a/modules/EcommerceFinance/Services/AccountMappingWorkbookImporter.php +++ b/modules/EcommerceFinance/Services/AccountMappingWorkbookImporter.php @@ -26,6 +26,7 @@ class AccountMappingWorkbookImporter 'goods' => ['商品名称关键词', '商品名称', '商品描述', '货品名称'], 'invoice' => ['票据口径', '票据', '票据类型', '发票'], 'category' => ['财务类型', '大类', '业务性质', '科目大类', '分类'], + 'feeMemo' => ['费用备注', '费用说明', '费用备注说明'], 'basis' => ['方向基准', '基准'], 'dAcct' => ['借方科目', '借/贷(借)', '借/贷(借)', '借方'], 'dSub' => ['借方二级'], diff --git a/resources/views/business/pages/financial-rules/account-mapping.blade.php b/resources/views/business/pages/financial-rules/account-mapping.blade.php index e3e05315..6dffa282 100644 --- a/resources/views/business/pages/financial-rules/account-mapping.blade.php +++ b/resources/views/business/pages/financial-rules/account-mapping.blade.php @@ -103,10 +103,10 @@ /* 表格必须锁列宽(table-layout:fixed)。默认的自动列宽会按内容互相挤压, 「借方/贷方科目」两列会被挤到文字被截断;锁死后按上面 th 的宽度分配, 窗口不够宽时由外层 .upstream-data-table-scroll 横向滚动。 - 89rem = 各列宽度之和,改列宽时要一起改。 */ + 115rem = 各列宽度之和,改列宽时要一起改。 */ /* min-width 必须不小于各列宽度之和,否则窄屏下浏览器会按比例压缩各列, 固定的 4.5rem 平台列又会被压到装不下「唯品会JX」这类值。 */ - .am-table { table-layout: fixed; min-width: 106rem; } + .am-table { table-layout: fixed; min-width: 115rem; } /* 只读单元格超长就省略号(编辑态那格要放开,否则下拉会被裁) */ .am-table > tbody > tr.am-item:not(.is-editing) > td { overflow: hidden; text-overflow: ellipsis; } @@ -496,6 +496,7 @@ 商品名称关键词 票据 财务类型 + 费用备注 借方科目 贷方科目 方向基准 @@ -805,9 +806,9 @@ + '' + esc(i.message) + ''; }).join('') + ''; } - return '
' + return '
' + '
' + esc(r.platform) + ' · ' + esc(r.item) - + ' (基准:' + esc(r.basis) + ',记录 ' + r.id + ')
' + + ' (费用备注:' + esc(r.feeMemo || '—') + ',基准:' + esc(r.basis) + ',记录 ' + r.id + ')
' + '
' + line('out', '账单支出', out) + line('in', '账单收入', inn) @@ -859,7 +860,7 @@ if (fOnly.value === 'issue' && !n.error && !n.warning && !n.tip) { return false; } } if (keyword) { - var hay = [r.platform, r.item, r.memo, r.goods, r.dAcct, r.dSub, r.cAcct, r.cSub, r.category, r.basis] + var hay = [r.platform, r.item, r.memo, r.goods, r.dAcct, r.dSub, r.cAcct, r.cSub, r.category, r.feeMemo, r.basis] .join(' ').toLowerCase(); if (hay.indexOf(keyword) < 0) { return false; } } @@ -878,6 +879,7 @@ + '' + '' + '' + + '' + '' + acctEditor('dAcct', 'dSub') + '' + '' + acctEditor('cAcct', 'cSub') + '' + '' @@ -895,6 +897,7 @@ + '' + esc(r.goods || '-') + '' + '' + esc(r.invoice || '—') + '' + '' + esc(r.category) + '' + + '' + esc(r.feeMemo || '-') + '' + '' + acct(r.dAcct, r.dSub) + '' + '' + acct(r.cAcct, r.cSub) + '' + '' + basisTag(r.basis) + '' @@ -1130,7 +1133,7 @@ function collectDraft() { var values = {}; - ['platform', 'item', 'memo', 'goods', 'invoice', 'category', 'dAcct', 'dSub', 'cAcct', 'cSub', 'basis'].forEach(function (f) { + ['platform', 'item', 'memo', 'goods', 'invoice', 'category', 'feeMemo', 'dAcct', 'dSub', 'cAcct', 'cSub', 'basis'].forEach(function (f) { values[f] = draft[f] == null ? '' : draft[f]; }); return values; @@ -1142,7 +1145,7 @@ if (!r) { return; } draft = { platform: r.platform, item: r.item, memo: r.memo, goods: r.goods, invoice: r.invoice, - category: r.category, dAcct: r.dAcct, dSub: r.dSub, cAcct: r.cAcct, cSub: r.cSub, basis: r.basis + category: r.category, feeMemo: r.feeMemo, dAcct: r.dAcct, dSub: r.dSub, cAcct: r.cAcct, cSub: r.cSub, basis: r.basis }; editingId = id; collapseDetail(); @@ -1173,7 +1176,7 @@ loadCoa().then(function () { draft = { platform: '', item: '', memo: '', goods: '', invoice: '-', category: '费用', - dAcct: '', dSub: '', cAcct: '', cSub: '', basis: '支出基准' + feeMemo: '', dAcct: '', dSub: '', cAcct: '', cSub: '', basis: '支出基准' }; editingId = 'new'; collapseDetail(); @@ -1192,6 +1195,7 @@ + '' + '' + '' + + '' + '' + acctEditor('dAcct', 'dSub') + '' + '' + acctEditor('cAcct', 'cSub') + '' + '' @@ -1240,7 +1244,7 @@ var rows = (data.sample || []).map(function (r) { return '' + esc(r.platform) + '' + esc(r.item) + '' + esc(r.memo) + '' + '' + esc(r.goods) + '' - + '' + esc(r.category) + '' + acct(r.dAcct, r.dSub) + '' + acct(r.cAcct, r.cSub) + '' + + '' + esc(r.category) + '' + esc(r.feeMemo) + '' + acct(r.dAcct, r.dSub) + '' + acct(r.cAcct, r.cSub) + '' + '' + esc(r.basis) + ''; }).join(''); var dupList = (data.duplicate_keys || []).length @@ -1255,7 +1259,7 @@ + '' + dupList + '
前 ' + (data.sample || []).length + ' 行预览:
' - + '' + rows + '
平台账单项目财务备注商品名称财务类型借方贷方基准
'; + + '' + rows + '
平台账单项目财务备注商品名称财务类型费用备注借方贷方基准
'; var foot = '' + '';