feat(app-client): 更新生产环境配置并优化采购模块显示

- 修改 TARO_POSTER_DOMAIN 环境变量,移除 H5 环境特殊处理逻辑
- 在 PurchasePreview 组件中新增“空磅”与“总磅”字段展示
- Weigh 组件中增加表单验证状态的日志输出
- 更新应用版本号从 v0.0.24 到 v0.0.25
- delivery 页面引入 PdfTemplate 并替换原有 Template 类
- create 页面调整 setActive 调用位置并在订单创建流程中设置默认值
- preview 页面将按钮文案由“编辑”改为“上一步”
- audit result 页面文案从“审核”统一为“审批”
- 重构 SupplierWeightCalculator 计算逻辑,修正额外纸箱重量使用字段
- 修复 PurchaseOrderCalculator 中利润计算公式的运算顺序错误
- 移除部分无用 console 日志,保留关键调试信息
This commit is contained in:
shenyifei 2025-11-20 18:42:26 +08:00
parent 5eefd62d85
commit 0cb0bab898
11 changed files with 37 additions and 15 deletions

View File

@ -22,10 +22,7 @@ export default {
process.env.TARO_ENV === "h5" process.env.TARO_ENV === "h5"
? '"/api"' ? '"/api"'
: '"https://api.erp.qilincloud168.com"', : '"https://api.erp.qilincloud168.com"',
"process.env.TARO_POSTER_DOMAIN": "process.env.TARO_POSTER_DOMAIN": '"https://poster.qilincloud168.com"',
process.env.TARO_ENV === "h5"
? '""'
: '"https://poster.qilincloud168.com"',
}, },
mini: { mini: {
miniCssExtractPluginOption: { miniCssExtractPluginOption: {

View File

@ -159,6 +159,18 @@ export default function PurchasePreview(props: IPurchasePreviewProps) {
</View> </View>
</View> </View>
<View className="mb-3 flex flex-col gap-2 border-b pb-3"> <View className="mb-3 flex flex-col gap-2 border-b pb-3">
<View className="flex items-center justify-between">
<View className="text-sm text-gray-600"></View>
<View className="text-sm font-medium">
{formatCurrency(supplier.emptyWeight || 0)} KG
</View>
</View>
<View className="flex items-center justify-between">
<View className="text-sm text-gray-600"></View>
<View className="text-sm font-medium">
{formatCurrency(supplier.totalWeight || 0)} KG
</View>
</View>
<View className="flex items-center justify-between"> <View className="flex items-center justify-between">
<View className="text-sm text-gray-600"></View> <View className="text-sm text-gray-600"></View>
<View className="text-sm font-medium"> <View className="text-sm font-medium">

View File

@ -300,6 +300,13 @@ export default forwardRef<WeighRef, IWeightProps>(function Weigh(props, ref) {
...prev, ...prev,
[id]: !isEmptyWeightValid, [id]: !isEmptyWeightValid,
})); }));
console.log(
isEmptyWeightValid,
isTotalWeightValid,
isPurchasePriceValid,
isProductIdValid,
isPaperValid,
);
const isValid = const isValid =
isEmptyWeightValid && isEmptyWeightValid &&

View File

@ -1,2 +1,2 @@
// App 相关常量 // App 相关常量
export const APP_VERSION = "v0.0.24"; export const APP_VERSION = "v0.0.25";

View File

@ -15,6 +15,7 @@ import {
DeliveryStep2Preview, DeliveryStep2Preview,
DeliveryStep3Success, DeliveryStep3Success,
} from "@/components"; } from "@/components";
import { PdfTemplate } from "@/utils/PdfTemplate";
// 特殊处理:其他费用要实时获取费用项目 // 特殊处理:其他费用要实时获取费用项目
const updateOtherFeesModule = async ( const updateOtherFeesModule = async (
@ -244,6 +245,7 @@ export default hocAuth(function Page(props: CommonComponent) {
}, },
onCancel: () => { onCancel: () => {
Dialog.close("dialog"); Dialog.close("dialog");
console.log("12123");
}, },
}); });
return; return;
@ -285,8 +287,7 @@ export default hocAuth(function Page(props: CommonComponent) {
// 截图预览内容 // 截图预览内容
const capturePreview = async () => { const capturePreview = async () => {
const template = new Template(moduleList); const template = new PdfTemplate(moduleList);
console.log("generateHtmlString", template.generateHtmlString());
const { data } = await poster.pdf.postApiV1Pdf({ const { data } = await poster.pdf.postApiV1Pdf({
html: template.generateHtmlString(), html: template.generateHtmlString(),
}); });

View File

@ -186,6 +186,7 @@ export default hocAuth(function Page(props: CommonComponent) {
setActive(active); setActive(active);
} }
} }
setActive(4);
const orderCostList1 = purchaseOrder.orderCostList.map( const orderCostList1 = purchaseOrder.orderCostList.map(
(item: CostItem) => ({ (item: CostItem) => ({
...item, ...item,
@ -295,6 +296,8 @@ export default hocAuth(function Page(props: CommonComponent) {
selected: true, selected: true,
isPaper: orderSupplierList[selectedIndex].isPaper, isPaper: orderSupplierList[selectedIndex].isPaper,
orderPackageList: [], orderPackageList: [],
productId: orderSupplierList[selectedIndex]?.productId,
productName: orderSupplierList[selectedIndex]?.productName,
}, },
]); ]);
}; };
@ -705,7 +708,6 @@ export default hocAuth(function Page(props: CommonComponent) {
setOrderCostList((prev) => { setOrderCostList((prev) => {
const costItemVOList = productVO.costItemVOList; const costItemVOList = productVO.costItemVOList;
console.log("prev", prev);
// 将 orderCostList 中 不存在与 costItemVOList 的项 删除,剩余项保留 // 将 orderCostList 中 不存在与 costItemVOList 的项 删除,剩余项保留
const orderCostList = prev?.filter((item) => { const orderCostList = prev?.filter((item) => {
return ( return (

View File

@ -66,11 +66,12 @@ export default hocAuth(function Page(props: CommonComponent) {
Taro.redirectTo({ Taro.redirectTo({
url: buildUrl("/pages/purchase/purchaser/create", { url: buildUrl("/pages/purchase/purchaser/create", {
orderId: purchaseOrder.orderId, orderId: purchaseOrder.orderId,
active: 6,
}), }),
}); });
}} }}
> >
</Button> </Button>
</View> </View>
<View className={"flex-1"}> <View className={"flex-1"}>

View File

@ -64,10 +64,10 @@ export default hocAuth(function Page(props: CommonComponent) {
</View> </View>
<View className="mb-2.5 text-xl font-bold text-gray-800"> <View className="mb-2.5 text-xl font-bold text-gray-800">
</View> </View>
<View className="mb-2.5 text-sm text-gray-600"></View> <View className="mb-2.5 text-sm text-gray-600"></View>
<View className="mb-2.5 text-xs text-gray-400"> <View className="mb-2.5 text-xs text-gray-400">

View File

@ -1,7 +1,8 @@
class Template { export class PdfTemplate {
private moduleList: any[]; private moduleList: any[];
constructor(moduleList: any[]) { constructor(moduleList: any[]) {
console.log("moduleList",moduleList)
this.moduleList = moduleList; this.moduleList = moduleList;
} }
@ -612,6 +613,7 @@ class Template {
}); });
htmlString += `</div></div>`; htmlString += `</div></div>`;
console.log("generateHtmlString", htmlString);
return htmlString; return htmlString;
}; };
} }

View File

@ -297,8 +297,8 @@ export class PurchaseOrderCalculator {
return 0; return 0;
} }
return new Decimal(this.getMelonNetProfit()) return new Decimal(this.getMelonNetProfit())
.minus(this.getCostDifference())
.mul(this.purchaseOrderVO.orderDealer?.shareRatio || 0) .mul(this.purchaseOrderVO.orderDealer?.shareRatio || 0)
.minus(this.getCostDifference())
.div(100) .div(100)
.toNumber(); .toNumber();
} }

View File

@ -113,12 +113,12 @@ export class SupplierWeightCalculator {
.toNumber(); .toNumber();
} else if (isLastSupplier) { } else if (isLastSupplier) {
// 最后一个农户根据isLast标识判断 // 最后一个农户根据isLast标识判断
// 净重 = (总磅 - 前一个总磅) * 2 + 剩余空箱子重量 - 额外纸箱重量 // 净重 = (总磅 - 前一个总磅) * 2 + 剩余空箱子重量 - 已使用额外纸箱重量
supplier.netWeight = new Decimal(supplier.totalWeight || 0) supplier.netWeight = new Decimal(supplier.totalWeight || 0)
.sub(previousTotalWeight) .sub(previousTotalWeight)
.mul(2) .mul(2)
.add(remainingBoxesWeight) .add(remainingBoxesWeight)
.sub(extraBoxesWeight) .sub(extraUsedBoxesWeight)
.toNumber(); .toNumber();
// 毛重 = 净重 + 本次使用纸箱重量 // 毛重 = 净重 + 本次使用纸箱重量
supplier.grossWeight = new Decimal(supplier.netWeight || 0) supplier.grossWeight = new Decimal(supplier.netWeight || 0)