Commit 7d171173862f64eebefeca0184eb1ad7817def64

Authored by 曾国涛
1 parent 98ce63ab

feat(Order): 修复一些bug

.umirc.ts
... ... @@ -102,7 +102,7 @@ export default defineConfig({
102 102 },
103 103 {
104 104 name: '待红冲发票',
105   - path: 'waitFlushInvoice',
  105 + path: 'wnpmaitFlushInvoice',
106 106 icon: 'BookOutlined',
107 107 access: 'canReadAdminAndFinanceAndSales',
108 108 component: './Invoice/waitFlushInvoice',
... ...
src/pages/Invoice/Invoice/index.tsx
... ... @@ -184,7 +184,7 @@ const InvoiceRecord = () => {
184 184 text="删除"
185 185 onConfirm={async () => {
186 186 let res = await postServiceInvoiceDeleteInvoice({
187   - data: { invoiceId: record.id },
  187 + data: { invoiceIds: [record.id] },
188 188 });
189 189 if (res) {
190 190 message.success(res.message);
... ...
src/pages/Invoice/InvoiceRecord/index.tsx
... ... @@ -446,6 +446,7 @@ const InvoiceRecord = () => {
446 446 () => {
447 447 messageApi.destroy();
448 448 },
  449 + '开票记录',
449 450 );
450 451 }}
451 452 >
... ...
src/pages/Invoice/waitFlushInvoice/index.tsx
... ... @@ -19,7 +19,6 @@ const InvoiceRecord = () => {
19 19 const [invoiceVerificationVisible, setInvoiceVerificationVisible] =
20 20 useState(false);
21 21 const [invoiceId, setInvoiceId] = useState(undefined);
22   - const [setPerms] = useState([]);
23 22 const [messageApi, contextHolder] = message.useMessage();
24 23 const reloadInvoiceTable = () => {
25 24 invoiceActionRef.current?.reload();
... ... @@ -101,7 +100,7 @@ const InvoiceRecord = () => {
101 100 title: '收款单位',
102 101 dataIndex: 'payee',
103 102 valueType: 'text',
104   - width: 200,
  103 + width: 250,
105 104 valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
106 105 },
107 106 {
... ... @@ -123,7 +122,7 @@ const InvoiceRecord = () => {
123 122 key: 'option',
124 123 fixed: 'right',
125 124 width: 160,
126   - render: ({ record }) => {
  125 + render: (record) => {
127 126 let btns = [];
128 127 if (record.paths?.includes('queryInvoiceDetails')) {
129 128 btns.push(
... ... @@ -234,7 +233,6 @@ const InvoiceRecord = () => {
234 233 },
235 234 });
236 235 if (res) {
237   - setPerms(res?.data?.specialPath);
238 236 return {
239 237 data: res?.data?.data || [],
240 238 total: res?.data?.total || 0,
... ...
src/pages/Order/Order/index.tsx
... ... @@ -5,11 +5,12 @@ import {
5 5 } from '@/services';
6 6 import { getUserInfo } from '@/utils/user';
7 7 import { useModel } from '@umijs/max';
8   -import { Button, Card, Col, Modal, Row } from 'antd';
  8 +import { Button, Card, Col, Modal, Row, message } from 'antd';
9 9 import { useEffect, useState } from 'react';
10 10 import OrderList from '../OrderList/OrderList';
11 11 import './index.less';
12 12 // import { useNavigate } from 'react-router-dom';
  13 +import { excelExport } from '@/services/exportRequest';
13 14 import { ProCard, ProTable } from '@ant-design/pro-components';
14 15 import { history } from '@umijs/max';
15 16 // import { format } from 'fecha';
... ... @@ -46,6 +47,7 @@ const OrderPage = () => {
46 47 const [pendingDelivery, setPendingDelivery] = useState(0);
47 48 const [pendingCompletion, setPendingCompletion] = useState(0);
48 49 const [deliveryOpen, setDeliveryOpen] = useState(false);
  50 + const [messageApi, contextHolder] = message.useMessage();
49 51 async function getInvoiceWarningNum() {
50 52 const res = await postServiceOrderWarningOrderStatistics({
51 53 data: {
... ... @@ -118,7 +120,7 @@ const OrderPage = () => {
118 120 <div className="order-page-container">
119 121 <div id="resizeDiv"></div>
120 122 <div id="resizeDiv"></div>
121   - {roleCode === 'SALES_REPRESENTATIVE' && (
  123 + {roleCode !== 'SALES_MANAGER' && (
122 124 <Modal
123 125 title="订单预警提醒"
124 126 open={open}
... ... @@ -535,6 +537,45 @@ const OrderPage = () =&gt; {
535 537 return res.data;
536 538 }}
537 539 rowKey="index"
  540 + search={{
  541 + labelWidth: 'auto',
  542 + defaultCollapsed: false,
  543 + optionRender: (searchConfig, formProps, dom) => [
  544 + ...dom,
  545 + <Button
  546 + key="out"
  547 + onClick={() => {
  548 + const searchParams =
  549 + searchConfig?.form?.getFieldsValue();
  550 + const values = {
  551 + ...searchConfig?.form?.getFieldsValue(),
  552 + limitOrderDatetimeGe: searchParams?.limitDatetime
  553 + ? searchParams.limitDatetime[0]
  554 + : null,
  555 + limitOrderDatetimeLe: searchParams?.limitDatetime
  556 + ? searchParams.limitDatetime[1]
  557 + : null,
  558 + };
  559 + messageApi.open({
  560 + type: 'loading',
  561 + content: '正在导出文件...',
  562 + });
  563 + excelExport(
  564 + '/api/service/order/exportLockOrders',
  565 + {
  566 + ...values,
  567 + },
  568 + () => {
  569 + messageApi.destroy();
  570 + },
  571 + '锁单',
  572 + );
  573 + }}
  574 + >
  575 + 导出
  576 + </Button>,
  577 + ],
  578 + }}
538 579 pagination={{ pageSize: 10 }}
539 580 />
540 581 </ProCard.TabPane>
... ... @@ -661,7 +702,7 @@ const OrderPage = () =&gt; {
661 702 </Row>
662 703 </Modal>
663 704 )}
664   -
  705 + {contextHolder}
665 706 <OrderList paramsNew={{}} searchShow={true} toolbarShow={true} />
666 707 </div>
667 708 );
... ...
src/pages/Order/OrderList/OrderList.tsx
... ... @@ -18,6 +18,7 @@ import {
18 18 postServiceOrderProcureOrder,
19 19 postServiceOrderProcurePrint,
20 20 postServiceOrderProvideProcurementRoles,
  21 + postServiceOrderPurchaseRejectionToSale,
21 22 postServiceOrderQueryServiceOrder,
22 23 postServiceOrderSaleCancelInvoicing,
23 24 postServiceOrderSalesConfirm,
... ... @@ -67,6 +68,7 @@ import {
67 68 Flex,
68 69 FloatButton,
69 70 Image,
  71 + Input,
70 72 MenuProps,
71 73 Modal,
72 74 Popconfirm,
... ... @@ -232,7 +234,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) =&gt; {
232 234 .flat()
233 235 .every((subItem) => subItem.paths?.includes('applyInvoicing_old'));
234 236 }, [selectedSubOrderKeys]);
235   -
  237 + const [procureNotes, setProcureNotes] = useState<string>('');
236 238 console.log(JSON.stringify(userInfo));
237 239 const triggerRecordOptNode = async (id) => {
238 240 const res = await postServiceOrderGetCurrentOptNode({
... ... @@ -1972,6 +1974,42 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) =&gt; {
1972 1974 ''
1973 1975 )}
1974 1976  
  1977 + {optRecord.paths?.includes('procureReject') && (
  1978 + <Popconfirm
  1979 + title="是否驳回至销售"
  1980 + description={
  1981 + <div>
  1982 + <Input.TextArea
  1983 + placeholder="请填写备注"
  1984 + onChange={(e: any) => {
  1985 + setProcureNotes(e.target.value);
  1986 + }}
  1987 + rows={4}
  1988 + ></Input.TextArea>
  1989 + </div>
  1990 + }
  1991 + onConfirm={async () => {
  1992 + let res = await postServiceOrderPurchaseRejectionToSale({
  1993 + data: {
  1994 + subIds: [optRecord.id],
  1995 + procureNotes: procureNotes,
  1996 + },
  1997 + });
  1998 +
  1999 + if (res?.result === RESPONSE_CODE.SUCCESS) {
  2000 + message.success(res.message);
  2001 + clearOptObject();
  2002 + setIsMainOrder(false);
  2003 + refreshTable();
  2004 + return true;
  2005 + }
  2006 + }}
  2007 + okText="确定"
  2008 + cancelText="取消"
  2009 + >
  2010 + <Button type="link">驳回至销售</Button>
  2011 + </Popconfirm>
  2012 + )}
1975 2013 {optRecord.paths?.includes('procureConvertProcure') ? (
1976 2014 <Button
1977 2015 className="p-0"
... ... @@ -4646,6 +4684,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) =&gt; {
4646 4684 columns={mainOrdersColumns}
4647 4685 rowKey="id"
4648 4686 pagination={{
  4687 + pageSizeOptions: [10, 20, 50, 100, 200],
4649 4688 showQuickJumper: true,
4650 4689 pageSize: pageSize,
4651 4690 current: currentPage,
... ...
src/pages/Order/WarningWhitelist/index.tsx
... ... @@ -208,7 +208,7 @@ const WarningWhitelist = () =&gt; {
208 208 onConfirm={async () => {
209 209 await postServiceOrderDeleteWarningOrderWhiteList({
210 210 query: {
211   - id: record.id,
  211 + orderId: record.orderId,
212 212 },
213 213 });
214 214 action?.reload();
... ...
src/pages/Order/constant.ts
... ... @@ -264,6 +264,8 @@ export const AFTER_INVOICING_STATUS = {
264 264 COMPLETE_INVOICING: '完全开票',
265 265 INVOICING: '开票中',
266 266 REISSUE: '重新开票',
  267 + WAIT_FLUSH: '待冲红',
  268 + FLUSHED: '已冲红',
267 269 };
268 270  
269 271 export const TAGS_COLOR = new Map<string, string>([
... ...
src/pages/Prepaid/constant.tsx
... ... @@ -247,6 +247,13 @@ export const BALANCE_CHANGE_COLUMNS = [
247 247 width: 200,
248 248 },
249 249 {
  250 + title: '关联订单id',
  251 + dataIndex: 'linkId',
  252 + key: 'linkId',
  253 + dataType: 'text',
  254 + width: 200,
  255 + },
  256 + {
250 257 title: '类型',
251 258 dataIndex: 'title',
252 259 key: 'title',
... ...
src/pages/integral/index.tsx 0 → 100644
  1 +import ButtonConfirm from '@/components/ButtomConfirm';
  2 +import EllipsisDiv from '@/components/Div/EllipsisDiv';
  3 +import { RESPONSE_CODE } from '@/constants/enum';
  4 +import {} from '@/pages/Invoice/constant';
  5 +import {
  6 + postCanrdApiUserList,
  7 + postPrepaidDelete,
  8 + postPrepaidList,
  9 +} from '@/services';
  10 +import { enumValueToLabel, formatDateTime } from '@/utils';
  11 +import { PlusOutlined } from '@ant-design/icons';
  12 +import { ActionType, ProTable } from '@ant-design/pro-components';
  13 +import { Button, Divider, Image, Tabs, message } from 'antd';
  14 +import { cloneDeep } from 'lodash';
  15 +import React, { useRef, useState } from 'react';
  16 +import CheckModal from '../Order/Order/components/CheckModal';
  17 +import { CHECK_TYPE } from '../Order/constant';
  18 +import BalanceChangeRecordsModal from './components/BalanceChangeRecordsModal';
  19 +import RechargePrepaymentModal from './components/RechargePrepaymentModal';
  20 +import {
  21 + ACCOUNT_COLUMNS,
  22 + PREPAID_STATUS_OPTIONS,
  23 + SALES_RECHARGE_PREPAYMENT_COLUMNS,
  24 +} from './constant';
  25 +import './index.less';
  26 +const PrepaidPage = () => {
  27 + const prepaidActionRef = useRef<ActionType>();
  28 + const accountActionRef = useRef<ActionType>();
  29 + const [rechargePrepaymentModalVisible, setRechargePrepaymentModalVisible] =
  30 + useState(false);
  31 + const [currentOptPrepaymentObj, setCurrentOptPrepaymentObj] = useState(null);
  32 + const [currentOptUserObj, setCurrentOptUserObj] = useState(null);
  33 + const [checkVisible, setCheckVisible] = useState(false);
  34 + const [
  35 + balanceChangeRecordsModalVisible,
  36 + setBalanceChangeRecordsModalVisible,
  37 + ] = useState(false);
  38 +
  39 + const reloadPrepaidTable = () => {
  40 + prepaidActionRef.current?.reload();
  41 + };
  42 +
  43 + const reloadAccountTable = () => {
  44 + accountActionRef.current?.reload();
  45 + };
  46 +
  47 + const getTableCellText = (target: any) => {
  48 + if (!target) {
  49 + return '';
  50 + }
  51 +
  52 + if (target.props) {
  53 + return target.props.text;
  54 + }
  55 +
  56 + return target;
  57 + };
  58 +
  59 + /**
  60 + * 加载发票列表表格的各个列格式
  61 + */
  62 + const prepaidColumnsInit = () => {
  63 + let columns = SALES_RECHARGE_PREPAYMENT_COLUMNS.map((item) => {
  64 + let newItem = { ...item };
  65 + let dataIndex = item.dataIndex;
  66 +
  67 + newItem.render = (text, record) => {
  68 + let textValue = record[dataIndex];
  69 +
  70 + if (dataIndex === 'status') {
  71 + textValue = enumValueToLabel(textValue, PREPAID_STATUS_OPTIONS);
  72 + }
  73 +
  74 + if (dataIndex.endsWith('Time')) {
  75 + textValue = formatDateTime(textValue);
  76 + }
  77 +
  78 + if (
  79 + dataIndex === 'proofImages' &&
  80 + textValue !== null &&
  81 + textValue !== undefined
  82 + ) {
  83 + console.log(textValue);
  84 + return (
  85 + <Image.PreviewGroup
  86 + className="mr-10"
  87 + preview={{
  88 + onChange: (current, prev) =>
  89 + console.log(`current index: ${current}, prev index: ${prev}`),
  90 + }}
  91 + >
  92 + {textValue.map((item, index) => (
  93 + <React.Fragment key={index}>
  94 + {index > 0 ? <Divider type="vertical" /> : ''}
  95 + <Image
  96 + className="max-h-[35px] max-w-[45px]"
  97 + src={item}
  98 + title={item}
  99 + />{' '}
  100 + </React.Fragment>
  101 + ))}
  102 + </Image.PreviewGroup>
  103 + );
  104 + }
  105 +
  106 + return <EllipsisDiv text={textValue} />;
  107 + };
  108 +
  109 + return newItem;
  110 + });
  111 +
  112 + columns.push({
  113 + title: '操作',
  114 + valueType: 'option',
  115 + key: 'option',
  116 + fixed: 'right',
  117 + width: 120,
  118 + render: (text, record) => {
  119 + let btns = [];
  120 + let opts = record.operations;
  121 + if (opts?.includes('modify')) {
  122 + btns.push(
  123 + <Button
  124 + className="p-0"
  125 + key="modify"
  126 + type="link"
  127 + onClick={() => {
  128 + setRechargePrepaymentModalVisible(true);
  129 + setCurrentOptPrepaymentObj(cloneDeep(record));
  130 + }}
  131 + >
  132 + 编辑
  133 + </Button>,
  134 + );
  135 + }
  136 +
  137 + if (opts?.includes('audit')) {
  138 + btns.push(
  139 + <Button
  140 + className="p-0"
  141 + key="view"
  142 + type="link"
  143 + onClick={() => {
  144 + setCurrentOptPrepaymentObj(record);
  145 + setCheckVisible(true);
  146 + }}
  147 + >
  148 + 审核
  149 + </Button>,
  150 + );
  151 + }
  152 +
  153 + if (opts?.includes('delete')) {
  154 + btns.push(
  155 + <ButtonConfirm
  156 + key="delete"
  157 + className="p-0"
  158 + title={'确认删除这条预存记录吗?'}
  159 + text="删除"
  160 + onConfirm={async () => {
  161 + let res = await postPrepaidDelete({
  162 + data: { ids: [record.id] },
  163 + });
  164 + if (res && res.result === RESPONSE_CODE.SUCCESS) {
  165 + message.success(res.message);
  166 + reloadPrepaidTable();
  167 + }
  168 + }}
  169 + />,
  170 + );
  171 + }
  172 + return btns;
  173 + },
  174 + });
  175 +
  176 + return columns;
  177 + };
  178 +
  179 + const accountColumnsInit = () => {
  180 + let columns = ACCOUNT_COLUMNS.map((item) => {
  181 + let newItem = { ...item };
  182 + let dataIndex = item.dataIndex;
  183 +
  184 + newItem.render = (text, record) => {
  185 + let textValue = record[dataIndex];
  186 + return <EllipsisDiv text={getTableCellText(textValue)} />;
  187 + };
  188 +
  189 + return newItem;
  190 + });
  191 +
  192 + columns.push({
  193 + title: '操作',
  194 + valueType: 'option',
  195 + key: 'option',
  196 + fixed: 'right',
  197 + width: 120,
  198 + render: (text, record) => {
  199 + let btns = [];
  200 + btns.push(
  201 + <Button
  202 + className="p-0"
  203 + key="view"
  204 + type="link"
  205 + onClick={() => {
  206 + setCurrentOptUserObj(record);
  207 + setBalanceChangeRecordsModalVisible(true);
  208 + }}
  209 + >
  210 + 消费记录
  211 + </Button>,
  212 + );
  213 + return btns;
  214 + },
  215 + });
  216 +
  217 + return columns;
  218 + };
  219 +
  220 + const tabsItems = [
  221 + {
  222 + key: 1,
  223 + label: '预存充值',
  224 + children: (
  225 + <ProTable
  226 + columns={prepaidColumnsInit()}
  227 + actionRef={prepaidActionRef}
  228 + cardBordered
  229 + pagination={{
  230 + pageSize: 10,
  231 + }}
  232 + request={async (params) => {
  233 + const res = await postPrepaidList({
  234 + data: { ...params },
  235 + });
  236 + return {
  237 + data: res?.data?.data || [],
  238 + total: res?.data?.total || 0,
  239 + };
  240 + }}
  241 + columnsState={{
  242 + persistenceKey: 'pro-table-singe-prepaid',
  243 + persistenceType: 'localStorage',
  244 + defaultValue: {
  245 + option: { fixed: 'right', disable: true },
  246 + },
  247 + onChange(value) {
  248 + console.log('value: ', value);
  249 + },
  250 + }}
  251 + rowKey="id"
  252 + search={{
  253 + labelWidth: 'auto',
  254 + }}
  255 + options={{
  256 + setting: {
  257 + listsHeight: 400,
  258 + },
  259 + }}
  260 + form={{}}
  261 + dateFormatter="string"
  262 + headerTitle="预存充值"
  263 + scroll={{ x: 1400 }}
  264 + toolBarRender={() => [
  265 + <Button
  266 + key="button"
  267 + icon={<PlusOutlined />}
  268 + onClick={() => {
  269 + setCurrentOptPrepaymentObj(null);
  270 + setRechargePrepaymentModalVisible(true);
  271 + }}
  272 + type="primary"
  273 + >
  274 + 新增充值
  275 + </Button>,
  276 + ]}
  277 + />
  278 + ),
  279 + },
  280 + {
  281 + key: 2,
  282 + label: '账号列表',
  283 + children: (
  284 + <ProTable
  285 + columns={accountColumnsInit()}
  286 + actionRef={accountActionRef}
  287 + cardBordered
  288 + pagination={{
  289 + pageSize: 10,
  290 + }}
  291 + request={async (params) => {
  292 + const res = await postCanrdApiUserList({
  293 + data: { ...params },
  294 + });
  295 + return {
  296 + data: res?.data?.data || [],
  297 + total: res?.data?.total || 0,
  298 + };
  299 + }}
  300 + columnsState={{
  301 + persistenceKey: 'pro-table-singe-account',
  302 + persistenceType: 'localStorage',
  303 + defaultValue: {
  304 + option: { fixed: 'right', disable: true },
  305 + },
  306 + onChange(value) {
  307 + console.log('value: ', value);
  308 + },
  309 + }}
  310 + rowKey="id"
  311 + search={{
  312 + labelWidth: 'auto',
  313 + }}
  314 + options={{
  315 + setting: {
  316 + listsHeight: 400,
  317 + },
  318 + }}
  319 + form={{}}
  320 + dateFormatter="string"
  321 + headerTitle="账号列表"
  322 + scroll={{ x: 1400 }}
  323 + toolBarRender={() => []}
  324 + />
  325 + ),
  326 + },
  327 + ];
  328 + return (
  329 + <div className="prepaid-index">
  330 + <Tabs
  331 + defaultActiveKey="1"
  332 + items={tabsItems}
  333 + onChange={(value) => {
  334 + if (value === '1') {
  335 + reloadPrepaidTable();
  336 + } else {
  337 + reloadAccountTable();
  338 + }
  339 + }}
  340 + />
  341 +
  342 + {rechargePrepaymentModalVisible && (
  343 + <RechargePrepaymentModal
  344 + setVisible={setRechargePrepaymentModalVisible}
  345 + onClose={() => {
  346 + setRechargePrepaymentModalVisible(false);
  347 + reloadPrepaidTable();
  348 + }}
  349 + prepaymentObject={currentOptPrepaymentObj}
  350 + />
  351 + )}
  352 +
  353 + {checkVisible && (
  354 + <CheckModal
  355 + setCheckVisible={(val: boolean) => {
  356 + setCheckVisible(val);
  357 + }}
  358 + data={[currentOptPrepaymentObj]}
  359 + subOrders={[currentOptPrepaymentObj]}
  360 + orderCheckType={CHECK_TYPE.PREPAID_AUDIT}
  361 + openOrderDrawer={false}
  362 + onClose={() => {
  363 + setCheckVisible(false);
  364 + reloadPrepaidTable();
  365 + }}
  366 + />
  367 + )}
  368 +
  369 + {balanceChangeRecordsModalVisible && (
  370 + <BalanceChangeRecordsModal
  371 + setVisible={(val: boolean) => {
  372 + setBalanceChangeRecordsModalVisible(val);
  373 + }}
  374 + userInfoObj={currentOptUserObj}
  375 + onClose={() => {
  376 + setBalanceChangeRecordsModalVisible(false);
  377 + }}
  378 + />
  379 + )}
  380 + </div>
  381 + );
  382 +};
  383 +
  384 +export default PrepaidPage;
... ...
src/services/exportRequest.ts
... ... @@ -4,6 +4,7 @@ export const excelExport = async (
4 4 url: any = '',
5 5 data: any = {},
6 6 exportLoadingDestory: any,
  7 + fileName,
7 8 ) => {
8 9 axios({
9 10 url: url,
... ... @@ -23,7 +24,7 @@ export const excelExport = async (
23 24 let a = document.createElement('a');
24 25 a.style.display = 'none';
25 26 a.href = fileUrl;
26   - a.download = '开票记录.xlsx';
  27 + a.download = fileName + '.xlsx';
27 28 document.body.appendChild(a);
28 29 a.click();
29 30 window.URL.revokeObjectURL(a.href);
... ...