Commit 9fd3a2139a7c8f641aa67b825428294b5b6c0cd8

Authored by zhongnanhuang
2 parents 7cc5f5a5 945ed31e

Merge branch 'znh' into 'develop'

Znh



See merge request !19
src/pages/Order/components/ApplyForInvoicingModal.tsx 0 → 100644
  1 +import { RESPONSE_CODE } from '@/constants/enum';
  2 +import { postServiceOrderApplyInvoicing } from '@/services';
  3 +import {
  4 + ModalForm,
  5 + ProFormTextArea,
  6 + ProFormUploadDragger,
  7 +} from '@ant-design/pro-components';
  8 +import { Form, message } from 'antd';
  9 +export default ({ setCheckVisible, subOrders, onClose }) => {
  10 + const [form] = Form.useForm<{
  11 + applyInvoicingNotes: string;
  12 + filePaths: any;
  13 + subIds: any[];
  14 + }>();
  15 + let subOrderIds = subOrders?.map((subOrder) => subOrder.id);
  16 +
  17 + return (
  18 + <ModalForm<{
  19 + applyInvoicingNotes: string;
  20 + filePaths: any;
  21 + subIds: any[];
  22 + }>
  23 + width={500}
  24 + open
  25 + title="申请开票"
  26 + form={form}
  27 + autoFocusFirstInput
  28 + modalProps={{
  29 + okText: '确认',
  30 + cancelText: '取消',
  31 + destroyOnClose: true,
  32 + onCancel: () => {
  33 + setCheckVisible(false);
  34 + },
  35 + }}
  36 + submitter={{
  37 + render: (props, defaultDoms) => {
  38 + return defaultDoms;
  39 + },
  40 + }}
  41 + submitTimeout={2000}
  42 + onFinish={async (values) => {
  43 + values.subIds = subOrderIds;
  44 + //附件处理
  45 + values.filePaths = values.filePaths?.map((item) => {
  46 + return { url: item.response.data[0] };
  47 + });
  48 +
  49 + const res = await postServiceOrderApplyInvoicing({ data: values });
  50 + if ((res.result = RESPONSE_CODE.SUCCESS)) {
  51 + message.success(res.message);
  52 + onClose();
  53 + }
  54 + }}
  55 + onOpenChange={setCheckVisible}
  56 + >
  57 + <div>如果需要合并订单,请将需要合并的订单id写在备注中。</div>
  58 + <ProFormTextArea
  59 + width="lg"
  60 + name="applyInvoicingNotes"
  61 + placeholder="请输入备注"
  62 + />
  63 + <ProFormUploadDragger
  64 + key="2"
  65 + label="附件"
  66 + name="filePaths"
  67 + action="/api/service/order/fileProcess"
  68 + fieldProps={{
  69 + headers: { Authorization: localStorage.getItem('token') },
  70 + }}
  71 + />
  72 + </ModalForm>
  73 + );
  74 +};
... ...
src/pages/Order/components/ProcureCheckModal.tsx
1 1 import { RESPONSE_CODE } from '@/constants/enum';
2 2 import {
3 3 postServiceOrderProcureCheckOrder,
  4 + postServiceOrderProcureConvertWarehouseKeeper,
4 5 postServiceOrderQuerySupplier,
5 6 } from '@/services';
6 7 import { ModalForm, ProFormSelect } from '@ant-design/pro-components';
7   -import { Form, message } from 'antd';
  8 +import { Button, Form, Input, Popconfirm, message } from 'antd';
  9 +import { useState } from 'react';
8 10 export default ({ setCheckVisible, data, subOrders, onClose }) => {
9 11 const [form] = Form.useForm<{ name: string; company: string }>();
  12 +
  13 + const [checkNotes, setCheckNotes] = useState<string>('');
  14 +
10 15 let subOrderIds: any[] = [];
11 16 //是单条子订单审核
12 17 if (subOrders === undefined) {
... ... @@ -31,7 +36,7 @@ export default ({ setCheckVisible, data, subOrders, onClose }) =&gt; {
31 36 }>
32 37 width={500}
33 38 open
34   - title="供应商选择"
  39 + title="采购审核"
35 40 form={form}
36 41 autoFocusFirstInput
37 42 modalProps={{
... ... @@ -44,7 +49,48 @@ export default ({ setCheckVisible, data, subOrders, onClose }) =&gt; {
44 49 }}
45 50 submitter={{
46 51 render: (props, defaultDoms) => {
47   - return defaultDoms;
  52 + return [
  53 + defaultDoms[0],
  54 + <>
  55 + <Popconfirm
  56 + title="是否转回仓库"
  57 + description={
  58 + <div>
  59 + <div className="py-2">
  60 + <span>转回仓库后将由仓库管理员进行打印、发货</span>
  61 + </div>
  62 + <Input.TextArea
  63 + placeholder="请填写备注"
  64 + onChange={(e: any) => {
  65 + setCheckNotes(e.target.value);
  66 + }}
  67 + rows={4}
  68 + ></Input.TextArea>
  69 + </div>
  70 + }
  71 + onConfirm={async () => {
  72 + const res =
  73 + await postServiceOrderProcureConvertWarehouseKeeper({
  74 + data: {
  75 + subIds: subOrderIds,
  76 + checkNotes: checkNotes,
  77 + },
  78 + });
  79 +
  80 + if (res?.result === RESPONSE_CODE.SUCCESS) {
  81 + message.success(res.message);
  82 + onClose();
  83 + return true;
  84 + }
  85 + }}
  86 + okText="确定"
  87 + cancelText="取消"
  88 + >
  89 + <Button type="primary">转回仓库</Button>
  90 + </Popconfirm>
  91 + </>,
  92 + defaultDoms[1],
  93 + ];
48 94 },
49 95 }}
50 96 submitTimeout={2000}
... ...
src/pages/Order/constant.ts
... ... @@ -112,6 +112,7 @@ export const ORDER_STATUS_OPTIONS = {
112 112 IN_AFTER_SALES: '售后中',
113 113 AFTER_SALES_COMPLETION: '售后完成',
114 114 NO_NEED_SEND: '无需发货',
  115 + PROCURE_CONVERT_WAREHOUSE_KEEPER: '采购转仓库',
115 116 };
116 117  
117 118 export const AFTE_SALES_PLAN_OPTIONS = {
... ... @@ -148,6 +149,7 @@ export const TAGS_COLOR = new Map&lt;string, string&gt;([
148 149 ['PROCURE_PROCESS_FOR_MINE', 'processing'],
149 150 ['PROCURE_WAIT_SHIP', 'processing'],
150 151 ['NO_NEED_SEND', 'success'],
  152 + ['PROCURE_CONVERT_WAREHOUSE_KEEPER', 'processing'],
151 153 ]);
152 154  
153 155 export const SALES_CODE_OPTIONS = [
... ... @@ -217,6 +219,7 @@ export const HISTORY_OPT_TYPE = new Map&lt;string, string&gt;([
217 219 ['PROCURE_PRINT', '采购打印子订单'],
218 220 ['PROCURE_SEND', '采购发货子订单'],
219 221 ['NO_NEED_SEND', '不需要发货'],
  222 + ['PROCURE_CONVERT_WAREHOUSE_KEEPER', '采购转仓库'],
220 223 ]);
221 224  
222 225 export const MAIN_ORDER_COLUMNS = [
... ...
src/pages/Order/index.tsx
... ... @@ -41,6 +41,7 @@ import { cloneDeep } from &#39;lodash&#39;;
41 41 import { Key, useRef, useState } from 'react';
42 42 import OrderPrintModal from '../OrderPrint/OrderPrintModal';
43 43 import AfterSalesDrawer from './components/AfterSalesDrawer';
  44 +import ApplyForInvoicingModal from './components/ApplyForInvoicingModal';
44 45 import AttachmentModal from './components/AttachmentModal';
45 46 import CheckModal from './components/CheckModal';
46 47 import ConfirmReceiptModal from './components/ConfirmReceiptModal';
... ... @@ -89,6 +90,8 @@ const OrderPage = () =&gt; {
89 90 const [isSendProduct, setIsSendProduct] = useState<boolean>(false);
90 91 const [isMainOrder, setIsMainOrder] = useState<boolean>(false);
91 92 const [importModalVisible, setImportModalVisible] = useState<boolean>(false);
  93 + const [applyForInvoicingVisible, setApplyForInvoicingVisible] =
  94 + useState<boolean>(false);
92 95 const [procureCheckModalVisible, setProcureCheckModalVisible] =
93 96 useState<boolean>(false);
94 97 const [confirmReceiptVisible, setConfirmReceiptVisible] =
... ... @@ -190,6 +193,24 @@ const OrderPage = () =&gt; {
190 193 );
191 194 };
192 195  
  196 + /**
  197 + * 检查是否可以打印
  198 + * @param paths 按钮集合
  199 + * @returns
  200 + */
  201 + function checkePrintable(paths: any) {
  202 + if (
  203 + !paths?.includes('printOrder') &&
  204 + !paths?.includes('supplierPrint') &&
  205 + !paths?.includes('procurePrint') &&
  206 + !paths?.includes('rePrintOrder')
  207 + ) {
  208 + return false;
  209 + }
  210 +
  211 + return true;
  212 + }
  213 +
193 214 const onCheckboxChange = (record: never) => {
194 215 let newSelectedItems = [];
195 216 if (selectedItems.includes(record.id)) {
... ... @@ -308,6 +329,28 @@ const OrderPage = () =&gt; {
308 329 );
309 330 }
310 331  
  332 + if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') {
  333 + return (
  334 + <MyToolTip
  335 + title={optRecord.checkNotes}
  336 + content={
  337 + <>
  338 + <Tag
  339 + color={TAGS_COLOR.get(optRecord.orderStatus)}
  340 + style={{ marginRight: '4px' }}
  341 + >
  342 + {enumValueToLabel(
  343 + optRecord.orderStatus,
  344 + ORDER_STATUS_OPTIONS,
  345 + )}
  346 + </Tag>
  347 + <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
  348 + </>
  349 + }
  350 + />
  351 + );
  352 + }
  353 +
311 354 return (
312 355 <Tag color={TAGS_COLOR.get(optRecord.orderStatus)}>
313 356 {enumValueToLabel(optRecord.orderStatus, ORDER_STATUS_OPTIONS)}
... ... @@ -349,22 +392,6 @@ const OrderPage = () =&gt; {
349 392 }}
350 393 />
351 394 </Flex>
352   -
353   - <Flex title={optRecord.notes}>
354   - <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis">
355   - <span className="text-[#8C8C8C]">
356   - 开票备注:请将2312210003,2312210002,2312210001订单合并开票
357   - </span>
358   - </div>
359   - {/* 编辑备注按钮 */}
360   - <EditTwoTone
361   - onClick={() => {
362   - setNotesEditVisible(true);
363   - setOrderRow(optRecord);
364   - setIsMainOrder(false);
365   - }}
366   - />
367   - </Flex>
368 395 </Flex>
369 396 <Flex className="w-[16%]" vertical gap="small">
370 397 <div
... ... @@ -663,6 +690,22 @@ const OrderPage = () =&gt; {
663 690 ) : (
664 691 ''
665 692 )}
  693 +
  694 + {optRecord.subPath?.includes('applyInvoicing') ? (
  695 + <Button
  696 + className="p-0"
  697 + type="link"
  698 + onClick={() => {
  699 + setApplyForInvoicingVisible(true);
  700 + setSelectedRows([optRecord]);
  701 + }}
  702 + >
  703 + 申请开票
  704 + </Button>
  705 + ) : (
  706 + ''
  707 + )}
  708 +
666 709 {optRecord.subPath?.includes('checkOrder') ? (
667 710 <Button
668 711 className="p-0"
... ... @@ -1079,10 +1122,18 @@ const OrderPage = () =&gt; {
1079 1122 className="p-0"
1080 1123 type="link"
1081 1124 onClick={() => {
1082   - if (!selectedRowObj[record.id]?.length) {
  1125 + const selectedSubOrders = selectedRowObj[record.id];
  1126 + if (!selectedSubOrders?.length) {
1083 1127 return message.error('请选择选择子订单');
1084 1128 }
1085   - setSelectedRows(selectedRowObj[record.id]);
  1129 +
  1130 + for (let subOrderRecord of selectedSubOrders) {
  1131 + let subPath = subOrderRecord.subPath;
  1132 + if (!checkePrintable(subPath)) {
  1133 + return message.error('请选择可以打印的子订单');
  1134 + }
  1135 + }
  1136 + setSelectedRows(selectedSubOrders);
1086 1137 setOrderRow(record);
1087 1138 setOrderPrintVisible(true);
1088 1139 setOrderCheckType(CHECK_TYPE.NORMAL);
... ... @@ -1186,6 +1237,40 @@ const OrderPage = () =&gt; {
1186 1237 ) : (
1187 1238 ''
1188 1239 )}
  1240 +
  1241 + {record.mainPath?.includes('applyInvoicing') ? (
  1242 + <Button
  1243 + type="link"
  1244 + className="p-0"
  1245 + onClick={() => {
  1246 + let selectedSubOrders = selectedRowObj[record.id];
  1247 + if (selectedSubOrders === undefined) {
  1248 + selectedSubOrders = record.subOrderInformationLists;
  1249 + }
  1250 +
  1251 + setSelectedRows(selectedSubOrders);
  1252 + for (let i = 0; i < selectedSubOrders.length; i++) {
  1253 + if (
  1254 + selectedSubOrders[i].invoicingStatus ===
  1255 + 'UN_INVOICE' ||
  1256 + selectedSubOrders[i].afterInvoicingStatus ===
  1257 + 'APPLY_FOR_INVOICING'
  1258 + ) {
  1259 + message.error(
  1260 + '请选择需要开票且未申请开票的子订单进行申请',
  1261 + );
  1262 + return;
  1263 + }
  1264 + }
  1265 + setApplyForInvoicingVisible(true);
  1266 + }}
  1267 + >
  1268 + 申请开票
  1269 + </Button>
  1270 + ) : (
  1271 + ''
  1272 + )}
  1273 +
1189 1274 {record.mainPath?.includes('updateOrder') ? (
1190 1275 <Button
1191 1276 className="p-0"
... ... @@ -1779,6 +1864,18 @@ const OrderPage = () =&gt; {
1779 1864 />
1780 1865 )}
1781 1866  
  1867 + {applyForInvoicingVisible && (
  1868 + <ApplyForInvoicingModal
  1869 + setCheckVisible={setApplyForInvoicingVisible}
  1870 + subOrders={selectedRows}
  1871 + onClose={() => {
  1872 + setApplyForInvoicingVisible(false);
  1873 + setSelectedRows({});
  1874 + refreshTable();
  1875 + }}
  1876 + />
  1877 + )}
  1878 +
1782 1879 {notesEditVisible && (
1783 1880 <OrderNotesEditModal
1784 1881 setNotesEditVisible={setNotesEditVisible}
... ...
src/services/definition.ts
... ... @@ -709,6 +709,19 @@ export interface ProcureCheckOrderDto {
709 709 supplier?: string;
710 710 }
711 711  
  712 +export interface ProcureConvertWarehouseKeeperDto {
  713 + /**
  714 + * @description
  715 + * 审核备注
  716 + */
  717 + checkNotes?: string;
  718 + /**
  719 + * @description
  720 + * 子订单id集合
  721 + */
  722 + subIds?: Array<number>;
  723 +}
  724 +
712 725 export interface ProcurePrintDto {
713 726 /**
714 727 * @description
... ... @@ -745,7 +758,16 @@ export interface QueryAnnexDto {
745 758 }
746 759  
747 760 export interface QueryHistoryRecordDto {
  761 + /**
  762 + * @description
  763 + * 子订单id集合
  764 + */
748 765 ids?: Array<number>;
  766 + /**
  767 + * @description
  768 + * 查看已经删除的订单,false表示查看未删除的订单,true表示查看删除的订单
  769 + */
  770 + isDeleteQueryOrder?: boolean;
749 771 }
750 772  
751 773 export interface QueryMainOrderDto {
... ...
src/services/request.ts
... ... @@ -35,6 +35,7 @@ import type {
35 35 OrderUnlockFieldApplyVO,
36 36 OrderUpdateVO,
37 37 ProcureCheckOrderDto,
  38 + ProcureConvertWarehouseKeeperDto,
38 39 ProcurePrintDto,
39 40 ProductInformationDto,
40 41 QueryAnnexDto,
... ... @@ -575,6 +576,77 @@ export const patchError = /* #__PURE__ */ (() =&gt; {
575 576 return request;
576 577 })();
577 578  
  579 +/** @description request parameter type for postOfficialWebsiteUploadAliOss */
  580 +export interface PostOfficialWebsiteUploadAliOssOption {
  581 + /**
  582 + * @description
  583 + * files
  584 + */
  585 + formData: {
  586 + /**
  587 + @description
  588 + files */
  589 + files: Array<File>;
  590 + };
  591 +}
  592 +
  593 +/** @description response type for postOfficialWebsiteUploadAliOss */
  594 +export interface PostOfficialWebsiteUploadAliOssResponse {
  595 + /**
  596 + * @description
  597 + * OK
  598 + */
  599 + 200: ServerResult;
  600 + /**
  601 + * @description
  602 + * Created
  603 + */
  604 + 201: any;
  605 + /**
  606 + * @description
  607 + * Unauthorized
  608 + */
  609 + 401: any;
  610 + /**
  611 + * @description
  612 + * Forbidden
  613 + */
  614 + 403: any;
  615 + /**
  616 + * @description
  617 + * Not Found
  618 + */
  619 + 404: any;
  620 +}
  621 +
  622 +export type PostOfficialWebsiteUploadAliOssResponseSuccess =
  623 + PostOfficialWebsiteUploadAliOssResponse[200];
  624 +/**
  625 + * @description
  626 + * 为官网提供上传文件的接口
  627 + * @tags 官网
  628 + * @produces *
  629 + * @consumes application/json
  630 + */
  631 +export const postOfficialWebsiteUploadAliOss = /* #__PURE__ */ (() => {
  632 + const method = 'post';
  633 + const url = '/official/website/uploadAliOss';
  634 + function request(
  635 + option: PostOfficialWebsiteUploadAliOssOption,
  636 + ): Promise<PostOfficialWebsiteUploadAliOssResponseSuccess> {
  637 + return requester(request.url, {
  638 + method: request.method,
  639 + ...option,
  640 + }) as unknown as Promise<PostOfficialWebsiteUploadAliOssResponseSuccess>;
  641 + }
  642 +
  643 + /** http method */
  644 + request.method = method;
  645 + /** request url */
  646 + request.url = url;
  647 + return request;
  648 +})();
  649 +
578 650 /** @description request parameter type for postOrderErpApplyList */
579 651 export interface PostOrderErpApplyListOption {
580 652 /**
... ... @@ -4927,6 +4999,77 @@ export const postServiceOrderApplyAfterSales = /* #__PURE__ */ (() =&gt; {
4927 4999 return request;
4928 5000 })();
4929 5001  
  5002 +/** @description request parameter type for postServiceOrderApplyInvoicing */
  5003 +export interface PostServiceOrderApplyInvoicingOption {
  5004 + /**
  5005 + * @description
  5006 + * dto
  5007 + */
  5008 + body: {
  5009 + /**
  5010 + @description
  5011 + dto */
  5012 + dto: Dto;
  5013 + };
  5014 +}
  5015 +
  5016 +/** @description response type for postServiceOrderApplyInvoicing */
  5017 +export interface PostServiceOrderApplyInvoicingResponse {
  5018 + /**
  5019 + * @description
  5020 + * OK
  5021 + */
  5022 + 200: ServerResult;
  5023 + /**
  5024 + * @description
  5025 + * Created
  5026 + */
  5027 + 201: any;
  5028 + /**
  5029 + * @description
  5030 + * Unauthorized
  5031 + */
  5032 + 401: any;
  5033 + /**
  5034 + * @description
  5035 + * Forbidden
  5036 + */
  5037 + 403: any;
  5038 + /**
  5039 + * @description
  5040 + * Not Found
  5041 + */
  5042 + 404: any;
  5043 +}
  5044 +
  5045 +export type PostServiceOrderApplyInvoicingResponseSuccess =
  5046 + PostServiceOrderApplyInvoicingResponse[200];
  5047 +/**
  5048 + * @description
  5049 + * 销售发起开票
  5050 + * @tags 内部订单
  5051 + * @produces *
  5052 + * @consumes application/json
  5053 + */
  5054 +export const postServiceOrderApplyInvoicing = /* #__PURE__ */ (() => {
  5055 + const method = 'post';
  5056 + const url = '/service/order/applyInvoicing';
  5057 + function request(
  5058 + option: PostServiceOrderApplyInvoicingOption,
  5059 + ): Promise<PostServiceOrderApplyInvoicingResponseSuccess> {
  5060 + return requester(request.url, {
  5061 + method: request.method,
  5062 + ...option,
  5063 + }) as unknown as Promise<PostServiceOrderApplyInvoicingResponseSuccess>;
  5064 + }
  5065 +
  5066 + /** http method */
  5067 + request.method = method;
  5068 + /** request url */
  5069 + request.url = url;
  5070 + return request;
  5071 +})();
  5072 +
4930 5073 /** @description request parameter type for postServiceOrderCheckOrder */
4931 5074 export interface PostServiceOrderCheckOrderOption {
4932 5075 /**
... ... @@ -5991,6 +6134,78 @@ export const postServiceOrderProcureCheckOrder = /* #__PURE__ */ (() =&gt; {
5991 6134 return request;
5992 6135 })();
5993 6136  
  6137 +/** @description request parameter type for postServiceOrderProcureConvertWarehouseKeeper */
  6138 +export interface PostServiceOrderProcureConvertWarehouseKeeperOption {
  6139 + /**
  6140 + * @description
  6141 + * dto
  6142 + */
  6143 + body: {
  6144 + /**
  6145 + @description
  6146 + dto */
  6147 + dto: ProcureConvertWarehouseKeeperDto;
  6148 + };
  6149 +}
  6150 +
  6151 +/** @description response type for postServiceOrderProcureConvertWarehouseKeeper */
  6152 +export interface PostServiceOrderProcureConvertWarehouseKeeperResponse {
  6153 + /**
  6154 + * @description
  6155 + * OK
  6156 + */
  6157 + 200: ServerResult;
  6158 + /**
  6159 + * @description
  6160 + * Created
  6161 + */
  6162 + 201: any;
  6163 + /**
  6164 + * @description
  6165 + * Unauthorized
  6166 + */
  6167 + 401: any;
  6168 + /**
  6169 + * @description
  6170 + * Forbidden
  6171 + */
  6172 + 403: any;
  6173 + /**
  6174 + * @description
  6175 + * Not Found
  6176 + */
  6177 + 404: any;
  6178 +}
  6179 +
  6180 +export type PostServiceOrderProcureConvertWarehouseKeeperResponseSuccess =
  6181 + PostServiceOrderProcureConvertWarehouseKeeperResponse[200];
  6182 +/**
  6183 + * @description
  6184 + * 采购转回仓库
  6185 + * @tags 内部订单
  6186 + * @produces *
  6187 + * @consumes application/json
  6188 + */
  6189 +export const postServiceOrderProcureConvertWarehouseKeeper =
  6190 + /* #__PURE__ */ (() => {
  6191 + const method = 'post';
  6192 + const url = '/service/order/procureConvertWarehouseKeeper';
  6193 + function request(
  6194 + option: PostServiceOrderProcureConvertWarehouseKeeperOption,
  6195 + ): Promise<PostServiceOrderProcureConvertWarehouseKeeperResponseSuccess> {
  6196 + return requester(request.url, {
  6197 + method: request.method,
  6198 + ...option,
  6199 + }) as unknown as Promise<PostServiceOrderProcureConvertWarehouseKeeperResponseSuccess>;
  6200 + }
  6201 +
  6202 + /** http method */
  6203 + request.method = method;
  6204 + /** request url */
  6205 + request.url = url;
  6206 + return request;
  6207 + })();
  6208 +
5994 6209 /** @description request parameter type for postServiceOrderProcurePrint */
5995 6210 export interface PostServiceOrderProcurePrintOption {
5996 6211 /**
... ...