Compare commits
No commits in common. "d467e25a76bf7ccac09e5151b43b1dc66401118f" and "47c7bdf35792388c6aa79eb1c56a483d86a8f67c" have entirely different histories.
d467e25a76
...
47c7bdf357
@ -1,7 +1,6 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { Input, Text, View } from "@tarojs/components";
|
import { Input, Text, View } from "@tarojs/components";
|
||||||
import { Icon, IconNames } from "@/components";
|
import { Icon, IconNames } from "@/components";
|
||||||
import { formatCurrency } from "@/utils";
|
|
||||||
|
|
||||||
interface PriceEditorProps {
|
interface PriceEditorProps {
|
||||||
value: number;
|
value: number;
|
||||||
@ -62,13 +61,6 @@ export default function PriceEditor(props: PriceEditorProps) {
|
|||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 清空输入
|
|
||||||
const clearValue = (e: any) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setInputValue("");
|
|
||||||
onSave(0);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!readOnly ? (
|
{!readOnly ? (
|
||||||
@ -81,7 +73,7 @@ export default function PriceEditor(props: PriceEditorProps) {
|
|||||||
<Text className="text-sm text-gray-500">{unit}</Text>
|
<Text className="text-sm text-gray-500">{unit}</Text>
|
||||||
</View>
|
</View>
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
<View className="relative flex flex-1 items-end">
|
<View className="relative flex">
|
||||||
<View className="input-bold flex h-10 w-full items-center border-b-2 border-red-500 !pb-2 text-3xl font-bold text-red-500 focus:outline-none">
|
<View className="input-bold flex h-10 w-full items-center border-b-2 border-red-500 !pb-2 text-3xl font-bold text-red-500 focus:outline-none">
|
||||||
<Input
|
<Input
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
@ -90,36 +82,13 @@ export default function PriceEditor(props: PriceEditorProps) {
|
|||||||
onInput={handleInputChange}
|
onInput={handleInputChange}
|
||||||
onBlur={saveEdit}
|
onBlur={saveEdit}
|
||||||
/>
|
/>
|
||||||
{inputValue !== "" && (
|
|
||||||
<Icon
|
|
||||||
name="circle-xmark"
|
|
||||||
size={20}
|
|
||||||
className="ml-2 cursor-pointer"
|
|
||||||
onClick={clearValue}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View
|
<View className="relative flex" onClick={() => setIsEditing(true)}>
|
||||||
className="relative flex flex-1 items-end"
|
|
||||||
onClick={() => setIsEditing(true)}
|
|
||||||
>
|
|
||||||
<Text className="h-10 w-full border-b-2 border-red-500 pb-2 text-3xl font-bold text-red-500 focus:outline-none">
|
<Text className="h-10 w-full border-b-2 border-red-500 pb-2 text-3xl font-bold text-red-500 focus:outline-none">
|
||||||
{formatCurrency(value || 0)}
|
{value?.toFixed(2) || "0"}
|
||||||
</Text>
|
</Text>
|
||||||
<Icon
|
|
||||||
name={value !== 0 ? "circle-xmark" : "pen-to-square"}
|
|
||||||
size={20}
|
|
||||||
className="absolute right-0 bottom-2 ml-2 cursor-pointer"
|
|
||||||
onClick={(event) => {
|
|
||||||
if (value !== 0) {
|
|
||||||
clearValue(event);
|
|
||||||
} else {
|
|
||||||
setIsEditing(true);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<View className="mt-1 text-xs text-gray-400">{hint}</View>
|
<View className="mt-1 text-xs text-gray-400">{hint}</View>
|
||||||
@ -135,7 +104,7 @@ export default function PriceEditor(props: PriceEditorProps) {
|
|||||||
</View>
|
</View>
|
||||||
<View className="relative">
|
<View className="relative">
|
||||||
<Text className="w-full py-2 text-3xl font-bold text-red-500">
|
<Text className="w-full py-2 text-3xl font-bold text-red-500">
|
||||||
{formatCurrency(value || 0)}
|
{value?.toFixed(2) || "0"}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import dayjs from "dayjs";
|
|||||||
import { Icon } from "@/components";
|
import { Icon } from "@/components";
|
||||||
|
|
||||||
interface Step1FormProps {
|
interface Step1FormProps {
|
||||||
readOnly?: boolean;
|
|
||||||
moduleList: any[];
|
moduleList: any[];
|
||||||
shipOrderVO: any;
|
shipOrderVO: any;
|
||||||
setShipOrderVO: (value: any) => void;
|
setShipOrderVO: (value: any) => void;
|
||||||
@ -21,7 +20,7 @@ export interface Step1FormRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||||
const { moduleList, shipOrderVO, setShipOrderVO, readOnly = false } = props;
|
const { moduleList, shipOrderVO, setShipOrderVO } = props;
|
||||||
|
|
||||||
// 当天和未来10天
|
// 当天和未来10天
|
||||||
const startDate = new Date();
|
const startDate = new Date();
|
||||||
@ -95,7 +94,6 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
className={`flex h-10 w-full items-center rounded-md ${formErrors.watermelonGrade ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
className={`flex h-10 w-full items-center rounded-md ${formErrors.watermelonGrade ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
disabled={readOnly}
|
|
||||||
value={shipOrderVO?.watermelonGrade || ""}
|
value={shipOrderVO?.watermelonGrade || ""}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
// 清除错误状态
|
// 清除错误状态
|
||||||
@ -106,9 +104,11 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
setShipOrderVO({
|
setShipOrderVO((prev: any) => {
|
||||||
...shipOrderVO!,
|
return {
|
||||||
watermelonGrade: value,
|
...prev!,
|
||||||
|
watermelonGrade: value,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
@ -158,7 +158,6 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
className={`flex h-10 w-full items-center rounded-md ${formErrors.shippingAddress ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
className={`flex h-10 w-full items-center rounded-md ${formErrors.shippingAddress ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
disabled={readOnly}
|
|
||||||
value={shipOrderVO?.shippingAddress || ""}
|
value={shipOrderVO?.shippingAddress || ""}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
// 清除错误状态
|
// 清除错误状态
|
||||||
@ -169,9 +168,11 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
setShipOrderVO({
|
setShipOrderVO((prev: any) => {
|
||||||
...shipOrderVO!,
|
return {
|
||||||
shippingAddress: value,
|
...prev!,
|
||||||
|
shippingAddress: value,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
@ -222,13 +223,12 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
className={
|
className={
|
||||||
"flex flex-1 flex-row items-center justify-between px-5" +
|
"flex flex-1 flex-row items-center justify-between px-5"
|
||||||
(readOnly ? " opacity-50" : "")
|
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
color: "var(--nutui-color-title, #1a1a1a)",
|
color: "var(--nutui-color-title, #1a1a1a)",
|
||||||
}}
|
}}
|
||||||
onClick={() => readOnly || setShow(true)}
|
onClick={() => setShow(true)}
|
||||||
>
|
>
|
||||||
<View className={"text-sm"}>
|
<View className={"text-sm"}>
|
||||||
{shipOrderVO?.estimatedArrivalDate
|
{shipOrderVO?.estimatedArrivalDate
|
||||||
@ -257,11 +257,13 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
setShipOrderVO({
|
setShipOrderVO((prev: any) => {
|
||||||
...shipOrderVO!,
|
return {
|
||||||
estimatedArrivalDate: dayjs(values.join("-")).format(
|
...prev!,
|
||||||
"YYYY-MM-DD",
|
estimatedArrivalDate: dayjs(values.join("-")).format(
|
||||||
),
|
"YYYY-MM-DD",
|
||||||
|
),
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -288,7 +290,6 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
className={`flex h-10 w-full items-center rounded-md ${formErrors.remark ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
className={`flex h-10 w-full items-center rounded-md ${formErrors.remark ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
disabled={readOnly}
|
|
||||||
value={shipOrderVO?.remark || ""}
|
value={shipOrderVO?.remark || ""}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
// 清除错误状态
|
// 清除错误状态
|
||||||
@ -299,9 +300,11 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
setShipOrderVO({
|
setShipOrderVO((prev: any) => {
|
||||||
...shipOrderVO!,
|
return {
|
||||||
remark: value,
|
...prev!,
|
||||||
|
remark: value,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
@ -359,7 +362,6 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
className={`flex h-10 items-center rounded-md ${formErrors.itemGrades?.[shipOrderItem.itemId] ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
className={`flex h-10 items-center rounded-md ${formErrors.itemGrades?.[shipOrderItem.itemId] ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
disabled={readOnly}
|
|
||||||
value={shipOrderItem.watermelonGrade || ""}
|
value={shipOrderItem.watermelonGrade || ""}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
// 清除该项的错误状态
|
// 清除该项的错误状态
|
||||||
@ -376,10 +378,10 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
setShipOrderVO({
|
setShipOrderVO((prev: any) => {
|
||||||
...shipOrderVO!,
|
return {
|
||||||
shipOrderItemList:
|
...prev!,
|
||||||
shipOrderVO?.shipOrderItemList?.map(
|
shipOrderItemList: prev?.shipOrderItemList?.map(
|
||||||
(item: any) => {
|
(item: any) => {
|
||||||
if (item.itemId === shipOrderItem.itemId) {
|
if (item.itemId === shipOrderItem.itemId) {
|
||||||
return {
|
return {
|
||||||
@ -390,6 +392,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
@ -549,7 +552,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View className="flex flex-col rounded-lg bg-white p-2.5 shadow-md">
|
||||||
{moduleList.map((module) => {
|
{moduleList.map((module) => {
|
||||||
const contentFields = renderContentFields(module);
|
const contentFields = renderContentFields(module);
|
||||||
// 如果没有内容配置字段,则不渲染该模块
|
// 如果没有内容配置字段,则不渲染该模块
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Text, View } from "@tarojs/components";
|
import { Text, View } from "@tarojs/components";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Dialog } from "@nutui/nutui-react-taro";
|
import { Dialog } from "@nutui/nutui-react-taro";
|
||||||
import { PriceEditor } from "@/components";
|
import { Icon, PriceEditor } from "@/components";
|
||||||
import CostCreate from "./CostCreate";
|
import CostCreate from "./CostCreate";
|
||||||
|
|
||||||
interface CostCardComponentProps {
|
interface CostCardComponentProps {
|
||||||
@ -58,21 +58,18 @@ export default function CostCard(props: CostCardComponentProps) {
|
|||||||
<View className="mb-2 flex items-center justify-between">
|
<View className="mb-2 flex items-center justify-between">
|
||||||
<Text className="text-sm font-medium">{orderCost.name}</Text>
|
<Text className="text-sm font-medium">{orderCost.name}</Text>
|
||||||
{!readOnly && (
|
{!readOnly && (
|
||||||
<View className="flex gap-2">
|
<View className="flex flex-row gap-2.5">
|
||||||
{orderCostItemList.length > 0 && (
|
<Icon
|
||||||
<View
|
name="pen-to-square"
|
||||||
className="cursor-pointer rounded-lg bg-blue-100 px-3 py-1 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-200"
|
size={16}
|
||||||
onClick={() => setShowEditModal(true)}
|
onClick={() => setShowEditModal(true)}
|
||||||
>
|
/>
|
||||||
编辑
|
<Icon
|
||||||
</View>
|
name="circle-xmark"
|
||||||
)}
|
size={16}
|
||||||
<View
|
color={"var(--color-red-500)"}
|
||||||
className="cursor-pointer rounded-lg bg-red-100 px-3 py-1 text-xs font-medium text-red-600 transition-colors hover:bg-red-200"
|
|
||||||
onClick={handleDelete}
|
onClick={handleDelete}
|
||||||
>
|
/>
|
||||||
删除
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
@ -97,25 +94,23 @@ export default function CostCard(props: CostCardComponentProps) {
|
|||||||
hint="点击金额可直接编辑"
|
hint="点击金额可直接编辑"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{orderCostItemList.length > 0 && (
|
<View className="flex flex-1 flex-col gap-2 pl-4">
|
||||||
<View className="flex flex-1 flex-col gap-2 pl-4">
|
{orderCostItemList.map((orderCostItem) => {
|
||||||
{orderCostItemList.map((orderCostItem) => {
|
return (
|
||||||
return (
|
<View
|
||||||
<View
|
key={orderCostItem.orderCostItemId}
|
||||||
key={orderCostItem.orderCostItemId}
|
className="flex items-center justify-between"
|
||||||
className="flex items-center justify-between"
|
>
|
||||||
>
|
<Text className="text-sm text-gray-500">
|
||||||
<Text className="text-sm text-gray-500">
|
{orderCostItem.name}
|
||||||
{orderCostItem.name}
|
</Text>
|
||||||
</Text>
|
<Text className="text-sm font-medium">
|
||||||
<Text className="text-sm font-medium">
|
{orderCostItem.count} {orderCostItem.unit}
|
||||||
{orderCostItem.count} {orderCostItem.unit}
|
</Text>
|
||||||
</Text>
|
</View>
|
||||||
</View>
|
);
|
||||||
);
|
})}
|
||||||
})}
|
</View>
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,6 @@ export { default as CostDifferenceSection } from "./section/CostDifferenceSectio
|
|||||||
export { default as MaterialCostSection } from "./section/MaterialCostSection";
|
export { default as MaterialCostSection } from "./section/MaterialCostSection";
|
||||||
export { default as ProductionAdvanceSection } from "./section/ProductionAdvanceSection";
|
export { default as ProductionAdvanceSection } from "./section/ProductionAdvanceSection";
|
||||||
export { default as WorkerAdvanceSection } from "./section/WorkerAdvanceSection";
|
export { default as WorkerAdvanceSection } from "./section/WorkerAdvanceSection";
|
||||||
export { default as DeliveryFormSection } from "./section/DeliveryFormSection";
|
|
||||||
|
|
||||||
export { default as PurchaseStep1Form } from "./document/Step1Form";
|
export { default as PurchaseStep1Form } from "./document/Step1Form";
|
||||||
export type { Step1FormRef as PurchaseStep1FormRef } from "./document/Step1Form";
|
export type { Step1FormRef as PurchaseStep1FormRef } from "./document/Step1Form";
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export default function EmptyBoxModule(props: IEmptyBoxModuleProps) {
|
|||||||
initBoxBrandList().then();
|
initBoxBrandList().then();
|
||||||
setEmptyBoxList(orderPackageList);
|
setEmptyBoxList(orderPackageList);
|
||||||
|
|
||||||
if (orderPackageList?.length > 0) {
|
if (orderPackageList.length > 0) {
|
||||||
// 根据当前供应商确定需要检查的纸箱类型
|
// 根据当前供应商确定需要检查的纸箱类型
|
||||||
let requiredTypes: string[] = ["EMPTY"];
|
let requiredTypes: string[] = ["EMPTY"];
|
||||||
|
|
||||||
|
|||||||
@ -549,7 +549,6 @@ export default forwardRef<MelonFarmerRef, IMelonFarmerProps>(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("supplierVO", supplierVO);
|
|
||||||
if (!supplierVO) {
|
if (!supplierVO) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -589,9 +588,9 @@ export default forwardRef<MelonFarmerRef, IMelonFarmerProps>(
|
|||||||
<Radio.Group
|
<Radio.Group
|
||||||
direction="horizontal"
|
direction="horizontal"
|
||||||
value={
|
value={
|
||||||
supplierVO.isLast === true
|
supplierVO.isLast
|
||||||
? "true"
|
? "true"
|
||||||
: supplierVO.isLast === false
|
: !supplierVO.isLast
|
||||||
? "false"
|
? "false"
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Icon } from "@/components";
|
|||||||
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
||||||
import { Checkbox, Input, Toast } from "@nutui/nutui-react-taro";
|
import { Checkbox, Input, Toast } from "@nutui/nutui-react-taro";
|
||||||
import { generateShortId } from "@/utils";
|
import { generateShortId } from "@/utils";
|
||||||
|
import { business } from "@/services";
|
||||||
|
|
||||||
// 定义ref暴露的方法接口
|
// 定义ref暴露的方法接口
|
||||||
export interface OrderCostRef {
|
export interface OrderCostRef {
|
||||||
@ -29,41 +30,54 @@ export default forwardRef<OrderCostRef, IOrderCostProps>(
|
|||||||
|
|
||||||
// 初始化函数
|
// 初始化函数
|
||||||
const init = async (costIds: string[]) => {
|
const init = async (costIds: string[]) => {
|
||||||
// 创建一个映射,用于快速查找orderCostItemList中的项目
|
let newOrderCostList: BusinessAPI.OrderCost[] = [];
|
||||||
const orderCostMap = new Map<string, BusinessAPI.OrderCost>();
|
|
||||||
|
|
||||||
orderCostList?.forEach((item) => {
|
// 获取成本列表
|
||||||
if (item.costId && costIds.includes(item.costId)) {
|
const {
|
||||||
orderCostMap.set(item.costId, item);
|
data: { data: costList, success },
|
||||||
}
|
} = await business.cost.listCost({
|
||||||
|
costListQry: {
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 构建初始列表,基于costTemplate中的项目
|
if (success) {
|
||||||
const newOrderCostList: IOrderCost[] = [];
|
const newCostList = costList?.filter((item) => {
|
||||||
|
return costIds.includes(item.costId);
|
||||||
|
});
|
||||||
|
|
||||||
// 遍历costList,将costList中的项目添加到orderCostList中
|
// 遍历costList,将costList中的项目添加到orderCostList中
|
||||||
parsedCostTemplate.productionTypeList?.forEach((item) => {
|
newCostList?.forEach((item) => {
|
||||||
const existingItem = orderCostMap.get(item.costItemId);
|
const orderCost = orderCostList.find(
|
||||||
|
(cost) => cost.costId === item.costId,
|
||||||
|
);
|
||||||
|
|
||||||
if (existingItem) {
|
const selected = parsedCostTemplate.productionTypeList?.some(
|
||||||
newOrderCostList.push({
|
(cost) => {
|
||||||
...existingItem,
|
return cost.costId === item.costId;
|
||||||
selected: !!existingItem,
|
},
|
||||||
});
|
);
|
||||||
} else {
|
|
||||||
newOrderCostList.push({
|
if (orderCost) {
|
||||||
orderCostId: generateShortId(),
|
newOrderCostList.push({
|
||||||
costItemIds: item.costItemIds,
|
...orderCost,
|
||||||
costId: item.costId,
|
selected: selected,
|
||||||
name: item.name,
|
});
|
||||||
type: item.type,
|
} else {
|
||||||
selected: false,
|
newOrderCostList.push({
|
||||||
count: 1,
|
orderCostId: generateShortId(),
|
||||||
price: item.price || 0,
|
costItemIds: item.costItemIds,
|
||||||
unit: item.unit || "元",
|
costId: item.costId,
|
||||||
});
|
name: item.name,
|
||||||
}
|
type: item.type,
|
||||||
});
|
selected: selected,
|
||||||
|
count: 1,
|
||||||
|
price: item.price || 0,
|
||||||
|
unit: item.unit || "元",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onChange?.({
|
onChange?.({
|
||||||
...value,
|
...value,
|
||||||
|
|||||||
@ -47,6 +47,8 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("orderCostItemList,", orderCostItemList);
|
||||||
|
|
||||||
// 构建初始列表,基于costTemplate中的项目
|
// 构建初始列表,基于costTemplate中的项目
|
||||||
const newOrderCostItemList: IOrderCostItem[] = [];
|
const newOrderCostItemList: IOrderCostItem[] = [];
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
|||||||
name: item.name,
|
name: item.name,
|
||||||
price: item.price,
|
price: item.price,
|
||||||
unit: item.unit,
|
unit: item.unit,
|
||||||
selected: !!existingItem,
|
selected: true,
|
||||||
count: existingItem?.count || 1,
|
count: existingItem?.count || 1,
|
||||||
payerType: existingItem?.payerType,
|
payerType: existingItem?.payerType,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
@ -80,7 +82,7 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
|||||||
name: item.name,
|
name: item.name,
|
||||||
price: item.price,
|
price: item.price,
|
||||||
unit: item.unit,
|
unit: item.unit,
|
||||||
selected: !!existingItem,
|
selected: true,
|
||||||
count: existingItem?.count || 1,
|
count: existingItem?.count || 1,
|
||||||
payerType: existingItem?.payerType,
|
payerType: existingItem?.payerType,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
@ -88,6 +90,7 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("newOrderCostItemList,", newOrderCostItemList);
|
||||||
onChange?.({
|
onChange?.({
|
||||||
...value,
|
...value,
|
||||||
orderCostItemList: newOrderCostItemList,
|
orderCostItemList: newOrderCostItemList,
|
||||||
|
|||||||
@ -41,7 +41,7 @@ export default forwardRef<OrderPackageRef, IOrderPackageProps>(
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
if (orderPackageList?.length > 0) {
|
if (orderPackageList.length > 0) {
|
||||||
// 根据当前供应商确定需要检查的纸箱类型
|
// 根据当前供应商确定需要检查的纸箱类型
|
||||||
let requiredTypes: string[] = [];
|
let requiredTypes: string[] = [];
|
||||||
|
|
||||||
|
|||||||
@ -245,7 +245,7 @@ export default function PurchasePreview(props: IPurchasePreviewProps) {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{purchaseOrder.orderPackageList?.length > 0 && (
|
{purchaseOrder.orderPackageList.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<View className="text-sm font-bold">空箱使用明细</View>
|
<View className="text-sm font-bold">空箱使用明细</View>
|
||||||
<View className="flex flex-col gap-2.5">
|
<View className="flex flex-col gap-2.5">
|
||||||
|
|||||||
@ -535,9 +535,9 @@ export default forwardRef<WeighRef, IWeightProps>(function Weigh(props, ref) {
|
|||||||
<Radio.Group
|
<Radio.Group
|
||||||
direction="horizontal"
|
direction="horizontal"
|
||||||
value={
|
value={
|
||||||
supplierVO.isPaper === true
|
supplierVO.isPaper
|
||||||
? "true"
|
? "true"
|
||||||
: supplierVO.isPaper === false
|
: !supplierVO.isPaper
|
||||||
? "false"
|
? "false"
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@ -639,7 +639,7 @@ export default forwardRef<WeighRef, IWeightProps>(function Weigh(props, ref) {
|
|||||||
<Radio.Group
|
<Radio.Group
|
||||||
direction="horizontal"
|
direction="horizontal"
|
||||||
value={
|
value={
|
||||||
supplierVO.isDepositPaid === true
|
supplierVO.isDepositPaid
|
||||||
? "true"
|
? "true"
|
||||||
: supplierVO.isDepositPaid === false
|
: supplierVO.isDepositPaid === false
|
||||||
? "false"
|
? "false"
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
import { Text, View } from "@tarojs/components";
|
import { Text, View } from "@tarojs/components";
|
||||||
import { formatCurrency, PurchaseOrderCalculator } from "@/utils";
|
import { Button, Popup, SafeArea } from "@nutui/nutui-react-taro";
|
||||||
|
import { PurchaseOrderCalculator } from "@/utils";
|
||||||
import { PriceEditor } from "@/components";
|
import { PriceEditor } from "@/components";
|
||||||
|
|
||||||
export default function CostDifferenceSection(props: {
|
export default function CostDifferenceSection(props: {
|
||||||
@ -11,6 +13,49 @@ export default function CostDifferenceSection(props: {
|
|||||||
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
||||||
const orderDealer = purchaseOrderVO.orderDealer;
|
const orderDealer = purchaseOrderVO.orderDealer;
|
||||||
|
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
// 主状态,用于页面显示
|
||||||
|
const costDifference =
|
||||||
|
orderDealer?.costDifference || calculator.getCostDifference();
|
||||||
|
|
||||||
|
// 弹窗内的临时状态
|
||||||
|
const [tempCostDifference, setTempCostDifference] = useState<number>(
|
||||||
|
orderDealer?.costDifference || 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
const profitSharing = calculator.getShareProfit() || 0;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!orderDealer?.costDifference) {
|
||||||
|
const defaultCostDifference = calculator.getCostDifference();
|
||||||
|
setTempCostDifference(defaultCostDifference);
|
||||||
|
// 更新父组件的状态
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
costDifference: defaultCostDifference,
|
||||||
|
profitSharing: profitSharing,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 保存调整成本
|
||||||
|
const saveCostDifference = () => {
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
costDifference: tempCostDifference,
|
||||||
|
profitSharing: profitSharing,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={"flex flex-col gap-2.5"}>
|
<View className={"flex flex-col gap-2.5"}>
|
||||||
{/* 卡片形式展示分成信息 */}
|
{/* 卡片形式展示分成信息 */}
|
||||||
@ -21,26 +66,21 @@ export default function CostDifferenceSection(props: {
|
|||||||
|
|
||||||
<View className="flex">
|
<View className="flex">
|
||||||
<PriceEditor
|
<PriceEditor
|
||||||
value={
|
value={costDifference}
|
||||||
orderDealer.costDifference === null ||
|
|
||||||
orderDealer.costDifference === undefined
|
|
||||||
? calculator.getCostDifference()
|
|
||||||
: orderDealer.costDifference
|
|
||||||
}
|
|
||||||
onSave={(newValue) => {
|
onSave={(newValue) => {
|
||||||
onChange?.({
|
onChange?.({
|
||||||
...purchaseOrderVO,
|
...purchaseOrderVO,
|
||||||
orderDealer: {
|
orderDealer: {
|
||||||
...orderDealer,
|
...orderDealer,
|
||||||
costDifference: newValue,
|
costDifference: newValue,
|
||||||
profitSharing: calculator.getShareProfit(),
|
profitSharing: profitSharing,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
readOnly={readOnly || !orderDealer?.shareAdjusted}
|
readOnly={readOnly || !orderDealer?.shareAdjusted}
|
||||||
label={orderDealer?.shareAdjusted ? "调分成金额" : "分成金额"}
|
label={orderDealer?.shareAdjusted ? "调分成金额" : "分成金额"}
|
||||||
unit="元"
|
unit="元"
|
||||||
hint="点击金额可直接编辑"
|
hint=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View className="flex flex-1 flex-col gap-2 pl-4">
|
<View className="flex flex-1 flex-col gap-2 pl-4">
|
||||||
@ -49,15 +89,66 @@ export default function CostDifferenceSection(props: {
|
|||||||
</View>
|
</View>
|
||||||
<View className="flex items-center justify-between">
|
<View className="flex items-center justify-between">
|
||||||
<Text className="text-primary text-2xl font-bold text-nowrap">
|
<Text className="text-primary text-2xl font-bold text-nowrap">
|
||||||
¥{" "}
|
¥ {profitSharing}
|
||||||
{formatCurrency(
|
|
||||||
orderDealer.profitSharing || calculator.getShareProfit() || 0,
|
|
||||||
)}
|
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* 分成弹窗 */}
|
||||||
|
<Popup
|
||||||
|
duration={150}
|
||||||
|
style={{
|
||||||
|
minHeight: "auto",
|
||||||
|
}}
|
||||||
|
visible={visible}
|
||||||
|
className={"flex flex-col"}
|
||||||
|
position="bottom"
|
||||||
|
title={"调分成金额"}
|
||||||
|
onClose={() => setVisible(false)}
|
||||||
|
onOverlayClick={() => {
|
||||||
|
setVisible(false);
|
||||||
|
}}
|
||||||
|
lockScroll
|
||||||
|
>
|
||||||
|
<View className={"flex flex-col gap-3 p-2.5"}>
|
||||||
|
<View className={"text-neutral-darkest text-sm font-medium"}>
|
||||||
|
调分成金额
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
className={
|
||||||
|
"border-neutral-base flex flex-row items-center rounded-md border border-solid"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
size={"large"}
|
||||||
|
block
|
||||||
|
type="primary"
|
||||||
|
onClick={saveCostDifference}
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className={"flex w-full flex-col bg-white"}>
|
||||||
|
<View className={"flex flex-row gap-2 p-3"}>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button
|
||||||
|
size={"large"}
|
||||||
|
block
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setVisible(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<SafeArea position={"bottom"} />
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { View } from "@tarojs/components";
|
|||||||
import { DealerPicker, Icon } from "@/components";
|
import { DealerPicker, Icon } from "@/components";
|
||||||
import { Button } from "@nutui/nutui-react-taro";
|
import { Button } from "@nutui/nutui-react-taro";
|
||||||
|
|
||||||
export default function DealerInfoSection(props: {
|
export default function (props: {
|
||||||
purchaseOrderVO: BusinessAPI.PurchaseOrderVO;
|
purchaseOrderVO: BusinessAPI.PurchaseOrderVO;
|
||||||
onChange?: (orderDealer: BusinessAPI.PurchaseOrderVO) => void;
|
onChange?: (orderDealer: BusinessAPI.PurchaseOrderVO) => void;
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
@ -82,7 +82,7 @@ export default function DealerInfoSection(props: {
|
|||||||
fill="outline"
|
fill="outline"
|
||||||
block
|
block
|
||||||
>
|
>
|
||||||
{orderDealer ? "修改下游经销商" : "选择下游经销商"}
|
{orderDealer ? "修改经销商" : "选择经销商"}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,81 +0,0 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
import { View } from "@tarojs/components";
|
|
||||||
import { DeliveryStep1Form } from "@/components";
|
|
||||||
import {
|
|
||||||
convertPurchaseOrderToShipOrder,
|
|
||||||
convertShipOrderVOToExamplesFormat,
|
|
||||||
} from "@/utils";
|
|
||||||
import { business } from "@/services";
|
|
||||||
|
|
||||||
export default function DeliveryFormSection(props: {
|
|
||||||
purchaseOrderVO: BusinessAPI.PurchaseOrderVO;
|
|
||||||
onChange?: (orderDealer: BusinessAPI.PurchaseOrderVO) => void;
|
|
||||||
readOnly?: boolean;
|
|
||||||
}) {
|
|
||||||
const { purchaseOrderVO, onChange, readOnly } = props;
|
|
||||||
const [moduleList, setModuleList] = useState<any[]>([]);
|
|
||||||
|
|
||||||
const shipOrderVO =
|
|
||||||
purchaseOrderVO.shipOrderVOList &&
|
|
||||||
purchaseOrderVO.shipOrderVOList.length > 0
|
|
||||||
? purchaseOrderVO.shipOrderVOList[0]
|
|
||||||
: convertPurchaseOrderToShipOrder(purchaseOrderVO);
|
|
||||||
|
|
||||||
const init = async (shipOrderVO: BusinessAPI.ShipOrderVO) => {
|
|
||||||
const { data } = await business.dealer.showDealer({
|
|
||||||
dealerShowQry: {
|
|
||||||
dealerId: shipOrderVO.dealerId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (data.data?.deliveryTemplate!) {
|
|
||||||
const template = JSON.parse(data.data?.deliveryTemplate!);
|
|
||||||
// 将 shipOrderVO 转换为 examples 的数据格式,然后再替换 moduleList 里面的 config 数据
|
|
||||||
const convertedData = convertShipOrderVOToExamplesFormat(shipOrderVO);
|
|
||||||
const updatedTemplate = await updateTemplateConfig(
|
|
||||||
template,
|
|
||||||
convertedData,
|
|
||||||
);
|
|
||||||
console.log("updatedTemplate", updatedTemplate);
|
|
||||||
setModuleList(updatedTemplate);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
init(shipOrderVO);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// 更新模板配置
|
|
||||||
const updateTemplateConfig = async (template: any[], data: any) => {
|
|
||||||
let templateList: any[] = [];
|
|
||||||
template.map(async (module: any) => {
|
|
||||||
let newModule = { ...module };
|
|
||||||
if (data[module.type]) {
|
|
||||||
newModule.config = { ...module.config, ...data[module.type] };
|
|
||||||
}
|
|
||||||
templateList.push(newModule);
|
|
||||||
});
|
|
||||||
|
|
||||||
return templateList;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!shipOrderVO) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View className={"flex flex-col gap-2.5"}>
|
|
||||||
<DeliveryStep1Form
|
|
||||||
readOnly={readOnly}
|
|
||||||
moduleList={moduleList}
|
|
||||||
shipOrderVO={shipOrderVO}
|
|
||||||
setShipOrderVO={(shipOrderVO) => {
|
|
||||||
onChange?.({
|
|
||||||
...purchaseOrderVO,
|
|
||||||
shipOrderVOList: [shipOrderVO],
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Text, View } from "@tarojs/components";
|
import { Text, View } from "@tarojs/components";
|
||||||
|
import { Button, Popup, SafeArea } from "@nutui/nutui-react-taro";
|
||||||
import { PurchaseOrderCalculator } from "@/utils";
|
import { PurchaseOrderCalculator } from "@/utils";
|
||||||
import { PriceEditor } from "@/components";
|
import { PriceEditor } from "@/components";
|
||||||
|
|
||||||
@ -12,13 +13,21 @@ export default function ProductionLossSection(props: {
|
|||||||
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
||||||
const orderDealer = purchaseOrderVO.orderDealer;
|
const orderDealer = purchaseOrderVO.orderDealer;
|
||||||
|
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
// 主状态 - 用于显示在页面上的值
|
// 主状态 - 用于显示在页面上的值
|
||||||
const displayLossAmount =
|
const displayLossAmount =
|
||||||
orderDealer?.lossAmount || calculator.getDefaultLossAmount();
|
orderDealer?.lossAmount || calculator.getDefaultLossAmount();
|
||||||
|
|
||||||
|
// 临时状态 - 用于弹窗内编辑的值
|
||||||
|
const [tempLossAmount, setTempLossAmount] = useState<number>(
|
||||||
|
orderDealer?.lossAmount || 0,
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!orderDealer?.lossAmount) {
|
if (!orderDealer?.lossAmount) {
|
||||||
const defaultValue = calculator.getDefaultLossAmount();
|
const defaultValue = calculator.getDefaultLossAmount();
|
||||||
|
setTempLossAmount(defaultValue);
|
||||||
// 更新父组件的状态
|
// 更新父组件的状态
|
||||||
onChange?.({
|
onChange?.({
|
||||||
...purchaseOrderVO,
|
...purchaseOrderVO,
|
||||||
@ -30,6 +39,31 @@ export default function ProductionLossSection(props: {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 设置税费补贴默认值
|
||||||
|
const setDefaultLossAmount = () => {
|
||||||
|
const defaultValue = calculator.getDefaultLossAmount();
|
||||||
|
setTempLossAmount(defaultValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存税费补贴
|
||||||
|
const saveLossAmount = () => {
|
||||||
|
// 更新父组件的状态
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
lossAmount: tempLossAmount,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭弹窗时恢复临时值为显示值
|
||||||
|
const closePopup = () => {
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={"flex flex-col gap-2.5"}>
|
<View className={"flex flex-col gap-2.5"}>
|
||||||
{/* 卡片形式展示返点信息 */}
|
{/* 卡片形式展示返点信息 */}
|
||||||
@ -54,10 +88,74 @@ export default function ProductionLossSection(props: {
|
|||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
label="损耗金额"
|
label="损耗金额"
|
||||||
unit="元"
|
unit="元"
|
||||||
hint="点击金额可直接编辑"
|
hint=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<View className="flex flex-1 flex-col gap-2 pl-4">
|
||||||
|
<View className="flex items-center justify-between">
|
||||||
|
<Text className="text-sm text-gray-500">损耗金额</Text>
|
||||||
|
</View>
|
||||||
|
<View className="flex items-center justify-between">
|
||||||
|
<Text className="text-primary text-2xl font-bold text-nowrap">
|
||||||
|
¥
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* 产地损耗弹窗 */}
|
||||||
|
<Popup
|
||||||
|
duration={150}
|
||||||
|
style={{
|
||||||
|
minHeight: "auto",
|
||||||
|
}}
|
||||||
|
visible={visible}
|
||||||
|
className={"flex flex-col"}
|
||||||
|
position="bottom"
|
||||||
|
title={"编辑产地损耗金额"}
|
||||||
|
onClose={closePopup}
|
||||||
|
onOverlayClick={closePopup}
|
||||||
|
lockScroll
|
||||||
|
>
|
||||||
|
<View className={"flex flex-col gap-3 p-2.5"}>
|
||||||
|
<View className={"text-neutral-darkest text-sm font-medium"}>
|
||||||
|
产地损耗金额
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
className={
|
||||||
|
"border-neutral-base flex flex-row items-center rounded-md border border-solid"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button size="small" onClick={setDefaultLossAmount}>
|
||||||
|
填入默认值
|
||||||
|
</Button>
|
||||||
|
<View className="ml-2 self-center text-xs text-gray-500">
|
||||||
|
默认值: {orderDealer.lossAmount}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className={"flex w-full flex-col bg-white"}>
|
||||||
|
<View className={"flex flex-row gap-2 p-3"}>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button size={"large"} block type="default" onClick={closePopup}>
|
||||||
|
取消
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button
|
||||||
|
size={"large"}
|
||||||
|
block
|
||||||
|
type="primary"
|
||||||
|
onClick={saveLossAmount}
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<SafeArea position={"bottom"} />
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,7 +149,6 @@ export default function PurchaseCostInfoSection(props: {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Table
|
<Table
|
||||||
className={"table-sum"}
|
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
title: "项目",
|
title: "项目",
|
||||||
@ -280,23 +279,6 @@ export default function PurchaseCostInfoSection(props: {
|
|||||||
}, 0),
|
}, 0),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
project: "定金(元)",
|
|
||||||
icon: "money-bill",
|
|
||||||
...(purchaseOrderVO?.orderSupplierList.length > 0
|
|
||||||
? purchaseOrderVO?.orderSupplierList.reduce((acc, item) => {
|
|
||||||
acc[item.orderSupplierId] = formatCurrency(
|
|
||||||
Number(item.depositAmount),
|
|
||||||
);
|
|
||||||
return acc;
|
|
||||||
}, {})
|
|
||||||
: {}),
|
|
||||||
total: formatCurrency(
|
|
||||||
purchaseOrderVO?.orderSupplierList.reduce((sum, supplier) => {
|
|
||||||
return sum + (supplier.depositAmount || 0);
|
|
||||||
}, 0),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
project: "合计(元)",
|
project: "合计(元)",
|
||||||
icon: "money-bill",
|
icon: "money-bill",
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { ScrollView, Text, View } from "@tarojs/components";
|
import { ScrollView, Text, View } from "@tarojs/components";
|
||||||
import { Button, Input, Popup, SafeArea } from "@nutui/nutui-react-taro";
|
import { Button, Popup, SafeArea } from "@nutui/nutui-react-taro";
|
||||||
import { PurchaseOrderCalculator, validatePrice } from "@/utils";
|
import { PurchaseOrderCalculator } from "@/utils";
|
||||||
import { business } from "@/services";
|
import { business } from "@/services";
|
||||||
|
import { PriceEditor } from "@/components";
|
||||||
|
|
||||||
export default function RebateCalcSection(props: {
|
export default function RebateCalcSection(props: {
|
||||||
purchaseOrderVO: BusinessAPI.PurchaseOrderVO;
|
purchaseOrderVO: BusinessAPI.PurchaseOrderVO;
|
||||||
@ -111,34 +112,33 @@ export default function RebateCalcSection(props: {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="flex">
|
<View className="flex">
|
||||||
{!readOnly ? (
|
<PriceEditor
|
||||||
<View
|
value={calculateRebateAmount(orderRebate)}
|
||||||
className="flex flex-1 flex-col"
|
onSave={(newValue) => {
|
||||||
onClick={() => setVisible(true)}
|
if (orderRebate.calcMethod === "FIXED_AMOUNT") {
|
||||||
>
|
const newOrderRebate = {
|
||||||
<View className="mb-2 flex items-center justify-between">
|
...orderRebate,
|
||||||
<Text className="text-sm text-gray-500">返点金额</Text>
|
amount: newValue,
|
||||||
<Text className="text-sm text-gray-500">元</Text>
|
};
|
||||||
</View>
|
|
||||||
<View className="relative flex flex-1 items-end">
|
const newPurchaseOrderVO = {
|
||||||
<Text className="w-full border-b-2 border-red-500 pb-2 text-3xl font-bold text-red-500 focus:outline-none">
|
...purchaseOrderVO,
|
||||||
{calculateRebateAmount(orderRebate).toFixed(2) || "0"}
|
rebate: true,
|
||||||
</Text>
|
orderRebate: newOrderRebate,
|
||||||
</View>
|
};
|
||||||
</View>
|
|
||||||
) : (
|
setOrderRebate(newOrderRebate);
|
||||||
<View className="flex flex-1 flex-col">
|
onChange?.(newPurchaseOrderVO);
|
||||||
<View className="mb-2 flex items-center justify-between">
|
} else {
|
||||||
<Text className="text-sm text-gray-500">返点金额</Text>
|
// 对于按净重计算的情况,不能直接修改金额,需要通过单价或净重调整
|
||||||
<Text className="text-sm text-gray-500">元</Text>
|
setVisible(true);
|
||||||
</View>
|
}
|
||||||
<View className="relative flex flex-1 items-end">
|
}}
|
||||||
<Text className="w-full py-2 text-3xl font-bold text-red-500">
|
readOnly={readOnly}
|
||||||
{calculateRebateAmount(orderRebate).toFixed(2) || "0"}
|
label="返点金额"
|
||||||
</Text>
|
unit="元"
|
||||||
</View>
|
hint=""
|
||||||
</View>
|
/>
|
||||||
)}
|
|
||||||
|
|
||||||
<View className="flex flex-1 flex-col gap-2 pl-4">
|
<View className="flex flex-1 flex-col gap-2 pl-4">
|
||||||
<View className="flex items-center justify-between">
|
<View className="flex items-center justify-between">
|
||||||
@ -239,33 +239,14 @@ export default function RebateCalcSection(props: {
|
|||||||
单价(元/斤)
|
单价(元/斤)
|
||||||
</View>
|
</View>
|
||||||
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
||||||
<Input
|
<Button
|
||||||
className="placeholder:text-neutral-dark flex-1"
|
size="large"
|
||||||
placeholder="请输入单价"
|
block
|
||||||
type="digit"
|
type="primary"
|
||||||
value={tempOrderRebate.unitPrice?.toString() || ""}
|
onClick={handleSave}
|
||||||
onChange={(value) => {
|
>
|
||||||
const numValue = validatePrice(value);
|
保存
|
||||||
if (numValue !== undefined) {
|
</Button>
|
||||||
handleRebateChange("unitPrice", numValue);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<View className="mr-2">元/斤</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className="flex items-center justify-between rounded-md bg-gray-100 p-3">
|
|
||||||
<View className="text-neutral-darkest text-sm font-medium">
|
|
||||||
返点金额
|
|
||||||
</View>
|
|
||||||
<View className="text-neutral-darkest text-sm font-medium">
|
|
||||||
{tempOrderRebate.netWeight && tempOrderRebate.unitPrice
|
|
||||||
? (
|
|
||||||
tempOrderRebate.netWeight * tempOrderRebate.unitPrice
|
|
||||||
).toFixed(2)
|
|
||||||
: "0.00"}{" "}
|
|
||||||
元
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@ -274,21 +255,15 @@ export default function RebateCalcSection(props: {
|
|||||||
<View className="text-neutral-darkest text-sm font-medium">
|
<View className="text-neutral-darkest text-sm font-medium">
|
||||||
返点金额(元)
|
返点金额(元)
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
||||||
<Input
|
<Button
|
||||||
className="placeholder:text-neutral-dark flex-1"
|
size="large"
|
||||||
placeholder="请输入返点金额"
|
block
|
||||||
type="digit"
|
type="primary"
|
||||||
value={tempOrderRebate.amount?.toString() || ""}
|
onClick={handleSave}
|
||||||
onChange={(value) => {
|
>
|
||||||
const numValue = validatePrice(value);
|
保存
|
||||||
if (numValue !== undefined) {
|
</Button>
|
||||||
handleRebateChange("amount", numValue);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<View className="mr-2">元</View>
|
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@ -306,11 +281,6 @@ export default function RebateCalcSection(props: {
|
|||||||
取消
|
取消
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex-1">
|
|
||||||
<Button size="large" block type="primary" onClick={handleSave}>
|
|
||||||
保存
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
import { Text, View } from "@tarojs/components";
|
import { Text, View } from "@tarojs/components";
|
||||||
|
import { Button, Popup, SafeArea } from "@nutui/nutui-react-taro";
|
||||||
import { PurchaseOrderCalculator } from "@/utils";
|
import { PurchaseOrderCalculator } from "@/utils";
|
||||||
import { PriceEditor } from "@/components";
|
import { PriceEditor } from "@/components";
|
||||||
|
|
||||||
@ -11,6 +13,56 @@ export default function TaxProvisionSection(props: {
|
|||||||
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
||||||
const orderDealer = purchaseOrderVO.orderDealer;
|
const orderDealer = purchaseOrderVO.orderDealer;
|
||||||
|
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
const displayTaxProvision =
|
||||||
|
orderDealer.taxProvision || calculator.getDefaultTaxProvision();
|
||||||
|
|
||||||
|
// 临时状态 - 用于弹窗内编辑的值
|
||||||
|
const [tempTaxProvision, setTempTaxProvision] = useState<number>(
|
||||||
|
orderDealer?.taxProvision || 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!orderDealer?.taxProvision) {
|
||||||
|
const defaultValue = calculator.getDefaultTaxProvision();
|
||||||
|
setTempTaxProvision(defaultValue);
|
||||||
|
// 更新父组件的状态
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
taxProvision: defaultValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 设置计提税金默认值
|
||||||
|
const setDefaultTaxProvision = () => {
|
||||||
|
const defaultValue = calculator.getDefaultTaxProvision();
|
||||||
|
setTempTaxProvision(defaultValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存计提税金
|
||||||
|
const saveTaxProvision = () => {
|
||||||
|
// 更新父组件的状态
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
taxProvision: tempTaxProvision,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭弹窗时恢复临时值为显示值
|
||||||
|
const closePopup = () => {
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={"flex flex-col gap-2.5"}>
|
<View className={"flex flex-col gap-2.5"}>
|
||||||
{/* 卡片形式展示计提税金信息 */}
|
{/* 卡片形式展示计提税金信息 */}
|
||||||
@ -21,12 +73,7 @@ export default function TaxProvisionSection(props: {
|
|||||||
|
|
||||||
<View className="flex">
|
<View className="flex">
|
||||||
<PriceEditor
|
<PriceEditor
|
||||||
value={
|
value={displayTaxProvision}
|
||||||
orderDealer.taxProvision === null ||
|
|
||||||
orderDealer.taxProvision === undefined
|
|
||||||
? calculator.getDefaultTaxProvision()
|
|
||||||
: orderDealer.taxProvision
|
|
||||||
}
|
|
||||||
onSave={(newValue) => {
|
onSave={(newValue) => {
|
||||||
// 更新父组件的状态
|
// 更新父组件的状态
|
||||||
onChange?.({
|
onChange?.({
|
||||||
@ -40,7 +87,7 @@ export default function TaxProvisionSection(props: {
|
|||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
label="计提金额"
|
label="计提金额"
|
||||||
unit="元"
|
unit="元"
|
||||||
hint="点击金额可直接编辑"
|
hint=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View className="flex flex-1 flex-col gap-2 pl-4">
|
<View className="flex flex-1 flex-col gap-2 pl-4">
|
||||||
@ -55,6 +102,60 @@ export default function TaxProvisionSection(props: {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* 计提税金弹窗 */}
|
||||||
|
<Popup
|
||||||
|
duration={150}
|
||||||
|
style={{
|
||||||
|
minHeight: "auto",
|
||||||
|
}}
|
||||||
|
visible={visible}
|
||||||
|
className={"flex flex-col"}
|
||||||
|
position="bottom"
|
||||||
|
title={"编辑计提税金"}
|
||||||
|
onClose={closePopup}
|
||||||
|
onOverlayClick={closePopup}
|
||||||
|
lockScroll
|
||||||
|
>
|
||||||
|
<View className={"flex flex-col gap-3 p-2.5"}>
|
||||||
|
<View className={"text-neutral-darkest text-sm font-medium"}>
|
||||||
|
计提税金金额
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
className={
|
||||||
|
"border-neutral-base flex flex-row items-center rounded-md border border-solid"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button size="small" onClick={setDefaultTaxProvision}>
|
||||||
|
按公式填入默认值
|
||||||
|
</Button>
|
||||||
|
<View className="ml-2 self-center text-xs text-gray-500">
|
||||||
|
默认值: (市场报价 - 税费补贴) ×{" "}
|
||||||
|
{orderDealer.accrualTaxRatio || "未设置"}%
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className={"flex w-full flex-col bg-white"}>
|
||||||
|
<View className={"flex flex-row gap-2 p-3"}>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button size={"large"} block type="default" onClick={closePopup}>
|
||||||
|
取消
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button
|
||||||
|
size={"large"}
|
||||||
|
block
|
||||||
|
type="primary"
|
||||||
|
onClick={saveTaxProvision}
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<SafeArea position={"bottom"} />
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
import { Text, View } from "@tarojs/components";
|
import { Text, View } from "@tarojs/components";
|
||||||
|
import { Button, Popup, SafeArea } from "@nutui/nutui-react-taro";
|
||||||
import { PurchaseOrderCalculator } from "@/utils";
|
import { PurchaseOrderCalculator } from "@/utils";
|
||||||
import { PriceEditor } from "@/components";
|
import { PriceEditor } from "@/components";
|
||||||
|
|
||||||
@ -11,6 +13,57 @@ export default function TaxSubsidySection(props: {
|
|||||||
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
const { purchaseOrderVO, onChange, readOnly, calculator } = props;
|
||||||
const orderDealer = purchaseOrderVO.orderDealer;
|
const orderDealer = purchaseOrderVO.orderDealer;
|
||||||
|
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
// 主状态 - 用于显示在页面上的值
|
||||||
|
const displayTaxSubsidy =
|
||||||
|
orderDealer?.taxSubsidy || calculator.getDefaultTaxSubsidy();
|
||||||
|
|
||||||
|
// 临时状态 - 用于弹窗内编辑的值
|
||||||
|
const [tempTaxSubsidy, setTempTaxSubsidy] = useState<number>(
|
||||||
|
orderDealer?.taxSubsidy || 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!orderDealer?.taxSubsidy) {
|
||||||
|
const defaultValue = calculator.getDefaultTaxSubsidy();
|
||||||
|
setTempTaxSubsidy(defaultValue);
|
||||||
|
// 更新父组件的状态
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
taxSubsidy: defaultValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 设置税费补贴默认值
|
||||||
|
const setDefaultTaxSubsidy = () => {
|
||||||
|
const defaultValue = calculator.getDefaultTaxSubsidy();
|
||||||
|
setTempTaxSubsidy(defaultValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存税费补贴
|
||||||
|
const saveTaxSubsidy = () => {
|
||||||
|
// 更新父组件的状态
|
||||||
|
onChange?.({
|
||||||
|
...purchaseOrderVO,
|
||||||
|
orderDealer: {
|
||||||
|
...orderDealer,
|
||||||
|
taxSubsidy: tempTaxSubsidy,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭弹窗时恢复临时值为显示值
|
||||||
|
const closePopup = () => {
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={"flex flex-col gap-2.5"}>
|
<View className={"flex flex-col gap-2.5"}>
|
||||||
{/* 卡片形式展示返点信息 */}
|
{/* 卡片形式展示返点信息 */}
|
||||||
@ -21,12 +74,7 @@ export default function TaxSubsidySection(props: {
|
|||||||
|
|
||||||
<View className="flex">
|
<View className="flex">
|
||||||
<PriceEditor
|
<PriceEditor
|
||||||
value={
|
value={displayTaxSubsidy}
|
||||||
orderDealer.taxSubsidy === null ||
|
|
||||||
orderDealer.taxSubsidy === undefined
|
|
||||||
? calculator.getDefaultTaxSubsidy()
|
|
||||||
: orderDealer.taxSubsidy
|
|
||||||
}
|
|
||||||
onSave={(newValue) => {
|
onSave={(newValue) => {
|
||||||
// 更新父组件的状态
|
// 更新父组件的状态
|
||||||
onChange?.({
|
onChange?.({
|
||||||
@ -40,7 +88,7 @@ export default function TaxSubsidySection(props: {
|
|||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
label="返点金额"
|
label="返点金额"
|
||||||
unit="元"
|
unit="元"
|
||||||
hint="点击金额可直接编辑"
|
hint=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View className="flex flex-1 flex-col gap-2 pl-4">
|
<View className="flex flex-1 flex-col gap-2 pl-4">
|
||||||
@ -55,6 +103,59 @@ export default function TaxSubsidySection(props: {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* 税费补贴弹窗 */}
|
||||||
|
<Popup
|
||||||
|
duration={150}
|
||||||
|
style={{
|
||||||
|
minHeight: "auto",
|
||||||
|
}}
|
||||||
|
visible={visible}
|
||||||
|
className={"flex flex-col"}
|
||||||
|
position="bottom"
|
||||||
|
title={"编辑税费补贴"}
|
||||||
|
onClose={closePopup}
|
||||||
|
onOverlayClick={closePopup}
|
||||||
|
lockScroll
|
||||||
|
>
|
||||||
|
<View className={"flex flex-col gap-3 p-2.5"}>
|
||||||
|
<View className={"text-neutral-darkest text-sm font-medium"}>
|
||||||
|
税费补贴金额
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
className={
|
||||||
|
"border-neutral-base flex flex-row items-center rounded-md border border-solid"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button size="small" onClick={setDefaultTaxSubsidy}>
|
||||||
|
按公式填入默认值
|
||||||
|
</Button>
|
||||||
|
<View className="ml-2 self-center text-xs text-gray-500">
|
||||||
|
默认值: 市场报价 × {orderDealer.companyRebateRatio || "未设置"}%
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className={"flex w-full flex-col bg-white"}>
|
||||||
|
<View className={"flex flex-row gap-2 p-3"}>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button size={"large"} block type="default" onClick={closePopup}>
|
||||||
|
取消
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View className={"flex-1"}>
|
||||||
|
<Button
|
||||||
|
size={"large"}
|
||||||
|
block
|
||||||
|
type="primary"
|
||||||
|
onClick={saveTaxSubsidy}
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<SafeArea position={"bottom"} />
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
// App 相关常量
|
// App 相关常量
|
||||||
export const APP_VERSION = "v0.0.28";
|
export const APP_VERSION = "v0.0.26";
|
||||||
|
|||||||
@ -7,11 +7,8 @@ import shipOrder from "@/constant/shipOrder";
|
|||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { business, poster } from "@/services";
|
import { business, poster } from "@/services";
|
||||||
import {
|
import dayjs from "dayjs";
|
||||||
buildUrl,
|
import { buildUrl, PdfTemplate } from "@/utils";
|
||||||
convertShipOrderVOToExamplesFormat,
|
|
||||||
PdfTemplate,
|
|
||||||
} from "@/utils";
|
|
||||||
import {
|
import {
|
||||||
DeliveryStep1Form,
|
DeliveryStep1Form,
|
||||||
DeliveryStep1FormRef,
|
DeliveryStep1FormRef,
|
||||||
@ -32,7 +29,7 @@ const updateOtherFeesModule = async (
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const costItems =
|
const costItems =
|
||||||
data?.filter((item) => item.type !== "ARTIFICIAL_TYPE") || [];
|
data?.filter((item) => item.costType !== "HUMAN_COST") || [];
|
||||||
|
|
||||||
console.log("module", module);
|
console.log("module", module);
|
||||||
|
|
||||||
@ -41,7 +38,7 @@ const updateOtherFeesModule = async (
|
|||||||
config: {
|
config: {
|
||||||
...module.config,
|
...module.config,
|
||||||
feeItems: shipOrderVO.orderCostList?.filter(
|
feeItems: shipOrderVO.orderCostList?.filter(
|
||||||
(item) => item.type !== "ARTIFICIAL_TYPE",
|
(item) => item.costType !== "HUMAN_COST",
|
||||||
),
|
),
|
||||||
feeLabels: costItems.reduce((acc: any, item: any) => {
|
feeLabels: costItems.reduce((acc: any, item: any) => {
|
||||||
acc[item.itemId] = item.name;
|
acc[item.itemId] = item.name;
|
||||||
@ -137,6 +134,76 @@ export default hocAuth(function Page(props: CommonComponent) {
|
|||||||
}
|
}
|
||||||
}, [shipOrderVO, deliveryTemplate]);
|
}, [shipOrderVO, deliveryTemplate]);
|
||||||
|
|
||||||
|
// 将 shipOrderVO 转换为 examples 的数据格式
|
||||||
|
const convertShipOrderVOToExamplesFormat = (
|
||||||
|
shipOrderVO: BusinessAPI.ShipOrderVO,
|
||||||
|
) => {
|
||||||
|
return {
|
||||||
|
title: {
|
||||||
|
title: "西瓜发货清单",
|
||||||
|
},
|
||||||
|
dealerInfo: {
|
||||||
|
dealerName: shipOrderVO.dealerName || "",
|
||||||
|
vehicleNumber: `第 ${shipOrderVO.vehicleNo || ""} 车`,
|
||||||
|
destination: shipOrderVO.receivingAddress || "",
|
||||||
|
watermelonGrade: shipOrderVO.watermelonGrade || "",
|
||||||
|
},
|
||||||
|
shippingInfo: {
|
||||||
|
shippingFrom: shipOrderVO.shippingAddress || "",
|
||||||
|
date: shipOrderVO.shippingDate || "",
|
||||||
|
},
|
||||||
|
weightInfo: {
|
||||||
|
data: shipOrderVO.shipOrderItemList,
|
||||||
|
accountCompany: shipOrderVO.companyName || "",
|
||||||
|
sumAmount:
|
||||||
|
shipOrderVO.shipOrderItemList?.reduce(
|
||||||
|
(acc, item) => acc + item?.totalAmount!,
|
||||||
|
0,
|
||||||
|
) || "",
|
||||||
|
},
|
||||||
|
packingSpec: {
|
||||||
|
data:
|
||||||
|
shipOrderVO.shipOrderPackageList?.map((item) => ({
|
||||||
|
boxSpecId: item.boxSpecId || "",
|
||||||
|
boxSpecName: item.boxSpecName || "",
|
||||||
|
boxType: item.boxProduct || "",
|
||||||
|
quantity: item.quantity?.toString() || "",
|
||||||
|
unitPrice: item.unitPrice?.toString() || "",
|
||||||
|
amount: item.itemAmount?.toString() || "",
|
||||||
|
unitWeight: item.singleWeight?.toString() || "",
|
||||||
|
weight: item.totalWeight?.toString() || "",
|
||||||
|
})) || [],
|
||||||
|
},
|
||||||
|
vehicleInfo: {
|
||||||
|
driverPhone: shipOrderVO?.driverPhone || "",
|
||||||
|
licensePlate: shipOrderVO.licensePlate || "",
|
||||||
|
estimatedArrivalTime: shipOrderVO.estimatedArrivalDate
|
||||||
|
? dayjs(shipOrderVO?.estimatedArrivalDate).format("YYYY年MM月DD日")
|
||||||
|
: "",
|
||||||
|
freightDebt: shipOrderVO.freightDebt?.toString() || "",
|
||||||
|
strawMatDebt: shipOrderVO.strawMatDebt?.toString() || "",
|
||||||
|
remarks: shipOrderVO.remark || "",
|
||||||
|
},
|
||||||
|
otherFees: {},
|
||||||
|
totalAmount: {
|
||||||
|
amount: shipOrderVO.totalAmount?.toString() || "",
|
||||||
|
farmer: shipOrderVO.farmerInfo || "",
|
||||||
|
},
|
||||||
|
otherInfo: {
|
||||||
|
data: shipOrderVO.shipOrderItemList,
|
||||||
|
driverPhone: shipOrderVO?.driverPhone || "",
|
||||||
|
licensePlate: shipOrderVO.licensePlate || "",
|
||||||
|
accountCompany: shipOrderVO.companyName || "",
|
||||||
|
vehicleNumber: `第 ${shipOrderVO.vehicleNo || ""} 车`,
|
||||||
|
destination: shipOrderVO.receivingAddress || "",
|
||||||
|
shippingFrom: shipOrderVO.shippingAddress || "",
|
||||||
|
estimatedArrivalTime: shipOrderVO.estimatedArrivalDate
|
||||||
|
? dayjs(shipOrderVO?.estimatedArrivalDate).format("YYYY年MM月DD日")
|
||||||
|
: "1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// 更新模板配置
|
// 更新模板配置
|
||||||
const updateTemplateConfig = async (
|
const updateTemplateConfig = async (
|
||||||
template: any[],
|
template: any[],
|
||||||
@ -357,14 +424,12 @@ export default hocAuth(function Page(props: CommonComponent) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{step === 1 && (
|
{step === 1 && (
|
||||||
<View className="flex flex-col rounded-lg bg-white p-2.5 shadow-md">
|
<DeliveryStep1Form
|
||||||
<DeliveryStep1Form
|
ref={step1FormRef}
|
||||||
ref={step1FormRef}
|
moduleList={moduleList}
|
||||||
moduleList={moduleList}
|
shipOrderVO={shipOrderVO}
|
||||||
shipOrderVO={shipOrderVO}
|
setShipOrderVO={setShipOrderVO}
|
||||||
setShipOrderVO={setShipOrderVO}
|
/>
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{step === 2 && <DeliveryStep2Preview moduleList={moduleList} />}
|
{step === 2 && <DeliveryStep2Preview moduleList={moduleList} />}
|
||||||
|
|||||||
@ -27,17 +27,14 @@ import {
|
|||||||
PackageInfoSection,
|
PackageInfoSection,
|
||||||
PackagingCostSection,
|
PackagingCostSection,
|
||||||
ProductionAdvanceSection,
|
ProductionAdvanceSection,
|
||||||
PurchaseCostInfoSection,
|
|
||||||
RebateCalcSection,
|
RebateCalcSection,
|
||||||
State,
|
State,
|
||||||
TaxProvisionSection,
|
TaxProvisionSection,
|
||||||
TaxSubsidySection,
|
TaxSubsidySection,
|
||||||
WorkerAdvanceSection,
|
WorkerAdvanceSection,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { buildUrl, formatCurrency, PurchaseOrderCalculator } from "@/utils";
|
import { buildUrl, PurchaseOrderCalculator } from "@/utils";
|
||||||
import ProductionLossSection from "../../../components/purchase/section/ProductionLossSection";
|
import ProductionLossSection from "../../../components/purchase/section/ProductionLossSection";
|
||||||
import DeliveryFormSection from "../../../components/purchase/section/DeliveryFormSection";
|
|
||||||
import classNames from "classnames";
|
|
||||||
|
|
||||||
const sections = {
|
const sections = {
|
||||||
// 市场报价
|
// 市场报价
|
||||||
@ -65,11 +62,11 @@ const sections = {
|
|||||||
// component: SupplierInfoSection,
|
// component: SupplierInfoSection,
|
||||||
// title: "瓜农信息",
|
// title: "瓜农信息",
|
||||||
// },
|
// },
|
||||||
// 采购成本
|
// // 采购成本
|
||||||
purchaseCostInfo: {
|
// purchaseCostInfo: {
|
||||||
component: PurchaseCostInfoSection,
|
// component: PurchaseCostInfoSection,
|
||||||
title: "采购成本复核",
|
// title: "采购成本",
|
||||||
},
|
// },
|
||||||
// 包装纸箱费
|
// 包装纸箱费
|
||||||
packageInfo: {
|
packageInfo: {
|
||||||
component: PackageInfoSection,
|
component: PackageInfoSection,
|
||||||
@ -130,11 +127,6 @@ const sections = {
|
|||||||
component: RebateCalcSection,
|
component: RebateCalcSection,
|
||||||
title: "个人返点复核",
|
title: "个人返点复核",
|
||||||
},
|
},
|
||||||
// 发货单复核
|
|
||||||
deliveryForm: {
|
|
||||||
component: DeliveryFormSection,
|
|
||||||
title: "发货单复核",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default hocAuth(function Page(props: CommonComponent) {
|
export default hocAuth(function Page(props: CommonComponent) {
|
||||||
@ -536,14 +528,19 @@ export default hocAuth(function Page(props: CommonComponent) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View className={"flex-1 text-center"}>个人利润</View>
|
<View className={"flex-1 text-center"}>个人利润</View>
|
||||||
<View
|
{personalProfit > 0 ? (
|
||||||
className={classNames("flex-1 text-left text-2xl font-bold", {
|
<View
|
||||||
"text-primary": personalProfit > 0,
|
className={"text-primary flex-1 text-left text-2xl font-bold"}
|
||||||
"text-red-500": personalProfit < 0,
|
>
|
||||||
})}
|
¥ {personalProfit || "-"}
|
||||||
>
|
</View>
|
||||||
¥ {formatCurrency(personalProfit) || "-"}
|
) : (
|
||||||
</View>
|
<View
|
||||||
|
className={"flex-1 text-left text-2xl font-bold text-red-500"}
|
||||||
|
>
|
||||||
|
¥ {personalProfit || "-"}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -422,24 +422,19 @@ export default hocAuth(function Page(props: CommonComponent) {
|
|||||||
purchaseOrder?.orderSupplierList[
|
purchaseOrder?.orderSupplierList[
|
||||||
purchaseOrder?.orderSupplierList.length - 1
|
purchaseOrder?.orderSupplierList.length - 1
|
||||||
]?.isLast && (
|
]?.isLast && (
|
||||||
<View className="flex flex-1 flex-col gap-2.5 bg-[#D1D5DB] p-2.5 pt-2.5">
|
<Button
|
||||||
<View className={"flex flex-1 flex-col gap-2.5"}>
|
icon={<Icon name={"plus"} size={20} />}
|
||||||
<View className="text-sm font-bold">快捷操作</View>
|
type={"primary"}
|
||||||
<Button
|
size={"xlarge"}
|
||||||
icon={<Icon name={"plus"} size={20} />}
|
fill={"outline"}
|
||||||
type={"primary"}
|
block
|
||||||
size={"xlarge"}
|
className="border-primary text-primary flex w-full items-center justify-center !border-4 !bg-white"
|
||||||
fill={"outline"}
|
onClick={() => {
|
||||||
block
|
orderOptionRef.current?.onAdd();
|
||||||
className="border-primary text-primary flex w-full items-center justify-center !border-4 !bg-white"
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
orderOptionRef.current?.onAdd();
|
<View>添加另一个瓜农</View>
|
||||||
}}
|
</Button>
|
||||||
>
|
|
||||||
<View>添加另一个瓜农</View>
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
@ -3924,8 +3924,6 @@ declare namespace BusinessAPI {
|
|||||||
orderPackageList: OrderPackage[];
|
orderPackageList: OrderPackage[];
|
||||||
/** 采购订单项目信息 */
|
/** 采购订单项目信息 */
|
||||||
orderCostItemList: OrderCostItem[];
|
orderCostItemList: OrderCostItem[];
|
||||||
/** 发货单信息 */
|
|
||||||
shipOrderVOList: ShipOrderVO[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type PurchaseOrderWithdrawReviewCmd = {
|
type PurchaseOrderWithdrawReviewCmd = {
|
||||||
@ -4266,7 +4264,7 @@ declare namespace BusinessAPI {
|
|||||||
/** 发货单ID */
|
/** 发货单ID */
|
||||||
shipOrderId: string;
|
shipOrderId: string;
|
||||||
/** 箱型ID */
|
/** 箱型ID */
|
||||||
boxSpecId?: string;
|
boxSpecId?: number;
|
||||||
/** 箱型 */
|
/** 箱型 */
|
||||||
boxSpecName?: string;
|
boxSpecName?: string;
|
||||||
/** 箱号 */
|
/** 箱号 */
|
||||||
|
|||||||
@ -8,7 +8,4 @@
|
|||||||
export {
|
export {
|
||||||
convertBoxBrandToOrderPackages,
|
convertBoxBrandToOrderPackages,
|
||||||
convertOrderPackagesToBoxBrands
|
convertOrderPackagesToBoxBrands
|
||||||
} from './boxBrandConverter'
|
} from './boxBrandConverter'
|
||||||
|
|
||||||
export { convertPurchaseOrderToShipOrder } from './purchaseOrderConverter'
|
|
||||||
export { convertShipOrderVOToExamplesFormat } from './shipOrderConverter'
|
|
||||||
@ -1,139 +0,0 @@
|
|||||||
// 将PurchaseOrderVO转换为ShipOrderVO
|
|
||||||
import { generateShortId } from "@/utils";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将PurchaseOrderVO转换为ShipOrderVO
|
|
||||||
* @param purchaseOrderVO 采购订单对象
|
|
||||||
* @returns 发货单对象
|
|
||||||
*/
|
|
||||||
export const convertPurchaseOrderToShipOrder = (
|
|
||||||
purchaseOrderVO: BusinessAPI.PurchaseOrderVO
|
|
||||||
): BusinessAPI.ShipOrderVO => {
|
|
||||||
// 添加一个辅助函数用于分组
|
|
||||||
const groupBy = <T>(
|
|
||||||
array: T[],
|
|
||||||
keyFn: (item: T) => string,
|
|
||||||
): Record<string, T[]> => {
|
|
||||||
return array.reduce(
|
|
||||||
(groups, item) => {
|
|
||||||
const key = keyFn(item);
|
|
||||||
if (!groups[key]) {
|
|
||||||
groups[key] = [];
|
|
||||||
}
|
|
||||||
groups[key].push(item);
|
|
||||||
return groups;
|
|
||||||
},
|
|
||||||
{} as Record<string, T[]>,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 转换供应商列表为发货单项列表,根据 purchasePrice 分组
|
|
||||||
const suppliersByPrice = groupBy(
|
|
||||||
purchaseOrderVO.orderSupplierList || [],
|
|
||||||
(supplier) => String(supplier.purchasePrice)
|
|
||||||
);
|
|
||||||
|
|
||||||
const shipOrderItemList: BusinessAPI.ShipOrderItem[] = Object.entries(suppliersByPrice).map(
|
|
||||||
([price, suppliers]) => {
|
|
||||||
// 计算该价格下的总毛重、总净重等
|
|
||||||
const totalGrossWeight = suppliers.reduce(
|
|
||||||
(sum, supplier) => sum + (supplier.grossWeight || 0), 0
|
|
||||||
);
|
|
||||||
|
|
||||||
const totalNetWeight = suppliers.reduce(
|
|
||||||
(sum, supplier) => sum + (supplier.netWeight || 0), 0
|
|
||||||
);
|
|
||||||
|
|
||||||
const totalBoxWeight = suppliers.reduce(
|
|
||||||
(sum, supplier) => {
|
|
||||||
if (supplier.totalWeight && supplier.netWeight) {
|
|
||||||
return sum + (supplier.totalWeight - supplier.netWeight);
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}, 0
|
|
||||||
);
|
|
||||||
|
|
||||||
const totalAmount = suppliers.reduce(
|
|
||||||
(sum, supplier) => sum + (supplier.invoiceAmount || 0), 0
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
itemId: generateShortId(),
|
|
||||||
shipOrderId: "", // 将在创建发货单时填充
|
|
||||||
grossWeight: totalGrossWeight,
|
|
||||||
boxWeight: totalBoxWeight,
|
|
||||||
netWeight: totalNetWeight,
|
|
||||||
unitPrice: parseFloat(price),
|
|
||||||
totalAmount: totalAmount,
|
|
||||||
watermelonGrade: "", // 需要手动填写
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// 转换包装信息,根据 boxSpecId 分组
|
|
||||||
const allPackages: BusinessAPI.OrderPackage[] = [];
|
|
||||||
purchaseOrderVO.orderSupplierList?.forEach(supplier => {
|
|
||||||
if (supplier.orderPackageList) {
|
|
||||||
allPackages.push(...supplier.orderPackageList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const packagesBySpec = groupBy(
|
|
||||||
allPackages,
|
|
||||||
(pkg) => pkg.boxSpecId
|
|
||||||
);
|
|
||||||
|
|
||||||
const shipOrderPackageList: BusinessAPI.ShipOrderPackage[] = Object.entries(packagesBySpec).map(
|
|
||||||
([specId, packages]) => {
|
|
||||||
// 计算该规格下的总数量、总重量等
|
|
||||||
const totalQuantity = packages.reduce(
|
|
||||||
(sum, pkg) => sum + (pkg.boxCount || 0), 0
|
|
||||||
);
|
|
||||||
|
|
||||||
const totalWeight = packages.reduce(
|
|
||||||
(sum, pkg) => sum + ((pkg.boxCount || 0) * (pkg.boxProductWeight || 0)), 0
|
|
||||||
);
|
|
||||||
|
|
||||||
// 获取第一条记录的价格信息(假设同一规格价格一致)
|
|
||||||
const firstPackage = packages[0];
|
|
||||||
|
|
||||||
const totalPrice = totalQuantity * (firstPackage.boxSalePrice || 0);
|
|
||||||
|
|
||||||
return {
|
|
||||||
orderPackageId: generateShortId(),
|
|
||||||
shipOrderId: "", // 将在创建发货单时填充
|
|
||||||
boxSpecId: specId,
|
|
||||||
boxSpecName: firstPackage.boxSpecName,
|
|
||||||
boxProduct: firstPackage.boxProductName,
|
|
||||||
quantity: totalQuantity,
|
|
||||||
unitPrice: firstPackage.boxSalePrice,
|
|
||||||
itemAmount: totalPrice,
|
|
||||||
singleWeight: firstPackage.boxProductWeight,
|
|
||||||
totalWeight: totalWeight,
|
|
||||||
boxBrandImage: firstPackage.boxBrandImage,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// 构建ShipOrderVO对象,不转换费用信息
|
|
||||||
return {
|
|
||||||
shipOrderId: generateShortId(),
|
|
||||||
purchaseOrderId: purchaseOrderVO.orderId,
|
|
||||||
orderSn: purchaseOrderVO.orderSn,
|
|
||||||
dealerId: purchaseOrderVO.orderDealer?.dealerId,
|
|
||||||
dealerName: purchaseOrderVO.orderDealer?.shortName,
|
|
||||||
companyId: purchaseOrderVO.orderCompany?.companyId,
|
|
||||||
companyName: purchaseOrderVO.orderCompany?.fullName,
|
|
||||||
vehicleNo: purchaseOrderVO.orderVehicle?.vehicleNo,
|
|
||||||
shippingAddress: purchaseOrderVO.orderVehicle?.origin,
|
|
||||||
receivingAddress: purchaseOrderVO.orderVehicle?.destination,
|
|
||||||
shippingDate: purchaseOrderVO.orderVehicle?.deliveryTime,
|
|
||||||
driverName: purchaseOrderVO.orderVehicle?.driver,
|
|
||||||
driverPhone: purchaseOrderVO.orderVehicle?.phone,
|
|
||||||
licensePlate: purchaseOrderVO.orderVehicle?.plate,
|
|
||||||
shipOrderItemList,
|
|
||||||
shipOrderPackageList,
|
|
||||||
createdBy: purchaseOrderVO.createdBy,
|
|
||||||
createdByName: purchaseOrderVO.createdByName,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
import dayjs from "dayjs";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将ShipOrderVO转换为示例数据格式
|
|
||||||
* @param shipOrderVO 发货单对象
|
|
||||||
* @returns 示例数据格式
|
|
||||||
*/
|
|
||||||
export const convertShipOrderVOToExamplesFormat = (
|
|
||||||
shipOrderVO: BusinessAPI.ShipOrderVO,
|
|
||||||
) => {
|
|
||||||
return {
|
|
||||||
title: {
|
|
||||||
title: "西瓜发货清单",
|
|
||||||
},
|
|
||||||
dealerInfo: {
|
|
||||||
dealerName: shipOrderVO.dealerName || "",
|
|
||||||
vehicleNumber: `第 ${shipOrderVO.vehicleNo || ""} 车`,
|
|
||||||
destination: shipOrderVO.receivingAddress || "",
|
|
||||||
watermelonGrade: shipOrderVO.watermelonGrade || "",
|
|
||||||
},
|
|
||||||
shippingInfo: {
|
|
||||||
shippingFrom: shipOrderVO.shippingAddress || "",
|
|
||||||
date: shipOrderVO.shippingDate || "",
|
|
||||||
},
|
|
||||||
weightInfo: {
|
|
||||||
data: shipOrderVO.shipOrderItemList,
|
|
||||||
accountCompany: shipOrderVO.companyName || "",
|
|
||||||
sumAmount:
|
|
||||||
shipOrderVO.shipOrderItemList?.reduce(
|
|
||||||
(acc, item) => acc + item?.totalAmount!,
|
|
||||||
0,
|
|
||||||
) || "",
|
|
||||||
},
|
|
||||||
packingSpec: {
|
|
||||||
data:
|
|
||||||
shipOrderVO.shipOrderPackageList?.map((item) => ({
|
|
||||||
boxSpecId: item.boxSpecId || "",
|
|
||||||
boxSpecName: item.boxSpecName || "",
|
|
||||||
boxType: item.boxProduct || "",
|
|
||||||
quantity: item.quantity?.toString() || "",
|
|
||||||
unitPrice: item.unitPrice?.toString() || "",
|
|
||||||
amount: item.itemAmount?.toString() || "",
|
|
||||||
unitWeight: item.singleWeight?.toString() || "",
|
|
||||||
weight: item.totalWeight?.toString() || "",
|
|
||||||
})) || [],
|
|
||||||
},
|
|
||||||
vehicleInfo: {
|
|
||||||
driverPhone: shipOrderVO?.driverPhone || "",
|
|
||||||
licensePlate: shipOrderVO.licensePlate || "",
|
|
||||||
estimatedArrivalTime: shipOrderVO.estimatedArrivalDate
|
|
||||||
? dayjs(shipOrderVO?.estimatedArrivalDate).format("YYYY年MM月DD日")
|
|
||||||
: "",
|
|
||||||
freightDebt: shipOrderVO.freightDebt?.toString() || "",
|
|
||||||
strawMatDebt: shipOrderVO.strawMatDebt?.toString() || "",
|
|
||||||
remarks: shipOrderVO.remark || "",
|
|
||||||
},
|
|
||||||
otherFees: {},
|
|
||||||
totalAmount: {
|
|
||||||
amount: shipOrderVO.totalAmount?.toString() || "",
|
|
||||||
farmer: shipOrderVO.farmerInfo || "",
|
|
||||||
},
|
|
||||||
otherInfo: {
|
|
||||||
data: shipOrderVO.shipOrderItemList,
|
|
||||||
driverPhone: shipOrderVO?.driverPhone || "",
|
|
||||||
licensePlate: shipOrderVO.licensePlate || "",
|
|
||||||
accountCompany: shipOrderVO.companyName || "",
|
|
||||||
vehicleNumber: `第 ${shipOrderVO.vehicleNo || ""} 车`,
|
|
||||||
destination: shipOrderVO.receivingAddress || "",
|
|
||||||
shippingFrom: shipOrderVO.shippingAddress || "",
|
|
||||||
estimatedArrivalTime: shipOrderVO.estimatedArrivalDate
|
|
||||||
? dayjs(shipOrderVO?.estimatedArrivalDate).format("YYYY年MM月DD日")
|
|
||||||
: "1",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@ -21,7 +21,7 @@ export function formatAmount(value: number): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 固定保留2位小数
|
// 固定保留2位小数
|
||||||
const fixedStr = Number(value).toFixed(2);
|
const fixedStr = value.toFixed(2);
|
||||||
|
|
||||||
// 去除小数点后多余的零
|
// 去除小数点后多余的零
|
||||||
// 具体规则:
|
// 具体规则:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user