fix: 利润率计算改用contract_amount作分母,修改单号增加无任务提示

1. 利润率:小程序原先用sale_price_total作分母,后端实际用
   contract_amount(有则优先)或sale_price_total,两者不一致
   导致利润率显示偏差,现对齐后端逻辑。
2. 修改单号:函数开头静默return改为toast提示,便于定位问题。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wsb1224 2026-07-05 18:28:31 +08:00
parent 829e6fcbd7
commit 0f7a27e377

View File

@ -140,7 +140,8 @@ Page({
var tax = Number(data.tax_total || 0);
var commission = Number(data.commission_amount || 0);
var profit = Number(data.profit_total || 0);
var profitRate = sale > 0 ? (profit / sale * 100).toFixed(1) + "%" : "-";
var incomeAmount = Number(data.contract_amount || 0) || sale;
var profitRate = incomeAmount > 0 ? (profit / incomeAmount * 100).toFixed(1) + "%" : "-";
// 费用明细:有值才显示
var feeItems = [
@ -622,7 +623,10 @@ Page({
var that = this;
var app = getApp();
var logistics = this.data.logistics;
if (!logistics || !logistics.task_id) return;
if (!logistics || !logistics.task_id) {
wx.showToast({ title: "暂无物流任务,无法修改", icon: "none" });
return;
}
wx.showModal({
title: "修改物流单号",
editable: true,