From 422497cfcc19613991972be14edf3e6c00126100 Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Fri, 16 Oct 2026 09:44:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E7=BB=A9=E6=98=8E=E7=BB=86=EF=BC=9AC?= =?UTF-8?q?=20=E6=96=B9=E6=A1=88=E2=80=94=E2=80=94=E4=B8=89=E6=9D=A1?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E7=AD=89=E5=BC=8F=E6=A1=A3=EF=BC=88=E6=9C=AA?= =?UTF-8?q?=E5=87=8F=E5=86=B2=E5=87=8F/=E4=BC=98=E6=83=A0/=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=92=8C=E5=86=B2=E5=87=8F=EF=BC=89=E5=9C=A8=E5=8F=A3?= =?UTF-8?q?=E5=BE=84=E6=A0=87=E8=AF=86=E8=A1=8C=E8=AE=A9=E4=BD=8D=E7=BB=99?= =?UTF-8?q?=E5=8F=A3=E5=BE=84=E5=85=9C=E5=BA=95=EF=BC=9B=E5=B7=AE=E9=A2=9D?= =?UTF-8?q?=E5=BE=85=E6=A0=B8=E5=AE=9E=E6=A1=A3=E6=8E=92=E9=99=A4=E5=8F=A3?= =?UTF-8?q?=E5=BE=84=E6=A0=87=E8=AF=86=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Business/Pages.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index 1e9c1f6a..9f3b9f61 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -301,9 +301,12 @@ class Pages extends Controller . " WHERE b.order_no = store_receipt_order_match_rows.online_order_no AND b.bill_item LIKE '价保扣款%'), 0)"; $rules['订单实付未减退款'] = "platform = '京东账单' AND " . $effective . ' < -0.005' . ' AND ABS(ROUND(ABS(' . $effective . ') - ' . $jiabaoRefund . ', 2)) <= 0.02'; - $rules[$label . '未减冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(discount_amount, 0))) < 0.005"; - $rules[$label . '未减优惠'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(offset_amount, 0))) < 0.005"; - $rules[$label . '未减优惠和冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - COALESCE(income_amount, 0)) < 0.005"; + // C 方案:这三条是"通用等式档"——口径(卖家实收 / 应付已付)能对上账单的行让位给口径兜底 + // (归零 + 口径标识),只有口径也对不上时才显示这三档,避免把口径差标成一堆"未减优惠/冲减"。 + $notBasisMarked = "COALESCE(remark, '') NOT IN ('订单实付按卖家实收核对', '订单实付按应付/已付核对')"; + $rules[$label . '未减冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(discount_amount, 0))) < 0.005 AND " . $notBasisMarked; + $rules[$label . '未减优惠'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(offset_amount, 0))) < 0.005 AND " . $notBasisMarked; + $rules[$label . '未减优惠和冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - COALESCE(income_amount, 0)) < 0.005 AND " . $notBasisMarked; // 抖音「订单实付含已退款部分」:负差额能在聚水潭退款单/取消子单金额里对上 // (≈差额,或放宽口径 ≈实付−收入=差额+优惠+冲减)才标注。 @@ -335,7 +338,7 @@ class Pages extends Controller } // 兜底档:有差额但没命中任何原因 →「差额待核实」(与页面渲染的兜底备注保持一致)。 - $conditions['差额待核实'] = 'ABS(' . $effective . ') > 0.005 AND NOT (' . implode(' OR ', $seen) . ')'; + $conditions['差额待核实'] = 'ABS(' . $effective . ') > 0.005 AND NOT (' . implode(' OR ', $seen) . ') AND ' . $notBasisMarked; return $conditions; } @@ -486,13 +489,19 @@ class Pages extends Controller return '订单实付未减退款'; } } - if (abs($product - ($income + $discount)) < 0.005) { + // C 方案:口径标识行让位给口径兜底,这三条通用等式档只对"口径也对不上"的行生效。 + $basisMarked = in_array( + trim((string) ($row->remark ?? '')), + ['订单实付按卖家实收核对', '订单实付按应付/已付核对'], + true + ); + if (! $basisMarked && abs($product - ($income + $discount)) < 0.005) { return $label . '未减冲减'; } - if (abs($product - ($income + $offset)) < 0.005) { + if (! $basisMarked && abs($product - ($income + $offset)) < 0.005) { return $label . '未减优惠'; } - if (abs($product - $income) < 0.005) { + if (! $basisMarked && abs($product - $income) < 0.005) { return $label . '未减优惠和冲减'; }