diff --git a/frontend/mini-app/pages/manager/approve-detail/approve-detail.js b/frontend/mini-app/pages/manager/approve-detail/approve-detail.js index 1056128..b3d1278 100644 --- a/frontend/mini-app/pages/manager/approve-detail/approve-detail.js +++ b/frontend/mini-app/pages/manager/approve-detail/approve-detail.js @@ -107,6 +107,7 @@ Page({ tierPrices.push({ code: tierKeys[t], name: tierNames[tierKeys[t]] || tierKeys[t], price: Number(data.sale_price_tier[tierKeys[t]] || 0).toFixed(2) }); } } + var itemProfit = Number(ci.sale_price || 0) - Number(ci.cost_amount || 0) - totalSurcharge; pricingItems.push({ product_name: ci.product_name, pricing_type: ci.pricing_type, length_m: ci.length_m, width_m: ci.width_m, @@ -114,7 +115,9 @@ Page({ baseCost: Number(ci.cost_amount || 0).toFixed(2), surchargeItems: surchargeItems, totalSurcharge: totalSurcharge.toFixed(2), costPrice: (Number(ci.cost_amount || 0) + totalSurcharge).toFixed(2), - formula_detail: ci.pricing_type ? ci.product_name + " " + (ci.length_m ? ci.length_m + "m × " + ci.width_m + "m" : "") + " 成本¥" + Number(ci.cost_amount || 0).toFixed(2) : "", + salePrice: Number(ci.sale_price || 0).toFixed(2), + profit: itemProfit.toFixed(2), + profitClass: itemProfit >= 0 ? "positive" : "negative", tierPrices: tierPrices, }); } @@ -126,6 +129,9 @@ Page({ rebateTotalText: Number(data.rebate_total || 0).toFixed(2), freightTotalText: Number(data.freight_total || 0).toFixed(2), profitTotalText: profit.toFixed(2), profitRate: profitRate, + profitClass: profit >= 0 ? "profit-positive" : "profit-negative", + profitArrow: profit >= 0 ? "↑" : "↓", + totalCostText: (cost + Number(data.rebate_total || 0) + Number(data.freight_total || 0)).toFixed(2), }), pricingItems: pricingItems, orderItems: orderItems, diff --git a/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxml b/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxml index 836be4b..f0efa21 100644 --- a/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxml +++ b/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxml @@ -19,9 +19,9 @@ {{orderInfo.statusText}} - + 利润 - {{orderInfo.profitTotalText}} + {{orderInfo.profitArrow}} {{orderInfo.profitTotalText}} 利润率 {{orderInfo.profitRate}} @@ -42,6 +42,10 @@ {{orderInfo.freightTotalText}} + + 总支出 + ¥{{orderInfo.totalCostText}} + 备注: {{orderInfo.remark}} @@ -62,28 +66,20 @@ - 基础成本 + 销售价 + ¥{{item.salePrice}} + + + - 基础成本 ¥{{item.baseCost}} - + {{sc.name}} + - {{sc.name}} ¥{{sc.amount}} - - 附加费合计 - ¥{{item.totalSurcharge}} - - - 成本价 - ¥{{item.costPrice}} - - - - {{item.formula_detail}} - - - - {{tier.name}}: ¥{{tier.price}} + + = 利润 + ¥{{item.profit}} diff --git a/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxss b/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxss index a1423ae..aeb44f8 100644 --- a/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxss +++ b/frontend/mini-app/pages/manager/approve-detail/approve-detail.wxss @@ -50,30 +50,27 @@ } .profit-highlight { - background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.12) 100%); - border: 1rpx solid rgba(16, 185, 129, 0.2); + border: 1rpx solid transparent; border-radius: 18rpx; padding: 24rpx; text-align: center; margin-bottom: 20rpx; } -.profit-label { - font-size: 24rpx; - color: #059669; - font-weight: 600; +.profit-positive .profit-label, +.profit-positive .profit-value, +.profit-positive .profit-rate { color: #059669; } +.profit-positive { + background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.12) 100%); + border-color: rgba(16, 185, 129, 0.2); } -.profit-value { - font-size: 52rpx; - font-weight: 800; - color: #059669; - margin: 6rpx 0; -} - -.profit-rate { - font-size: 22rpx; - color: #059669; +.profit-negative .profit-label, +.profit-negative .profit-value, +.profit-negative .profit-rate { color: #dc2626; } +.profit-negative { + background: linear-gradient(135deg, rgba(220, 38, 38, 0.06) 0%, rgba(220, 38, 38, 0.12) 100%); + border-color: rgba(220, 38, 38, 0.2); } .summary-grid { @@ -117,6 +114,19 @@ color: #475569; } +.total-row { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 14rpx; + padding: 14rpx 18rpx; + background: #f1f5f9; + border-radius: 12rpx; + font-size: 26rpx; +} +.total-label { color: #475569; font-weight: 600; } +.total-value { font-weight: 700; color: #0f172a; } + .section-title { font-size: 26rpx; color: #64748b; @@ -164,7 +174,7 @@ } .reject-btn { - background: #ffffff; + background: #fff1f2; color: #be123c; border: 2rpx solid #fecdd3; } @@ -180,12 +190,11 @@ .pricing-calc { background: #f0f9ff; border-radius: 14rpx; padding: 16rpx; margin: 8rpx 0; } .calc-row { display: flex; justify-content: space-between; padding: 6rpx 0; font-size: 24rpx; } .calc-row.calc-sub { color: #64748b; font-size: 22rpx; padding-left: 20rpx; } -.calc-row.calc-total { border-top: 1rpx solid #bfdbfe; padding-top: 10rpx; margin-top: 6rpx; font-weight: 700; color: #1d4ed8; } +.calc-row.calc-total { border-top: 1rpx solid #bfdbfe; padding-top: 10rpx; margin-top: 6rpx; font-weight: 700; } +.calc-row.calc-total.positive { color: #059669; border-top-color: #a7f3d0; } +.calc-row.calc-total.negative { color: #dc2626; border-top-color: #fecdd3; } .calc-label { color: #374151; } .calc-value { font-weight: 600; color: #0f172a; } -.formula-text { font-size: 22rpx; color: #94a3b8; margin-top: 6rpx; } -.tier-row { display: flex; flex-wrap: wrap; gap: 10rpx; margin-top: 10rpx; } -.tier-chip { background: #eff6ff; color: #1d4ed8; font-size: 20rpx; padding: 4rpx 14rpx; border-radius: 999rpx; font-weight: 600; } /* 利润计算过程卡片 */ .calc-card { padding: 24rpx; }