Merge branch 'claude/nice-heyrovsky-5b0cf0'

This commit is contained in:
taiyi 2026-06-06 22:25:03 +08:00
commit 10c1c4c178
3 changed files with 52 additions and 41 deletions

View File

@ -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,

View File

@ -19,9 +19,9 @@
</view>
<view class="badge {{orderInfo.badgeClass}}">{{orderInfo.statusText}}</view>
</view>
<view class="profit-highlight">
<view class="profit-highlight {{orderInfo.profitClass}}">
<view class="profit-label">利润</view>
<view class="profit-value">{{orderInfo.profitTotalText}}</view>
<view class="profit-value">{{orderInfo.profitArrow}} {{orderInfo.profitTotalText}}</view>
<view class="profit-rate" wx:if="{{orderInfo.profitRate}}">利润率 {{orderInfo.profitRate}}</view>
</view>
<view class="summary-grid">
@ -42,6 +42,10 @@
<view class="summary-value">{{orderInfo.freightTotalText}}</view>
</view>
</view>
<view class="total-row">
<text class="total-label">总支出</text>
<text class="total-value">¥{{orderInfo.totalCostText}}</text>
</view>
<view wx:if="{{orderInfo.remark}}" class="remark-row">
<text class="remark-label">备注:</text>
<text class="remark-text">{{orderInfo.remark}}</text>
@ -62,28 +66,20 @@
</view>
<view wx:if="{{item.calcDetail}}" class="pricing-calc">
<view class="calc-row">
<text class="calc-label">基础成本</text>
<text class="calc-label">销售价</text>
<text class="calc-value">¥{{item.salePrice}}</text>
</view>
<view class="calc-row calc-sub">
<text class="calc-label">- 基础成本</text>
<text class="calc-value">¥{{item.baseCost}}</text>
</view>
<view wx:for="{{item.surchargeItems}}" wx:for-item="sc" wx:key="key" class="calc-row calc-sub">
<text class="calc-label">+ {{sc.name}}</text>
<text class="calc-label">- {{sc.name}}</text>
<text class="calc-value">¥{{sc.amount}}</text>
</view>
<view wx:if="{{item.totalSurcharge > 0}}" class="calc-row calc-sub">
<text class="calc-label">附加费合计</text>
<text class="calc-value">¥{{item.totalSurcharge}}</text>
</view>
<view class="calc-row calc-total">
<text class="calc-label">成本价</text>
<text class="calc-value">¥{{item.costPrice}}</text>
</view>
</view>
<view wx:if="{{item.formula_detail}}" class="formula-text">
<text>{{item.formula_detail}}</text>
</view>
<view wx:if="{{item.tierPrices.length}}" class="tier-row">
<view wx:for="{{item.tierPrices}}" wx:for-item="tier" wx:key="code" class="tier-chip">
<text>{{tier.name}}: ¥{{tier.price}}</text>
<view class="calc-row calc-total {{item.profitClass}}">
<text class="calc-label">= 利润</text>
<text class="calc-value">¥{{item.profit}}</text>
</view>
</view>
</view>

View File

@ -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; }