diff --git a/backend/app/__pycache__/main.cpython-313.pyc b/backend/app/__pycache__/main.cpython-313.pyc index 4af207e..672d5ad 100644 Binary files a/backend/app/__pycache__/main.cpython-313.pyc and b/backend/app/__pycache__/main.cpython-313.pyc differ diff --git a/backend/app/main.py b/backend/app/main.py index 22221b3..79700a0 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -3908,14 +3908,14 @@ def export_refund_records(q: str = "", start_date: str = "", end_date: str = "", query = _refund_record_query(user, q, start_date, end_date) output = io.StringIO() writer = csv.writer(output) - writer.writerow(["店铺名称", "电商平台", "商品ID", "转账时间", "订单号", "收款人", "收款账号", "返款金额(元)", "付款账户", "操作人", "支付宝流水"]) + writer.writerow(["电商平台", "店铺名称", "商品ID", "转账时间", "订单号", "收款人", "收款账号", "返款金额(元)", "付款账户", "操作人", "支付宝流水"]) total = 0 def safe(value): value = str(value or "") return "'" + value if value.lstrip().startswith(("=", "+", "-", "@")) or value.startswith(("\t", "\r", "\n")) else value for record in db.scalars(query.order_by(RefundRecord.transferred_at.desc(), RefundRecord.id.desc()).execution_options(yield_per=500)): total += record.amount_fen - writer.writerow([safe(record.shop_name), safe(record.ecommerce_platform), safe(record.product_id), (record.transferred_at + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S"), safe(record.order_no), safe(record.payee_name), safe(record.payee_account), f"{record.amount_fen / 100:.2f}", safe(record.payer_account), safe(record.operator_name), safe(record.alipay_trade_no)]) + writer.writerow([safe(record.ecommerce_platform), safe(record.shop_name), safe(record.product_id), (record.transferred_at + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S"), safe(record.order_no), safe(record.payee_name), safe(record.payee_account), f"{record.amount_fen / 100:.2f}", safe(record.payer_account), safe(record.operator_name), safe(record.alipay_trade_no)]) writer.writerow(["合计", "", "", "", "", "", "", f"{total / 100:.2f}", "", "", ""]) return Response(content="\ufeff" + output.getvalue(), media_type="text/csv; charset=utf-8", headers={"Content-Disposition": 'attachment; filename="refund-records.csv"'}) diff --git a/backend/data/app.db b/backend/data/app.db new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/RefundRecordsPage.jsx b/frontend/src/RefundRecordsPage.jsx index 9d77bad..215a7a5 100644 --- a/frontend/src/RefundRecordsPage.jsx +++ b/frontend/src/RefundRecordsPage.jsx @@ -75,9 +75,22 @@ export default function RefundRecordsPage({ api }) { {error &&

{error}

}
- {["店铺名称", "电商平台", "商品ID", "转账时间", "订单号", "收款人", "收款账号", "返款金额", "付款账户", "操作人", "支付宝流水"].map((title) => )} + + + + + + + + + + + + + + {["电商平台", "店铺名称", "商品ID", "转账时间", "订单号", "收款人", "收款账号", "返款金额", "付款账户", "操作人", "支付宝流水"].map((title) => )}{loading || error ? : data.items.length ? data.items.map((item) => - + ) : } {!loading && !error && }
{title}
{title}
{loading ? "加载中…" : "记录加载失败,请调整筛选或重新进入页面"}
{item.shop_name || "—"}{item.ecommerce_platform || "—"}{item.product_id || "—"}{formatDateTime(item.transferred_at)}{item.order_no}{item.payee_name || "—"}{item.payee_account || "—"}{money(item.amount_fen)}{item.payer_account || "—"}{item.operator_name || "—"}{item.alipay_trade_no || "—"}{item.ecommerce_platform || "—"}{item.shop_name || "—"}{item.product_id || "—"}{formatDateTime(item.transferred_at)}{item.order_no}{item.payee_name || "—"}{item.payee_account || "—"}{money(item.amount_fen)}{item.payer_account || "—"}{item.operator_name || "—"}{item.alipay_trade_no || "—"}
暂无返款记录
合计(当前筛选全部记录){money(data.total_amount_fen)}
diff --git a/frontend/src/admin.css b/frontend/src/admin.css index f24a841..3a60a96 100644 --- a/frontend/src/admin.css +++ b/frontend/src/admin.css @@ -6394,8 +6394,27 @@ html.dingtalk-mobile .answer-v2-footer { .refund-records-toolbar input[type="date"] { padding: 9px; border: 1px solid #cbdaf2; border-radius: 8px; background: white; color: inherit; } .refund-records-toolbar > .primary-button { margin-left: auto; display: flex; align-items: center; gap: 6px; } .refund-records-hint { color: #7186a5; font-size: 12px; margin: 16px 0; } -.refund-records-table { min-width: 1250px; } -.refund-records-table td { overflow-wrap: anywhere; max-width: 230px; } +.refund-records-table { width: 100%; min-width: 1540px; table-layout: fixed; } +.refund-records-table col.refund-col-platform { width: 90px; } +.refund-records-table col.refund-col-shop { width: 175px; } +.refund-records-table col.refund-col-product { width: 155px; } +.refund-records-table col.refund-col-time { width: 155px; } +.refund-records-table col.refund-col-order { width: 195px; } +.refund-records-table col.refund-col-payee { width: 85px; } +.refund-records-table col.refund-col-account { width: 125px; } +.refund-records-table col.refund-col-amount { width: 90px; } +.refund-records-table col.refund-col-payer { width: 90px; } +.refund-records-table col.refund-col-operator { width: 105px; } +.refund-records-table col.refund-col-trade { width: 275px; } +.refund-records-table td { max-width: none; overflow-wrap: normal; word-break: normal; } +.refund-records-table .refund-shop-cell { overflow-wrap: anywhere; } +.refund-records-table .refund-platform-cell, +.refund-records-table .refund-product-cell, +.refund-records-table .refund-time-cell, +.refund-records-table .refund-order-cell, +.refund-records-table .refund-payee-account-cell, +.refund-records-table .refund-trade-cell { white-space: nowrap; font-variant-numeric: tabular-nums; } +.refund-records-table .refund-trade-cell { font-size: 12px; } .refund-records-table tfoot { background: #f6f8fc; } .refund-records-error { color: #dc2626; } .refund-record-fields { border: 0; padding: 0; margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }