@kmkf-fe-packages/kmkf-work-order-service-component 2.2.44-beta.95 → 2.2.44-beta.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@
2
2
  .flowWorkOrderDetail {
3
3
  display: flex;
4
4
  flex-direction: column;
5
+ height: 100%;
6
+ min-height: 0;
5
7
  .ant-input-number {
6
8
  width: 200px
7
9
  }
@@ -50,13 +52,15 @@
50
52
  }
51
53
  }
52
54
  .center {
53
- height: calc(100vh - 168px);
54
- overflow-y: scroll;
55
+ flex: 1;
56
+ min-height: 0;
57
+ overflow-y: auto;
55
58
  padding: 8px 0px;
56
59
  }
57
60
 
58
61
  .readonly, .center {
59
- height: 100%;
62
+ flex: 1;
63
+ min-height: 0;
60
64
  overflow-y: auto;
61
65
  }
62
66
  .hasStatus {
@@ -3,6 +3,7 @@ import type { SubOrder } from '../interface';
3
3
  import './index.less';
4
4
  interface PlatformOrderCardProps {
5
5
  order: SubOrder;
6
+ onCreateWorkOrder?: (orderNo?: string) => void;
6
7
  }
7
8
  /**
8
9
  * 平台订单卡片组件
@@ -8,12 +8,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
8
  * @Author: wangzhenggui jianjia.wzg@raycloud.com
9
9
  * @Date: 2026-04-01 16:27:58
10
10
  * @LastEditors: wangzhenggui jianjia.wzg@raycloud.com
11
- * @LastEditTime: 2026-04-09 11:11:22
11
+ * @LastEditTime: 2026-04-10 19:02:14
12
12
  * @FilePath: /kmkf-fe-packages/packages/kmkf-work-order-service-component/src/KmErpTradeList/components/PlatformOrderCard.tsx
13
13
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
14
14
  */
15
15
  import React, { useState } from 'react';
16
- import { Image, Tooltip, message, Button } from 'antd';
16
+ import { Image, Tooltip, message, Button, Divider } from 'antd';
17
17
  import copy from 'copy-to-clipboard';
18
18
  import { CopyOutlined } from '@ant-design/icons';
19
19
  import StockQueryDrawer from "./StockQueryDrawer";
@@ -23,7 +23,8 @@ import "./index.less";
23
23
  * 展示字段:商品图片、系统商品名、平台商家编码、系统商家编码、规格名、数量
24
24
  */
25
25
  var PlatformOrderCard = function PlatformOrderCard(_ref) {
26
- var order = _ref.order;
26
+ var order = _ref.order,
27
+ onCreateWorkOrder = _ref.onCreateWorkOrder;
27
28
  var picUrl = order.picUrl,
28
29
  sysTitle = order.sysTitle,
29
30
  outerId = order.outerId,
@@ -54,6 +55,9 @@ var PlatformOrderCard = function PlatformOrderCard(_ref) {
54
55
  }
55
56
  setDrawerVisible(true);
56
57
  };
58
+ var handleCreateWorkOrder = function handleCreateWorkOrder() {
59
+ onCreateWorkOrder === null || onCreateWorkOrder === void 0 ? void 0 : onCreateWorkOrder(tid);
60
+ };
57
61
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
58
62
  className: "platform-order-card"
59
63
  }, /*#__PURE__*/React.createElement("div", {
@@ -112,7 +116,16 @@ var PlatformOrderCard = function PlatformOrderCard(_ref) {
112
116
  className: "label"
113
117
  }, "\u6570\u91CF\uFF1A"), /*#__PURE__*/React.createElement("span", {
114
118
  className: "value"
115
- }, itemNum || '-'))))), /*#__PURE__*/React.createElement(StockQueryDrawer, {
119
+ }, itemNum || '-'))), /*#__PURE__*/React.createElement(Divider, {
120
+ type: "vertical",
121
+ className: "platform-order-divider"
122
+ }), /*#__PURE__*/React.createElement("div", {
123
+ className: "product-actions"
124
+ }, /*#__PURE__*/React.createElement(Button, {
125
+ type: "primary",
126
+ size: "small",
127
+ onClick: handleCreateWorkOrder
128
+ }, "\u65B0\u589E\u5DE5\u5355")))), /*#__PURE__*/React.createElement(StockQueryDrawer, {
116
129
  visible: drawerVisible,
117
130
  onClose: function onClose() {
118
131
  return setDrawerVisible(false);
@@ -1,3 +1,11 @@
1
+ /*
2
+ * @Author: wangzhenggui jianjia.wzg@raycloud.com
3
+ * @Date: 2026-04-10 14:32:36
4
+ * @LastEditors: wangzhenggui jianjia.wzg@raycloud.com
5
+ * @LastEditTime: 2026-04-10 15:03:30
6
+ * @FilePath: /kmkf-fe-packages/packages/kmkf-work-order-service-component/src/KmErpTradeList/components/Search.tsx
7
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
+ */
1
9
  import { Input } from 'antd';
2
10
  import React from 'react';
3
11
  /**
@@ -22,7 +30,6 @@ var Search = function Search(props) {
22
30
  placeholder: "\u8BF7\u8F93\u5165\u5E73\u53F0\u8BA2\u5355\u53F7\u641C\u7D22",
23
31
  allowClear: true,
24
32
  enterButton: "\u67E5\u8BE2",
25
- size: "large",
26
33
  onSearch: handleSearch,
27
34
  disabled: disabled
28
35
  }));
@@ -0,0 +1,7 @@
1
+ declare type LogicFlow = {
2
+ id: string;
3
+ name: string;
4
+ key: string;
5
+ };
6
+ export declare const filterFlowTemplates: (flowList: LogicFlow[], keyword: string) => LogicFlow[];
7
+ export {};
@@ -0,0 +1,10 @@
1
+ export var filterFlowTemplates = function filterFlowTemplates(flowList, keyword) {
2
+ var normalizedKeyword = keyword.trim();
3
+ if (!normalizedKeyword) {
4
+ return flowList;
5
+ }
6
+ return flowList.filter(function (item) {
7
+ var _item$name;
8
+ return (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.includes(normalizedKeyword);
9
+ });
10
+ };
@@ -5,7 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useState } from 'react';
8
- import { Divider, Tag, Tooltip, message, Button, List, Empty, Drawer } from 'antd';
8
+ import { Tag, Tooltip, message, Button, List, Empty, Drawer, Input } from 'antd';
9
9
  import { CopyOutlined, LeftOutlined } from '@ant-design/icons';
10
10
  import copy from 'copy-to-clipboard';
11
11
  import { useSelector } from 'react-redux';
@@ -14,6 +14,7 @@ import PlatformOrderCard from "./PlatformOrderCard";
14
14
  import OrderLogDrawer from "./OrderLogDrawer";
15
15
  import FlowTemplateDetail from "../../FlowTemplateDetailV2";
16
16
  import { selectFlowList } from "../../model/logicFlow/selector";
17
+ import { filterFlowTemplates } from "./SystemOrderCard.filter";
17
18
  import "./index.less";
18
19
  // 系统状态映射 - 中文标签
19
20
  var SYS_STATUS_LABEL = {
@@ -58,39 +59,46 @@ var SYS_STATUS_COLOR = {
58
59
  * 系统订单卡片组件
59
60
  */
60
61
  var SystemOrderCard = function SystemOrderCard(_ref) {
61
- var _order$subOrders2, _order$subOrders2$;
62
62
  var order = _ref.order;
63
- var _useState = useState(false),
63
+ var _useState = useState(''),
64
64
  _useState2 = _slicedToArray(_useState, 2),
65
- logDrawerVisible = _useState2[0],
66
- setLogDrawerVisible = _useState2[1];
67
- var _useState3 = useState(false),
65
+ templateSearchValue = _useState2[0],
66
+ setTemplateSearchValue = _useState2[1];
67
+ var _useState3 = useState(''),
68
68
  _useState4 = _slicedToArray(_useState3, 2),
69
- flowTemplateDrawerVisible = _useState4[0],
70
- setFlowTemplateDrawerVisible = _useState4[1];
69
+ selectedOrderNo = _useState4[0],
70
+ setSelectedOrderNo = _useState4[1];
71
71
  var _useState5 = useState(false),
72
72
  _useState6 = _slicedToArray(_useState5, 2),
73
- templateDrawerVisible = _useState6[0],
74
- setTemplateDrawerVisible = _useState6[1];
75
- var _useState7 = useState(null),
73
+ logDrawerVisible = _useState6[0],
74
+ setLogDrawerVisible = _useState6[1];
75
+ var _useState7 = useState(false),
76
76
  _useState8 = _slicedToArray(_useState7, 2),
77
- selectedFlow = _useState8[0],
78
- setSelectedFlow = _useState8[1];
77
+ flowTemplateDrawerVisible = _useState8[0],
78
+ setFlowTemplateDrawerVisible = _useState8[1];
79
+ var _useState9 = useState(false),
80
+ _useState10 = _slicedToArray(_useState9, 2),
81
+ templateDrawerVisible = _useState10[0],
82
+ setTemplateDrawerVisible = _useState10[1];
83
+ var _useState11 = useState(null),
84
+ _useState12 = _slicedToArray(_useState11, 2),
85
+ selectedFlow = _useState12[0],
86
+ setSelectedFlow = _useState12[1];
79
87
  var flowList = useSelector(selectFlowList);
80
88
  var shopList = useAppSelector(function (state) {
81
- return state.kmErpTradeList.userInfo.shopList;
89
+ return state.workOrder.userInfo.shopList;
82
90
  });
83
91
  var accountName = useAppSelector(function (state) {
84
- return state.kmErpTradeList.userInfo.account;
92
+ return state.workOrder.userInfo.account;
85
93
  });
86
94
  var companyKey = useAppSelector(function (state) {
87
- return state.kmErpTradeList.userInfo.companyKey;
95
+ return state.workOrder.userInfo.companyKey;
88
96
  });
89
97
  var bindERP = useAppSelector(function (state) {
90
- return state.kmErpTradeList.userInfo.bindERP;
98
+ return state.workOrder.userInfo.bindERP;
91
99
  });
92
100
  var platformInfo = useAppSelector(function (state) {
93
- return state.kmErpTradeList.platformInfo;
101
+ return state.global.platformInfo;
94
102
  });
95
103
  var buyerNick = platformInfo.buyerNick,
96
104
  buyerId = platformInfo.buyerId,
@@ -99,14 +107,14 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
99
107
  userKey = platformInfo.userKey;
100
108
  var hasBindWdt = useAppSelector(function (state) {
101
109
  var _JSON$parse, _JSON$parse$plugins, _JSON$parse$plugins$w;
102
- return ((_JSON$parse = JSON.parse(state.kmErpTradeList.userInfo.companyUserConfig || '{}')) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$plugins = _JSON$parse.plugins) === null || _JSON$parse$plugins === void 0 ? void 0 : (_JSON$parse$plugins$w = _JSON$parse$plugins.wdt) === null || _JSON$parse$plugins$w === void 0 ? void 0 : _JSON$parse$plugins$w.show) || false;
110
+ return ((_JSON$parse = JSON.parse(state.workOrder.userInfo.companyUserConfig || '{}')) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$plugins = _JSON$parse.plugins) === null || _JSON$parse$plugins === void 0 ? void 0 : (_JSON$parse$plugins$w = _JSON$parse$plugins.wdt) === null || _JSON$parse$plugins$w === void 0 ? void 0 : _JSON$parse$plugins$w.show) || false;
103
111
  });
104
112
  var hasBindJst = useAppSelector(function (state) {
105
113
  var _JSON$parse2, _JSON$parse2$plugins, _JSON$parse2$plugins$;
106
- return ((_JSON$parse2 = JSON.parse(state.kmErpTradeList.userInfo.companyUserConfig || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : (_JSON$parse2$plugins = _JSON$parse2.plugins) === null || _JSON$parse2$plugins === void 0 ? void 0 : (_JSON$parse2$plugins$ = _JSON$parse2$plugins.jst) === null || _JSON$parse2$plugins$ === void 0 ? void 0 : _JSON$parse2$plugins$.show) || false;
114
+ return ((_JSON$parse2 = JSON.parse(state.workOrder.userInfo.companyUserConfig || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : (_JSON$parse2$plugins = _JSON$parse2.plugins) === null || _JSON$parse2$plugins === void 0 ? void 0 : (_JSON$parse2$plugins$ = _JSON$parse2$plugins.jst) === null || _JSON$parse2$plugins$ === void 0 ? void 0 : _JSON$parse2$plugins$.show) || false;
107
115
  });
108
116
  var hasSuperAdminRole = useAppSelector(function (state) {
109
- return state.kmErpTradeList.userInfo.hasSuperAdminRole;
117
+ return state.workOrder.userInfo.hasSuperAdminRole;
110
118
  });
111
119
  var sid = order.sid,
112
120
  sysStatus = order.sysStatus,
@@ -142,13 +150,15 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
142
150
  };
143
151
 
144
152
  // 打开模板选择抽屉
145
- var handleOpenTemplateDrawer = function handleOpenTemplateDrawer() {
153
+ var handleOpenTemplateDrawer = function handleOpenTemplateDrawer(orderNo) {
154
+ setSelectedOrderNo(orderNo || '');
146
155
  setTemplateDrawerVisible(true);
147
156
  };
148
157
 
149
158
  // 关闭模板选择抽屉
150
159
  var handleCloseTemplateDrawer = function handleCloseTemplateDrawer() {
151
160
  setTemplateDrawerVisible(false);
161
+ setTemplateSearchValue('');
152
162
  };
153
163
 
154
164
  // 选择工单模板
@@ -194,12 +204,23 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
194
204
  if (!status) return 'default';
195
205
  return SYS_STATUS_COLOR[status] || 'processing';
196
206
  };
207
+ var filteredFlowList = filterFlowTemplates(flowList || [], templateSearchValue);
208
+ var isSearching = Boolean(templateSearchValue.trim());
197
209
 
198
210
  // 模板选择抽屉内容
199
211
  var templateDrawerContent = /*#__PURE__*/React.createElement("div", {
200
212
  className: "flow-list-popover"
201
- }, flowList && flowList.length > 0 ? /*#__PURE__*/React.createElement(List, {
202
- dataSource: flowList,
213
+ }, /*#__PURE__*/React.createElement("div", {
214
+ className: "flow-list-search"
215
+ }, /*#__PURE__*/React.createElement(Input.Search, {
216
+ placeholder: "\u8BF7\u8F93\u5165\u6A21\u677F\u540D\u79F0",
217
+ value: templateSearchValue,
218
+ onChange: function onChange(e) {
219
+ return setTemplateSearchValue(e.target.value);
220
+ },
221
+ allowClear: true
222
+ })), flowList && flowList.length > 0 ? filteredFlowList.length > 0 ? /*#__PURE__*/React.createElement(List, {
223
+ dataSource: filteredFlowList,
203
224
  className: "flow-list",
204
225
  grid: {
205
226
  gutter: 8,
@@ -218,6 +239,11 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
218
239
  }
219
240
  }) : /*#__PURE__*/React.createElement("div", {
220
241
  className: "flow-list-empty"
242
+ }, /*#__PURE__*/React.createElement(Empty, {
243
+ description: isSearching ? '未找到匹配的工单模板' : '暂无工单模板',
244
+ image: Empty.PRESENTED_IMAGE_SIMPLE
245
+ })) : /*#__PURE__*/React.createElement("div", {
246
+ className: "flow-list-empty"
221
247
  }, /*#__PURE__*/React.createElement(Empty, {
222
248
  description: "\u6682\u65E0\u5DE5\u5355\u6A21\u677F",
223
249
  image: Empty.PRESENTED_IMAGE_SIMPLE
@@ -290,23 +316,15 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
290
316
  className: "label"
291
317
  }, "\u6536\u8D27\u5730\u5740\uFF1A"), /*#__PURE__*/React.createElement("span", {
292
318
  className: "value address"
293
- }, [receiverState, receiverCity, receiverDistrict].join(''), /*#__PURE__*/React.createElement("br", null), source === 'sys' ? [receiverName, receiverMobile, receiverAddress].join('') : '**************'))), /*#__PURE__*/React.createElement(Divider, {
294
- type: "vertical",
295
- className: "order-info-divider"
296
- }), /*#__PURE__*/React.createElement("div", {
297
- className: "order-info-right"
298
- }, /*#__PURE__*/React.createElement(Button, {
299
- type: "primary",
300
- block: true,
301
- onClick: handleOpenTemplateDrawer
302
- }, "\u65B0\u589E\u5DE5\u5355"))), /*#__PURE__*/React.createElement("div", {
319
+ }, [receiverState, receiverCity, receiverDistrict].join(''), /*#__PURE__*/React.createElement("br", null), source === 'sys' ? [receiverName, receiverMobile, receiverAddress].join('') : '**************')))), /*#__PURE__*/React.createElement("div", {
303
320
  className: "system-order-footer"
304
321
  }, /*#__PURE__*/React.createElement("div", {
305
322
  className: "platform-orders-list"
306
323
  }, subOrders.map(function (subOrder, index) {
307
324
  return /*#__PURE__*/React.createElement(PlatformOrderCard, {
308
325
  key: subOrder.tid || index,
309
- order: subOrder
326
+ order: subOrder,
327
+ onCreateWorkOrder: handleOpenTemplateDrawer
310
328
  });
311
329
  })))), /*#__PURE__*/React.createElement(OrderLogDrawer, {
312
330
  visible: logDrawerVisible,
@@ -337,7 +355,7 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
337
355
  flowWorkOrderId: '',
338
356
  plat: {
339
357
  accountName: accountName,
340
- orderNo: order === null || order === void 0 ? void 0 : (_order$subOrders2 = order.subOrders) === null || _order$subOrders2 === void 0 ? void 0 : (_order$subOrders2$ = _order$subOrders2[0]) === null || _order$subOrders2$ === void 0 ? void 0 : _order$subOrders2$.tid,
358
+ orderNo: selectedOrderNo,
341
359
  buyerId: buyerId,
342
360
  buyerNick: buyerNick,
343
361
  platform: platform,
@@ -348,10 +366,7 @@ var SystemOrderCard = function SystemOrderCard(_ref) {
348
366
  hasSuperAdminRole: hasSuperAdminRole
349
367
  },
350
368
  otherInfo: {},
351
- callbackDealWorkOrderSuccess: handleDealWorkOrderSuccess,
352
- onOpenWangWang: function onOpenWangWang() {
353
- return void 0;
354
- }
369
+ callbackDealWorkOrderSuccess: handleDealWorkOrderSuccess
355
370
  })));
356
371
  };
357
372
  export default SystemOrderCard;
@@ -1,17 +1,16 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  interface KmErpTradeListProps {
4
- isTbZnkf?: boolean;
5
- platform?: string;
6
- shopId?: string;
7
- buyerNick?: string;
4
+ isHistory: boolean;
8
5
  buyerId?: string;
9
- orderNo?: string;
10
- userKey?: string;
11
- otherInfo?: any;
12
- platInfo?: any;
13
- onEmpowerCallback?: () => void;
14
- onOpenWangWang?: (nick: string, id: string) => void;
6
+ shopId?: string;
15
7
  }
16
- declare const KmErpTradeListWrap: (props: KmErpTradeListProps) => React.JSX.Element;
17
- export default KmErpTradeListWrap;
8
+ /**
9
+ * 快麦 ERP 订单列表组件
10
+ * 使用场景:
11
+ * - 组件接受一个 buyerId 的 Props
12
+ * - 当 buyerId 不为空且每次发生变化之后重新调用订单列表接口
13
+ * - 如果该参数为空时,订单列表区域展示请选择当前买家的 Empty 提示
14
+ */
15
+ declare const KmErpTradeList: React.FC<KmErpTradeListProps>;
16
+ export default KmErpTradeList;
@@ -1,21 +1,21 @@
1
- /*
2
- * @Author: wangzhenggui jianjia.wzg@raycloud.com
3
- * @Date: 2026-04-02 10:55:30
4
- * @LastEditors: wangzhenggui jianjia.wzg@raycloud.com
5
- * @LastEditTime: 2026-04-07 15:22:51
6
- * @FilePath: /kmkf-fe-packages/packages/kmkf-work-order-service-component/src/KmErpTradeList/index.tsx
7
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AEit
8
- */
9
- import React, { useEffect } from 'react';
10
- import { Provider } from 'react-redux';
11
- import { Tabs, ConfigProvider } from 'antd';
12
- import store from "../model/store";
13
- import { useAppDispatch } from "../model/hooks";
14
- import { fetchLogicFlowList } from "../model/logicFlow";
15
- import { fetchQueryCurrentCompanyUser } from "../model/kmErpTradeList";
16
- import TradeList from "./TradeList";
17
- import zhCN from 'antd/es/locale/zh_CN';
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React, { useEffect, useState } from 'react';
12
+ import { Empty } from 'antd';
13
+ import Search from "./components/Search";
14
+ import TradeList from "./components/TradeList";
15
+ import { kmErpOrderDetail } from "./api";
18
16
  import "./index.less";
17
+ var DEFAULT_PAGE_SIZE = 20;
18
+
19
19
  /**
20
20
  * 快麦 ERP 订单列表组件
21
21
  * 使用场景:
@@ -24,69 +24,148 @@ import "./index.less";
24
24
  * - 如果该参数为空时,订单列表区域展示请选择当前买家的 Empty 提示
25
25
  */
26
26
  var KmErpTradeList = function KmErpTradeList(props) {
27
- var dispatch = useAppDispatch();
28
- var platform = props.platform,
29
- _props$isTbZnkf = props.isTbZnkf,
30
- isTbZnkf = _props$isTbZnkf === void 0 ? false : _props$isTbZnkf,
27
+ var _useState = useState(false),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ loading = _useState2[0],
30
+ setLoading = _useState2[1];
31
+ var _useState3 = useState([]),
32
+ _useState4 = _slicedToArray(_useState3, 2),
33
+ list = _useState4[0],
34
+ setList = _useState4[1];
35
+ var _useState5 = useState(0),
36
+ _useState6 = _slicedToArray(_useState5, 2),
37
+ total = _useState6[0],
38
+ setTotal = _useState6[1];
39
+ var _useState7 = useState(1),
40
+ _useState8 = _slicedToArray(_useState7, 2),
41
+ pageNo = _useState8[0],
42
+ setPageNo = _useState8[1];
43
+ var _useState9 = useState(''),
44
+ _useState10 = _slicedToArray(_useState9, 2),
45
+ searchTid = _useState10[0],
46
+ setSearchTid = _useState10[1];
47
+ var _useState11 = useState(''),
48
+ _useState12 = _slicedToArray(_useState11, 2),
49
+ error = _useState12[0],
50
+ setError = _useState12[1];
51
+ var buyerId = props.buyerId,
31
52
  shopId = props.shopId,
32
- buyerNick = props.buyerNick,
33
- buyerId = props.buyerId,
34
- orderNo = props.orderNo,
35
- userKey = props.userKey,
36
- _props$otherInfo = props.otherInfo,
37
- otherInfo = _props$otherInfo === void 0 ? {} : _props$otherInfo;
38
- useEffect(function () {
39
- //存储平台信息
40
- dispatch({
41
- type: 'kmErpTradeList/setState',
42
- payload: {
43
- platformInfo: {
44
- isTbZnkf: isTbZnkf,
45
- platform: platform,
46
- shopId: shopId,
47
- buyerNick: buyerNick,
48
- buyerId: buyerId,
49
- orderNo: orderNo,
50
- userKey: userKey,
51
- otherInfo: otherInfo
53
+ isHistory = props.isHistory;
54
+
55
+ // 获取订单列表
56
+ var fetchOrderList = /*#__PURE__*/function () {
57
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58
+ var page,
59
+ tid,
60
+ res,
61
+ _args = arguments;
62
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ page = _args.length > 0 && _args[0] !== undefined ? _args[0] : 1;
66
+ tid = _args.length > 1 ? _args[1] : undefined;
67
+ if (!(!buyerId && !tid)) {
68
+ _context.next = 8;
69
+ break;
70
+ }
71
+ setList([]);
72
+ setTotal(0);
73
+ setError('');
74
+ setLoading(false);
75
+ return _context.abrupt("return");
76
+ case 8:
77
+ setLoading(true);
78
+ setError('');
79
+ _context.prev = 10;
80
+ _context.next = 13;
81
+ return kmErpOrderDetail({
82
+ buyerOpenUid: buyerId,
83
+ shopIdList: shopId ? [shopId] : [],
84
+ tid: tid || searchTid,
85
+ pageNo: page,
86
+ pageSize: DEFAULT_PAGE_SIZE,
87
+ timeRangeType: isHistory ? 'BEFORE_LIMIT' : 'WITHIN_LIMIT'
88
+ });
89
+ case 13:
90
+ res = _context.sent;
91
+ if (res !== null && res !== void 0 && res.success && res !== null && res !== void 0 && res.data) {
92
+ setList(res.data.orderDetailDtoList || []);
93
+ setTotal(res.data.total || 0);
94
+ setPageNo(page);
95
+ } else {
96
+ setError((res === null || res === void 0 ? void 0 : res.message) || '获取订单列表失败');
97
+ }
98
+ _context.next = 20;
99
+ break;
100
+ case 17:
101
+ _context.prev = 17;
102
+ _context.t0 = _context["catch"](10);
103
+ setError((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '请求失败,请稍后重试');
104
+ case 20:
105
+ _context.prev = 20;
106
+ setLoading(false);
107
+ return _context.finish(20);
108
+ case 23:
109
+ case "end":
110
+ return _context.stop();
52
111
  }
53
- }
54
- });
55
- }, [platform, shopId, buyerNick, buyerId, orderNo, userKey, otherInfo]);
56
- var initHandle = function initHandle() {
57
- dispatch(fetchLogicFlowList);
58
- dispatch(fetchQueryCurrentCompanyUser());
59
- };
112
+ }, _callee, null, [[10, 17, 20, 23]]);
113
+ }));
114
+ return function fetchOrderList() {
115
+ return _ref.apply(this, arguments);
116
+ };
117
+ }();
118
+
119
+ // 监听 buyerId 变化
60
120
  useEffect(function () {
61
- initHandle();
62
- }, []);
121
+ if (buyerId) {
122
+ // 重置搜索条件和分页
123
+ setSearchTid('');
124
+ fetchOrderList(1, '');
125
+ }
126
+ }, [buyerId]);
127
+
128
+ // 搜索处理
129
+ var handleSearch = function handleSearch(params) {
130
+ var tid = params.value.tid || '';
131
+ setSearchTid(tid);
132
+ fetchOrderList(1, tid);
133
+ };
134
+
135
+ // 分页处理
136
+ var handlePageChange = function handlePageChange(page) {
137
+ fetchOrderList(page, searchTid);
138
+ };
139
+
140
+ // buyerId 为空时显示空状态
141
+ if (!buyerId) {
142
+ return /*#__PURE__*/React.createElement("div", {
143
+ className: "km-erp-trade-list-container"
144
+ }, /*#__PURE__*/React.createElement(Search, {
145
+ onSearch: handleSearch,
146
+ disabled: true
147
+ }), /*#__PURE__*/React.createElement("div", {
148
+ className: "km-erp-trade-list-content"
149
+ }, /*#__PURE__*/React.createElement(Empty, {
150
+ description: "\u8BF7\u9009\u62E9\u5F53\u524D\u4E70\u5BB6"
151
+ })));
152
+ }
63
153
  return /*#__PURE__*/React.createElement("div", {
64
154
  className: "km-erp-trade-list-container"
65
- }, /*#__PURE__*/React.createElement(Tabs, {
66
- items: [{
67
- key: '1',
68
- label: '三个月内订单',
69
- children: /*#__PURE__*/React.createElement(TradeList, {
70
- isHistory: false,
71
- buyerId: buyerId,
72
- shopId: shopId
73
- })
74
- }, {
75
- key: '2',
76
- label: '归档订单',
77
- children: /*#__PURE__*/React.createElement(TradeList, {
78
- isHistory: true,
79
- buyerId: buyerId,
80
- shopId: shopId
81
- })
82
- }]
83
- }));
84
- };
85
- var KmErpTradeListWrap = function KmErpTradeListWrap(props) {
86
- return /*#__PURE__*/React.createElement(Provider, {
87
- store: store
88
- }, /*#__PURE__*/React.createElement(ConfigProvider, {
89
- locale: zhCN
90
- }, /*#__PURE__*/React.createElement(KmErpTradeList, props)));
155
+ }, /*#__PURE__*/React.createElement(Search, {
156
+ onSearch: handleSearch,
157
+ disabled: loading
158
+ }), /*#__PURE__*/React.createElement("div", {
159
+ className: "km-erp-trade-list-content"
160
+ }, /*#__PURE__*/React.createElement(TradeList, {
161
+ list: list,
162
+ loading: loading,
163
+ pageNo: pageNo,
164
+ pageSize: DEFAULT_PAGE_SIZE,
165
+ total: total,
166
+ onPageChange: handlePageChange,
167
+ error: error,
168
+ buyerId: buyerId
169
+ })));
91
170
  };
92
- export default KmErpTradeListWrap;
171
+ export default KmErpTradeList;
@@ -107,23 +107,12 @@
107
107
  gap: 16px;
108
108
  padding: 4px 8px;
109
109
  border-bottom: 1px solid #f0f0f0;
110
- .order-info-divider {
111
- height: auto;
112
- }
113
110
 
114
111
  .order-info-left {
115
112
  flex: 1;
116
113
  min-width: 0;
117
114
  }
118
115
 
119
- .order-info-right {
120
- flex-shrink: 0;
121
- display: flex;
122
- flex-direction: column;
123
- justify-content: center;
124
- align-items: center;
125
- }
126
-
127
116
  .order-info-row {
128
117
  display: flex;
129
118
  margin-bottom: 6px;
@@ -217,6 +206,7 @@
217
206
  .platform-order-body {
218
207
  display: flex;
219
208
  gap: 10px;
209
+ align-items: center;
220
210
  background-color: #fff;
221
211
  padding: 8px;
222
212
  .product-image {
@@ -254,7 +244,7 @@
254
244
  overflow: hidden;
255
245
  text-overflow: ellipsis;
256
246
  display: -webkit-box;
257
- -webkit-line-clamp: 2;
247
+ -webkit-line-clamp: 3;
258
248
  -webkit-box-orient: vertical;
259
249
  }
260
250
 
@@ -280,6 +270,20 @@
280
270
  }
281
271
  }
282
272
  }
273
+
274
+ .platform-order-divider {
275
+ align-self: stretch;
276
+ height: auto;
277
+ margin: 0 4px;
278
+ }
279
+
280
+ .product-actions {
281
+ flex-shrink: 0;
282
+ display: flex;
283
+ align-items: center;
284
+ justify-content: center;
285
+ min-width: 88px;
286
+ }
283
287
  }
284
288
  }
285
289
 
@@ -531,6 +535,10 @@
531
535
  }
532
536
 
533
537
  .flow-list-popover {
538
+ .flow-list-search {
539
+ margin-bottom: 16px;
540
+ }
541
+
534
542
  .flow-list {
535
543
  .flow-list-item {
536
544
  cursor: pointer;
@@ -2,6 +2,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2
2
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
3
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
4
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -11,8 +15,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
15
  /*
12
16
  * @Author: wangzhenggui jianjia.wzg@raycloud.com
13
17
  * @Date: 2022-09-16 11:19:43
14
- * @LastEditors: litian
15
- * @LastEditTime: 2022-11-24 14:11:47
18
+ * @LastEditors: wangzhenggui jianjia.wzg@raycloud.com
19
+ * @LastEditTime: 2026-04-10 15:19:14
16
20
  * @FilePath: /kmkf-work-order-service-component/src/WorkOrder/index.tsx
17
21
  * @Description:
18
22
  *
@@ -33,6 +37,7 @@ import { LogoutOutlined } from '@ant-design/icons';
33
37
  import OrderList from "./components/WorkOrderList";
34
38
  import Reminder from "./components/Reminder";
35
39
  import WdtTradeList from "../WdtTradeList";
40
+ import TradeList from "../KmErpTradeList";
36
41
  import PaymentWorkOrderList from "./components/PaymentWorkOrderList";
37
42
  import CustomerServiceToDoList from "../CustomerServiceToDoList";
38
43
  import CustomerServiceToDoCard from "./components/CustomerServiceToDoCard";
@@ -50,7 +55,7 @@ message.config({
50
55
  rtl: false
51
56
  });
52
57
  var WorkOrder = function WorkOrder(props) {
53
- var _companyUserConfig, _companyUserConfig$pd, _companyUserConfig2, _companyUserConfig2$p, _companyUserConfig2$p2;
58
+ var _companyUserConfig, _companyUserConfig$pd, _companyUserConfig4, _companyUserConfig4$f, _companyUserConfig5, _companyUserConfig5$k, _companyUserConfig8, _companyUserConfig8$f, _companyUserConfig9, _companyUserConfig9$k, _companyUserConfig10, _companyUserConfig10$, _companyUserConfig10$2;
54
59
  var platform = props.platform,
55
60
  _props$isTbZnkf = props.isTbZnkf,
56
61
  isTbZnkf = _props$isTbZnkf === void 0 ? false : _props$isTbZnkf,
@@ -176,11 +181,27 @@ var WorkOrder = function WorkOrder(props) {
176
181
  setIsEmpower(_isEmpower);
177
182
  }
178
183
  }, [shopList]);
184
+ useEffect(function () {
185
+ var _companyUserConfig2, _companyUserConfig2$f, _companyUserConfig3, _companyUserConfig3$k;
186
+ if (platform === PlatForm.FXG && (_companyUserConfig2 = companyUserConfig) !== null && _companyUserConfig2 !== void 0 && (_companyUserConfig2$f = _companyUserConfig2.fxg) !== null && _companyUserConfig2$f !== void 0 && _companyUserConfig2$f.isShowErpTradeList || platform === PlatForm.KS && (_companyUserConfig3 = companyUserConfig) !== null && _companyUserConfig3 !== void 0 && (_companyUserConfig3$k = _companyUserConfig3.ks) !== null && _companyUserConfig3$k !== void 0 && _companyUserConfig3$k.isShowErpTradeList) {
187
+ setTabActive('kmErpTradeList');
188
+ }
189
+ }, [platform, (_companyUserConfig4 = companyUserConfig) === null || _companyUserConfig4 === void 0 ? void 0 : (_companyUserConfig4$f = _companyUserConfig4.fxg) === null || _companyUserConfig4$f === void 0 ? void 0 : _companyUserConfig4$f.isShowErpTradeList, (_companyUserConfig5 = companyUserConfig) === null || _companyUserConfig5 === void 0 ? void 0 : (_companyUserConfig5$k = _companyUserConfig5.ks) === null || _companyUserConfig5$k === void 0 ? void 0 : _companyUserConfig5$k.isShowErpTradeList]);
179
190
  var options = useMemo(function () {
191
+ var _companyUserConfig6, _companyUserConfig6$f, _companyUserConfig7, _companyUserConfig7$k;
180
192
  var opt = [{
181
193
  label: '自定义工单',
182
194
  value: 'custom'
183
195
  }];
196
+ if (platform === PlatForm.FXG && (_companyUserConfig6 = companyUserConfig) !== null && _companyUserConfig6 !== void 0 && (_companyUserConfig6$f = _companyUserConfig6.fxg) !== null && _companyUserConfig6$f !== void 0 && _companyUserConfig6$f.isShowErpTradeList || platform === PlatForm.KS && (_companyUserConfig7 = companyUserConfig) !== null && _companyUserConfig7 !== void 0 && (_companyUserConfig7$k = _companyUserConfig7.ks) !== null && _companyUserConfig7$k !== void 0 && _companyUserConfig7$k.isShowErpTradeList) {
197
+ opt = [{
198
+ label: '三个月内订单',
199
+ value: 'kmErpTradeList'
200
+ }, {
201
+ label: '归档订单',
202
+ value: 'kmErpTradeListHistory'
203
+ }].concat(_toConsumableArray(opt));
204
+ }
184
205
  if (isShowPayment) {
185
206
  opt.push({
186
207
  label: '打款工单',
@@ -194,7 +215,7 @@ var WorkOrder = function WorkOrder(props) {
194
215
  });
195
216
  }
196
217
  return opt;
197
- }, [isShowPayment, isShowWdt]);
218
+ }, [isShowPayment, isShowWdt, platform, (_companyUserConfig8 = companyUserConfig) === null || _companyUserConfig8 === void 0 ? void 0 : (_companyUserConfig8$f = _companyUserConfig8.fxg) === null || _companyUserConfig8$f === void 0 ? void 0 : _companyUserConfig8$f.isShowErpTradeList, (_companyUserConfig9 = companyUserConfig) === null || _companyUserConfig9 === void 0 ? void 0 : (_companyUserConfig9$k = _companyUserConfig9.ks) === null || _companyUserConfig9$k === void 0 ? void 0 : _companyUserConfig9$k.isShowErpTradeList]);
198
219
  var shopUniqueKey = useMemo(function () {
199
220
  var _find;
200
221
  return (_find = (shopList || []).find(function (item) {
@@ -353,7 +374,15 @@ var WorkOrder = function WorkOrder(props) {
353
374
  tabActive: tabActive,
354
375
  onOpenWangWang: onOpenWangWang
355
376
  }), tabActive === 'wdt' && /*#__PURE__*/React.createElement(WdtTradeList, {
356
- version: ((_companyUserConfig2 = companyUserConfig) === null || _companyUserConfig2 === void 0 ? void 0 : (_companyUserConfig2$p = _companyUserConfig2.plugins) === null || _companyUserConfig2$p === void 0 ? void 0 : (_companyUserConfig2$p2 = _companyUserConfig2$p.wdt) === null || _companyUserConfig2$p2 === void 0 ? void 0 : _companyUserConfig2$p2.version) || ''
377
+ version: ((_companyUserConfig10 = companyUserConfig) === null || _companyUserConfig10 === void 0 ? void 0 : (_companyUserConfig10$ = _companyUserConfig10.plugins) === null || _companyUserConfig10$ === void 0 ? void 0 : (_companyUserConfig10$2 = _companyUserConfig10$.wdt) === null || _companyUserConfig10$2 === void 0 ? void 0 : _companyUserConfig10$2.version) || ''
378
+ }), tabActive === 'kmErpTradeList' && /*#__PURE__*/React.createElement(TradeList, {
379
+ isHistory: false,
380
+ buyerId: buyerId,
381
+ shopId: shopId
382
+ }), tabActive === 'kmErpTradeListHistory' && /*#__PURE__*/React.createElement(TradeList, {
383
+ isHistory: true,
384
+ buyerId: buyerId,
385
+ shopId: shopId
357
386
  }), customerServiceToDoListOpen && /*#__PURE__*/React.createElement(CustomerServiceToDoList, {
358
387
  shopUniqueKey: shopUniqueKey
359
388
  }), [PlatForm.XIAOZHI].includes(platform) && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.isAICreateOrder) && /*#__PURE__*/React.createElement(CustomerServiceToDoCard, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-work-order-service-component",
3
- "version": "2.2.44-beta.95",
3
+ "version": "2.2.44-beta.97",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -75,7 +75,7 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "e762245e5dfdb19966a19366af45ce56f7397b24",
78
+ "gitHead": "972de461a891cdcd223005375d2b793e891531a3",
79
79
  "gitHooks": {
80
80
  "pre-commit": "lint-staged"
81
81
  }
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- interface KmErpTradeListProps {
4
- isHistory: boolean;
5
- buyerId?: string;
6
- shopId?: string;
7
- }
8
- /**
9
- * 快麦 ERP 订单列表组件
10
- * 使用场景:
11
- * - 组件接受一个 buyerId 的 Props
12
- * - 当 buyerId 不为空且每次发生变化之后重新调用订单列表接口
13
- * - 如果该参数为空时,订单列表区域展示请选择当前买家的 Empty 提示
14
- */
15
- declare const KmErpTradeList: React.FC<KmErpTradeListProps>;
16
- export default KmErpTradeList;
@@ -1,171 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useEffect, useState } from 'react';
12
- import { Empty } from 'antd';
13
- import Search from "./components/Search";
14
- import TradeList from "./components/TradeList";
15
- import { kmErpOrderDetail } from "./api";
16
- import "./index.less";
17
- var DEFAULT_PAGE_SIZE = 20;
18
-
19
- /**
20
- * 快麦 ERP 订单列表组件
21
- * 使用场景:
22
- * - 组件接受一个 buyerId 的 Props
23
- * - 当 buyerId 不为空且每次发生变化之后重新调用订单列表接口
24
- * - 如果该参数为空时,订单列表区域展示请选择当前买家的 Empty 提示
25
- */
26
- var KmErpTradeList = function KmErpTradeList(props) {
27
- var _useState = useState(false),
28
- _useState2 = _slicedToArray(_useState, 2),
29
- loading = _useState2[0],
30
- setLoading = _useState2[1];
31
- var _useState3 = useState([]),
32
- _useState4 = _slicedToArray(_useState3, 2),
33
- list = _useState4[0],
34
- setList = _useState4[1];
35
- var _useState5 = useState(0),
36
- _useState6 = _slicedToArray(_useState5, 2),
37
- total = _useState6[0],
38
- setTotal = _useState6[1];
39
- var _useState7 = useState(1),
40
- _useState8 = _slicedToArray(_useState7, 2),
41
- pageNo = _useState8[0],
42
- setPageNo = _useState8[1];
43
- var _useState9 = useState(''),
44
- _useState10 = _slicedToArray(_useState9, 2),
45
- searchTid = _useState10[0],
46
- setSearchTid = _useState10[1];
47
- var _useState11 = useState(''),
48
- _useState12 = _slicedToArray(_useState11, 2),
49
- error = _useState12[0],
50
- setError = _useState12[1];
51
- var buyerId = props.buyerId,
52
- shopId = props.shopId,
53
- isHistory = props.isHistory;
54
-
55
- // 获取订单列表
56
- var fetchOrderList = /*#__PURE__*/function () {
57
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58
- var page,
59
- tid,
60
- res,
61
- _args = arguments;
62
- return _regeneratorRuntime().wrap(function _callee$(_context) {
63
- while (1) switch (_context.prev = _context.next) {
64
- case 0:
65
- page = _args.length > 0 && _args[0] !== undefined ? _args[0] : 1;
66
- tid = _args.length > 1 ? _args[1] : undefined;
67
- if (!(!buyerId && !tid)) {
68
- _context.next = 8;
69
- break;
70
- }
71
- setList([]);
72
- setTotal(0);
73
- setError('');
74
- setLoading(false);
75
- return _context.abrupt("return");
76
- case 8:
77
- setLoading(true);
78
- setError('');
79
- _context.prev = 10;
80
- _context.next = 13;
81
- return kmErpOrderDetail({
82
- buyerOpenUid: buyerId,
83
- shopIdList: shopId ? [shopId] : [],
84
- tid: tid || searchTid,
85
- pageNo: page,
86
- pageSize: DEFAULT_PAGE_SIZE,
87
- timeRangeType: isHistory ? 'BEFORE_LIMIT' : 'WITHIN_LIMIT'
88
- });
89
- case 13:
90
- res = _context.sent;
91
- if (res !== null && res !== void 0 && res.success && res !== null && res !== void 0 && res.data) {
92
- setList(res.data.orderDetailDtoList || []);
93
- setTotal(res.data.total || 0);
94
- setPageNo(page);
95
- } else {
96
- setError((res === null || res === void 0 ? void 0 : res.message) || '获取订单列表失败');
97
- }
98
- _context.next = 20;
99
- break;
100
- case 17:
101
- _context.prev = 17;
102
- _context.t0 = _context["catch"](10);
103
- setError((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '请求失败,请稍后重试');
104
- case 20:
105
- _context.prev = 20;
106
- setLoading(false);
107
- return _context.finish(20);
108
- case 23:
109
- case "end":
110
- return _context.stop();
111
- }
112
- }, _callee, null, [[10, 17, 20, 23]]);
113
- }));
114
- return function fetchOrderList() {
115
- return _ref.apply(this, arguments);
116
- };
117
- }();
118
-
119
- // 监听 buyerId 变化
120
- useEffect(function () {
121
- if (buyerId) {
122
- // 重置搜索条件和分页
123
- setSearchTid('');
124
- fetchOrderList(1, '');
125
- }
126
- }, [buyerId]);
127
-
128
- // 搜索处理
129
- var handleSearch = function handleSearch(params) {
130
- var tid = params.value.tid || '';
131
- setSearchTid(tid);
132
- fetchOrderList(1, tid);
133
- };
134
-
135
- // 分页处理
136
- var handlePageChange = function handlePageChange(page) {
137
- fetchOrderList(page, searchTid);
138
- };
139
-
140
- // buyerId 为空时显示空状态
141
- if (!buyerId) {
142
- return /*#__PURE__*/React.createElement("div", {
143
- className: "km-erp-trade-list-container"
144
- }, /*#__PURE__*/React.createElement(Search, {
145
- onSearch: handleSearch,
146
- disabled: true
147
- }), /*#__PURE__*/React.createElement("div", {
148
- className: "km-erp-trade-list-content"
149
- }, /*#__PURE__*/React.createElement(Empty, {
150
- description: "\u8BF7\u9009\u62E9\u5F53\u524D\u4E70\u5BB6"
151
- })));
152
- }
153
- return /*#__PURE__*/React.createElement("div", {
154
- className: "km-erp-trade-list-container"
155
- }, /*#__PURE__*/React.createElement(Search, {
156
- onSearch: handleSearch,
157
- disabled: loading
158
- }), /*#__PURE__*/React.createElement("div", {
159
- className: "km-erp-trade-list-content"
160
- }, /*#__PURE__*/React.createElement(TradeList, {
161
- list: list,
162
- loading: loading,
163
- pageNo: pageNo,
164
- pageSize: DEFAULT_PAGE_SIZE,
165
- total: total,
166
- onPageChange: handlePageChange,
167
- error: error,
168
- buyerId: buyerId
169
- })));
170
- };
171
- export default KmErpTradeList;