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) }); 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({ pricingItems.push({
product_name: ci.product_name, pricing_type: ci.pricing_type, product_name: ci.product_name, pricing_type: ci.pricing_type,
length_m: ci.length_m, width_m: ci.width_m, length_m: ci.length_m, width_m: ci.width_m,
@ -114,7 +115,9 @@ Page({
baseCost: Number(ci.cost_amount || 0).toFixed(2), baseCost: Number(ci.cost_amount || 0).toFixed(2),
surchargeItems: surchargeItems, totalSurcharge: totalSurcharge.toFixed(2), surchargeItems: surchargeItems, totalSurcharge: totalSurcharge.toFixed(2),
costPrice: (Number(ci.cost_amount || 0) + 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, tierPrices: tierPrices,
}); });
} }
@ -126,6 +129,9 @@ Page({
rebateTotalText: Number(data.rebate_total || 0).toFixed(2), rebateTotalText: Number(data.rebate_total || 0).toFixed(2),
freightTotalText: Number(data.freight_total || 0).toFixed(2), freightTotalText: Number(data.freight_total || 0).toFixed(2),
profitTotalText: profit.toFixed(2), profitRate: profitRate, 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, pricingItems: pricingItems,
orderItems: orderItems, orderItems: orderItems,

View File

@ -19,9 +19,9 @@
</view> </view>
<view class="badge {{orderInfo.badgeClass}}">{{orderInfo.statusText}}</view> <view class="badge {{orderInfo.badgeClass}}">{{orderInfo.statusText}}</view>
</view> </view>
<view class="profit-highlight"> <view class="profit-highlight {{orderInfo.profitClass}}">
<view class="profit-label">利润</view> <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 class="profit-rate" wx:if="{{orderInfo.profitRate}}">利润率 {{orderInfo.profitRate}}</view>
</view> </view>
<view class="summary-grid"> <view class="summary-grid">
@ -42,6 +42,10 @@
<view class="summary-value">{{orderInfo.freightTotalText}}</view> <view class="summary-value">{{orderInfo.freightTotalText}}</view>
</view> </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"> <view wx:if="{{orderInfo.remark}}" class="remark-row">
<text class="remark-label">备注:</text> <text class="remark-label">备注:</text>
<text class="remark-text">{{orderInfo.remark}}</text> <text class="remark-text">{{orderInfo.remark}}</text>
@ -62,28 +66,20 @@
</view> </view>
<view wx:if="{{item.calcDetail}}" class="pricing-calc"> <view wx:if="{{item.calcDetail}}" class="pricing-calc">
<view class="calc-row"> <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> <text class="calc-value">¥{{item.baseCost}}</text>
</view> </view>
<view wx:for="{{item.surchargeItems}}" wx:for-item="sc" wx:key="key" class="calc-row calc-sub"> <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> <text class="calc-value">¥{{sc.amount}}</text>
</view> </view>
<view wx:if="{{item.totalSurcharge > 0}}" class="calc-row calc-sub"> <view class="calc-row calc-total {{item.profitClass}}">
<text class="calc-label">附加费合计</text> <text class="calc-label">= 利润</text>
<text class="calc-value">¥{{item.totalSurcharge}}</text> <text class="calc-value">¥{{item.profit}}</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> </view>
</view> </view>
</view> </view>

View File

@ -50,30 +50,27 @@
} }
.profit-highlight { .profit-highlight {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.12) 100%); border: 1rpx solid transparent;
border: 1rpx solid rgba(16, 185, 129, 0.2);
border-radius: 18rpx; border-radius: 18rpx;
padding: 24rpx; padding: 24rpx;
text-align: center; text-align: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.profit-label { .profit-positive .profit-label,
font-size: 24rpx; .profit-positive .profit-value,
color: #059669; .profit-positive .profit-rate { color: #059669; }
font-weight: 600; .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 { .profit-negative .profit-label,
font-size: 52rpx; .profit-negative .profit-value,
font-weight: 800; .profit-negative .profit-rate { color: #dc2626; }
color: #059669; .profit-negative {
margin: 6rpx 0; 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);
.profit-rate {
font-size: 22rpx;
color: #059669;
} }
.summary-grid { .summary-grid {
@ -117,6 +114,19 @@
color: #475569; 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 { .section-title {
font-size: 26rpx; font-size: 26rpx;
color: #64748b; color: #64748b;
@ -164,7 +174,7 @@
} }
.reject-btn { .reject-btn {
background: #ffffff; background: #fff1f2;
color: #be123c; color: #be123c;
border: 2rpx solid #fecdd3; border: 2rpx solid #fecdd3;
} }
@ -180,12 +190,11 @@
.pricing-calc { background: #f0f9ff; border-radius: 14rpx; padding: 16rpx; margin: 8rpx 0; } .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 { 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-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-label { color: #374151; }
.calc-value { font-weight: 600; color: #0f172a; } .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; } .calc-card { padding: 24rpx; }