Compare commits

...

2 Commits

Author SHA1 Message Date
shenyifei
cb24afa3ee feat(message): 实现消息中心功能并优化UI交互
- 集成消息服务API,实现消息列表分页加载功能
- 添加消息未读数量实时更新,每30秒自动刷新一次
- 实现消息标记已读、删除消息等操作功能
- 优化消息界面UI,支持无限滚动加载更多消息
- 添加消息内容预览和跳转到相关业务单据功能
- 在个人中心页面增加调试模式开关快捷入口
- 修复订单车辆组件中草帘价格验证逻辑问题
- 更新供应商称重模块,新增计价方式和定金支付验证
- 调整包装创建页面品牌选择样式布局
- 更新应用版本号至v0.0.76
- 集成经销商对账记录等相关业务服务模块
2026-01-15 16:26:15 +08:00
shenyifei
e3b6f056b8 feat(components): 添加图片预览组件并重构交付单预览功能
- 新增 ImagePreview 组件支持图片缩放和拖拽功能
- 将 Step2Preview 中的预览逻辑提取到 ImagePreview 组件
- 移除 Step3Success 中的重复利润计算代码
- 添加利润明细表预览功能到成本差异模块
- 优化上传组件支持 PDF 文件类型显示
- 修复 OCR 相机页面闪关灯默认状态问题
- 更新供应商信息识别结果字段映射
- 调整版本号至 v0.0.75
2026-01-14 11:35:00 +08:00
33 changed files with 2877 additions and 607 deletions

View File

@ -31,8 +31,9 @@
"postinstall": "weapp-tw patch",
"lint": "eslint --ext .js,.tsx,.ts,.jsx src",
"lint-staged": "lint-staged",
"fix-types": "node ../../scripts/fix-types.js",
"format": "prettier --cache --write src/pages src/components",
"openapi2ts": "openapi2ts && prettier --cache --write ./src/services"
"openapi2ts": "openapi2ts && prettier --cache --write ./src/services && npm run fix-types"
},
"browserslist": [
"last 3 versions",

View File

@ -4,10 +4,12 @@ import { View } from "@tarojs/components";
import { SafeArea, Tabbar } from "@nutui/nutui-react-taro";
import { globalStore } from "@/store/global-store";
import { CustomTheme, Icon } from "@/components";
import { business } from "@/services";
export default function CustomTabBar() {
const { tabBar, setTabBar } = globalStore((state: any) => state);
const [scaleFactor, setScaleFactor] = useState(1);
const [unreadCount, setUnreadCount] = useState(0);
const userRoleVO = globalStore((state: any) => state.userRoleVO);
@ -22,6 +24,35 @@ export default function CustomTabBar() {
}
}, []);
// 获取未读消息数量
const fetchUnreadCount = async () => {
try {
const { data } = await business.messageReceiver.getUnreadCount({
messageReceiverUnreadCountQry: {},
});
if (data.success && data.data !== undefined) {
setUnreadCount(data.data);
}
} catch (error) {
console.error("获取未读消息数量失败:", error);
}
};
// 初始化时获取未读消息数量
useEffect(() => {
fetchUnreadCount();
}, []);
// 每30秒刷新一次未读消息数量
useEffect(() => {
const timer = setInterval(() => {
fetchUnreadCount();
}, 30000); // 30秒
return () => clearInterval(timer);
}, []);
const tabBarList = useMemo(() => {
// 如果没有用户角色信息,默认显示所有菜单项
return [
@ -101,14 +132,21 @@ export default function CustomTabBar() {
}}
>
{tabBarList.map((item, index) => {
const isMessageTab = item.pagePath === "/pages/main/message/index";
return (
<Tabbar.Item
style={{
// @ts-ignore
"--nutui-badge-background-color": "#ff0f23",
}}
key={index}
icon={
tabBar?.selected === index
? item.selectedIconPath
: item.iconPath
}
value={isMessageTab ? unreadCount : undefined}
title={item.text}
/>
);

View File

@ -0,0 +1,139 @@
import React, { useState } from "react";
import { Text, View } from "@tarojs/components";
import { Button } from "@nutui/nutui-react-taro";
interface IImagePreview {
children: React.ReactNode;
}
export default function ImagePreview(props: IImagePreview) {
const { children } = props;
const [scale, setScale] = useState(0.5); // 缩放比例
const [touchInfo, setTouchInfo] = useState({
startDistance: 0,
startScale: 0.5,
}); // 触摸信息
const [position, setPosition] = useState({ x: 0, y: -(29.7 * 37.8 * 0.5) }); // 当前位置
const [startPosition, setStartPosition] = useState({ x: 0, y: 0 }); // 起始位置
// 放大
const zoomIn = () => {
setScale((prev) => Math.min(prev + 0.1, 3)); // 最大放大到3倍
};
// 缩小
const zoomOut = () => {
setScale((prev) => Math.max(prev - 0.1, 0.5)); // 最小缩小到0.5倍
};
// 重置缩放
const resetZoom = () => {
setScale(0.5);
setPosition({ x: 0, y: -(29.7 * 37.8 * 0.5) }); // 重置位置
};
// 计算两点间距离
const getDistance = (touches: any) => {
const dx = touches[0].clientX - touches[1].clientX;
const dy = touches[0].clientY - touches[1].clientY;
return Math.sqrt(dx * dx + dy * dy);
};
// 处理触摸开始事件
const handleTouchStart = (e: any) => {
const touches = e.touches;
if (touches.length === 2) {
// 双指触摸,记录初始距离和当前缩放值
const distance = getDistance(touches);
setTouchInfo({
startDistance: distance,
startScale: scale,
});
} else if (touches.length === 1) {
// 单指触摸,记录起始位置
setStartPosition({
x: touches[0].clientX - position.x,
y: touches[0].clientY - position.y,
});
}
};
// 处理触摸移动事件
const handleTouchMove = (e: any) => {
const touches = e.touches;
e.preventDefault(); // 阻止默认滚动行为
if (touches.length === 2) {
// 双指触摸,计算缩放比例
const currentDistance = getDistance(touches);
const newScale =
touchInfo.startScale * (currentDistance / touchInfo.startDistance);
// 限制缩放范围在0.5到3之间
setScale(Math.min(Math.max(0.5, newScale), 3));
} else if (touches.length === 1 && scale > 0.5) {
// 单指触摸且已放大,允许拖动
setPosition({
x: touches[0].clientX - startPosition.x,
y: touches[0].clientY - startPosition.y,
});
}
};
// 处理触摸结束事件
const handleTouchEnd = (e: any) => {
// 可以在这里添加触摸结束后的处理逻辑
console.log("Touch ended", e);
};
return (
<View className="flex flex-1 flex-col items-center overflow-hidden">
{/* 缩放控制按钮 */}
<View className="mb-2 flex w-full justify-center gap-2 bg-white p-2">
<Button size="small" onClick={zoomOut}>
-
</Button>
<Button size="small" onClick={resetZoom}>
</Button>
<Button size="small" onClick={zoomIn}>
+
</Button>
<Text className="ml-2 flex items-center">
{Math.round(scale * 100)}%
</Text>
</View>
{/* 预览区域 */}
<View
className="flex-1 overflow-auto"
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
overflow: "hidden",
}}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
>
<View
id="preview"
className="rounded-lg bg-white shadow-md"
style={{
width: "21cm",
padding: "2cm 1cm 0 1cm",
margin: "0 auto",
height: "29.7cm", // A4纸高度
transform: `scale(${scale}) translate(${position.x}px, ${position.y}px)`,
transformOrigin: "center center",
transition:
scale === touchInfo.startScale ? "transform 0.2s ease" : "none",
}}
>
{children}
</View>
</View>
</View>
);
}

View File

@ -10,6 +10,7 @@ export { CustomTheme } from "./CustomTheme";
export { TabBar } from "./TabBar";
export { default as PriceEditor } from "./PriceEditor";
export { default as VersionChecker } from "./VersionChecker";
export { default as ImagePreview } from "./ImagePreview";
export type { TabBarProps } from "./TabBar";
export * from "./typing";

View File

@ -1,6 +1,4 @@
import { useState } from "react";
import { Text, View } from "@tarojs/components";
import { Button } from "@nutui/nutui-react-taro";
import { ImagePreview } from "@/components";
import {
DealerInfo,
OtherFees,
@ -20,167 +18,45 @@ interface Step2PreviewProps {
export default function Step2Preview(props: Step2PreviewProps) {
const { moduleList } = props;
const [scale, setScale] = useState(0.5); // 缩放比例
const [touchInfo, setTouchInfo] = useState({
startDistance: 0,
startScale: 0.5,
}); // 触摸信息
const [position, setPosition] = useState({ x: 0, y: -(29.7 * 37.8 * 0.5) }); // 当前位置
const [startPosition, setStartPosition] = useState({ x: 0, y: 0 }); // 起始位置
// 放大
const zoomIn = () => {
setScale((prev) => Math.min(prev + 0.1, 3)); // 最大放大到3倍
};
// 缩小
const zoomOut = () => {
setScale((prev) => Math.max(prev - 0.1, 0.5)); // 最小缩小到0.5倍
};
// 重置缩放
const resetZoom = () => {
setScale(0.5);
setPosition({ x: 0, y: -(29.7 * 37.8 * 0.5) }); // 重置位置
};
// 计算两点间距离
const getDistance = (touches: any) => {
const dx = touches[0].clientX - touches[1].clientX;
const dy = touches[0].clientY - touches[1].clientY;
return Math.sqrt(dx * dx + dy * dy);
};
// 处理触摸开始事件
const handleTouchStart = (e: any) => {
const touches = e.touches;
if (touches.length === 2) {
// 双指触摸,记录初始距离和当前缩放值
const distance = getDistance(touches);
setTouchInfo({
startDistance: distance,
startScale: scale,
});
} else if (touches.length === 1) {
// 单指触摸,记录起始位置
setStartPosition({
x: touches[0].clientX - position.x,
y: touches[0].clientY - position.y,
});
}
};
// 处理触摸移动事件
const handleTouchMove = (e: any) => {
const touches = e.touches;
e.preventDefault(); // 阻止默认滚动行为
if (touches.length === 2) {
// 双指触摸,计算缩放比例
const currentDistance = getDistance(touches);
const newScale =
touchInfo.startScale * (currentDistance / touchInfo.startDistance);
// 限制缩放范围在0.5到3之间
setScale(Math.min(Math.max(0.5, newScale), 3));
} else if (touches.length === 1 && scale > 0.5) {
// 单指触摸且已放大,允许拖动
setPosition({
x: touches[0].clientX - startPosition.x,
y: touches[0].clientY - startPosition.y,
});
}
};
// 处理触摸结束事件
const handleTouchEnd = (e: any) => {
// 可以在这里添加触摸结束后的处理逻辑
console.log("Touch ended", e);
};
return (
<View className="flex flex-1 flex-col items-center overflow-hidden">
{/* 缩放控制按钮 */}
<View className="mb-2 flex w-full justify-center gap-2 bg-white p-2">
<Button size="small" onClick={zoomOut}>
-
</Button>
<Button size="small" onClick={resetZoom}>
</Button>
<Button size="small" onClick={zoomIn}>
+
</Button>
<Text className="ml-2 flex items-center">
{Math.round(scale * 100)}%
</Text>
</View>
<ImagePreview>
{moduleList.map((module) => {
if (module.type === "title") {
return <TitleInfo key={"title"} module={module} />;
}
{/* 预览区域 */}
<View
className="flex-1 overflow-auto"
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
overflow: "hidden",
}}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
>
<View
id="preview"
className="rounded-lg bg-white shadow-md"
style={{
width: "21cm",
padding: "2cm 1cm 0 1cm",
margin: "0 auto",
height: "29.7cm", // A4纸高度
transform: `scale(${scale}) translate(${position.x}px, ${position.y}px)`,
transformOrigin: "center center",
transition:
scale === touchInfo.startScale ? "transform 0.2s ease" : "none",
}}
>
{moduleList.map((module) => {
if (module.type === "title") {
return <TitleInfo key={"title"} module={module} />;
}
if (module.type === "dealerInfo") {
return <DealerInfo key={"dealerInfo"} module={module} />;
}
if (module.type === "dealerInfo") {
return <DealerInfo key={"dealerInfo"} module={module} />;
}
if (module.type === "shippingInfo") {
return <ShippingInfo key={"shippingInfo"} module={module} />;
}
if (module.type === "shippingInfo") {
return <ShippingInfo key={"shippingInfo"} module={module} />;
}
if (module.type === "weightInfo") {
return <WeightInfo key={"weightInfo"} module={module} />;
}
if (module.type === "weightInfo") {
return <WeightInfo key={"weightInfo"} module={module} />;
}
if (module.type === "packingSpec") {
return <PackingSpec key={"packingSpec"} module={module} />;
}
if (module.type === "packingSpec") {
return <PackingSpec key={"packingSpec"} module={module} />;
}
if (module.type === "vehicleInfo") {
return <VehicleInfo key={"vehicleInfo"} module={module} />;
}
if (module.type === "vehicleInfo") {
return <VehicleInfo key={"vehicleInfo"} module={module} />;
}
if (module.type === "otherFees") {
return <OtherFees key={"otherFees"} module={module} />;
}
if (module.type === "otherFees") {
return <OtherFees key={"otherFees"} module={module} />;
}
if (module.type === "totalAmount") {
return <TotalAmount key={"totalAmount"} module={module} />;
}
if (module.type === "totalAmount") {
return <TotalAmount key={"totalAmount"} module={module} />;
}
if (module.type === "otherInfo") {
return <OtherInfo key={"otherInfo"} module={module} />;
}
})}
</View>
</View>
</View>
if (module.type === "otherInfo") {
return <OtherInfo key={"otherInfo"} module={module} />;
}
})}
</ImagePreview>
);
}

View File

@ -6,7 +6,6 @@ import { Icon } from "@/components";
import { business, poster } from "@/services";
import {
exportProfitTableExcel,
OrderCalculator,
ProfitTableRow,
ProfitTableTemplate,
} from "@/utils";
@ -256,35 +255,6 @@ export default function Step3Success(props: Step3SuccessProps) {
}
};
// 计算单车的利润数据
const calculateOrderProfit = (order: BusinessAPI.OrderVO): ProfitTableRow => {
// 车次
const vehicleNo = `${order.orderVehicle.vehicleNo || ""}`;
// 发货日期 - 从 orderShipList 获取
const shippingDate = dayjs(order.orderVehicle.deliveryTime).format(
"YYYY/MM/DD",
);
const orderCalculator = new OrderCalculator(order);
// 计算产地成本
const originCost = orderCalculator
.getCostCalculator()
.calculateMelonPurchaseCost();
// 报价金额
const quoteAmount = orderCalculator.getSalesAmount();
// 计算利润
const profit = orderCalculator.getPersonalProfit();
return {
vehicleNo,
shippingDate,
originCost,
quoteAmount,
profit,
};
};
// 生成利润表
const generateProfitTable = async () => {
try {

View File

@ -71,7 +71,6 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
const [formErrors, setFormErrors] = useState<{
warehouse?: boolean;
estimatedArrivalDate?: boolean;
remark?: boolean;
}>({});
// 暴露方法给父组件
@ -233,7 +232,7 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
</View>
<View
className={`flex w-full items-center rounded-md ${formErrors.remark ? "border-4 border-red-500" : "border-4 border-gray-300"}`}
className={`flex w-full items-center rounded-md border-4 border-gray-300`}
>
<TextArea
className={"flex-1"}
@ -243,14 +242,6 @@ const Step1Form = forwardRef<Step1FormRef, Step1FormProps>((props, ref) => {
showCount
value={orderShipVO?.remark || ""}
onChange={(value) => {
// 清除错误状态
if (formErrors.remark && value) {
setFormErrors((prev) => ({
...prev,
remark: false,
}));
}
setOrderShipVO((prev: any) => {
return {
...prev!,

View File

@ -51,7 +51,7 @@ export type { MarketPriceSectionRef } from "./section/MarketPriceSection";
export { default as RebateCalcSection } from "./section/RebateCalcSection";
export { default as TaxSubsidySection } from "./section/TaxSubsidySection";
export { default as TaxProvisionSection } from "./section/TaxProvisionSection";
export { default as CostDifferenceSection } from "./section/CostDifferenceSection";
export { CostDifferenceSection } from "./section/CostDifferenceSection";
export { default as MaterialCostSection } from "./section/MaterialCostSection";
export { default as ProductionAdvanceSection } from "./section/ProductionAdvanceSection";
export { default as WorkerAdvanceSection } from "./section/WorkerAdvanceSection";

View File

@ -129,8 +129,9 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
orderVehicle?.destination || "",
);
const isPriceValid = validatePrice(orderVehicle?.price || 0);
const openStrawCurtain = orderVehicle?.openStrawCurtain || false;
const isStrawCurtainPriceValid =
!orderVehicle.openStrawCurtain ||
!openStrawCurtain ||
validatePrice(orderVehicle?.strawCurtainPrice || 0);
const isDeliveryTimeValid = validateDeliveryTime(
orderVehicle?.deliveryTime || "",
@ -146,7 +147,7 @@ export default forwardRef<OrderVehicleRef, IOrderVehicleProps>(
setDeliveryTimeError(!isDeliveryTimeValid);
setDealerNameError(!isDealerValid);
if (orderVehicle.openStrawCurtain) {
if (openStrawCurtain) {
setStrawCurtainPriceError(!isStrawCurtainPriceValid);
}

View File

@ -770,6 +770,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
console.log("识别结果为:", res.result);
setSupplierVO({
...supplierVO,
bankName: res.result.bankName,
bankCard: res.result.number,
});

View File

@ -125,6 +125,16 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
[key: string]: boolean;
}>({});
// 添加包纸箱字段的错误状态
const [pricingMethodError, setPricingMethodError] = useState<{
[key: string]: boolean;
}>({});
// 添加是否付定金字段的错误状态
const [isDepositPaidError, setIsDepositPaidError] = useState<{
[key: string]: boolean;
}>({});
// 装车方式切换确认状态
const [loadingModeConfirmVisible, setLoadingModeConfirmVisible] =
useState(false);
@ -417,6 +427,44 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
return true;
};
// 校验是否选择包纸箱
const validatePricingMethod = (pricingMethod: any) => {
if (
pricingMethod === undefined ||
pricingMethod === null ||
pricingMethod === ""
) {
setPricingMethodError((prev) => ({
...prev,
[supplierVO.orderSupplierId]: true,
}));
return false;
}
setPricingMethodError((prev) => ({
...prev,
[supplierVO.orderSupplierId]: false,
}));
return true;
};
// 校验是否选择是否付定金
const validateIsDepositPaid = (isDepositPaid: any) => {
if (isDepositPaid === undefined || isDepositPaid === null) {
setIsDepositPaidError((prev) => ({
...prev,
[supplierVO.orderSupplierId]: true,
}));
return false;
}
setIsDepositPaidError((prev) => ({
...prev,
[supplierVO.orderSupplierId]: false,
}));
return true;
};
// 对外暴露的校验方法
const validate = () => {
const id = supplierVO?.orderSupplierId;
@ -433,6 +481,12 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
supplierVO.isDepositPaid,
supplierVO.depositAmount,
);
const isPricingMethodValid = validatePricingMethod(
supplierVO.pricingMethod,
);
const isDepositPaidValid = validateIsDepositPaid(
supplierVO.isDepositPaid,
);
// 再次校验空磅重量(因为总磅重量可能影响空磅重量的校验结果)
const isEmptyWeightValidAgain = validateEmptyWeight(
@ -471,13 +525,25 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
[id]: !isDepositAmountValid,
}));
setPricingMethodError((prev) => ({
...prev,
[id]: !isPricingMethodValid,
}));
setIsDepositPaidError((prev) => ({
...prev,
[id]: !isDepositPaidValid,
}));
const isValid =
isEmptyWeightValidAgain &&
isTotalWeightValid &&
isPurchasePriceValid &&
isProductIdValid &&
isPaperValid &&
isDepositAmountValid;
isDepositAmountValid &&
isPricingMethodValid &&
isDepositPaidValid;
if (!isValid) {
Toast.show("toast", {
@ -774,6 +840,12 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
direction="horizontal"
value={supplierVO.pricingMethod}
onChange={(value) => {
// 清除错误状态
setPricingMethodError((prev) => ({
...prev,
[supplierVO.orderSupplierId]: false,
}));
setSupplierVO({
...supplierVO,
pricingMethod: value as any,
@ -785,6 +857,9 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
</Radio.Group>
</View>
</View>
{pricingMethodError[supplierVO.orderSupplierId] && (
<View className="mt-1 text-xs text-red-500"></View>
)}
</View>
{/* 有定金吗,有定金就要填写本车扣多少定金 */}
@ -803,6 +878,12 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
: undefined
}
onChange={(value) => {
// 清除错误状态
setIsDepositPaidError((prev) => ({
...prev,
[supplierVO.orderSupplierId]: false,
}));
const isDepositPaidValue =
value === "true"
? true
@ -826,6 +907,11 @@ export default forwardRef<SupplierWeighRef, IWeightProps>(
</Radio.Group>
</View>
</View>
{isDepositPaidError[supplierVO.orderSupplierId] && (
<View className="mt-1 text-xs text-red-500">
</View>
)}
{supplierVO.isDepositPaid === true && (
<>

View File

@ -145,11 +145,21 @@ export default function TicketUpload(props: ITicketUploadProps) {
className="bg-primary/10 flex flex-col gap-2.5 rounded-lg p-2.5"
>
<View className="flex items-center">
<View className="relative mr-3 h-16 w-16 overflow-hidden rounded-lg">
<Image
className="h-full w-full object-cover"
src={uploadFileItem.filePath!}
/>
<View className="relative mr-3 h-16 w-16 flex-shrink-0 overflow-hidden rounded-lg">
{uploadFileItem.fileType !== "pdf" ? (
<Image
className="h-full w-full object-cover"
src={uploadFileItem.filePath!}
/>
) : (
<Icon
className={
"bg-primary/10 flex h-16 w-16 items-center justify-center"
}
name="file-pdf"
size={32}
/>
)}
</View>
<View className="flex-1">
<View className="font-medium" id="invoice-filename">
@ -222,6 +232,14 @@ export default function TicketUpload(props: ITicketUploadProps) {
setLoading(true);
const file = res.tempFiles[0];
uploadFile(file.path).then(({ url }) => {
if (!url) {
Toast.show("toast", {
title: "上传失败",
icon: "fail",
content: "上传失败",
});
return Promise.reject();
}
setSupplierVO({
...supplierVO!,
invoiceImg: [
@ -263,6 +281,14 @@ export default function TicketUpload(props: ITicketUploadProps) {
setLoading(true);
const file = res.tempFiles[0];
uploadFile(file.path).then(({ url }) => {
if (!url) {
Toast.show("toast", {
title: "上传失败",
icon: "fail",
content: "上传失败",
});
return Promise.reject();
}
setSupplierVO({
...supplierVO!,
invoiceImg: [
@ -319,7 +345,7 @@ export default function TicketUpload(props: ITicketUploadProps) {
className="bg-primary/10 flex flex-col gap-2.5 rounded-lg p-2.5"
>
<View className="flex items-center">
<View className="relative mr-3 h-16 w-16 overflow-hidden rounded-lg">
<View className="relative mr-3 h-16 w-16 flex-shrink-0 overflow-hidden rounded-lg">
<Image
className="h-full w-full object-cover"
src={uploadFileItem.filePath!}
@ -355,6 +381,11 @@ export default function TicketUpload(props: ITicketUploadProps) {
(newContractImg && newContractImg.length > 0) ||
false,
});
Toast.show("toast", {
title: "删除成功",
icon: "success",
content: "合同已删除",
});
}}
>
<View></View>
@ -376,12 +407,22 @@ export default function TicketUpload(props: ITicketUploadProps) {
success: (res) => {
setLoading(true);
const uploadPromises = res.tempFiles.map((file) =>
uploadFile(file.path).then(({ url }) => ({
fileName: url.split("/").pop(),
filePath: url,
fileSize: file.size,
fileType: url.split(".").pop(),
})),
uploadFile(file.path).then(({ url }) => {
if (!url) {
Toast.show("toast", {
title: "上传失败",
icon: "fail",
content: "上传失败",
});
return Promise.reject();
}
return {
fileName: url.split("/").pop(),
filePath: url,
fileSize: file.size,
fileType: url.split(".").pop(),
};
}),
);
Promise.all(uploadPromises)
@ -438,12 +479,22 @@ export default function TicketUpload(props: ITicketUploadProps) {
success: (res) => {
setLoading(true);
const uploadPromises = res.tempFiles.map((file) =>
uploadFile(file.path).then(({ url }) => ({
fileName: url.split("/").pop(),
filePath: url,
fileSize: file.size,
fileType: url.split(".").pop(),
})),
uploadFile(file.path).then(({ url }) => {
if (!url) {
Toast.show("toast", {
title: "上传失败",
icon: "fail",
content: "上传失败",
});
return Promise.reject();
}
return {
fileName: url.split("/").pop(),
filePath: url,
fileSize: file.size,
fileType: url.split(".").pop(),
};
}),
);
Promise.all(uploadPromises)

View File

@ -227,7 +227,7 @@ export default function PackageCreate(props: IPackageCreateProps) {
?.map((boxBrand) => (
<View
key={boxBrand.id}
className={"flex flex-col items-center justify-center"}
className={"flex flex-col items-center justify-center gap-1"}
onClick={() => handleBatchBrandSelect(boxBrand)}
>
<View
@ -246,7 +246,7 @@ export default function PackageCreate(props: IPackageCreateProps) {
alt={boxBrand.boxBrandImage}
/>
</View>
<View className="text-center text-xs">
<View className="text-center text-xs text-nowrap">
{boxBrand.boxBrandName}
</View>
</View>

View File

@ -1,8 +1,13 @@
import { Text, View } from "@tarojs/components";
import { OrderCalculator } from "@/utils";
import { PriceEditor } from "@/components";
import { OrderCalculator, ProfitTableRow } from "@/utils";
import { Icon, ImagePreview, PriceEditor } from "@/components";
import { Button, Popup } from "@nutui/nutui-react-taro";
import { useState } from "react";
import dayjs from "dayjs";
import { business } from "@/services";
import { ProfitCalculationService } from "@/utils/classes/calculators";
export default function CostDifferenceSection(props: {
export function CostDifferenceSection(props: {
orderVO: BusinessAPI.OrderVO;
onChange?: (orderVO: BusinessAPI.OrderVO) => void;
readOnly?: boolean;
@ -11,6 +16,74 @@ export default function CostDifferenceSection(props: {
const { orderVO, onChange, readOnly, calculator } = props;
const orderDealer = orderVO.orderDealer;
const [previewVisible, setPreviewVisible] = useState(false);
// 获取当前月份
const currentMonth = dayjs(orderVO.orderVehicle.deliveryTime).format(
"YYYY-MM-01",
);
const [profitData, setProfitData] = useState<ProfitTableRow[]>([]);
const init = async (currentMonth: string) => {
// 查询本月的所有订单数据
let {
data: { data: orderVOList = [] },
} = await business.order.listOrder({
orderListQry: {
dealerId: orderVO.orderDealer.dealerId,
month: currentMonth,
state: "COMPLETED", // 只查询已完成的订单
},
});
orderVOList.push(orderVO);
// 获取当前车次
const currentVehicleNo = orderVO.orderVehicle.vehicleNo;
// 筛选截止到当前车次之前的数据
const profitData: ProfitTableRow[] = [];
let includeNext = true;
// orderVOList 根据车次正序
orderVOList.sort((a, b) => {
return (
Number(a.orderVehicle.vehicleNo) - Number(b.orderVehicle?.vehicleNo)
);
});
for (const order of orderVOList) {
// 如果还没有到达当前车次,继续
if (includeNext) {
const profitRow = ProfitCalculationService.calculateOrderProfit(order);
profitData.push(profitRow);
// 如果是当前车次,停止添加
if (order.orderVehicle.vehicleNo === currentVehicleNo) {
includeNext = false;
}
}
}
setProfitData(profitData);
};
// 预览发货单操作
const handlePreview = () => {
init(currentMonth);
setPreviewVisible(true);
};
// 计算合计
const totalOriginCost = profitData.reduce(
(sum, row) => sum + row.originCost,
0,
);
const totalQuoteAmount = profitData.reduce(
(sum, row) => sum + row.quoteAmount,
0,
);
const totalProfit = profitData.reduce((sum, row) => sum + row.profit, 0);
return (
<View className={"flex flex-col gap-2.5"}>
{/* 卡片形式展示分成信息 */}
@ -56,6 +129,105 @@ export default function CostDifferenceSection(props: {
</View>
</View>
</View>
{/* 预览利润表 */}
<View className={"flex-1"}>
<Button
icon={<Icon name="eye" size={18} />}
size={"large"}
type="primary"
fill="outline"
block
onClick={handlePreview}
>
</Button>
</View>
{/* 预览发货单 */}
<Popup
duration={150}
style={{
minHeight: "auto",
}}
className={"!bg-[#D1D5DB]"}
visible={previewVisible}
position="bottom"
onClose={() => {
setPreviewVisible(false);
}}
closeable
destroyOnClose
title={"预览利润单"}
>
<View className={"overflow-hidden p-2.5"}>
<ImagePreview>
<View className="table-border">
<View className="table-title flex items-end justify-center text-base">
</View>
<View className={"grid w-full grid-cols-5 gap-0 text-base"}>
<View className={"col-span-1 flex items-end justify-center"}>
</View>
<View className={"col-span-1 flex items-end justify-center"}>
</View>
<View className={"col-span-1 flex items-end justify-center"}>
</View>
<View className={"col-span-1 flex items-end justify-center"}>
</View>
<View className={"col-span-1 flex items-end justify-center"}>
</View>
</View>
{profitData.map((row, index) => (
<View
className={"grid w-full grid-cols-5 gap-0 text-base"}
key={index}
>
<View className={"col-span-1 flex items-end justify-center"}>
{row.vehicleNo}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{row.shippingDate}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{row.originCost}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{row.quoteAmount}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{row.profit.toFixed(2)}
</View>
</View>
))}
<View className={"grid w-full grid-cols-5 gap-0 text-base"}>
<View
className={
"col-span-2 flex items-end justify-center bg-yellow-500"
}
>
{dayjs(currentMonth).format("MMMM")}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{totalOriginCost.toFixed(2)}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{totalQuoteAmount.toFixed(2)}
</View>
<View className={"col-span-1 flex items-end justify-center"}>
{totalProfit.toFixed(2)}
</View>
</View>
</View>
</ImagePreview>
</View>
</Popup>
</View>
);
}

View File

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

View File

@ -285,9 +285,9 @@ export default hocAuth(function Page(props: CommonComponent) {
}
// 检查预计到仓时间字段是否开启且已填写
else if (column.dataIndex === "requiredEstimatedArrivalTime") {
formData.estimatedArrivalDate = dayjs(
orderShip?.estimatedArrivalDate,
).format("YYYY-MM-DD");
formData.estimatedArrivalDate = orderShip?.estimatedArrivalDate
? dayjs(orderShip?.estimatedArrivalDate).format("YYYY-MM-DD")
: undefined;
}
// 检查备注字段是否开启且已填写
else if (column.dataIndex === "requiredRemarks") {

View File

@ -11,6 +11,10 @@ import { globalStore } from "@/store/global-store";
import { APP_VERSION } from "@/constant";
import { CustomTabBar, Icon } from "@/components";
// 示例:通过连续点击标题触发后门
let clickCount = 0;
let lastClickTime = 0;
export default hocAuth(function Page(props: CommonComponent) {
const { user, userRoleVO } = props;
console.log("userRoleVO", userRoleVO);
@ -26,6 +30,26 @@ export default hocAuth(function Page(props: CommonComponent) {
const [channel, setChannel] = useState<BusinessAPI.ChannelVO>();
const [enableDebug, setEnableDebug] = useState<boolean>(false);
const onTitleClick = () => {
const now = Date.now();
if (now - lastClickTime < 1000) {
// 1秒内连续点击
clickCount++;
if (clickCount >= 5) {
// 打开调试
Taro.setEnableDebug({
enableDebug: !enableDebug,
});
setEnableDebug(!enableDebug);
clickCount = 0;
}
} else {
clickCount = 1;
}
lastClickTime = now;
};
const initChannel = async () => {
const { data } = await auth.channel.selectChannelByDomain({
domain: "operation.erp.qilincloud168.com",
@ -332,7 +356,10 @@ export default hocAuth(function Page(props: CommonComponent) {
</View>
</View>
<View className="flex w-full flex-col py-4 text-center">
<View
className="flex w-full flex-col py-4 text-center"
onClick={onTitleClick}
>
<Text className="text-neutral-darker text-xs">
{APP_VERSION}
</Text>

View File

@ -1,387 +1,249 @@
import hocAuth from "@/hocs/auth";
import { CommonComponent } from "@/types/typings";
import { CustomTabBar, Icon } from "@/components";
import { View } from "@tarojs/components";
import { Button } from "@nutui/nutui-react-taro";
import { useState } from "react";
import { ActionType, PageList } from "@/components";
import { Text, View } from "@tarojs/components";
import { business } from "@/services";
import { useRef } from "react";
import { Button, Dialog, Toast } from "@nutui/nutui-react-taro";
import dayjs from "dayjs";
import classNames from "classnames";
import Taro from "@tarojs/taro";
import { buildUrl } from "@/utils";
export default hocAuth(function Page(props: CommonComponent) {
const { userRoleVO } = props;
export default hocAuth(function Page() {
const actionRef = useRef<ActionType>();
const [activeTab, setActiveTab] = useState<"todo" | "done" | "message">(
"message",
);
// 标记消息为已读
const handleMarkAsRead = async (
messageReceiver: BusinessAPI.MessageReceiverVO,
) => {
if (messageReceiver.isRead) {
return;
}
const handleTabChange = (tab: "todo" | "done" | "message") => {
setActiveTab(tab);
try {
const { data } = await business.messageReceiver.markReadMessageReceiver({
messageReceiverId: messageReceiver.messageReceiverId,
});
if (data.success) {
Toast.show("toast", {
icon: "success",
title: "提示",
content: "已标记为已读",
});
actionRef.current?.reload();
} else {
Toast.show("toast", {
icon: "fail",
title: "提示",
content: data.errMessage || "操作失败",
});
}
} catch (error) {
Toast.show("toast", {
icon: "fail",
title: "提示",
content: "操作失败",
});
}
};
// 渲染待办内容列表
const renderTodoList = () => (
<View className="mt-3 space-y-3">
{/* 采购审核任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge bg-primary mt-1 mr-3"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
单号: FH20230615001
</View>
<View className="text-neutral-darker text-xs">车次: K123</View>
<View className="text-neutral-darker text-xs">
瓜农: 张大山
</View>
</View>
<View className="text-sm font-semibold text-gray-800">
¥2,850
</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-primary px-4 py-1 text-sm text-white">
</Button>
</View>
</View>
</View>
</View>
// 删除消息
const handleDelete = (messageReceiver: BusinessAPI.MessageReceiverVO) => {
Dialog.open("dialog", {
title: "删除消息",
content: "确定要删除这条消息吗?",
confirmText: "确定",
cancelText: "取消",
onConfirm: async () => {
try {
const { data } =
await business.messageReceiver.destroyMessageReceiver({
messageReceiverId: messageReceiver.messageReceiverId,
});
{/* 老板审批任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge mt-1 mr-3 bg-yellow-500"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
单号: FH20230614005
</View>
<View className="text-neutral-darker text-xs">车次: K456</View>
<View className="text-neutral-darker text-xs">
瓜农: 李丰收
</View>
</View>
<View className="text-sm font-semibold text-gray-800">
¥4,320
</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-gray-200 px-4 py-1 text-sm text-gray-700">
</Button>
</View>
</View>
</View>
</View>
{/* 改签处理任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge mt-1 mr-3 bg-red-500"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
原单号: FH20230610003
</View>
<View className="text-neutral-darker text-xs">车次: K789</View>
<View className="text-neutral-darker text-xs">
客户: 鲜果超市
</View>
<View className="text-neutral-darker text-xs">
原因: 部分商品损坏
</View>
</View>
<View className="text-sm font-semibold text-gray-800">-¥680</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-primary px-4 py-1 text-sm text-white">
</Button>
</View>
</View>
</View>
</View>
{/* 待改签任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge mt-1 mr-3 bg-orange-500"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
原单号: FH20230612002
</View>
<View className="text-neutral-darker text-xs">车次: K567</View>
<View className="text-neutral-darker text-xs">
客户: 水果一号店
</View>
<View className="text-neutral-darker text-xs">
原因: 价格有异议
</View>
</View>
<View className="text-sm font-semibold text-gray-800">
-¥1,250
</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-primary px-4 py-1 text-sm text-white">
</Button>
</View>
</View>
</View>
</View>
</View>
);
// 渲染已办内容列表
const renderDoneList = () => (
<View className="mt-3 space-y-3">
{/* 已完成审核任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge mt-1 mr-3 bg-green-500"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
单号: FH20230615001
</View>
<View className="text-neutral-darker text-xs">车次: K123</View>
<View className="text-neutral-darker text-xs">
瓜农: 张大山
</View>
</View>
<View className="text-sm font-semibold text-gray-800">
¥2,850
</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-gray-200 px-4 py-1 text-sm text-gray-700">
</Button>
</View>
</View>
</View>
</View>
{/* 已完成老板审批任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge mt-1 mr-3 bg-green-500"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
单号: FH20230614005
</View>
<View className="text-neutral-darker text-xs">车次: K456</View>
<View className="text-neutral-darker text-xs">
瓜农: 李丰收
</View>
</View>
<View className="text-sm font-semibold text-gray-800">
¥4,320
</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-gray-200 px-4 py-1 text-sm text-gray-700">
</Button>
</View>
</View>
</View>
</View>
{/* 已处理改签任务 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="status-badge mt-1 mr-3 bg-green-500"></View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View>
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker mt-1 text-xs">
原单号: FH20230610003
</View>
<View className="text-neutral-darker text-xs">车次: K789</View>
<View className="text-neutral-darker text-xs">
客户: 鲜果超市
</View>
</View>
<View className="text-sm font-semibold text-gray-800">-¥680</View>
</View>
<View className="mt-3 flex justify-end">
<Button className="!rounded-button bg-gray-200 px-4 py-1 text-sm text-gray-700">
</Button>
</View>
</View>
</View>
</View>
</View>
);
// 渲染消息内容列表
const renderMessageList = () => (
<View className="mt-3 space-y-3">
{/* 系统通知 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="mr-3 flex h-8 w-8 items-center justify-center rounded-full bg-blue-100">
<Icon name={"bell"} color={"var(--color-blue-500)"} size={24} />
</View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker text-xs">10:30</View>
</View>
<View className="mt-1 text-sm text-gray-600">
</View>
</View>
</View>
</View>
{/* 审核提醒 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="bg-primary/10 mr-3 flex h-8 w-8 items-center justify-center rounded-full">
<Icon
name={"file-signature"}
color={"var(--color-primary)"}
size={24}
/>
</View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker text-xs">09:15</View>
</View>
<View className="mt-1 text-sm text-gray-600">
FH20230615001
</View>
</View>
</View>
</View>
{/* 改签通知 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="mr-3 flex h-8 w-8 items-center justify-center rounded-full bg-orange-100">
<Icon
name={"right-left"}
color={"var(--color-orange-600)"}
size={24}
/>
</View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker text-xs"></View>
</View>
<View className="mt-1 text-sm text-gray-600">
</View>
</View>
</View>
</View>
{/* 利润提醒 */}
<View className="rounded-xl bg-white p-4 shadow-sm">
<View className="flex items-start">
<View className="mr-3 flex h-8 w-8 items-center justify-center rounded-full bg-green-100">
<Icon
name={"chart-line"}
color={"var(--color-green-500)"}
size={24}
/>
</View>
<View className="flex-1">
<View className="flex items-start justify-between">
<View className="text-sm font-medium text-gray-800">
</View>
<View className="text-neutral-darker text-xs"></View>
</View>
<View className="mt-1 text-sm text-gray-600">
85%
</View>
</View>
</View>
</View>
</View>
);
if (data.success) {
Toast.show("toast", {
icon: "success",
title: "提示",
content: "删除成功",
});
actionRef.current?.reload();
} else {
Toast.show("toast", {
icon: "fail",
title: "提示",
content: data.errMessage || "删除失败",
});
}
} catch (error) {
Toast.show("toast", {
icon: "fail",
title: "提示",
content: "删除失败",
});
} finally {
Dialog.close("dialog");
}
},
onCancel: () => {
Dialog.close("dialog");
},
});
};
return (
<>
{/* 任务列表 */}
<View className={"p-2.5"}>
{/* Tab切换 */}
<View className="flex border-b border-gray-200">
<PageList<BusinessAPI.MessageReceiverVO, BusinessAPI.MessageReceiverPageQry>
rowId={"messageReceiverId"}
itemHeight={182}
type={"infinite"}
actionRef={actionRef}
render={(messageReceiverVO: BusinessAPI.MessageReceiverVO, index) => {
const { messageVO } = messageReceiverVO;
return (
<View
className={`flex-1 py-2 text-center ${activeTab === "todo" ? "border-primary border-b-2" : ""}`}
onClick={() => handleTabChange("todo")}
className={classNames(
"relative flex flex-col divide-y divide-neutral-100 overflow-hidden rounded-xl bg-white shadow-sm",
!messageReceiverVO.isRead && "border-l-4 border-l-blue-500",
)}
key={index}
>
<View
className={`text-sm font-medium ${activeTab === "todo" ? "text-primary" : "text-gray-500"}`}
>
{/* 头部区域:标题 + 已读状态 */}
<View className="flex items-center justify-between gap-2 px-4 py-3">
<View className="flex min-w-0 flex-1 items-center gap-2">
{/* 未读指示器 */}
{!messageReceiverVO.isRead && (
<View className="h-2 w-2 rounded-full bg-blue-500" />
)}
<Text className="text-neutral-darkest truncate text-base font-semibold">
{messageVO?.title || "暂无标题"}
</Text>
</View>
<View className="flex flex-col items-end gap-1">
<Text
className={classNames(
"rounded px-2 py-0.5 text-xs font-medium",
messageReceiverVO.isRead
? "bg-gray-100 text-gray-600"
: "bg-blue-100 text-blue-600",
)}
>
{messageReceiverVO.isRead ? "已读" : "未读"}
</Text>
</View>
</View>
{/* 详细信息区域 */}
<View className="flex cursor-pointer flex-col gap-2 px-4 py-3">
<View className="flex flex-col gap-1">
<Text className="text-neutral-dark text-xs"></Text>
<Text
className="text-neutral-darkest text-sm break-words whitespace-pre-wrap"
style={{
whiteSpace: "pre-wrap",
wordBreak: "break-word",
}}
>
{messageVO?.content || "暂无内容"}
</Text>
</View>
<View className="flex flex-row items-center justify-between">
<Text className="text-neutral-dark text-xs"></Text>
<Text className="text-neutral-darkest text-xs font-medium">
{messageReceiverVO.createdAt
? dayjs(messageReceiverVO.createdAt).format(
"YYYY-MM-DD HH:mm",
)
: "-"}
</Text>
</View>
{messageReceiverVO.readAt && (
<View className="flex flex-row items-center justify-between">
<Text className="text-neutral-dark text-xs"></Text>
<Text className="text-neutral-darkest text-xs font-medium">
{dayjs(messageReceiverVO.readAt).format("YYYY-MM-DD HH:mm")}
</Text>
</View>
)}
</View>
{/* 操作按钮区域 */}
<View className="flex justify-end gap-2 border-t border-neutral-100 bg-gray-50 px-4 py-3">
{!messageReceiverVO.isRead && (
<Button
type="primary"
size="small"
onClick={(e) => {
handleMarkAsRead(messageReceiverVO);
e.stopPropagation();
}}
>
</Button>
)}
<Button
type="primary"
size="small"
onClick={async (e) => {
e.stopPropagation();
if (messageVO?.subjectType === "AUDIT") {
const {
data: { data: auditVO, success },
} = await business.audit.showAudit({
auditShowQry: {
auditId: messageVO.subjectId,
},
});
if (
success &&
auditVO &&
auditVO.subjectType === "PURCHASE_ORDER"
) {
await Taro.navigateTo({
url: buildUrl("/pages/audit/audit", {
orderId: auditVO.subjectId,
auditId: auditVO.auditId,
}),
});
}
}
}}
>
</Button>
<Button
type="danger"
size="small"
onClick={(e) => {
handleDelete(messageReceiverVO);
e.stopPropagation();
}}
>
</Button>
</View>
</View>
<View
className={`flex-1 py-2 text-center ${activeTab === "done" ? "border-primary border-b-2" : ""}`}
onClick={() => handleTabChange("done")}
>
<View
className={`text-sm font-medium ${activeTab === "done" ? "text-primary" : "text-gray-500"}`}
>
</View>
</View>
<View
className={`flex-1 py-2 text-center ${activeTab === "message" ? "border-primary border-b-2" : ""}`}
onClick={() => handleTabChange("message")}
>
<View
className={`text-sm font-medium ${activeTab === "message" ? "text-primary" : "text-gray-500"}`}
>
</View>
</View>
</View>
{/* 根据选中的Tab显示不同的内容列表 */}
{activeTab === "todo" && renderTodoList()}
{activeTab === "done" && renderDoneList()}
{activeTab === "message" && renderMessageList()}
</View>
{process.env.TARO_ENV === "weapp" && <CustomTabBar />}
</>
);
}}
request={async (params) => {
const {
data: { data, success, notEmpty },
} = await business.messageReceiver.pageMessageReceiver({
messageReceiverPageQry: {
...params,
},
});
return {
data,
success,
hasMore: notEmpty,
};
}}
pagination={{
pageSize: 10,
}}
/>
);
});

View File

@ -38,7 +38,7 @@ export default function Page() {
const [data, setData] = useState({
skipphotoStatus: "0",
flash: true,
flash: false,
bottom: 125,
windowWidth: 300,
touchPadding: 36,

View File

@ -107,7 +107,7 @@ export default base(function Page() {
"var(--tw-leading, var(--text-sm--line-height))",
"--nutui-color-title": "#9CA3AF",
}}
placeholder="请输入您的手机号"
placeholder="请输入您的号"
value={username}
onChange={(value) => {
setUsername(value);

View File

@ -0,0 +1,135 @@
// @ts-ignore
/* eslint-disable */
import request from "../request";
/** 创建经销商账款明细 POST /operation/createDealerAccountRecord */
export async function createDealerAccountRecord(
body: BusinessAPI.DealerAccountRecordCreateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseDealerAccountRecordVO>(
"/operation/createDealerAccountRecord",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 经销商账款明细删除 DELETE /operation/destroyDealerAccountRecord */
export async function destroyDealerAccountRecord(
body: BusinessAPI.DealerAccountRecordDestroyCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>(
"/operation/destroyDealerAccountRecord",
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 经销商账款明细列表 GET /operation/listDealerAccountRecord */
export async function listDealerAccountRecord(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.listDealerAccountRecordParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.MultiResponseDealerAccountRecordVO>(
"/operation/listDealerAccountRecord",
{
method: "GET",
params: {
...params,
dealerAccountRecordListQry: undefined,
...params["dealerAccountRecordListQry"],
},
...(options || {}),
},
);
}
/** 经销商账款明细列表 GET /operation/pageDealerAccountRecord */
export async function pageDealerAccountRecord(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.pageDealerAccountRecordParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.PageResponseDealerAccountRecordVO>(
"/operation/pageDealerAccountRecord",
{
method: "GET",
params: {
...params,
dealerAccountRecordPageQry: undefined,
...params["dealerAccountRecordPageQry"],
},
...(options || {}),
},
);
}
/** 经销商账款明细详情 GET /operation/showDealerAccountRecord */
export async function showDealerAccountRecord(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.showDealerAccountRecordParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseDealerAccountRecordVO>(
"/operation/showDealerAccountRecord",
{
method: "GET",
params: {
...params,
dealerAccountRecordShowQry: undefined,
...params["dealerAccountRecordShowQry"],
},
...(options || {}),
},
);
}
/** 经销商账款明细更新 PUT /operation/updateDealerAccountRecord */
export async function updateDealerAccountRecord(
body: BusinessAPI.DealerAccountRecordUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseDealerAccountRecordVO>(
"/operation/updateDealerAccountRecord",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 经销商账款明细更新 PATCH /operation/updateDealerAccountRecord */
export async function updateDealerAccountRecord1(
body: BusinessAPI.DealerAccountRecordUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseDealerAccountRecordVO>(
"/operation/updateDealerAccountRecord",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}

View File

@ -6,6 +6,9 @@ import * as user from "./user";
import * as supplier from "./supplier";
import * as supplierInvoice from "./supplierInvoice";
import * as setting from "./setting";
import * as reconciliation from "./reconciliation";
import * as reconciliationPayment from "./reconciliationPayment";
import * as reconciliationInvoice from "./reconciliationInvoice";
import * as product from "./product";
import * as platform from "./platform";
import * as paymentTask from "./paymentTask";
@ -13,6 +16,8 @@ import * as paymentRecord from "./paymentRecord";
import * as order from "./order";
import * as orderSupplier from "./orderSupplier";
import * as orderShip from "./orderShip";
import * as messageTemplate from "./messageTemplate";
import * as messageReceiver from "./messageReceiver";
import * as menu from "./menu";
import * as material from "./material";
import * as materialCategory from "./materialCategory";
@ -24,6 +29,7 @@ import * as dealer from "./dealer";
import * as dealerWarehouse from "./dealerWarehouse";
import * as dealerRebateCustomer from "./dealerRebateCustomer";
import * as dealerPaymentAccount from "./dealerPaymentAccount";
import * as dealerAccountRecord from "./dealerAccountRecord";
import * as cost from "./cost";
import * as costItem from "./costItem";
import * as company from "./company";
@ -45,6 +51,9 @@ export default {
supplier,
supplierInvoice,
setting,
reconciliation,
reconciliationPayment,
reconciliationInvoice,
product,
platform,
paymentTask,
@ -52,6 +61,8 @@ export default {
order,
orderSupplier,
orderShip,
messageTemplate,
messageReceiver,
menu,
material,
materialCategory,
@ -63,6 +74,7 @@ export default {
dealerWarehouse,
dealerRebateCustomer,
dealerPaymentAccount,
dealerAccountRecord,
cost,
costItem,
company,

View File

@ -0,0 +1,167 @@
// @ts-ignore
/* eslint-disable */
import request from "../request";
/** 创建消息接收 POST /operation/createMessageReceiver */
export async function createMessageReceiver(
body: BusinessAPI.MessageReceiverCreateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageReceiverVO>(
"/operation/createMessageReceiver",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 消息接收删除 DELETE /operation/destroyMessageReceiver */
export async function destroyMessageReceiver(
body: BusinessAPI.MessageReceiverDestroyCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>("/operation/destroyMessageReceiver", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
}
/** 获取未读消息数量 GET /operation/getUnreadCount */
export async function getUnreadCount(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.getUnreadCountParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseInteger>(
"/operation/getUnreadCount",
{
method: "GET",
params: {
...params,
messageReceiverUnreadCountQry: undefined,
...params["messageReceiverUnreadCountQry"],
},
...(options || {}),
},
);
}
/** 消息接收列表 GET /operation/listMessageReceiver */
export async function listMessageReceiver(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.listMessageReceiverParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.MultiResponseMessageReceiverVO>(
"/operation/listMessageReceiver",
{
method: "GET",
params: {
...params,
messageReceiverListQry: undefined,
...params["messageReceiverListQry"],
},
...(options || {}),
},
);
}
/** 标记消息已读 POST /operation/markReadMessageReceiver */
export async function markReadMessageReceiver(
body: BusinessAPI.MessageReceiverMarkReadCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>("/operation/markReadMessageReceiver", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
}
/** 消息接收列表 GET /operation/pageMessageReceiver */
export async function pageMessageReceiver(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.pageMessageReceiverParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.PageResponseMessageReceiverVO>(
"/operation/pageMessageReceiver",
{
method: "GET",
params: {
...params,
messageReceiverPageQry: undefined,
...params["messageReceiverPageQry"],
},
...(options || {}),
},
);
}
/** 消息接收详情 GET /operation/showMessageReceiver */
export async function showMessageReceiver(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.showMessageReceiverParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageReceiverVO>(
"/operation/showMessageReceiver",
{
method: "GET",
params: {
...params,
messageReceiverShowQry: undefined,
...params["messageReceiverShowQry"],
},
...(options || {}),
},
);
}
/** 消息接收更新 PUT /operation/updateMessageReceiver */
export async function updateMessageReceiver(
body: BusinessAPI.MessageReceiverUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageReceiverVO>(
"/operation/updateMessageReceiver",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 消息接收更新 PATCH /operation/updateMessageReceiver */
export async function updateMessageReceiver1(
body: BusinessAPI.MessageReceiverUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageReceiverVO>(
"/operation/updateMessageReceiver",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}

View File

@ -0,0 +1,132 @@
// @ts-ignore
/* eslint-disable */
import request from "../request";
/** 创建消息模板 POST /operation/createMessageTemplate */
export async function createMessageTemplate(
body: BusinessAPI.MessageTemplateCreateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageTemplateVO>(
"/operation/createMessageTemplate",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 消息模板删除 DELETE /operation/destroyMessageTemplate */
export async function destroyMessageTemplate(
body: BusinessAPI.MessageTemplateDestroyCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>("/operation/destroyMessageTemplate", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
}
/** 消息模板列表 GET /operation/listMessageTemplate */
export async function listMessageTemplate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.listMessageTemplateParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.MultiResponseMessageTemplateVO>(
"/operation/listMessageTemplate",
{
method: "GET",
params: {
...params,
messageTemplateListQry: undefined,
...params["messageTemplateListQry"],
},
...(options || {}),
},
);
}
/** 消息模板列表 GET /operation/pageMessageTemplate */
export async function pageMessageTemplate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.pageMessageTemplateParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.PageResponseMessageTemplateVO>(
"/operation/pageMessageTemplate",
{
method: "GET",
params: {
...params,
messageTemplatePageQry: undefined,
...params["messageTemplatePageQry"],
},
...(options || {}),
},
);
}
/** 消息模板详情 GET /operation/showMessageTemplate */
export async function showMessageTemplate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.showMessageTemplateParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageTemplateVO>(
"/operation/showMessageTemplate",
{
method: "GET",
params: {
...params,
messageTemplateShowQry: undefined,
...params["messageTemplateShowQry"],
},
...(options || {}),
},
);
}
/** 消息模板更新 PUT /operation/updateMessageTemplate */
export async function updateMessageTemplate(
body: BusinessAPI.MessageTemplateUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageTemplateVO>(
"/operation/updateMessageTemplate",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 消息模板更新 PATCH /operation/updateMessageTemplate */
export async function updateMessageTemplate1(
body: BusinessAPI.MessageTemplateUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseMessageTemplateVO>(
"/operation/updateMessageTemplate",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}

View File

@ -0,0 +1,150 @@
// @ts-ignore
/* eslint-disable */
import request from "../request";
/** 对账完成 POST /operation/completeReconciliation */
export async function completeReconciliation(
body: BusinessAPI.ReconciliationCompleteCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationVO>(
"/operation/completeReconciliation",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 创建对账 POST /operation/createReconciliation */
export async function createReconciliation(
body: BusinessAPI.ReconciliationCreateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationVO>(
"/operation/createReconciliation",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账删除 DELETE /operation/destroyReconciliation */
export async function destroyReconciliation(
body: BusinessAPI.ReconciliationDestroyCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>("/operation/destroyReconciliation", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
}
/** 对账列表 GET /operation/listReconciliation */
export async function listReconciliation(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.listReconciliationParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.MultiResponseReconciliationVO>(
"/operation/listReconciliation",
{
method: "GET",
params: {
...params,
reconciliationListQry: undefined,
...params["reconciliationListQry"],
},
...(options || {}),
},
);
}
/** 对账列表 GET /operation/pageReconciliation */
export async function pageReconciliation(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.pageReconciliationParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.PageResponseReconciliationVO>(
"/operation/pageReconciliation",
{
method: "GET",
params: {
...params,
reconciliationPageQry: undefined,
...params["reconciliationPageQry"],
},
...(options || {}),
},
);
}
/** 对账详情 GET /operation/showReconciliation */
export async function showReconciliation(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.showReconciliationParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationVO>(
"/operation/showReconciliation",
{
method: "GET",
params: {
...params,
reconciliationShowQry: undefined,
...params["reconciliationShowQry"],
},
...(options || {}),
},
);
}
/** 对账更新 PUT /operation/updateReconciliation */
export async function updateReconciliation(
body: BusinessAPI.ReconciliationUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationVO>(
"/operation/updateReconciliation",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账更新 PATCH /operation/updateReconciliation */
export async function updateReconciliation1(
body: BusinessAPI.ReconciliationUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationVO>(
"/operation/updateReconciliation",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}

View File

@ -0,0 +1,135 @@
// @ts-ignore
/* eslint-disable */
import request from "../request";
/** 创建对账发票 POST /operation/createReconciliationInvoice */
export async function createReconciliationInvoice(
body: BusinessAPI.ReconciliationInvoiceCreateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationInvoiceVO>(
"/operation/createReconciliationInvoice",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账发票删除 DELETE /operation/destroyReconciliationInvoice */
export async function destroyReconciliationInvoice(
body: BusinessAPI.ReconciliationInvoiceDestroyCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>(
"/operation/destroyReconciliationInvoice",
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账发票列表 GET /operation/listReconciliationInvoice */
export async function listReconciliationInvoice(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.listReconciliationInvoiceParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.MultiResponseReconciliationInvoiceVO>(
"/operation/listReconciliationInvoice",
{
method: "GET",
params: {
...params,
reconciliationInvoiceListQry: undefined,
...params["reconciliationInvoiceListQry"],
},
...(options || {}),
},
);
}
/** 对账发票列表 GET /operation/pageReconciliationInvoice */
export async function pageReconciliationInvoice(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.pageReconciliationInvoiceParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.PageResponseReconciliationInvoiceVO>(
"/operation/pageReconciliationInvoice",
{
method: "GET",
params: {
...params,
reconciliationInvoicePageQry: undefined,
...params["reconciliationInvoicePageQry"],
},
...(options || {}),
},
);
}
/** 对账发票详情 GET /operation/showReconciliationInvoice */
export async function showReconciliationInvoice(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.showReconciliationInvoiceParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationInvoiceVO>(
"/operation/showReconciliationInvoice",
{
method: "GET",
params: {
...params,
reconciliationInvoiceShowQry: undefined,
...params["reconciliationInvoiceShowQry"],
},
...(options || {}),
},
);
}
/** 对账发票更新 PUT /operation/updateReconciliationInvoice */
export async function updateReconciliationInvoice(
body: BusinessAPI.ReconciliationInvoiceUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationInvoiceVO>(
"/operation/updateReconciliationInvoice",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账发票更新 PATCH /operation/updateReconciliationInvoice */
export async function updateReconciliationInvoice1(
body: BusinessAPI.ReconciliationInvoiceUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationInvoiceVO>(
"/operation/updateReconciliationInvoice",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}

View File

@ -0,0 +1,135 @@
// @ts-ignore
/* eslint-disable */
import request from "../request";
/** 创建对账付款 POST /operation/createReconciliationPayment */
export async function createReconciliationPayment(
body: BusinessAPI.ReconciliationPaymentCreateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationPaymentVO>(
"/operation/createReconciliationPayment",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账付款删除 DELETE /operation/destroyReconciliationPayment */
export async function destroyReconciliationPayment(
body: BusinessAPI.ReconciliationPaymentDestroyCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.Response>(
"/operation/destroyReconciliationPayment",
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账付款列表 GET /operation/listReconciliationPayment */
export async function listReconciliationPayment(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.listReconciliationPaymentParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.MultiResponseReconciliationPaymentVO>(
"/operation/listReconciliationPayment",
{
method: "GET",
params: {
...params,
reconciliationPaymentListQry: undefined,
...params["reconciliationPaymentListQry"],
},
...(options || {}),
},
);
}
/** 对账付款列表 GET /operation/pageReconciliationPayment */
export async function pageReconciliationPayment(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.pageReconciliationPaymentParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.PageResponseReconciliationPaymentVO>(
"/operation/pageReconciliationPayment",
{
method: "GET",
params: {
...params,
reconciliationPaymentPageQry: undefined,
...params["reconciliationPaymentPageQry"],
},
...(options || {}),
},
);
}
/** 对账付款详情 GET /operation/showReconciliationPayment */
export async function showReconciliationPayment(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: BusinessAPI.showReconciliationPaymentParams,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationPaymentVO>(
"/operation/showReconciliationPayment",
{
method: "GET",
params: {
...params,
reconciliationPaymentShowQry: undefined,
...params["reconciliationPaymentShowQry"],
},
...(options || {}),
},
);
}
/** 对账付款更新 PUT /operation/updateReconciliationPayment */
export async function updateReconciliationPayment(
body: BusinessAPI.ReconciliationPaymentUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationPaymentVO>(
"/operation/updateReconciliationPayment",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}
/** 对账付款更新 PATCH /operation/updateReconciliationPayment */
export async function updateReconciliationPayment1(
body: BusinessAPI.ReconciliationPaymentUpdateCmd,
options?: { [key: string]: any },
) {
return request<BusinessAPI.SingleResponseReconciliationPaymentVO>(
"/operation/updateReconciliationPayment",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
},
);
}

File diff suppressed because it is too large Load Diff

View File

@ -7,3 +7,4 @@
export { OrderCalculator } from "./OrderCalculator";
export { WeightCalculationService } from "./services/WeightCalculationService";
export { ProfitCalculationService } from "./services/ProfitCalculationService";

View File

@ -0,0 +1,34 @@
import { OrderCalculator, ProfitTableRow } from "@/utils";
import dayjs from "dayjs";
export class ProfitCalculationService {
// 计算单车的利润数据
static calculateOrderProfit(order: BusinessAPI.OrderVO): ProfitTableRow {
// 车次
const vehicleNo = `${order.orderVehicle.vehicleNo || ""}`;
// 发货日期 - 从 orderShipList 获取
const shippingDate = dayjs(order.orderVehicle.deliveryTime).format(
"YYYY/MM/DD",
);
const orderCalculator = new OrderCalculator(order);
// 计算产地成本
const originCost = orderCalculator
.getCostCalculator()
.calculateMelonPurchaseCost();
// 报价金额
const quoteAmount = orderCalculator.getSalesAmount();
// 计算利润
const profit = orderCalculator.getPersonalProfit();
return {
vehicleNo,
shippingDate,
originCost,
quoteAmount,
profit,
};
}
}

View File

@ -121,5 +121,6 @@ export const convertOrderToOrderShip = (
state: "WAIT_PAYMENT",
receivableAmount: calculator.getMarketPrice(),
orderShipItemList,
remark: oldOrderShip?.remark || "",
};
};

64
scripts/fix-types.js Normal file
View File

@ -0,0 +1,64 @@
const fs = require("fs");
const path = require("path");
function processFile(filePath) {
try {
let content = fs.readFileSync(filePath, "utf8");
const original = content;
// 替换所有 number[] 为 string[]
content = content.replace(/number\[\]/g, "string[]");
// 可选:替换其他相关类型
content = content.replace(/Array<number>/g, "Array<string>");
content = content.replace(
/ReadonlyArray<number>/g,
"ReadonlyArray<string>",
);
if (content !== original) {
fs.writeFileSync(filePath, content, "utf8");
console.log(`✓ Updated: ${path.relative(process.cwd(), filePath)}`);
return true;
}
return false;
} catch (error) {
console.error(`✗ Error processing ${filePath}:`, error.message);
return false;
}
}
function processDirectory(dirPath) {
let updatedCount = 0;
function walk(dir) {
const items = fs.readdirSync(dir);
for (const item of items) {
const fullPath = path.join(dir, item);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
walk(fullPath);
} else if (item.endsWith(".ts") || item.endsWith(".tsx")) {
if (processFile(fullPath)) {
updatedCount++;
}
}
}
}
walk(dirPath);
return updatedCount;
}
// 主程序
const targetDir = "src/services";
if (fs.existsSync(targetDir)) {
console.log(`Processing directory: ${targetDir}`);
const updated = processDirectory(targetDir);
console.log(`\nDone! Updated ${updated} files.`);
} else {
console.error(`Directory not found: ${targetDir}`);
process.exit(1);
}

File diff suppressed because one or more lines are too long