${config.title || ""}
`;
if (config.showDealerName || config.showWatermelonGrade) {
htmlString += `
`;
}
if (module.type === "shippingInfo") {
htmlString += `
${
config.showWatermelonGrade
? `${config.dealerName || ""}-${config.watermelonGrade || ""}`
: config.dealerName || ""
}
`;
} else {
htmlString += ``;
}
if (config.showDestination || config.showVehicleNumber) {
htmlString += `
${config.destination || ""} ${config.vehicleNumber || ""}
`;
} else {
htmlString += ``;
}
htmlString += `
`;
if (config.showShippingFrom) {
htmlString += `
`;
}
if (module.type === "weightInfo") {
if (config.data) {
config.data.forEach((item: any) => {
htmlString += `发货地:
${config.shippingFrom || ""}
`;
}
if (config.showDate) {
htmlString += `
日期:
${config.date || ""}
`;
}
htmlString += ``;
if (config.showNetWeight) {
htmlString += `
`;
}
if (config.showBoxWeight) {
htmlString += `
`;
}
if (config.showGrossWeight) {
htmlString += `
`;
}
if (config.showUnitPrice) {
htmlString += `
`;
}
if (config.showAmount) {
htmlString += `
`;
}
if (config.showGrade) {
htmlString += `
`;
}
htmlString += `
`;
});
}
htmlString += `净重:
${item.netWeight || ""}
${config.netWeightUnit === "1" ? "斤" : "公斤"}
箱重:
${item.boxWeight || ""}
${config.boxWeightUnit === "1" ? "斤" : "公斤"}
毛重:
${item.grossWeight || ""}
${config.grossWeightUnit === "1" ? "斤" : "公斤"}
单价:
${item.unitPrice || ""}
${config.unitPriceUnit === "1" ? "元/斤" : "元/公斤"}
金额:
${item.totalAmount || ""}
元
品级:
${item.watermelonGrade || ""}
`;
if (config.showAccountCompany) {
htmlString += `
`;
}
if (config.showSumAmount) {
htmlString += `
`;
}
htmlString += `
`;
}
if (module.type === "packingSpec") {
htmlString += `入账公司:
${config.accountCompany || ""}
总计:
${config.sumAmount || ""}
元
`;
// 计算需要显示的列数
const visibleColumnCount =
[
config.showBoxType,
config.showQuantity,
config.showUnitPrice,
config.showAmount,
config.showUnitWeight,
config.showWeight,
].filter(Boolean).length + 1; // +1 是因为"规格:"列总是显示
const gridClass = `grid w-full gap-0 text-base grid-cols-${visibleColumnCount}`;
htmlString += `
`;
htmlString += `
`;
}
if (module.type === "vehicleInfo") {
htmlString += `规格:
`;
if (config.columns) {
config.columns.forEach((column: any, index: number) => {
if (index === 0) {
htmlString += ` `;
return;
}
if (
(column.dataIndex === "boxType" && config.showBoxType) ||
(column.dataIndex === "quantity" && config.showQuantity) ||
(column.dataIndex === "unitPrice" && config.showUnitPrice) ||
(column.dataIndex === "amount" && config.showAmount) ||
(column.dataIndex === "unitWeight" && config.showUnitWeight) ||
(column.dataIndex === "weight" && config.showWeight)
) {
htmlString += `
`;
htmlString += `${column.title || ""}
`;
}
});
}
htmlString += ``;
if (config.data) {
config.data.forEach((item: any, index: number) => {
htmlString += `
`;
});
}
htmlString += `
`;
}
if (config.showAmount) {
htmlString += `
`;
}
if (config.showWeight) {
htmlString += `
`;
htmlString += `
${item.boxSpecName}
`;
htmlString += `
${item.boxType || ""}
`;
if (config.showQuantity) {
htmlString += `
${item.quantity || ""}
`;
}
if (config.showUnitPrice) {
htmlString += `
${item.unitPrice || ""}
`;
}
if (config.showAmount) {
htmlString += `
${item.amount || ""}
`;
}
if (config.showUnitWeight) {
htmlString += `
${item.unitWeight || ""}
`;
}
if (config.showWeight) {
htmlString += `
${item.weight || ""}
`;
}
htmlString += `总件数
`;
if (config.showQuantity) {
htmlString += `
${
config.data?.reduce(
(acc: any, cur: any) => acc + Number(cur.quantity || 0),
0,
) || 0
}
`;
}
if (config.showUnitPrice) {
htmlString += `
${
config.data?.reduce(
(acc: any, cur: any) => acc + Number(cur.amount || 0),
0,
) || 0
}
`;
}
if (config.showUnitWeight) {
htmlString += `
${
config.data?.reduce(
(acc: any, cur: any) => acc + Number(cur.weight || 0),
0,
) || 0
}
`;
}
htmlString += `
`;
if (config.showDriverPhone) {
htmlString += `
`;
}
if (module.type === "otherFees") {
htmlString += `司机号码:
${config.driverPhone || ""}
`;
}
if (config.showLicensePlate) {
htmlString += `
车牌:
${config.licensePlate || ""}
`;
}
if (config.showEstimatedArrivalTime) {
htmlString += `
预计到仓时间:
${config.estimatedArrivalTime || ""}
`;
}
if (config.showRemarks) {
htmlString += `
备注:
${config.remarks || ""}
`;
}
if (config.showFreightDebt) {
htmlString += `
${config.freightDebtTitle || "运费欠"}:
${config.freightDebt || ""}
`;
}
if (config.showStrawMatDebt) {
htmlString += `
草帘欠:
${config.strawMatDebt || ""}
`;
}
htmlString += ``;
if (config.feeItems) {
config.feeItems.forEach((feeType: any) => {
htmlString += `
`;
}
if (module.type === "totalAmount") {
htmlString += `
${(config.feeLabels && config.feeLabels[feeType]) || ""}:
${config[feeType] || ""}元
`;
});
}
htmlString += ``;
if (config.showTotalAmount) {
htmlString += `
`;
}
if (module.type === "otherInfo") {
htmlString += `
${config.sumTitle || "合计金额"}:
${config.amount || ""}
元
`;
}
if (config.showFarmer) {
htmlString += `
瓜农:
${config.farmer || ""}
`;
}
htmlString += `车次:
${config.vehicleNumber}
收货地:
${config.destination}
产地:
${config.shippingFrom}
供应商:
${config.accountCompany}
发车时间:
${config.date}
到达时间:
${config.estimatedArrivalTime}
品名:
${item.watermelonGrade}
发货重量:
以公司入库重量为准。
净瓜单价:
${item.unitPrice}
${config.unitPriceUnit === "1" ? "元/斤" : "元/公斤"}
大约重量:
${config.data?.reduce(
(acc: any, cur: any) => acc + cur.netWeight,
0,
)}
斤
箱数
${config.data?.reduce(
(acc: any, cur: any) => acc + cur.boxCount,
0,
)}
件
车号:
${config.licensePlate}
手机号:
${config.driverPhone}