From 9fccd0d0d1a288275b74cdc2dd58b99975c727df Mon Sep 17 00:00:00 2001 From: renshen <1005457301@qq.com> Date: Wed, 12 Aug 2026 16:56:22 +0800 Subject: [PATCH] fix: align refund labels with source fields --- .../refunds/non-jingxi-refund-data.blade.php | 80 ++++++++++-------- tests/Feature/Business/PagesTest.php | 81 ++++++++++--------- 2 files changed, 88 insertions(+), 73 deletions(-) diff --git a/resources/views/business/pages/refunds/non-jingxi-refund-data.blade.php b/resources/views/business/pages/refunds/non-jingxi-refund-data.blade.php index 722764f3..342f64e3 100644 --- a/resources/views/business/pages/refunds/non-jingxi-refund-data.blade.php +++ b/resources/views/business/pages/refunds/non-jingxi-refund-data.blade.php @@ -1,38 +1,38 @@ @php $columns = [ - 'Id', - 'refundDate', - 'as_id', - 'outer_as_id', - 'o_id', - '', - 'so_id', - 'type', - 'node', - 'isZC', - 'shop_name', - 'platform', - 'responsibleDepartment', - 'totalRefundMoney', - 'originPostcode', - 'shop_i_i_id', - 'shop_sku_id', - 'i_id', - 'sku_id', - 'buyer_paid_amount', - 'qty', - 'unitCostGoods', - 'detailRefundMoney', - 'refundType', - 'refundQty', - 'refundCostGoods', - 'RefundMoneyIncome', - 'AfSalesMoney', - 'createTime', - 'status', - 'shop_status', - 'created', - 'confirm_date', + ['label' => '序号/主键ID', 'field' => 'Id'], + ['label' => '退款日期', 'field' => 'refundDate'], + ['label' => '售后单ID', 'field' => 'as_id'], + ['label' => '外部售后单号', 'field' => 'outer_as_id'], + ['label' => '订单ID', 'field' => 'o_id'], + ['label' => '', 'field' => ''], + ['label' => '子订单ID', 'field' => 'so_id'], + ['label' => '类型', 'field' => 'type'], + ['label' => '节点', 'field' => 'node'], + ['label' => '是否自营', 'field' => 'isZC'], + ['label' => '店铺名称', 'field' => 'shop_name'], + ['label' => '平台', 'field' => 'platform'], + ['label' => '责任部门', 'field' => 'responsibleDepartment'], + ['label' => '退款总金额', 'field' => 'totalRefundMoney'], + ['label' => '原始邮编', 'field' => 'originPostcode'], + ['label' => '店铺商品ID', 'field' => 'shop_i_id'], + ['label' => '店铺SKU编码', 'field' => 'shop_sku_id'], + ['label' => '商品ID', 'field' => 'i_id'], + ['label' => 'SKU编码', 'field' => 'sku_id'], + ['label' => '买家实付金额', 'field' => 'buyer_paid_amount'], + ['label' => '数量', 'field' => 'qty'], + ['label' => '商品单位成本', 'field' => 'unitCostGoods'], + ['label' => '明细退款金额', 'field' => 'detailRefundMoney'], + ['label' => '退款类型', 'field' => 'refundType'], + ['label' => '退款数量', 'field' => 'refundQty'], + ['label' => '退款商品成本', 'field' => 'refundCostGoods'], + ['label' => '退款回款金额', 'field' => 'RefundMoneyIncome'], + ['label' => '售后金额', 'field' => 'AfSalesMoney'], + ['label' => '创建时间', 'field' => 'createTime'], + ['label' => '状态', 'field' => 'status'], + ['label' => '店铺状态', 'field' => 'shop_status'], + ['label' => '创建记录/创建时间', 'field' => 'created'], + ['label' => '确认日期', 'field' => 'confirm_date'], ]; @endphp @@ -41,15 +41,25 @@
- + @foreach ($columns as $column) - + + @endforeach + + + @foreach ($columns as $column) + @endforeach diff --git a/tests/Feature/Business/PagesTest.php b/tests/Feature/Business/PagesTest.php index 6d3565fe..368a9968 100644 --- a/tests/Feature/Business/PagesTest.php +++ b/tests/Feature/Business/PagesTest.php @@ -104,51 +104,56 @@ class PagesTest extends FeatureTestCase ->assertSeeText('该页面暂未配置数据表,敬请期待。') ->assertSee('class="biz-empty"', false); - $this->get(route('business.pages.show', [ + $response = $this->get(route('business.pages.show', [ 'section' => 'refunds', 'page' => 'non-jingxi-refund-data', - ])) + ])); + + $response ->assertOk() ->assertSeeText('非京喜退款数据') ->assertSee('aria-label="非京喜退款数据"', false) ->assertSeeText('暂无数据') ->assertSee('class="upstream-data-table refund-data-table refund-data-table--wide"', false) - ->assertDontSee('class="biz-empty"', false) - ->assertSeeInOrder([ - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - ], false); + ->assertSee('data-header-row="labels"', false) + ->assertSee('data-header-row="fields"', false) + ->assertDontSee('class="biz-empty"', false); + + $html = $response->getContent(); + $headerRows = []; + preg_match_all( + '/]*data-header-row="(labels|fields)"[^>]*>(.*?)<\/tr>/s', + $html, + $headerRows, + PREG_SET_ORDER, + ); + + $headers = collect($headerRows)->mapWithKeys(function (array $row): array { + $cells = []; + preg_match_all('/]*>(.*?)<\/th>/s', $row[2], $cells); + + return [$row[1] => collect($cells[1])->map( + fn (string $cell): string => trim(html_entity_decode(strip_tags($cell))) + )->all()]; + }); + + $this->assertSame([ + '序号/主键ID', '退款日期', '售后单ID', '外部售后单号', '订单ID', '', + '子订单ID', '类型', '节点', '是否自营', '店铺名称', '平台', '责任部门', + '退款总金额', '原始邮编', '店铺商品ID', '店铺SKU编码', '商品ID', 'SKU编码', + '买家实付金额', '数量', '商品单位成本', '明细退款金额', '退款类型', + '退款数量', '退款商品成本', '退款回款金额', '售后金额', '创建时间', '状态', + '店铺状态', '创建记录/创建时间', '确认日期', + ], $headers->get('labels')); + + $this->assertSame([ + 'Id', 'refundDate', 'as_id', 'outer_as_id', 'o_id', '', 'so_id', 'type', + 'node', 'isZC', 'shop_name', 'platform', 'responsibleDepartment', + 'totalRefundMoney', 'originPostcode', 'shop_i_id', 'shop_sku_id', 'i_id', + 'sku_id', 'buyer_paid_amount', 'qty', 'unitCostGoods', 'detailRefundMoney', + 'refundType', 'refundQty', 'refundCostGoods', 'RefundMoneyIncome', + 'AfSalesMoney', 'createTime', 'status', 'shop_status', 'created', 'confirm_date', + ], $headers->get('fields')); $this->withExceptionHandling()->get(route('business.pages.show', [ 'section' => 'refunds', -- 2.47.2
{{ $column }}{{ $column['label'] }}
{{ $column['field'] }}
IdrefundDateas_idouter_as_ido_idso_idtypenodeisZCshop_nameplatformresponsibleDepartmenttotalRefundMoneyoriginPostcodeshop_i_i_idshop_sku_idi_idsku_idbuyer_paid_amountqtyunitCostGoodsdetailRefundMoneyrefundTyperefundQtyrefundCostGoodsRefundMoneyIncomeAfSalesMoneycreateTimestatusshop_statuscreatedconfirm_date