feat(components): 为输入组件添加清除功能并优化类型定义
- 为多个 Input 组件添加 clearable 属性提升用户体验 - 将部分 number 类型输入改为 digit 类型以适配移动端 - 调整布局样式类名如 flex-1 和 flex-shrink-0 的应用 - 修正 API 类型定义中 roleId、costItemIds 等字段从 number[] 到 string[] - 优化档口重量计算器中的方法参数和计算逻辑 - 新增采购报价重量计算方法支持毛重/净重切换
This commit is contained in:
parent
1802e904ec
commit
d019257566
@ -158,6 +158,7 @@ export default function DealerPicker(props: IDealerPickerProps) {
|
||||
className={`flex h-10 w-full items-center rounded-md border-4 border-gray-300`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入经销商名称"
|
||||
value={inputValue}
|
||||
|
||||
@ -96,6 +96,7 @@ 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"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
disabled={readOnly}
|
||||
value={orderShip?.watermelonGrade || ""}
|
||||
onChange={(value) => {
|
||||
@ -159,6 +160,7 @@ 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"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
disabled={readOnly}
|
||||
value={orderShip?.shippingAddress || ""}
|
||||
onChange={(value) => {
|
||||
@ -351,14 +353,15 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||
key={orderShipItem.orderShipItemId}
|
||||
className={"flex flex-row gap-2.5"}
|
||||
>
|
||||
<View className="flex flex-1 items-center text-sm font-normal text-[#000000]">
|
||||
<View className="flex flex-shrink-0 items-center text-sm font-normal text-[#000000]">
|
||||
单价:{orderShipItem.unitPrice} 元/斤
|
||||
</View>
|
||||
|
||||
<View
|
||||
className={`flex h-10 items-center rounded-md ${formErrors.itemGrades?.[orderShipItem.orderShipItemId] ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
className={`flex h-10 flex-1 items-center rounded-md ${formErrors.itemGrades?.[orderShipItem.orderShipItemId] ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
disabled={readOnly}
|
||||
value={orderShipItem.watermelonGrade || ""}
|
||||
onChange={(value) => {
|
||||
|
||||
@ -186,6 +186,7 @@ export default function ExpenseCostCreate(props: IExpenseCostCreateProps) {
|
||||
className={`border-neutral-base flex flex-row items-center rounded-md ${formErrors.expenseAmount ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
type={"digit"}
|
||||
value={expressCost?.expenseAmount?.toString() || ""}
|
||||
|
||||
@ -164,6 +164,7 @@ export default function ExpenseProvisionCreate(
|
||||
className={`border-neutral-base flex flex-row items-center rounded-md ${formErrors.provisionAmount ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
type={"digit"}
|
||||
value={expenseProvision?.provisionAmount?.toString() || ""}
|
||||
|
||||
@ -203,6 +203,7 @@ export default function CostCreate(props: AddCostComponentProps) {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
type={"digit"}
|
||||
value={amount?.toString()}
|
||||
@ -275,6 +276,7 @@ export default function CostCreate(props: AddCostComponentProps) {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
type={"digit"}
|
||||
value={amount?.toString()}
|
||||
@ -332,7 +334,8 @@ export default function CostCreate(props: AddCostComponentProps) {
|
||||
</View>
|
||||
<View className="flex h-8 w-12 items-center justify-center border-y border-gray-200">
|
||||
<Input
|
||||
type="number"
|
||||
clearable
|
||||
type="digit"
|
||||
value={currentCount.toString()}
|
||||
align={"center"}
|
||||
className="!h-8 !w-12 !p-0 !text-center"
|
||||
|
||||
@ -344,6 +344,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||
</View>
|
||||
<View className="border-neutral-base relative flex h-10 w-full items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
placeholder="请输入商品名称"
|
||||
value={goodsFormData.productName}
|
||||
@ -366,6 +367,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||
</View>
|
||||
<View className="border-neutral-base relative flex h-10 w-full items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
placeholder="请输入商品产地"
|
||||
value={goodsFormData.origin}
|
||||
@ -431,6 +433,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||
</View>
|
||||
<View className="border-neutral-base relative flex h-10 w-full items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
type="number"
|
||||
placeholder="请输入数量"
|
||||
@ -452,6 +455,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||
</View>
|
||||
<View className="border-neutral-base relative flex h-10 w-full items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
type="number"
|
||||
placeholder="请输入总重量"
|
||||
@ -473,6 +477,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
|
||||
</View>
|
||||
<View className="border-neutral-base relative flex h-10 w-full items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
type="number"
|
||||
placeholder="请输入单价"
|
||||
|
||||
@ -238,7 +238,8 @@ export default forwardRef<OrderCostRef, IOrderCostProps>(
|
||||
className={`flex h-12 w-full shrink items-center border-4 ${countError[orderCostId] && selected ? "border-red-500" : "border-gray-200"} bg-white`}
|
||||
>
|
||||
<Input
|
||||
type="number"
|
||||
clearable
|
||||
type="digit"
|
||||
value={price.toString()}
|
||||
align={"center"}
|
||||
placeholder={"输入多少钱"}
|
||||
|
||||
@ -435,6 +435,7 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
||||
className={`flex h-12 w-full shrink items-center border-4 border-gray-200`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="number"
|
||||
value={count?.toString()}
|
||||
align={"center"}
|
||||
@ -490,7 +491,8 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
||||
className={`flex h-12 w-full shrink items-center border-4 ${countError[orderCostItemId] && selected ? "border-red-500" : "border-gray-200"} bg-white`}
|
||||
>
|
||||
<Input
|
||||
type="number"
|
||||
clearable
|
||||
type="digit"
|
||||
value={price.toString()}
|
||||
align={"center"}
|
||||
placeholder={"输入多少钱"}
|
||||
@ -553,6 +555,7 @@ export default forwardRef<OrderCostItemRef, IOrderCostItemProps>(
|
||||
className={`flex h-12 items-center rounded-md ${foremanError ? "border-2 border-red-500 bg-red-100" : "border-2 border-gray-300 bg-white"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className="text-base"
|
||||
type="text"
|
||||
placeholder={"工头的名字"}
|
||||
|
||||
@ -608,6 +608,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${plateError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入车牌号"
|
||||
value={orderVehicle?.plate}
|
||||
@ -629,6 +630,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${driverError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入司机姓名"
|
||||
value={orderVehicle?.driver}
|
||||
@ -650,6 +652,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${phoneError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="tel"
|
||||
placeholder="请输入联系电话"
|
||||
value={orderVehicle?.phone}
|
||||
@ -671,6 +674,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${originError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入出发地"
|
||||
value={orderVehicle?.origin}
|
||||
@ -739,6 +743,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${destinationError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入目的地"
|
||||
value={orderVehicle?.destination}
|
||||
@ -762,6 +767,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${priceError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="digit"
|
||||
placeholder="请输入运费,可填0"
|
||||
value={orderVehicle?.price?.toString()}
|
||||
@ -811,6 +817,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${strawCurtainPriceError ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="digit"
|
||||
placeholder="请输入草帘费用"
|
||||
value={orderVehicle?.strawCurtainPrice?.toString()}
|
||||
|
||||
@ -908,6 +908,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
||||
>
|
||||
<Icon name="user" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入档口名称"
|
||||
value={supplierVO.name}
|
||||
@ -934,6 +935,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
||||
>
|
||||
<Icon name="user" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入收款人姓名"
|
||||
value={supplierVO.payeeName}
|
||||
@ -967,6 +969,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
||||
className="mx-2"
|
||||
/>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入银行名称"
|
||||
value={supplierVO.bankName}
|
||||
@ -1000,6 +1003,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
||||
className="mx-2"
|
||||
/>
|
||||
<Input
|
||||
clearable
|
||||
type="digit"
|
||||
placeholder="请输入银行卡号"
|
||||
value={supplierVO.bankCard}
|
||||
@ -1028,6 +1032,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
||||
>
|
||||
<Icon name="phone" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="tel"
|
||||
placeholder="请输入手机号码"
|
||||
value={supplierVO.phone}
|
||||
|
||||
@ -244,6 +244,7 @@ export default forwardRef<StallWeighRef, IStallWeighProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${selectedProduct === "其他(请注明)" && customProduct ? "border-primary border-4" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="请输入品种"
|
||||
type="text"
|
||||
value={customProduct}
|
||||
@ -417,6 +418,7 @@ export default forwardRef<StallWeighRef, IStallWeighProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${priceError[supplierVO.orderSupplierId] ? "border-4 border-red-500" : "border-4 border-yellow-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="0.00"
|
||||
type="digit"
|
||||
value={supplierVO.purchasePrice?.toString()}
|
||||
@ -476,6 +478,7 @@ export default forwardRef<StallWeighRef, IStallWeighProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${grossWeightError[supplierVO.orderSupplierId] ? "border-4 border-red-500" : "border-4 border-blue-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="0"
|
||||
type="digit"
|
||||
value={supplierVO.grossWeight?.toString()}
|
||||
|
||||
@ -865,6 +865,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
||||
>
|
||||
<Icon name="user" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入姓名"
|
||||
value={supplierVO.name}
|
||||
@ -891,6 +892,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
||||
>
|
||||
<Icon name="id-card" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="idcard"
|
||||
placeholder="请输入身份证号"
|
||||
value={supplierVO.idCard}
|
||||
@ -915,6 +917,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
||||
>
|
||||
<Icon name="building" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入银行名称"
|
||||
value={supplierVO.bankName}
|
||||
@ -946,6 +949,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
||||
className="mx-2"
|
||||
/>
|
||||
<Input
|
||||
clearable
|
||||
type="digit"
|
||||
placeholder="请输入银行卡号"
|
||||
value={supplierVO.bankCard}
|
||||
@ -970,6 +974,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
||||
>
|
||||
<Icon name="phone" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="tel"
|
||||
placeholder="请输入手机号码"
|
||||
value={supplierVO.phone}
|
||||
|
||||
@ -532,6 +532,7 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${selectedProduct === "其他(请注明)" && customProduct ? "border-primary border-4" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="请输入品种"
|
||||
type="text"
|
||||
value={customProduct}
|
||||
@ -835,6 +836,7 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${depositError[supplierVO.orderSupplierId] ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="0"
|
||||
type="digit"
|
||||
value={supplierVO.depositAmount?.toString()}
|
||||
@ -894,6 +896,7 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${priceError[supplierVO.orderSupplierId] ? "border-4 border-red-500" : "border-4 border-yellow-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="0.00"
|
||||
type="digit"
|
||||
value={supplierVO.purchasePrice?.toString()}
|
||||
@ -953,6 +956,7 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${emptyWeightError[supplierVO.orderSupplierId] ? "border-4 border-red-500" : "border-4 border-blue-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="0"
|
||||
type="digit"
|
||||
value={supplierVO.emptyWeight?.toString()}
|
||||
@ -1012,6 +1016,7 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
|
||||
className={`flex h-10 w-full items-center rounded-md ${totalWeightError[supplierVO.orderSupplierId] ? "border-4 border-red-500" : "border-4 border-green-300"}`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="0"
|
||||
type="digit"
|
||||
value={supplierVO.totalWeight?.toString()}
|
||||
|
||||
@ -271,6 +271,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入本车次号"}
|
||||
type={"text"}
|
||||
@ -293,6 +294,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入发货地"}
|
||||
type={"text"}
|
||||
@ -315,6 +317,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入收货地"}
|
||||
type={"text"}
|
||||
@ -381,6 +384,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入车牌号"}
|
||||
type={"text"}
|
||||
@ -403,6 +407,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入联系电话"}
|
||||
type={"text"}
|
||||
@ -461,6 +466,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入运费"}
|
||||
type={"digit"}
|
||||
@ -522,6 +528,7 @@ export default function BasicInfoSection(props: {
|
||||
}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
className={"placeholder:text-neutral-dark"}
|
||||
placeholder={"请输入草帘费金额"}
|
||||
type={"digit"}
|
||||
@ -603,6 +610,7 @@ export default function BasicInfoSection(props: {
|
||||
className={`flex h-10 flex-1 items-center rounded-md border-4 border-gray-300`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
placeholder="请输入车次号"
|
||||
type="text"
|
||||
value={orderVehicle?.vehicleNo || ""}
|
||||
|
||||
@ -409,6 +409,7 @@ export default function EmptyBoxInfoSection(props: {
|
||||
</View>
|
||||
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark"
|
||||
placeholder="请输入销售单价"
|
||||
type="digit"
|
||||
|
||||
@ -164,6 +164,22 @@ export default function MarketPriceSection(props: {
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
{supplier.type === "STALL" && (
|
||||
<View className="flex items-center justify-between">
|
||||
<Text className="text-sm text-gray-500">采购报价</Text>
|
||||
<Text className="text-sm font-medium">
|
||||
{supplier.pricingMethod === "BY_GROSS_WEIGHT"
|
||||
? "毛重"
|
||||
: "净重"}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
<View className="flex items-center justify-between">
|
||||
<Text className="text-sm text-gray-500">采购成本</Text>
|
||||
<Text className="text-sm font-medium">
|
||||
{supplier.invoiceAmount} 元
|
||||
</Text>
|
||||
</View>
|
||||
<View className="flex items-center justify-between">
|
||||
<Text className="text-sm text-gray-500">采购单价</Text>
|
||||
<Text className="text-sm font-medium">
|
||||
|
||||
@ -351,6 +351,7 @@ export default function PurchaseCostInfoSection(props: {
|
||||
</View>
|
||||
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark"
|
||||
placeholder="请输入采购单价"
|
||||
type="digit"
|
||||
|
||||
@ -191,6 +191,7 @@ export default function RebateCalcSection(props: {
|
||||
</View>
|
||||
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
placeholder="请输入单价"
|
||||
type="digit"
|
||||
@ -223,6 +224,7 @@ export default function RebateCalcSection(props: {
|
||||
|
||||
<View className="border-neutral-base flex flex-row items-center rounded-md border border-solid">
|
||||
<Input
|
||||
clearable
|
||||
className="placeholder:text-neutral-dark flex-1"
|
||||
placeholder="请输入返点金额"
|
||||
type="digit"
|
||||
|
||||
@ -785,6 +785,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
className={`flex h-10 flex-1 items-center rounded-md border-4 border-gray-300`}
|
||||
>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
disabled={
|
||||
!(
|
||||
|
||||
@ -96,6 +96,7 @@ export default base(function Page() {
|
||||
/>
|
||||
</View>
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
id="username"
|
||||
name="username"
|
||||
@ -128,6 +129,7 @@ export default base(function Page() {
|
||||
/>
|
||||
</View>
|
||||
<Input
|
||||
clearable
|
||||
style={{
|
||||
// @ts-ignore
|
||||
"--nutui-input-font-size": "var(--text-sm)",
|
||||
|
||||
@ -470,6 +470,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="user" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入档口名称"
|
||||
value={supplierVO.name}
|
||||
@ -496,6 +497,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="user" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入收款人姓名"
|
||||
value={supplierVO.payeeName}
|
||||
@ -517,6 +519,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="building" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入银行名称"
|
||||
value={supplierVO.bankName}
|
||||
@ -543,6 +546,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
className="mx-2"
|
||||
/>
|
||||
<Input
|
||||
clearable
|
||||
type="digit"
|
||||
placeholder="请输入银行卡号"
|
||||
value={supplierVO.bankCard}
|
||||
@ -564,6 +568,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="phone" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="tel"
|
||||
placeholder="请输入手机号码"
|
||||
value={supplierVO.phone}
|
||||
|
||||
@ -504,6 +504,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="user" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入姓名"
|
||||
value={supplierVO.name}
|
||||
@ -530,6 +531,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="id-card" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="idcard"
|
||||
placeholder="请输入身份证号"
|
||||
value={supplierVO.idCard}
|
||||
@ -551,6 +553,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="building" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="text"
|
||||
placeholder="请输入银行名称"
|
||||
value={supplierVO.bankName}
|
||||
@ -577,6 +580,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
className="mx-2"
|
||||
/>
|
||||
<Input
|
||||
clearable
|
||||
type="digit"
|
||||
placeholder="请输入银行卡号"
|
||||
value={supplierVO.bankCard}
|
||||
@ -598,6 +602,7 @@ export default hocAuth(function Page(props: CommonComponent) {
|
||||
>
|
||||
<Icon name="phone" size={16} color="#999" className="mx-2" />
|
||||
<Input
|
||||
clearable
|
||||
type="tel"
|
||||
placeholder="请输入手机号码"
|
||||
value={supplierVO.phone}
|
||||
|
||||
@ -100,7 +100,7 @@ declare namespace AuthAPI {
|
||||
/** 用户ID */
|
||||
userId: string;
|
||||
/** 角色ID */
|
||||
roleIdList: number[];
|
||||
roleIdList: string[];
|
||||
/** 角色信息 */
|
||||
userRoleList?: UserRoleVO[];
|
||||
};
|
||||
@ -195,7 +195,7 @@ declare namespace AuthAPI {
|
||||
|
||||
type RoleMenuTreeQry = {
|
||||
/** 角色权限 */
|
||||
roleId?: number[];
|
||||
roleId?: string[];
|
||||
/** 平台ID */
|
||||
platformId: string;
|
||||
};
|
||||
@ -329,7 +329,7 @@ declare namespace AuthAPI {
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 客户标签 */
|
||||
labelId?: number[];
|
||||
labelId?: string[];
|
||||
/** 用户ID */
|
||||
userId: string;
|
||||
};
|
||||
|
||||
@ -208,7 +208,7 @@ declare namespace BusinessAPI {
|
||||
/** 品牌图片URL */
|
||||
image?: string;
|
||||
/** 纸箱规格ID */
|
||||
specIds?: number[];
|
||||
specIds?: string[];
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
@ -279,7 +279,7 @@ declare namespace BusinessAPI {
|
||||
/** 品牌图片URL */
|
||||
image?: string;
|
||||
/** 纸箱规格ID */
|
||||
specIds?: number[];
|
||||
specIds?: string[];
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
@ -296,7 +296,7 @@ declare namespace BusinessAPI {
|
||||
/** 品牌图片URL */
|
||||
image?: string;
|
||||
/** 纸箱规格ID */
|
||||
specIds?: number[];
|
||||
specIds?: string[];
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
@ -1021,7 +1021,7 @@ declare namespace BusinessAPI {
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
status: boolean;
|
||||
/** 成本项ID */
|
||||
costItemIds?: number[];
|
||||
costItemIds?: string[];
|
||||
};
|
||||
|
||||
type CostDestroyCmd = {
|
||||
@ -1241,7 +1241,7 @@ declare namespace BusinessAPI {
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
status: boolean;
|
||||
/** 成本项ID */
|
||||
costItemIds?: number[];
|
||||
costItemIds?: string[];
|
||||
};
|
||||
|
||||
type CostVO = {
|
||||
@ -1272,7 +1272,7 @@ declare namespace BusinessAPI {
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
status: boolean;
|
||||
/** 项目id集合 */
|
||||
costItemIds?: number[];
|
||||
costItemIds?: string[];
|
||||
/** 创建时间 */
|
||||
createdAt?: string;
|
||||
/** 项目列表 */
|
||||
@ -1971,7 +1971,7 @@ declare namespace BusinessAPI {
|
||||
/** 登录密码 */
|
||||
password: string;
|
||||
/** 角色ID */
|
||||
roleId: number[];
|
||||
roleId: string[];
|
||||
};
|
||||
|
||||
type EmployeeDestroyCmd = {
|
||||
@ -2064,7 +2064,7 @@ declare namespace BusinessAPI {
|
||||
/** 用户ID */
|
||||
userId: string;
|
||||
/** 角色ID */
|
||||
roleIdList: number[];
|
||||
roleIdList: string[];
|
||||
/** 角色信息 */
|
||||
userRoleList?: UserRoleVO[];
|
||||
};
|
||||
@ -2485,7 +2485,7 @@ declare namespace BusinessAPI {
|
||||
/** 平台id */
|
||||
platformId: string;
|
||||
/** 角色Id */
|
||||
roleId?: number[];
|
||||
roleId?: string[];
|
||||
/** 是否隐藏 */
|
||||
hideInMenu?: boolean;
|
||||
/** 权限Id */
|
||||
@ -2558,7 +2558,7 @@ declare namespace BusinessAPI {
|
||||
/** 平台id */
|
||||
platformId: string;
|
||||
/** 角色Id */
|
||||
roleId?: number[];
|
||||
roleId?: string[];
|
||||
/** 是否隐藏 */
|
||||
hideInMenu?: boolean;
|
||||
/** 权限Id */
|
||||
@ -2945,7 +2945,7 @@ declare namespace BusinessAPI {
|
||||
| "LOGISTICS_TYPE"
|
||||
| "EXPENSE_TYPE";
|
||||
/** 关联项目id */
|
||||
costItemIds?: number[];
|
||||
costItemIds?: string[];
|
||||
/** 是否选中 */
|
||||
selected: boolean;
|
||||
/** 是否已付款 */
|
||||
@ -2978,7 +2978,7 @@ declare namespace BusinessAPI {
|
||||
| "LOGISTICS_TYPE"
|
||||
| "EXPENSE_TYPE";
|
||||
/** 关联项目id */
|
||||
costItemIds?: number[];
|
||||
costItemIds?: string[];
|
||||
/** 是否付款 */
|
||||
isPaid?: boolean;
|
||||
};
|
||||
@ -3073,7 +3073,7 @@ declare namespace BusinessAPI {
|
||||
| "LOGISTICS_TYPE"
|
||||
| "EXPENSE_TYPE";
|
||||
/** 关联项目id */
|
||||
costItemIds?: number[];
|
||||
costItemIds?: string[];
|
||||
/** 创建时间 */
|
||||
createdAt: string;
|
||||
/** 采购订单状态: 0_草稿;1_审核中;2_已完成;3_已关闭; */
|
||||
@ -3781,7 +3781,7 @@ declare namespace BusinessAPI {
|
||||
/** 产品名称 */
|
||||
productName?: string;
|
||||
/** 关联费用id */
|
||||
costIds?: number[];
|
||||
costIds?: string[];
|
||||
/** 成本模板 */
|
||||
costTemplate?: string;
|
||||
/** 是否已付定金 */
|
||||
@ -3804,7 +3804,7 @@ declare namespace BusinessAPI {
|
||||
|
||||
type OrderSupplierBatchInvoiceUploadCmd = {
|
||||
/** 供应商ID列表 */
|
||||
orderSupplierIdList: number[];
|
||||
orderSupplierIdList: string[];
|
||||
/** 是否上传票证 */
|
||||
invoiceUpload?: boolean;
|
||||
/** 发票照片 */
|
||||
@ -4671,7 +4671,7 @@ declare namespace BusinessAPI {
|
||||
/** 产品名称 */
|
||||
name: string;
|
||||
/** 关联成本费用id */
|
||||
costIds?: number[];
|
||||
costIds?: string[];
|
||||
/** 成本模板 */
|
||||
costTemplate?: string;
|
||||
/** 备注 */
|
||||
@ -4738,7 +4738,7 @@ declare namespace BusinessAPI {
|
||||
/** 产品名称 */
|
||||
name: string;
|
||||
/** 关联成本费用id */
|
||||
costIds?: number[];
|
||||
costIds?: string[];
|
||||
/** 成本模板 */
|
||||
costTemplate?: string;
|
||||
/** 备注 */
|
||||
@ -4763,7 +4763,7 @@ declare namespace BusinessAPI {
|
||||
/** 状态:1_启用;0_禁用 */
|
||||
status: boolean;
|
||||
/** 成本ID集合 */
|
||||
costIds?: number[];
|
||||
costIds?: string[];
|
||||
/** 成本费用 */
|
||||
costVOList?: CostVO[];
|
||||
/** 成本模板 */
|
||||
@ -4790,7 +4790,7 @@ declare namespace BusinessAPI {
|
||||
/** 角色详情 */
|
||||
description?: string;
|
||||
/** 角色id */
|
||||
menuId: number[];
|
||||
menuId: string[];
|
||||
};
|
||||
|
||||
type RoleDestroyCmd = {
|
||||
@ -4812,7 +4812,7 @@ declare namespace BusinessAPI {
|
||||
/** 角色编号 */
|
||||
roleId?: string;
|
||||
/** 应用角色Id */
|
||||
roleIdList?: number[];
|
||||
roleIdList?: string[];
|
||||
/** 平台Id */
|
||||
platformId?: string;
|
||||
/** 平台Id */
|
||||
@ -4859,7 +4859,7 @@ declare namespace BusinessAPI {
|
||||
/** 角色详情 */
|
||||
description?: string;
|
||||
/** 角色id */
|
||||
menuId: number[];
|
||||
menuId: string[];
|
||||
/** 角色ID */
|
||||
roleId: string;
|
||||
};
|
||||
@ -4880,9 +4880,9 @@ declare namespace BusinessAPI {
|
||||
/** 平台 */
|
||||
platformVO?: PlatformVO;
|
||||
/** 权限列表 */
|
||||
permissionId: number[];
|
||||
permissionId: string[];
|
||||
/** 菜单列表 */
|
||||
menuId: number[];
|
||||
menuId: string[];
|
||||
/** 创建时间 */
|
||||
createdAt: string;
|
||||
};
|
||||
@ -5610,7 +5610,7 @@ declare namespace BusinessAPI {
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 客户标签 */
|
||||
labelId?: number[];
|
||||
labelId?: string[];
|
||||
};
|
||||
|
||||
type UserDestroyCmd = {
|
||||
@ -5632,7 +5632,7 @@ declare namespace BusinessAPI {
|
||||
/** 状态:1_启用;0_禁用; */
|
||||
status?: boolean;
|
||||
/** 用户ID */
|
||||
userIdList?: number[];
|
||||
userIdList?: string[];
|
||||
/** 用户名 */
|
||||
name?: string;
|
||||
};
|
||||
@ -5675,9 +5675,9 @@ declare namespace BusinessAPI {
|
||||
/** 是否是管理员 */
|
||||
isAdmin?: boolean;
|
||||
/** 会员id列表 */
|
||||
userIdList?: number[];
|
||||
userIdList?: string[];
|
||||
/** 排除的用户id列表 */
|
||||
excludeUserIdList?: number[];
|
||||
excludeUserIdList?: string[];
|
||||
/** 小区id */
|
||||
communityId?: number;
|
||||
offset?: number;
|
||||
@ -5687,7 +5687,7 @@ declare namespace BusinessAPI {
|
||||
/** 用户ID */
|
||||
userId: string;
|
||||
/** 角色ID */
|
||||
roleIdList?: number[];
|
||||
roleIdList?: string[];
|
||||
/** 是否覆盖 */
|
||||
cover: boolean;
|
||||
};
|
||||
@ -5732,7 +5732,7 @@ declare namespace BusinessAPI {
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 客户标签 */
|
||||
labelId?: number[];
|
||||
labelId?: string[];
|
||||
/** 用户ID */
|
||||
userId: string;
|
||||
};
|
||||
|
||||
@ -35,7 +35,10 @@ export class StallWeightCalculator {
|
||||
/**
|
||||
* 计算单个供应商的重量
|
||||
*/
|
||||
private calculateSupplierWeight(supplier: BusinessAPI.OrderSupplier, index: number): void {
|
||||
private calculateSupplierWeight(
|
||||
supplier: BusinessAPI.OrderSupplier,
|
||||
index: number,
|
||||
): void {
|
||||
const isFirstSupplier = index === 0;
|
||||
const isLastSupplier = supplier.isLast;
|
||||
|
||||
@ -43,14 +46,21 @@ export class StallWeightCalculator {
|
||||
this.setEmptyWeight(supplier, index);
|
||||
|
||||
// 计算各类纸箱重量
|
||||
const weights = this.calculateAllBoxWeights(supplier.orderPackageList || []);
|
||||
const weights = this.calculateAllBoxWeights(
|
||||
supplier.orderPackageList || [],
|
||||
);
|
||||
|
||||
if (!supplier.isPaper) {
|
||||
// 非纸箱包装的简化计算
|
||||
this.calculateNonPaperSupplier(supplier, weights.used);
|
||||
} else {
|
||||
// 纸箱包装的复杂计算
|
||||
this.calculatePaperSupplier(supplier, weights, isFirstSupplier, isLastSupplier);
|
||||
this.calculatePaperSupplier(
|
||||
supplier,
|
||||
weights,
|
||||
isFirstSupplier,
|
||||
isLastSupplier,
|
||||
);
|
||||
}
|
||||
|
||||
// 计算发票金额
|
||||
@ -63,7 +73,10 @@ export class StallWeightCalculator {
|
||||
/**
|
||||
* 设置空磅重量
|
||||
*/
|
||||
private setEmptyWeight(supplier: BusinessAPI.OrderSupplier, index: number): void {
|
||||
private setEmptyWeight(
|
||||
supplier: BusinessAPI.OrderSupplier,
|
||||
index: number,
|
||||
): void {
|
||||
if (index === 0) {
|
||||
// 第一个农户保持原有空磅重量
|
||||
} else {
|
||||
@ -87,17 +100,23 @@ export class StallWeightCalculator {
|
||||
/**
|
||||
* 计算非纸箱包装供应商的重量
|
||||
*/
|
||||
private calculateNonPaperSupplier(supplier: BusinessAPI.OrderSupplier, usedBoxesWeight: number): void {
|
||||
private calculateNonPaperSupplier(
|
||||
supplier: BusinessAPI.OrderSupplier,
|
||||
usedBoxesWeight: number,
|
||||
): void {
|
||||
// 毛重 = (总磅 - 空磅) × 2
|
||||
supplier.grossWeight = DecimalUtils.multiply(
|
||||
DecimalUtils.subtract(supplier.totalWeight || 0, supplier.emptyWeight || 0),
|
||||
2
|
||||
DecimalUtils.subtract(
|
||||
supplier.totalWeight || 0,
|
||||
supplier.emptyWeight || 0,
|
||||
),
|
||||
2,
|
||||
);
|
||||
|
||||
// 净重 = 毛重 - 使用纸箱重量
|
||||
supplier.netWeight = DecimalUtils.subtract(
|
||||
supplier.grossWeight || 0,
|
||||
usedBoxesWeight
|
||||
usedBoxesWeight,
|
||||
);
|
||||
}
|
||||
|
||||
@ -108,11 +127,17 @@ export class StallWeightCalculator {
|
||||
supplier: BusinessAPI.OrderSupplier,
|
||||
weights: { used: number; extra: number; remain: number; extraUsed: number },
|
||||
isFirstSupplier: boolean,
|
||||
isLastSupplier: boolean
|
||||
isLastSupplier: boolean,
|
||||
): void {
|
||||
const weightDiff = isFirstSupplier
|
||||
? DecimalUtils.subtract(supplier.totalWeight || 0, this.initialEmptyWeight)
|
||||
: DecimalUtils.subtract(supplier.totalWeight || 0, this.previousTotalWeight);
|
||||
? DecimalUtils.subtract(
|
||||
supplier.totalWeight || 0,
|
||||
this.initialEmptyWeight,
|
||||
)
|
||||
: DecimalUtils.subtract(
|
||||
supplier.totalWeight || 0,
|
||||
this.previousTotalWeight,
|
||||
);
|
||||
|
||||
const weightDiffInJin = DecimalUtils.multiply(weightDiff, 2);
|
||||
|
||||
@ -121,37 +146,46 @@ export class StallWeightCalculator {
|
||||
supplier.netWeight = DecimalUtils.add(
|
||||
DecimalUtils.subtract(
|
||||
DecimalUtils.add(weightDiffInJin, weights.remain),
|
||||
weights.extraUsed
|
||||
)
|
||||
weights.extraUsed,
|
||||
),
|
||||
);
|
||||
} else if (isLastSupplier) {
|
||||
// 最后一个农户
|
||||
supplier.netWeight = DecimalUtils.add(
|
||||
DecimalUtils.subtract(
|
||||
weightDiffInJin,
|
||||
weights.extraUsed
|
||||
),
|
||||
weights.remain
|
||||
DecimalUtils.subtract(weightDiffInJin, weights.extraUsed),
|
||||
weights.remain,
|
||||
);
|
||||
} else {
|
||||
// 中间农户(包括第一个但不是最后一个)
|
||||
supplier.netWeight = DecimalUtils.subtract(weightDiffInJin, weights.extra);
|
||||
supplier.netWeight = DecimalUtils.subtract(
|
||||
weightDiffInJin,
|
||||
weights.extra,
|
||||
);
|
||||
}
|
||||
|
||||
// 毛重 = 净重 + 本次使用纸箱重量
|
||||
supplier.grossWeight = DecimalUtils.add(
|
||||
supplier.netWeight || 0,
|
||||
weights.used
|
||||
weights.used,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报价的重量
|
||||
*/
|
||||
private calculateQuoteWeight(supplier: BusinessAPI.OrderSupplier): number {
|
||||
return supplier.pricingMethod === "BY_GROSS_WEIGHT"
|
||||
? supplier.grossWeight
|
||||
: supplier.netWeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算发票金额
|
||||
*/
|
||||
private calculateInvoiceAmount(supplier: BusinessAPI.OrderSupplier): void {
|
||||
supplier.invoiceAmount = DecimalUtils.multiply(
|
||||
supplier.netWeight || 0,
|
||||
supplier.purchasePrice || 0
|
||||
this.calculateQuoteWeight(supplier),
|
||||
supplier.purchasePrice || 0,
|
||||
);
|
||||
}
|
||||
|
||||
@ -160,16 +194,16 @@ export class StallWeightCalculator {
|
||||
*/
|
||||
private calculateBoxWeightByType(
|
||||
packages: BusinessAPI.OrderPackage[],
|
||||
boxType?: string
|
||||
boxType?: string,
|
||||
): number {
|
||||
const filteredPackages = boxType
|
||||
? packages.filter(pkg => pkg.boxType === boxType)
|
||||
? packages.filter((pkg) => pkg.boxType === boxType)
|
||||
: packages;
|
||||
|
||||
return filteredPackages.reduce((total, pkg) => {
|
||||
const weight = DecimalUtils.multiply(
|
||||
pkg.boxCount || 0,
|
||||
pkg.boxProductWeight || 0
|
||||
pkg.boxProductWeight || 0,
|
||||
);
|
||||
return DecimalUtils.add(total, weight);
|
||||
}, 0);
|
||||
@ -186,7 +220,7 @@ export class StallWeightCalculator {
|
||||
* 获取指定供应商的净重
|
||||
*/
|
||||
getSupplierNetWeight(supplierId: string | number): number {
|
||||
const supplier = this.suppliers.find(s => s.supplierId === supplierId);
|
||||
const supplier = this.suppliers.find((s) => s.supplierId === supplierId);
|
||||
return supplier?.netWeight || 0;
|
||||
}
|
||||
|
||||
@ -194,7 +228,7 @@ export class StallWeightCalculator {
|
||||
* 获取指定供应商的毛重
|
||||
*/
|
||||
getSupplierGrossWeight(supplierId: string | number): number {
|
||||
const supplier = this.suppliers.find(s => s.supplierId === supplierId);
|
||||
const supplier = this.suppliers.find((s) => s.supplierId === supplierId);
|
||||
return supplier?.grossWeight || 0;
|
||||
}
|
||||
|
||||
@ -245,7 +279,7 @@ export class StallWeightCalculator {
|
||||
|
||||
return {
|
||||
isValid: errors.length === 0,
|
||||
errors
|
||||
errors,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user