feat(supplier): 新增瓜农管理和发票上传功能
- 在 PageList 组件中实现选择行功能,支持复选框操作和状态管理 - 更新 ToolBar 类型定义,允许传递任意类型的选中数据 - 添加新的图标资源:eye、eye-slash 和 phone-flip - 重构 SupplierPicker 组件以适配最新的 API 接口类型 - 在工作台常量中增加“瓜农管理”和“上传发票”页面路由配置 - 创建供应商采购发票页面及列表展示组件 - 实现瓜农列表页面,支持搜索和详情展示 - 引入并导出订单供应商相关服务接口和类型定义 - 扩展业务模块的类型声明文件,新增订单供应商相关结构体 - 更新字体图标库版本,并添加新图标样式 - 在应用配置中注册新的供应商相关页面路径 - 优化采购订单计算器逻辑,排除特定费用项的重复计算
This commit is contained in:
parent
9c0c0de0c7
commit
761bc7c8ed
@ -42,6 +42,11 @@ config = {
|
||||
root: "pages/delivery",
|
||||
pages: ["list", "document/delivery", "document/purchase"],
|
||||
},
|
||||
// 瓜农
|
||||
{
|
||||
root: "pages/supplier",
|
||||
pages: ["list", "purchase/invoice"],
|
||||
},
|
||||
],
|
||||
permission: {
|
||||
"scope.userLocation": {
|
||||
|
||||
@ -302,7 +302,41 @@ export default <T extends {}, Q extends Query = Query>(
|
||||
onLoadMore={loadMore}
|
||||
onRefresh={refresh}
|
||||
>
|
||||
{data.map((item, index) => render(item as any, index))}
|
||||
{data.map(
|
||||
(item, index) =>
|
||||
(toolbar?.selectRow && (
|
||||
<View
|
||||
className={"flex flex-1 items-center gap-2.5"}
|
||||
key={index}
|
||||
>
|
||||
<Checkbox
|
||||
checked={selectRows.some(
|
||||
(item1) => item1[rowId] == item[rowId],
|
||||
)}
|
||||
value={item[rowId]}
|
||||
onClick={() => {
|
||||
if (
|
||||
selectRows.some(
|
||||
(item1) => item1[rowId] === item[rowId],
|
||||
)
|
||||
) {
|
||||
setSelectRows((prev) => {
|
||||
return prev.filter(
|
||||
(item1) => item1[rowId] !== item[rowId],
|
||||
);
|
||||
});
|
||||
} else {
|
||||
setSelectRows((prev) => {
|
||||
return [...prev, item];
|
||||
});
|
||||
}
|
||||
}}
|
||||
></Checkbox>
|
||||
{render(item as any, index)}
|
||||
</View>
|
||||
)) ||
|
||||
render(item as any, index),
|
||||
)}
|
||||
</InfiniteLoading>
|
||||
</View>
|
||||
)}
|
||||
@ -315,7 +349,7 @@ export default <T extends {}, Q extends Query = Query>(
|
||||
{toolbar?.actions && toolbar?.actions.map((item) => item)}
|
||||
|
||||
{toolbar?.selectRow?.onClick && (
|
||||
<View key={"confirm"} className={"flex justify-between gap-2"}>
|
||||
<View key={"confirm"} className={"flex justify-between gap-2 p-2.5"}>
|
||||
<View className={"flex flex-1 items-center justify-between gap-1"}>
|
||||
<View className={"flex items-center gap-2"}>
|
||||
<Checkbox
|
||||
@ -329,9 +363,13 @@ export default <T extends {}, Q extends Query = Query>(
|
||||
} else {
|
||||
setSelectAll("1");
|
||||
data?.forEach((item) => {
|
||||
if (selectRows.indexOf(item[rowId]) == -1) {
|
||||
if (
|
||||
selectRows.some(
|
||||
(item1) => item1[rowId] !== item[rowId],
|
||||
)
|
||||
) {
|
||||
setSelectRows((prev) => {
|
||||
return [...prev, item[rowId]];
|
||||
return [...prev, item];
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -343,7 +381,7 @@ export default <T extends {}, Q extends Query = Query>(
|
||||
</Text>
|
||||
</View>
|
||||
<Text className={"text-sm text-stone-950"}>
|
||||
共{selectRows.length || 0}张
|
||||
共{selectRows.length || 0}项
|
||||
</Text>
|
||||
</View>
|
||||
<Button
|
||||
|
||||
@ -23,7 +23,7 @@ export type TabPane = {
|
||||
|
||||
export type ToolBar = {
|
||||
selectRow?: {
|
||||
onClick: (selectRow: string[]) => void;
|
||||
onClick: (selectRow: any[]) => void;
|
||||
};
|
||||
actions?: React.ReactNode[];
|
||||
tabs?: {
|
||||
|
||||
@ -3,6 +3,9 @@ import classNames from "classnames";
|
||||
import React from "react";
|
||||
|
||||
export type IconNames =
|
||||
| "eye"
|
||||
| "eye-slash"
|
||||
| "phone-flip"
|
||||
| "address-book"
|
||||
| "pen-to-square"
|
||||
| "location-dot"
|
||||
|
||||
@ -3,19 +3,18 @@ import { Icon } from "@/components";
|
||||
import { ScrollView, View } from "@tarojs/components";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { business } from "@/services";
|
||||
import { SupplierVO } from "@/types/typings";
|
||||
|
||||
interface ISupplierPickerProps {
|
||||
trigger?: React.ReactNode;
|
||||
onFinish: (supplierVO: SupplierVO) => void;
|
||||
onFinish: (supplierVO: BusinessAPI.SupplierVO) => void;
|
||||
}
|
||||
|
||||
export default function SupplierPicker(props: ISupplierPickerProps) {
|
||||
const { onFinish, trigger } = props;
|
||||
|
||||
const [supplierVO, setSupplierVO] = useState<SupplierVO>();
|
||||
const [supplierVO, setSupplierVO] = useState<BusinessAPI.SupplierVO>();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [supplierList, setSupplierList] = useState<SupplierVO[]>();
|
||||
const [supplierList, setSupplierList] = useState<BusinessAPI.SupplierVO[]>();
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
@ -28,7 +27,7 @@ export default function SupplierPicker(props: ISupplierPickerProps) {
|
||||
const { data } = await business.supplier.listSupplier({
|
||||
supplierListQry: {
|
||||
name: value || undefined,
|
||||
status: true
|
||||
status: true,
|
||||
},
|
||||
});
|
||||
|
||||
@ -57,7 +56,7 @@ export default function SupplierPicker(props: ISupplierPickerProps) {
|
||||
position="bottom"
|
||||
onClose={async () => {
|
||||
if (visible) {
|
||||
setSupplierVO(undefined)
|
||||
setSupplierVO(undefined);
|
||||
setSearchText("");
|
||||
setVisible(false);
|
||||
} else if (supplierVO) {
|
||||
@ -88,7 +87,7 @@ export default function SupplierPicker(props: ISupplierPickerProps) {
|
||||
key={item.supplierId}
|
||||
onClick={async () => {
|
||||
setSupplierVO(item);
|
||||
setSearchText("")
|
||||
setSearchText("");
|
||||
setVisible(false);
|
||||
}}
|
||||
>
|
||||
|
||||
@ -126,6 +126,15 @@ const quickActionMap = {
|
||||
icon: "file-invoice",
|
||||
iconColor: "var(--color-orange-600)",
|
||||
bgColorClass: "bg-orange-100",
|
||||
path: "/pages/supplier/purchase/invoice",
|
||||
},
|
||||
{
|
||||
id: "supplierManage",
|
||||
title: "瓜农管理",
|
||||
icon: "clipboard-list",
|
||||
iconColor: "var(--color-green-600)",
|
||||
bgColorClass: "bg-green-100",
|
||||
path: "/pages/supplier/list",
|
||||
},
|
||||
],
|
||||
"market-buyer": [
|
||||
@ -145,13 +154,6 @@ const quickActionMap = {
|
||||
bgColorClass: "bg-green-100",
|
||||
path: "/pages/purchase/purchaser/history",
|
||||
},
|
||||
{
|
||||
id: "invoiceUpload",
|
||||
title: "上传发票",
|
||||
icon: "file-invoice",
|
||||
iconColor: "var(--color-orange-600)",
|
||||
bgColorClass: "bg-orange-100",
|
||||
},
|
||||
],
|
||||
reviewer: [
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 5042354 */
|
||||
src: url('//at.alicdn.com/t/c/font_5042354_wqti51yo9xk.woff2?t=1762227792781') format('woff2'),
|
||||
url('//at.alicdn.com/t/c/font_5042354_wqti51yo9xk.woff?t=1762227792781') format('woff'),
|
||||
url('//at.alicdn.com/t/c/font_5042354_wqti51yo9xk.ttf?t=1762227792781') format('truetype');
|
||||
src: url('//at.alicdn.com/t/c/font_5042354_hkkkrqw0kin.woff2?t=1763456511295') format('woff2'),
|
||||
url('//at.alicdn.com/t/c/font_5042354_hkkkrqw0kin.woff?t=1763456511295') format('woff'),
|
||||
url('//at.alicdn.com/t/c/font_5042354_hkkkrqw0kin.ttf?t=1763456511295') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
@ -13,6 +13,18 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-phone-flip:before {
|
||||
content: "\e624";
|
||||
}
|
||||
|
||||
.icon-eye:before {
|
||||
content: "\e62f";
|
||||
}
|
||||
|
||||
.icon-eye-slash:before {
|
||||
content: "\e62e";
|
||||
}
|
||||
|
||||
.icon-address-book:before {
|
||||
content: "\e623";
|
||||
}
|
||||
|
||||
4
packages/app-client/src/pages/supplier/list.config.ts
Normal file
4
packages/app-client/src/pages/supplier/list.config.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "瓜农管理",
|
||||
navigationBarBackgroundColor: "#fff",
|
||||
});
|
||||
127
packages/app-client/src/pages/supplier/list.tsx
Normal file
127
packages/app-client/src/pages/supplier/list.tsx
Normal file
@ -0,0 +1,127 @@
|
||||
import { ActionType, PageList, ToolBar } from "@/components";
|
||||
import { useShareAppMessage } from "@tarojs/taro";
|
||||
import { useRef } from "react";
|
||||
import { business } from "@/services";
|
||||
import hocAuth from "@/hocs/auth";
|
||||
import { CommonComponent } from "@/types/typings";
|
||||
import { Label, Text, View } from "@tarojs/components";
|
||||
import dayjs from "dayjs";
|
||||
import Phone from "../../components/biz/Phone";
|
||||
|
||||
export default hocAuth(function Page(props: CommonComponent) {
|
||||
const { shareOptions } = props;
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const toolbar: ToolBar = {
|
||||
search: {
|
||||
activeKey: "name",
|
||||
defaultActiveKey: "name",
|
||||
items: [
|
||||
{
|
||||
key: "name",
|
||||
name: "瓜农名称",
|
||||
placeholder: "请输入瓜农名称",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
useShareAppMessage((res) => {
|
||||
console.log("useShareAppMessage1", res, shareOptions);
|
||||
// 如果是按钮触发的转发,使用默认配置
|
||||
if (res.from === "button") {
|
||||
return shareOptions;
|
||||
}
|
||||
// 页面转发使用设置的配置
|
||||
return {};
|
||||
});
|
||||
|
||||
return (
|
||||
<PageList<BusinessAPI.SupplierVO, BusinessAPI.SupplierPageQry>
|
||||
rowId={"supplierId"}
|
||||
itemHeight={182}
|
||||
type={"infinite"}
|
||||
actionRef={actionRef}
|
||||
render={(supplierVO: BusinessAPI.SupplierVO, index) => (
|
||||
<View className={"mb-2.5"} key={index}>
|
||||
<View
|
||||
className={
|
||||
"relative flex flex-col divide-y-2 divide-neutral-100 rounded-lg bg-white px-2.5"
|
||||
}
|
||||
>
|
||||
<View className={"flex flex-col divide-y-2 divide-neutral-100"}>
|
||||
<View className={"py-2.5"}>
|
||||
<View className={"flex flex-row items-center"}>
|
||||
<View className={"flex flex-1 flex-col gap-2"}>
|
||||
<View className={"flex flex-row gap-1"}>
|
||||
{/* 复制 */}
|
||||
<Text
|
||||
className={"text-neutral-darkest text-xl font-bold"}
|
||||
>
|
||||
{supplierVO?.name}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={"py-2.5"}>
|
||||
<View className={"flex flex-col gap-2"}>
|
||||
<View
|
||||
className={
|
||||
"flex flex-row items-center justify-between gap-2.5"
|
||||
}
|
||||
>
|
||||
<Label className={"text-neutral-dark text-sm"}>
|
||||
创建时间
|
||||
</Label>
|
||||
<Text className={"text-neutral-darkest text-sm"}>
|
||||
{dayjs(supplierVO.createdAt).format("MM-DD HH:mm")}
|
||||
</Text>
|
||||
</View>
|
||||
<View
|
||||
className={
|
||||
"flex flex-row items-center justify-between gap-2.5"
|
||||
}
|
||||
>
|
||||
<Label className={"text-neutral-dark text-sm"}>
|
||||
联系方式
|
||||
</Label>
|
||||
<View
|
||||
className={
|
||||
"flex flex-1 flex-row items-center justify-end gap-1"
|
||||
}
|
||||
>
|
||||
<Phone phone={supplierVO.phone} />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={"py-2.5"}>
|
||||
<View className={"flex flex-row justify-end gap-2"}></View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
toolbar={toolbar}
|
||||
request={async (params) => {
|
||||
const {
|
||||
data: { data, success, notEmpty },
|
||||
} = await business.supplier.pageSupplier({
|
||||
supplierPageQry: {
|
||||
...params,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
data,
|
||||
success,
|
||||
hasMore: notEmpty,
|
||||
};
|
||||
}}
|
||||
pagination={{
|
||||
pageSize: 10,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "上传发票",
|
||||
navigationBarBackgroundColor: "#fff",
|
||||
});
|
||||
165
packages/app-client/src/pages/supplier/purchase/invoice.tsx
Normal file
165
packages/app-client/src/pages/supplier/purchase/invoice.tsx
Normal file
@ -0,0 +1,165 @@
|
||||
import {
|
||||
ActionType,
|
||||
Icon,
|
||||
PageList,
|
||||
SupplierPicker,
|
||||
ToolBar,
|
||||
} from "@/components";
|
||||
import { useShareAppMessage } from "@tarojs/taro";
|
||||
import { useRef, useState } from "react";
|
||||
import { business } from "@/services";
|
||||
import hocAuth from "@/hocs/auth";
|
||||
import { CommonComponent } from "@/types/typings";
|
||||
import { View } from "@tarojs/components";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default hocAuth(function Page(props: CommonComponent) {
|
||||
const { shareOptions } = props;
|
||||
|
||||
const [supplierVO, setSupplierVO] = useState<BusinessAPI.SupplierVO>();
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const toolbar: ToolBar = {
|
||||
selectRow: {
|
||||
onClick: async (orderSupplierVOList: BusinessAPI.OrderSupplierVO[]) => {
|
||||
console.log("orderSupplierVOList", orderSupplierVOList);
|
||||
},
|
||||
},
|
||||
search: {
|
||||
activeKey: "vehicleNo",
|
||||
defaultActiveKey: "vehicleNo",
|
||||
items: [
|
||||
{
|
||||
key: "vehicleNo",
|
||||
name: "车次号",
|
||||
placeholder: "请输入车次号",
|
||||
},
|
||||
{
|
||||
key: "plate",
|
||||
name: "车牌号",
|
||||
placeholder: "请输入车牌号",
|
||||
},
|
||||
],
|
||||
},
|
||||
render: () => (
|
||||
<>
|
||||
<View className={"flex flex-row gap-2.5"}>
|
||||
<SupplierPicker
|
||||
onFinish={(supplierVO) => {
|
||||
setSupplierVO(supplierVO);
|
||||
actionRef.current?.reload();
|
||||
}}
|
||||
trigger={
|
||||
<View
|
||||
className={`"border-2 border-primary flex h-6 items-center rounded-md px-2.5`}
|
||||
>
|
||||
<View className={"text-primary text-xs"}>
|
||||
{supplierVO?.name || "瓜农"}
|
||||
</View>
|
||||
{supplierVO?.name ? (
|
||||
<Icon
|
||||
name={"circle-xmark"}
|
||||
size={16}
|
||||
onClick={(event) => {
|
||||
setSupplierVO(undefined);
|
||||
actionRef.current?.reload();
|
||||
event.stopPropagation();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Icon name={"chevron-down"} size={16} />
|
||||
)}
|
||||
</View>
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</>
|
||||
),
|
||||
};
|
||||
|
||||
useShareAppMessage((res) => {
|
||||
console.log("useShareAppMessage1", res, shareOptions);
|
||||
// 如果是按钮触发的转发,使用默认配置
|
||||
if (res.from === "button") {
|
||||
return shareOptions;
|
||||
}
|
||||
// 页面转发使用设置的配置
|
||||
return {};
|
||||
});
|
||||
|
||||
return (
|
||||
<PageList<BusinessAPI.OrderSupplierVO, BusinessAPI.OrderSupplierPageQry>
|
||||
rowId={"orderSupplierId"}
|
||||
itemHeight={182}
|
||||
type={"infinite"}
|
||||
actionRef={actionRef}
|
||||
render={(orderSupplierVO: BusinessAPI.OrderSupplierVO, index) => (
|
||||
<View className={"mb-2.5 flex-1"} key={index}>
|
||||
<View
|
||||
className={
|
||||
"relative flex flex-col divide-y-2 divide-neutral-100 rounded-lg bg-white p-2.5"
|
||||
}
|
||||
>
|
||||
<View className="flex-1">
|
||||
<View className="flex items-start justify-between">
|
||||
<View>
|
||||
<View className="text-base font-medium text-gray-800">
|
||||
{orderSupplierVO.name} (
|
||||
{orderSupplierVO.orderVehicle?.origin}-
|
||||
{orderSupplierVO.orderVehicle?.destination})
|
||||
</View>
|
||||
</View>
|
||||
{/*<View className="rounded bg-gray-100 px-2 py-1 text-xs text-gray-800">*/}
|
||||
{/* 草稿*/}
|
||||
{/*</View>*/}
|
||||
</View>
|
||||
<View className="my-1 flex flex-row flex-wrap gap-1 text-sm text-gray-600">
|
||||
<View className="text-primary">
|
||||
{orderSupplierVO.orderVehicle?.vehicleNo
|
||||
? "第" + orderSupplierVO.orderVehicle?.vehicleNo + "车"
|
||||
: "暂未生成车次"}
|
||||
</View>
|
||||
<View>
|
||||
{dayjs(orderSupplierVO.orderVehicle?.deliveryTime).format(
|
||||
"MM-DD",
|
||||
)}
|
||||
</View>
|
||||
<View>|</View>
|
||||
<View>{orderSupplierVO.netWeight}斤</View>
|
||||
<View>|</View>
|
||||
<View>¥{orderSupplierVO.invoiceAmount}</View>
|
||||
</View>
|
||||
<View className="text-xs text-gray-500">
|
||||
{`${orderSupplierVO.productName} | 品种:`}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
toolbar={toolbar}
|
||||
request={async (params) => {
|
||||
const {
|
||||
data: { data, success, notEmpty },
|
||||
} = await business.orderSupplier.pageOrderSupplier({
|
||||
orderSupplierPageQry: {
|
||||
...params,
|
||||
...(supplierVO
|
||||
? {
|
||||
supplierId: supplierVO.supplierId,
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
data,
|
||||
success,
|
||||
hasMore: notEmpty,
|
||||
};
|
||||
}}
|
||||
pagination={{
|
||||
pageSize: 10,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@ -9,6 +9,7 @@ import * as setting from "./setting";
|
||||
import * as purchaseOrder from "./purchaseOrder";
|
||||
import * as product from "./product";
|
||||
import * as platform from "./platform";
|
||||
import * as orderSupplier from "./orderSupplier";
|
||||
import * as menu from "./menu";
|
||||
import * as material from "./material";
|
||||
import * as materialCategory from "./materialCategory";
|
||||
@ -39,6 +40,7 @@ export default {
|
||||
purchaseOrder,
|
||||
product,
|
||||
platform,
|
||||
orderSupplier,
|
||||
menu,
|
||||
material,
|
||||
materialCategory,
|
||||
|
||||
59
packages/app-client/src/services/business/orderSupplier.ts
Normal file
59
packages/app-client/src/services/business/orderSupplier.ts
Normal file
@ -0,0 +1,59 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from "../request";
|
||||
|
||||
/** 订单供应商列表 GET /operation/pageOrderSupplier */
|
||||
export async function pageOrderSupplier(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: BusinessAPI.pageOrderSupplierParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<BusinessAPI.PageResponseOrderSupplierVO>(
|
||||
"/operation/pageOrderSupplier",
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
...params,
|
||||
orderSupplierPageQry: undefined,
|
||||
...params["orderSupplierPageQry"],
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 订单供应商更新 PUT /operation/updateOrderSupplier */
|
||||
export async function updateOrderSupplier(
|
||||
body: BusinessAPI.OrderSupplierUpdateCmd,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<BusinessAPI.SingleResponseOrderSupplierVO>(
|
||||
"/operation/updateOrderSupplier",
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 订单供应商更新 PATCH /operation/updateOrderSupplier */
|
||||
export async function updateOrderSupplier1(
|
||||
body: BusinessAPI.OrderSupplierUpdateCmd,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<BusinessAPI.SingleResponseOrderSupplierVO>(
|
||||
"/operation/updateOrderSupplier",
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -2549,6 +2549,8 @@ declare namespace BusinessAPI {
|
||||
type OrderPackage = {
|
||||
/** 记录ID */
|
||||
orderPackageId?: string;
|
||||
/** 采购订单记录ID */
|
||||
orderId?: string;
|
||||
/** 供应商记录ID */
|
||||
orderSupplierId?: string;
|
||||
/** 箱子品牌ID */
|
||||
@ -2575,7 +2577,7 @@ declare namespace BusinessAPI {
|
||||
boxCostPrice?: number;
|
||||
/** 销售单价(元/个) */
|
||||
boxSalePrice?: number;
|
||||
/** 箱子类型:1_本次使用;2_额外运输;3_已使用额外运输;4_车上剩余; */
|
||||
/** 箱子类型:1_本次使用;2_额外运输;3_已使用额外运输;4_车上剩余;5_瓜农纸箱;6_空箱; */
|
||||
boxType: "USED" | "EXTRA" | "EXTRA_USED" | "REMAIN" | "OWN" | "EMPTY";
|
||||
};
|
||||
|
||||
@ -2653,6 +2655,106 @@ declare namespace BusinessAPI {
|
||||
productName?: string;
|
||||
/** 采购订单包装箱信息 */
|
||||
orderPackageList?: OrderPackage[];
|
||||
/** 采购订单车辆信息 */
|
||||
orderVehicle?: OrderVehicle;
|
||||
};
|
||||
|
||||
type OrderSupplierPageQry = {
|
||||
pageSize?: number;
|
||||
pageIndex?: number;
|
||||
orderBy?: string;
|
||||
orderDirection?: string;
|
||||
groupBy?: string;
|
||||
needTotalCount?: boolean;
|
||||
/** 自定义字段key */
|
||||
customFieldKey?: string;
|
||||
/** 自定义字段value */
|
||||
customFieldValue?: string;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态:1_启用;0_禁用; */
|
||||
status?: boolean;
|
||||
/** 订单供应商ID */
|
||||
orderSupplierId?: string;
|
||||
/** 订单ID */
|
||||
orderId?: string;
|
||||
/** 供应商id */
|
||||
supplierId?: string;
|
||||
/** 发货日期 */
|
||||
deliveryTime?: string[];
|
||||
offset?: number;
|
||||
};
|
||||
|
||||
type OrderSupplierUpdateCmd = {
|
||||
/** 订单供应商ID */
|
||||
orderSupplierId: string;
|
||||
/** 是否上传票证 */
|
||||
invoiceUpload?: boolean;
|
||||
/** 发票照片 */
|
||||
invoiceImg?: string[];
|
||||
/** 是否上传合同 */
|
||||
contractUpload?: boolean;
|
||||
/** 合同照片 */
|
||||
contractImg?: string[];
|
||||
};
|
||||
|
||||
type OrderSupplierVO = {
|
||||
/** 记录ID */
|
||||
orderSupplierId: string;
|
||||
/** 订单ID */
|
||||
orderId: string;
|
||||
/** 供应商ID */
|
||||
supplierId?: string;
|
||||
/** 供应商姓名 */
|
||||
name?: string;
|
||||
/** 身份证号 */
|
||||
idCard?: string;
|
||||
/** 银行卡号 */
|
||||
bankCard?: string;
|
||||
/** 手机号 */
|
||||
phone?: string;
|
||||
/** 微信二维码 */
|
||||
wechatQr?: string;
|
||||
/** 是否最后一家 */
|
||||
isLast?: boolean;
|
||||
/** 空磅是否包含纸箱 */
|
||||
isPaper?: boolean;
|
||||
/** 产品id */
|
||||
productId?: string;
|
||||
/** 产品名称 */
|
||||
productName?: string;
|
||||
/** 空车重量(kg) */
|
||||
emptyWeight?: number;
|
||||
/** 总重量(kg) */
|
||||
totalWeight?: number;
|
||||
/** 毛重(斤) */
|
||||
grossWeight?: number;
|
||||
/** 净重(斤) */
|
||||
netWeight?: number;
|
||||
/** 采购单价(元/斤) */
|
||||
purchasePrice?: number;
|
||||
/** 销售单价(元/斤) */
|
||||
salePrice?: number;
|
||||
/** 报价方式:1_按毛重报价;2_按净重报价; */
|
||||
pricingMethod?: boolean;
|
||||
/** 发票金额 */
|
||||
invoiceAmount?: number;
|
||||
/** 空车照片 */
|
||||
emptyWeightImg?: string;
|
||||
/** 满载照片 */
|
||||
totalWeightImg?: string;
|
||||
/** 是否上传票证 */
|
||||
invoiceUpload?: boolean;
|
||||
/** 发票照片 */
|
||||
invoiceImg?: string[];
|
||||
/** 是否上传合同 */
|
||||
contractUpload?: boolean;
|
||||
/** 合同照片 */
|
||||
contractImg?: string[];
|
||||
/** 创建时间 */
|
||||
createdAt?: string;
|
||||
/** 车辆信息 */
|
||||
orderVehicle?: OrderVehicle;
|
||||
};
|
||||
|
||||
type OrderVehicle = {
|
||||
@ -2761,6 +2863,10 @@ declare namespace BusinessAPI {
|
||||
materialPageQry: MaterialPageQry;
|
||||
};
|
||||
|
||||
type pageOrderSupplierParams = {
|
||||
orderSupplierPageQry: OrderSupplierPageQry;
|
||||
};
|
||||
|
||||
type pagePermissionParams = {
|
||||
permissionPageQry: PermissionPageQry;
|
||||
};
|
||||
@ -2985,6 +3091,19 @@ declare namespace BusinessAPI {
|
||||
totalPages?: number;
|
||||
};
|
||||
|
||||
type PageResponseOrderSupplierVO = {
|
||||
success?: boolean;
|
||||
errCode?: string;
|
||||
errMessage?: string;
|
||||
totalCount?: number;
|
||||
pageSize?: number;
|
||||
pageIndex?: number;
|
||||
data?: OrderSupplierVO[];
|
||||
empty?: boolean;
|
||||
notEmpty?: boolean;
|
||||
totalPages?: number;
|
||||
};
|
||||
|
||||
type PageResponsePermissionVO = {
|
||||
success?: boolean;
|
||||
errCode?: string;
|
||||
@ -3323,6 +3442,8 @@ declare namespace BusinessAPI {
|
||||
orderSupplierList: OrderSupplier[];
|
||||
/** 采购订单费用信息 */
|
||||
orderCostList: OrderCost[];
|
||||
/** 采购订单包装箱信息 */
|
||||
orderPackageList: OrderPackage[];
|
||||
/** 是否是暂存 */
|
||||
draft: boolean;
|
||||
pricingMethod?: "BY_GROSS_WEIGHT" | "BY_NET_WEIGHT";
|
||||
@ -3362,7 +3483,7 @@ declare namespace BusinessAPI {
|
||||
orderSupplierList: OrderSupplier[];
|
||||
/** 采购订单费用信息 */
|
||||
orderCostList: OrderCost[];
|
||||
/** 采购订单空箱费用 */
|
||||
/** 采购订单包装箱信息 */
|
||||
orderPackageList: OrderPackage[];
|
||||
};
|
||||
|
||||
@ -3469,7 +3590,7 @@ declare namespace BusinessAPI {
|
||||
active?: number;
|
||||
/** 采购订单费用信息 */
|
||||
orderCostList: OrderCost[];
|
||||
/** 采购订单空箱费用 */
|
||||
/** 采购订单包装箱信息 */
|
||||
orderPackageList: OrderPackage[];
|
||||
};
|
||||
|
||||
@ -3495,6 +3616,8 @@ declare namespace BusinessAPI {
|
||||
orderSupplierList: OrderSupplier[];
|
||||
/** 采购订单费用信息 */
|
||||
orderCostList: OrderCost[];
|
||||
/** 采购订单包装箱信息 */
|
||||
orderPackageList: OrderPackage[];
|
||||
};
|
||||
|
||||
type PurchaseOrderVO = {
|
||||
@ -3556,7 +3679,7 @@ declare namespace BusinessAPI {
|
||||
orderSupplierList: OrderSupplier[];
|
||||
/** 采购订单费用信息 */
|
||||
orderCostList: OrderCost[];
|
||||
/** 采购订单空箱费用 */
|
||||
/** 采购订单包装箱信息 */
|
||||
orderPackageList: OrderPackage[];
|
||||
};
|
||||
|
||||
@ -4304,6 +4427,13 @@ declare namespace BusinessAPI {
|
||||
data?: MenuVO;
|
||||
};
|
||||
|
||||
type SingleResponseOrderSupplierVO = {
|
||||
success?: boolean;
|
||||
errCode?: string;
|
||||
errMessage?: string;
|
||||
data?: OrderSupplierVO;
|
||||
};
|
||||
|
||||
type SingleResponseOssTokenVO = {
|
||||
success?: boolean;
|
||||
errCode?: string;
|
||||
|
||||
@ -30,6 +30,10 @@ export class PurchaseOrderCalculator {
|
||||
getTotalPackagingCost(): number {
|
||||
const costItemsCost = this.purchaseOrderVO.orderCostList.reduce(
|
||||
(sum, cost) => {
|
||||
// 先过滤一下
|
||||
if (cost.name === "纸箱费") {
|
||||
return new Decimal(sum).toNumber();
|
||||
}
|
||||
return new Decimal(sum)
|
||||
.plus(new Decimal(cost.price || 0).mul(cost.count || 0))
|
||||
.toNumber();
|
||||
@ -84,6 +88,8 @@ export class PurchaseOrderCalculator {
|
||||
getTotalPurchaseCost(): number {
|
||||
const supplierPurchaseCost = this.getSupplierPurchaseCost();
|
||||
const totalPackagingCost = this.getTotalPackagingCost();
|
||||
console.log("supplierPurchaseCost", supplierPurchaseCost);
|
||||
console.log("totalPackagingCost", totalPackagingCost);
|
||||
return new Decimal(supplierPurchaseCost)
|
||||
.plus(totalPackagingCost)
|
||||
.toNumber();
|
||||
@ -389,9 +395,7 @@ export class PurchaseOrderCalculator {
|
||||
const includePackingFlag =
|
||||
this.purchaseOrderVO.orderDealer?.includePackingFlag;
|
||||
if (includePackingFlag) {
|
||||
return decimal
|
||||
.plus(this.getTotalPackagingCost())
|
||||
.toNumber();
|
||||
return decimal.plus(this.getTotalPackagingCost()).toNumber();
|
||||
}
|
||||
|
||||
return decimal.toNumber();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user