@kmkf-fe-packages/services-components 2.9.1-beta.7 → 2.9.1-beta.8

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.
@@ -1,1017 +0,0 @@
1
- "use strict";
2
-
3
- var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) {
5
- return value instanceof P ? value : new P(function (resolve) {
6
- resolve(value);
7
- });
8
- }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) {
11
- try {
12
- step(generator.next(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- }
17
- function rejected(value) {
18
- try {
19
- step(generator["throw"](value));
20
- } catch (e) {
21
- reject(e);
22
- }
23
- }
24
- function step(result) {
25
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
- }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- var __generator = this && this.__generator || function (thisArg, body) {
31
- var _ = {
32
- label: 0,
33
- sent: function sent() {
34
- if (t[0] & 1) throw t[1];
35
- return t[1];
36
- },
37
- trys: [],
38
- ops: []
39
- },
40
- f,
41
- y,
42
- t,
43
- g;
44
- return g = {
45
- next: verb(0),
46
- "throw": verb(1),
47
- "return": verb(2)
48
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
- return this;
50
- }), g;
51
- function verb(n) {
52
- return function (v) {
53
- return step([n, v]);
54
- };
55
- }
56
- function step(op) {
57
- if (f) throw new TypeError("Generator is already executing.");
58
- while (_) try {
59
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
- if (y = 0, t) op = [op[0] & 2, t.value];
61
- switch (op[0]) {
62
- case 0:
63
- case 1:
64
- t = op;
65
- break;
66
- case 4:
67
- _.label++;
68
- return {
69
- value: op[1],
70
- done: false
71
- };
72
- case 5:
73
- _.label++;
74
- y = op[1];
75
- op = [0];
76
- continue;
77
- case 7:
78
- op = _.ops.pop();
79
- _.trys.pop();
80
- continue;
81
- default:
82
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
- _ = 0;
84
- continue;
85
- }
86
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
- _.label = op[1];
88
- break;
89
- }
90
- if (op[0] === 6 && _.label < t[1]) {
91
- _.label = t[1];
92
- t = op;
93
- break;
94
- }
95
- if (t && _.label < t[2]) {
96
- _.label = t[2];
97
- _.ops.push(op);
98
- break;
99
- }
100
- if (t[2]) _.ops.pop();
101
- _.trys.pop();
102
- continue;
103
- }
104
- op = body.call(thisArg, _);
105
- } catch (e) {
106
- op = [6, e];
107
- y = 0;
108
- } finally {
109
- f = t = 0;
110
- }
111
- if (op[0] & 5) throw op[1];
112
- return {
113
- value: op[0] ? op[1] : void 0,
114
- done: true
115
- };
116
- }
117
- };
118
- var __spreadArrays = this && this.__spreadArrays || function () {
119
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
120
- for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
121
- return r;
122
- };
123
- exports.__esModule = true;
124
- exports.AlipayBill = exports.MsgContent = exports.BsSystemOrderTable = exports.FileRender = exports.BsGoodsTable = exports.BsGoodPic = exports.BsExchangeList = exports.BsGoodImage = exports.CommonOrderContent = exports.BsExpressRender = exports.JstGoodImage = exports.GoodImage = exports.ShowTotalImage = exports.showImage = exports.getFormItem = void 0;
125
- var antd_1 = require("antd");
126
- var react_1 = require("react");
127
- var kmkf_utils_1 = require("@kmkf-fe-packages/kmkf-utils");
128
- var api_1 = require("../../service/api");
129
- var react_copy_to_clipboard_1 = require("react-copy-to-clipboard");
130
- var index_module_less_1 = require("./index.module.less");
131
- var default_img_png_1 = require("./img/default-img.png");
132
- var CopyText_1 = require("../../commonComponents/CopyText");
133
- var kmkf_utils_2 = require("@kmkf-fe-packages/kmkf-utils");
134
- var columnsBaseInfoMap_1 = require("./constants/columnsBaseInfoMap");
135
- var Paragraph = antd_1.Typography.Paragraph;
136
- exports.getFormItem = function (_a) {
137
- var name = _a.name,
138
- title = _a.title,
139
- _b = _a.rules,
140
- rules = _b === void 0 ? [] : _b,
141
- required = _a.required,
142
- component = _a.component;
143
- var newRules = rules;
144
- if (required) {
145
- newRules = rules.concat({
146
- required: true,
147
- message: "\u8BF7\u8F93\u5165" + title
148
- });
149
- }
150
- return react_1["default"].createElement("div", {
151
- className: "form-item--wrap",
152
- style: {
153
- position: "relative"
154
- }
155
- }, react_1["default"].createElement(antd_1.Form.Item, {
156
- name: name,
157
- label: title,
158
- rules: newRules,
159
- className: "form-item-label--index"
160
- }, component));
161
- };
162
- //图片展示
163
- exports.showImage = function (_a) {
164
- var item = _a.item,
165
- type = _a.type,
166
- index = _a.index,
167
- showHeader = _a.showHeader;
168
- var picUrl = item.picUrl ? (item === null || item === void 0 ? void 0 : item.platform) !== "tabao" ? item.picUrl : item.picUrl + "_40x40.jpg" : default_img_png_1["default"];
169
- var mapping_itemCode = kmkf_utils_2.getMapping(kmkf_utils_2.columnsGoodsList);
170
- return react_1["default"].createElement("div", {
171
- className: index_module_less_1["default"].goodImgBox,
172
- key: index
173
- }, type === "itemCode" && !showHeader.includes("picUrl") ? null : (item === null || item === void 0 ? void 0 : item.platform) === "taobao" ? react_1["default"].createElement("a", {
174
- target: "_blank",
175
- href: item.numIid ? "https://item.taobao.com/item.htm?id=" + item.numIid : "javascript:void(0);"
176
- }, react_1["default"].createElement("img", {
177
- style: {
178
- width: "40px",
179
- height: "40px",
180
- objectFit: "contain"
181
- },
182
- src: picUrl
183
- })) : react_1["default"].createElement("img", {
184
- style: {
185
- width: "40px",
186
- height: "40px",
187
- objectFit: "contain"
188
- },
189
- src: picUrl
190
- }), react_1["default"].createElement("div", {
191
- className: index_module_less_1["default"].options,
192
- onClick: function onClick() {}
193
- }, type === "itemId" && react_1["default"].createElement(TextTool, {
194
- title: "商品id",
195
- text: item.numIid
196
- }), type === "itemCode" && react_1["default"].createElement(react_1["default"].Fragment, null, showHeader.filter(function (dataIndex) {
197
- return dataIndex !== "picUrl";
198
- }).map(function (dataIndex) {
199
- return react_1["default"].createElement(TextTool, {
200
- title: mapping_itemCode[dataIndex],
201
- text: item[dataIndex]
202
- });
203
- })), (type === "itemThird" || type === "jstItemThird") && (item.itemId || item.supplierItemOuterId) && react_1["default"].createElement(TextTool, {
204
- title: "供应商编码",
205
- text: item.itemId || item.supplierItemOuterId
206
- }), (type === "itemThird" || type === "jstItemThird") && item.supplierName && react_1["default"].createElement(TextTool, {
207
- title: "供应商名称",
208
- text: item.supplierName
209
- }), type !== "itemCode" && item.propertiesName && react_1["default"].createElement(TextTool, {
210
- title: "规格",
211
- text: item.propertiesName
212
- })));
213
- };
214
- //文字提示
215
- var TextTool = function TextTool(_a) {
216
- var title = _a.title,
217
- text = _a.text;
218
- return react_1["default"].createElement(antd_1.Tooltip, {
219
- placement: "topLeft",
220
- title: text
221
- }, react_1["default"].createElement("div", {
222
- style: {
223
- overflow: "hidden",
224
- whiteSpace: "nowrap",
225
- textOverflow: "ellipsis"
226
- }
227
- }, title, ":", text));
228
- };
229
- //查看更多图片
230
- exports.ShowTotalImage = function (_a) {
231
- var total = _a.total,
232
- _b = _a.allImage,
233
- allImage = _b === void 0 ? [] : _b,
234
- type = _a.type,
235
- _c = _a.showHeader,
236
- showHeader = _c === void 0 ? [] : _c;
237
- var _d = react_1.useState(false),
238
- visible = _d[0],
239
- setVisible = _d[1];
240
- var mapping_itemCode = kmkf_utils_2.getMapping(kmkf_utils_2.columnsGoodsList);
241
- return react_1["default"].createElement(react_1["default"].Fragment, null, react_1["default"].createElement(antd_1.Button, {
242
- type: "link",
243
- onClick: function onClick() {
244
- return setVisible(true);
245
- }
246
- }, "\u67E5\u770B\u5168\u90E8(" + total + ")"), react_1["default"].createElement(antd_1.Modal, {
247
- visible: visible,
248
- footer: null,
249
- onCancel: function onCancel() {
250
- return setVisible(false);
251
- },
252
- title: "\u6240\u6709\u9009\u62E9\u5B9D\u8D1D"
253
- }, react_1["default"].createElement("div", {
254
- style: {
255
- display: "flex",
256
- flexWrap: "wrap"
257
- }
258
- }, allImage.map(function (i, index) {
259
- return react_1["default"].createElement("div", {
260
- style: {
261
- width: "50%"
262
- },
263
- key: index
264
- }, type === "itemCode" && !showHeader.includes("picUrl") ? null : react_1["default"].createElement("a", {
265
- href: i.link || ((i === null || i === void 0 ? void 0 : i.platform) === "taobao" && i.numIid ? "https://item.taobao.com/item.htm?id=" + i.numIid : "javascript:void(0);"),
266
- target: "__blank",
267
- style: {
268
- marginRight: "12px",
269
- marginTop: "8px",
270
- padding: "2px",
271
- border: "1px dashed #ccc",
272
- display: "inline-block"
273
- }
274
- }, react_1["default"].createElement("img", {
275
- alt: "",
276
- src: i.picUrl || default_img_png_1["default"],
277
- style: {
278
- width: "72px",
279
- height: "72px",
280
- objectFit: "contain"
281
- }
282
- })), react_1["default"].createElement("div", null, type === "itemId" && react_1["default"].createElement(TextTool, {
283
- title: "商品id",
284
- text: i.numIid
285
- }), type === "itemCode" && react_1["default"].createElement(react_1["default"].Fragment, null, showHeader.filter(function (dataIndex) {
286
- return dataIndex !== "picUrl";
287
- }).map(function (dataIndex) {
288
- return react_1["default"].createElement(TextTool, {
289
- title: mapping_itemCode[dataIndex],
290
- text: i[dataIndex]
291
- });
292
- })), (type === "itemThird" || type === "jstItemThird") && (i.itemId || i.supplierItemOuterId) && react_1["default"].createElement(TextTool, {
293
- title: "供应商编码",
294
- text: i.itemId || i.supplierItemOuterId
295
- }), (type === "itemThird" || type === "jstItemThird") && i.supplierName && react_1["default"].createElement(TextTool, {
296
- title: "供应商名称",
297
- text: i.supplierName
298
- }), type !== "itemCode" && i.propertiesName && react_1["default"].createElement(TextTool, {
299
- title: "规格",
300
- text: i.propertiesName
301
- })));
302
- }))));
303
- };
304
- //商品列表展示
305
- exports.GoodImage = function (_a) {
306
- var _b;
307
- var list = _a.list,
308
- _c = _a.type,
309
- type = _c === void 0 ? "" : _c,
310
- _d = _a.showHeader,
311
- showHeader = _d === void 0 ? [] : _d;
312
- var total = (list === null || list === void 0 ? void 0 : list.length) || 0;
313
- var initShowTotal = 3;
314
- var showHeaderMap = react_1.useMemo(function () {
315
- var isStringArray = Array.isArray(showHeader) && typeof showHeader[0] === "string";
316
- var isObjectArray = Array.isArray(showHeader) && Object.prototype.toString.call(showHeader[0]) === "[object Object]";
317
- var dataIndexList = [];
318
- if (isStringArray) {
319
- dataIndexList = showHeader;
320
- } else if (isObjectArray) {
321
- dataIndexList = showHeader.filter(function (item) {
322
- return item.show !== false;
323
- }).map(function (item) {
324
- return item.dataIndex;
325
- });
326
- }
327
- return dataIndexList;
328
- }, [showHeader]);
329
- return (list === null || list === void 0 ? void 0 : list.length) > 0 ? react_1["default"].createElement("div", {
330
- style: {
331
- display: type === "itemSelect" ? "flex" : "block"
332
- }
333
- }, (_b = list === null || list === void 0 ? void 0 : list.slice(0, initShowTotal)) === null || _b === void 0 ? void 0 : _b.map(function (item, index) {
334
- return exports.showImage({
335
- item: item,
336
- type: type,
337
- index: index,
338
- showHeader: showHeaderMap
339
- });
340
- }), total > initShowTotal && react_1["default"].createElement(exports.ShowTotalImage, {
341
- total: total,
342
- allImage: list,
343
- showHeader: showHeaderMap,
344
- type: type
345
- })) : null;
346
- };
347
- var content = function content(item, index) {
348
- return react_1["default"].createElement("div", {
349
- style: {
350
- maxHeight: "300px",
351
- overflowY: "auto"
352
- }
353
- }, react_1["default"].createElement("div", {
354
- style: {
355
- textAlign: "center"
356
- }
357
- }, "\u5305\u88F9" + (index + 1) + "\u5546\u54C1\u4FE1\u606F", item.sid && react_1["default"].createElement("span", null, "(\u7CFB\u7EDF\u5355\u53F7:", item.sid, ")")), ((item === null || item === void 0 ? void 0 : item.items) || []).map(function (t, index) {
358
- return react_1["default"].createElement("div", {
359
- key: index
360
- }, react_1["default"].createElement(antd_1.Space, null, react_1["default"].createElement(antd_1.Image, {
361
- width: 70,
362
- src: t.picUrl,
363
- preview: false
364
- }), react_1["default"].createElement("div", null, react_1["default"].createElement("div", null, t.title), react_1["default"].createElement("div", null, "\u7F16\u7801\uFF1A", t.skuId))));
365
- }));
366
- };
367
- exports.JstGoodImage = function (_a) {
368
- var _b = _a.list,
369
- list = _b === void 0 ? [] : _b,
370
- type = _a.type,
371
- _c = _a.platformType,
372
- platformType = _c === void 0 ? "default" : _c;
373
- var getSendName = function getSendName(item) {
374
- return kmkf_utils_1.SendDataCenter.getInstance(platformType).getSendNameByCode(item.sendName);
375
- };
376
- return (list === null || list === void 0 ? void 0 : list.length) ? (list || []).map(function (item, index) {
377
- var logisticsCompany = item.logisticsCompany;
378
- var company = kmkf_utils_1.ExpressData.getInstance(platformType).getExpressNameByCode(logisticsCompany);
379
- return react_1["default"].createElement("div", null, react_1["default"].createElement(antd_1.Space, null, react_1["default"].createElement(antd_1.Popover, {
380
- content: content(item, index),
381
- overlayStyle: {
382
- zIndex: 1080
383
- }
384
- }, react_1["default"].createElement("span", {
385
- key: index,
386
- style: {
387
- color: "#1890ff",
388
- cursor: "pointer"
389
- }
390
- }, "\u5305\u88F9" + (index + 1), ":")), type === 1 ? react_1["default"].createElement("span", null, company && item.logisticsCode ? react_1["default"].createElement(react_1["default"].Fragment, null, company, "/", react_1["default"].createElement(CopyText_1["default"], {
391
- text: item.logisticsCode
392
- })) : company ? company : item.logisticsCode ? react_1["default"].createElement(CopyText_1["default"], {
393
- text: item.logisticsCode
394
- }) : null) : null, type === 2 ? react_1["default"].createElement("span", null, item.supplyName && item.supplyId ? [item.supplyId, item.supplyName].join("/") : item.supplyId ? item.supplyId : item.supplyName) : null, type === 3 ? react_1["default"].createElement("span", null, item.sendName && item.sendId ? [item.sendId, getSendName(item)].join("/") : item.sendId ? item.sendId : getSendName(item)) : null, type === 4 ? react_1["default"].createElement("span", null, (item === null || item === void 0 ? void 0 : item.deliveryNo) || "") : null));
395
- }) : null;
396
- };
397
- exports.BsExpressRender = function (_a) {
398
- var _b = _a.list,
399
- list = _b === void 0 ? [] : _b,
400
- _c = _a.showField,
401
- showField = _c === void 0 ? "" : _c,
402
- _d = _a.platformType,
403
- platformType = _d === void 0 ? "default" : _d;
404
- return (list === null || list === void 0 ? void 0 : list.length) ? (list || []).map(function (item, index) {
405
- var logisticsCompany = item.logisticsCompany;
406
- var company = kmkf_utils_1.ExpressData.getInstance(platformType).getExpressNameByCode(logisticsCompany);
407
- return react_1["default"].createElement("div", null, react_1["default"].createElement(antd_1.Space, null, react_1["default"].createElement(antd_1.Popover, {
408
- content: content(item, index),
409
- overlayStyle: {
410
- zIndex: 1080
411
- }
412
- }, react_1["default"].createElement("span", {
413
- key: index,
414
- style: {
415
- color: "#1890ff",
416
- cursor: "pointer"
417
- }
418
- }, "\u5305\u88F9", ":")), showField === "company" ? react_1["default"].createElement("span", null, company ? company : null) : null, showField === "code" ? react_1["default"].createElement("span", null, item.logisticsCode ? react_1["default"].createElement(CopyText_1["default"], {
419
- text: item.logisticsCode
420
- }) : null) : null));
421
- }) : null;
422
- };
423
- exports.CommonOrderContent = function (_a) {
424
- var _b = _a.list,
425
- list = _b === void 0 ? [] : _b,
426
- initValueKey = _a.valueKey,
427
- failValue = _a.failValue,
428
- _c = _a.options,
429
- options = _c === void 0 ? [] : _c,
430
- _d = _a.isShowPopover,
431
- isShowPopover = _d === void 0 ? true : _d;
432
- var getContentData = function getContentData(item, index) {
433
- if (item.platformId) return {
434
- text: "平台售后单号",
435
- id: item.platformId
436
- };
437
- if (item.returnLogisticsCode) return {
438
- text: "物流单号",
439
- id: item.returnLogisticsCode
440
- };
441
- return {
442
- text: "系统订单号" + (index + 1),
443
- id: item.systemOrderId
444
- };
445
- };
446
- var orderContent = function orderContent(item, index) {
447
- var contentData = getContentData(item, index);
448
- return react_1["default"].createElement("div", null, react_1["default"].createElement("div", {
449
- style: {
450
- textAlign: "center"
451
- }
452
- }, contentData.text, "\uFF1A", contentData.id));
453
- };
454
- return (list === null || list === void 0 ? void 0 : list.length) ? (list || []).map(function (item, index) {
455
- var _a;
456
- var valueKey = "";
457
- if (Array.isArray(initValueKey)) {
458
- for (var index_1 = 0; index_1 < initValueKey.length; index_1++) {
459
- var itemKey = initValueKey[index_1];
460
- if (item[itemKey]) {
461
- valueKey = itemKey;
462
- break;
463
- }
464
- }
465
- } else {
466
- valueKey = initValueKey;
467
- }
468
- var color = ((_a = options.find(function (it) {
469
- return item[valueKey] === it.value;
470
- })) === null || _a === void 0 ? void 0 : _a.color) || "#000";
471
- var currentOption = options.find(function (option) {
472
- return item[valueKey] === option.value;
473
- });
474
- return react_1["default"].createElement("div", null, react_1["default"].createElement(antd_1.Space, null, isShowPopover ? react_1["default"].createElement(antd_1.Popover, {
475
- content: orderContent(item, index),
476
- overlayStyle: {
477
- zIndex: 1080
478
- }
479
- }, react_1["default"].createElement("span", {
480
- key: index,
481
- style: {
482
- color: "#1890ff",
483
- cursor: "pointer"
484
- }
485
- }, "" + getContentData(item, index).text, ":")) : null, react_1["default"].createElement("span", {
486
- style: {
487
- color: color
488
- }
489
- }, currentOption ? currentOption.label : (item === null || item === void 0 ? void 0 : item[valueKey]) || "")), item.reason && (item === null || item === void 0 ? void 0 : item[valueKey]) !== "成功" && react_1["default"].createElement("div", {
490
- className: "c-red"
491
- }, item.reason));
492
- }) : null;
493
- };
494
- //bs商品展示 todo
495
- exports.BsGoodImage = function (_a) {
496
- var item = _a.item,
497
- index = _a.index;
498
- var picUrl = item.picUrl || default_img_png_1["default"];
499
- var keyMap = {
500
- name: "bs名称",
501
- code: "bs编码",
502
- skuId: "bssku编码",
503
- money: "bs实付金额",
504
- number: "bs数量",
505
- share: "bs分摊价",
506
- type: "bs赠品类型"
507
- };
508
- return react_1["default"].createElement("div", {
509
- className: index_module_less_1["default"].goodImgBox,
510
- key: index
511
- }, react_1["default"].createElement("img", {
512
- style: {
513
- width: "40px",
514
- height: "40px",
515
- objectFit: "contain"
516
- },
517
- src: picUrl
518
- }), react_1["default"].createElement("div", {
519
- className: index_module_less_1["default"].options
520
- }, Object.keys(keyMap).map(function (key) {
521
- return item[key] ? react_1["default"].createElement(TextTool, {
522
- title: keyMap[key],
523
- text: item[key]
524
- }) : null;
525
- })));
526
- };
527
- //bs换货 todo
528
- exports.BsExchangeList = function (_a) {
529
- var list = _a.list,
530
- showHeader = _a.showHeader;
531
- return react_1["default"].createElement("div", {
532
- className: index_module_less_1["default"].bsImgBox
533
- }, list.map(function (item) {
534
- return react_1["default"].createElement(react_1["default"].Fragment, null, exports.BsGoodsTable({
535
- list: (item === null || item === void 0 ? void 0 : item.bsExchangeReturnGoods) || [],
536
- showHeader: showHeader,
537
- text: "退回"
538
- }), exports.BsGoodsTable({
539
- list: item === null || item === void 0 ? void 0 : item.bsExchangeSwapOutGoods,
540
- showHeader: showHeader,
541
- text: "换出"
542
- }));
543
- }));
544
- };
545
- //bs图片展示
546
- exports.BsGoodPic = function (list) {
547
- return list.map(function (t) {
548
- return react_1["default"].createElement(antd_1.Image, {
549
- width: 60,
550
- src: t
551
- });
552
- });
553
- };
554
- exports.BsGoodsTable = function (_a) {
555
- var list = _a.list,
556
- showHeader = _a.showHeader,
557
- _b = _a.text,
558
- text = _b === void 0 ? "" : _b,
559
- type = _a.type;
560
- //商品信息
561
- var COLUMNS_MAP = function COLUMNS_MAP(text) {
562
- if (text === void 0) {
563
- text = "";
564
- }
565
- return function (type) {
566
- var _a;
567
- var columnsMap = columnsBaseInfoMap_1.getColumnsMap({
568
- text: text
569
- });
570
- return (_a = columnsMap[type]) !== null && _a !== void 0 ? _a : columnsMap["default"];
571
- };
572
- };
573
- //商品信息
574
- var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS(text) {
575
- if (text === void 0) {
576
- text = "";
577
- }
578
- var COLUMNS_INFO = COLUMNS_MAP(text);
579
- return COLUMNS_INFO(type);
580
- };
581
- // const GOODS_INFO_COLUMNS = (text = '') => {
582
- // return
583
- // }
584
- var newColumns = react_1.useMemo(function () {
585
- var initBaseInfoColumns = GOODS_INFO_COLUMNS();
586
- var baseInfoColumns = [];
587
- var isStringArray = Array.isArray(showHeader) && typeof showHeader[0] === "string";
588
- var isObjectArray = Array.isArray(showHeader) && Object.prototype.toString.call(showHeader[0]) === "[object Object]";
589
- if (isStringArray) {
590
- baseInfoColumns = initBaseInfoColumns.filter(function (col) {
591
- return showHeader.includes(col.dataIndex);
592
- });
593
- } else if (isObjectArray) {
594
- baseInfoColumns = showHeader.filter(function (col) {
595
- return col.show !== false;
596
- }).map(function (col) {
597
- var currentCol = initBaseInfoColumns.find(function (item) {
598
- return item.dataIndex === col.dataIndex;
599
- });
600
- return currentCol ? currentCol : undefined;
601
- }).filter(Boolean);
602
- }
603
- var columnList = __spreadArrays([{
604
- dataIndex: "",
605
- title: "序号",
606
- align: "center",
607
- ellipsis: true,
608
- width: 50,
609
- render: function render(val, record, index) {
610
- return react_1["default"].createElement("span", null, index + 1);
611
- }
612
- }], baseInfoColumns);
613
- return columnList;
614
- }, [showHeader, list]);
615
- return react_1["default"].createElement(antd_1.Table, {
616
- columns: newColumns,
617
- dataSource: list,
618
- rowKey: "uuid",
619
- size: "small",
620
- pagination: false,
621
- scroll: {
622
- x: "100%"
623
- },
624
- locale: {
625
- emptyText: "暂无数据"
626
- }
627
- });
628
- };
629
- exports.FileRender = function (_a) {
630
- var _b = _a.fileList,
631
- fileList = _b === void 0 ? [] : _b,
632
- _c = _a.canDownload,
633
- canDownload = _c === void 0 ? false : _c;
634
- var _d = react_1.useState(false),
635
- visible = _d[0],
636
- setVisible = _d[1];
637
- var _e = react_1.useState(""),
638
- fileUrl = _e[0],
639
- setFileUrl = _e[1];
640
- var _f = react_1.useState(""),
641
- fileType = _f[0],
642
- setFileType = _f[1];
643
- var _g = react_1.useState(""),
644
- fileName = _g[0],
645
- setFileName = _g[1];
646
- var _h = react_1.useState(false),
647
- downloading = _h[0],
648
- setDownloading = _h[1];
649
- var handleCancel = function handleCancel() {
650
- setFileUrl("");
651
- setFileName("");
652
- setVisible(false);
653
- setDownloading(false);
654
- };
655
- var onPreview = function onPreview(file) {
656
- var _a;
657
- var fileArr = (_a = file === null || file === void 0 ? void 0 : file.url) === null || _a === void 0 ? void 0 : _a.split(".");
658
- var fileType = fileArr[fileArr.length - 1];
659
- if (["png", "jpg", "jpeg", "gif", "bmp", "svg"].includes(fileType.toLowerCase())) {
660
- setFileUrl(file === null || file === void 0 ? void 0 : file.url);
661
- setFileName(file === null || file === void 0 ? void 0 : file.name);
662
- setFileType("pic");
663
- setVisible(true);
664
- } else if (["mp4", "avi", "mpeg", "asf", "mov", "3gp", "wmv", "rmvb"].includes(fileType.toLowerCase())) {
665
- setFileUrl(file === null || file === void 0 ? void 0 : file.url);
666
- setFileName(file === null || file === void 0 ? void 0 : file.name);
667
- setFileType("video");
668
- setVisible(true);
669
- } else {
670
- window.open(file === null || file === void 0 ? void 0 : file.url);
671
- }
672
- };
673
- var download = function download(url, name) {
674
- setDownloading(true);
675
- fetch(url).then(function (res) {
676
- return res.blob();
677
- }).then(function (blob) {
678
- var a = document.createElement("a");
679
- document.body.appendChild(a);
680
- a.style.display = "none";
681
- var url = window.URL.createObjectURL(blob);
682
- a.href = url;
683
- a.download = name;
684
- a.click();
685
- document.body.removeChild(a);
686
- window.URL.revokeObjectURL(url);
687
- })["finally"](function () {
688
- setDownloading(false);
689
- });
690
- };
691
- return react_1["default"].createElement(react_1["default"].Fragment, null, fileList.map(function (item) {
692
- return react_1["default"].createElement("a", {
693
- style: {
694
- color: "#1890ff",
695
- cursor: "pointer",
696
- display: "block"
697
- },
698
- onClick: function onClick(e) {
699
- e.preventDefault();
700
- onPreview(item);
701
- },
702
- href: item === null || item === void 0 ? void 0 : item.url
703
- }, item.name);
704
- }), react_1["default"].createElement(antd_1.Modal, {
705
- visible: visible,
706
- title: fileName,
707
- footer: null,
708
- onCancel: handleCancel
709
- }, canDownload ? react_1["default"].createElement(antd_1.Button, {
710
- type: "link",
711
- onClick: function onClick() {
712
- return download(fileUrl, fileName);
713
- },
714
- loading: downloading
715
- }, "\u4E0B\u8F7D") : react_1["default"].createElement(react_copy_to_clipboard_1.CopyToClipboard, {
716
- text: fileUrl,
717
- onCopy: function onCopy() {
718
- antd_1.message.success("复制成功");
719
- }
720
- }, react_1["default"].createElement(antd_1.Button, {
721
- type: "link"
722
- }, "\u4E0B\u8F7D\u5730\u5740")), fileType === "pic" ? react_1["default"].createElement("img", {
723
- alt: "example",
724
- style: {
725
- width: "100%"
726
- },
727
- src: fileUrl
728
- }) : react_1["default"].createElement("video", {
729
- style: {
730
- width: "100%",
731
- height: "100%"
732
- },
733
- autoPlay: true,
734
- controls: true,
735
- src: fileUrl
736
- })));
737
- };
738
- exports.BsSystemOrderTable = function (_a) {
739
- var value = _a.value,
740
- type = _a.type;
741
- var columnMap = {
742
- BS_SYSTEM_ORDER: [{
743
- dataIndex: "billType",
744
- title: "订单类型"
745
- }, {
746
- dataIndex: "billNo",
747
- title: "系统订单号"
748
- }, {
749
- dataIndex: "billTag",
750
- title: "标签"
751
- }, {
752
- title: "主播名称",
753
- dataIndex: "authorName"
754
- }, {
755
- title: "主播ID",
756
- dataIndex: "authorId"
757
- }],
758
- KM_SYSTEM_ORDER: kmkf_utils_2.KM_SYSTEM_ORDER_CONFIG.columns,
759
- WLN_SYSTEM_ORDER: [{
760
- dataIndex: "billType",
761
- title: "单据类型"
762
- }, {
763
- dataIndex: "billNo",
764
- title: "系统订单号"
765
- }, {
766
- dataIndex: "billTag",
767
- title: "标签"
768
- }],
769
- WDT_SYSTEM_ORDER: [{
770
- dataIndex: "billType",
771
- title: "订单类型"
772
- }, {
773
- dataIndex: "billNo",
774
- title: "系统订单号"
775
- }, {
776
- dataIndex: "billTag",
777
- title: "订单标签"
778
- }],
779
- BS_E3_SYSTEM_ORDER: [{
780
- title: "系统订单号",
781
- dataIndex: "orderSn",
782
- width: 150,
783
- ellipsis: true
784
- }, {
785
- title: "订单状态",
786
- dataIndex: "orderStatus",
787
- width: 100,
788
- ellipsis: true,
789
- render: function render(val) {
790
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_ORDER_STATUS_MAP[val] || val);
791
- }
792
- }, {
793
- title: "是否被拆分",
794
- dataIndex: "isSplit",
795
- width: 100,
796
- ellipsis: true,
797
- render: function render(val) {
798
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_BOOLEAN_STATUS_MAP[val] || val);
799
- }
800
- }, {
801
- title: "是否拆分子单",
802
- dataIndex: "isSplitNew",
803
- width: 100,
804
- ellipsis: true,
805
- render: function render(val) {
806
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_BOOLEAN_STATUS_MAP[val] || val);
807
- }
808
- }, {
809
- title: "是否被合并",
810
- dataIndex: "isCombine",
811
- width: 100,
812
- ellipsis: true,
813
- render: function render(val) {
814
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_BOOLEAN_STATUS_MAP[val] || val);
815
- }
816
- }, {
817
- title: "是否合并新单",
818
- dataIndex: "isCombineNew",
819
- width: 100,
820
- ellipsis: true,
821
- render: function render(val) {
822
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_BOOLEAN_STATUS_MAP[val] || val);
823
- }
824
- }, {
825
- title: "是否复制单",
826
- dataIndex: "isCopy",
827
- width: 100,
828
- ellipsis: true,
829
- render: function render(val) {
830
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_BOOLEAN_STATUS_MAP[val] || val);
831
- }
832
- }, {
833
- title: "是否换货单",
834
- dataIndex: "isExchangeOrder",
835
- width: 100,
836
- ellipsis: true,
837
- render: function render(val) {
838
- return react_1["default"].createElement("span", null, kmkf_utils_1.BS_E3_BOOLEAN_STATUS_MAP[val] || val);
839
- }
840
- }, {
841
- title: "订单备注",
842
- dataIndex: "orderMsg",
843
- width: 100,
844
- ellipsis: true
845
- }],
846
- GY_SYSTEM_ORDER: kmkf_utils_2.GY_SYSTEM_ORDER_CONFIG.columns
847
- };
848
- var rowKeyMap = {
849
- BS_SYSTEM_ORDER: "billNo",
850
- KM_SYSTEM_ORDER: "billNo",
851
- WLN_SYSTEM_ORDER: "billNo",
852
- WDT_SYSTEM_ORDER: "billNo",
853
- BS_E3_SYSTEM_ORDER: "orderSn",
854
- GY_SYSTEM_ORDER: "billNo"
855
- };
856
- var rowSelection = {
857
- selectedRowKeys: (value === null || value === void 0 ? void 0 : value.selectIds) || ((value === null || value === void 0 ? void 0 : value.showOrderInfo) || []).reduce(function (prv, next) {
858
- if (next.select) {
859
- prv.push(next[rowKeyMap[type]] || "billNo");
860
- }
861
- return prv;
862
- }, []),
863
- getCheckboxProps: function getCheckboxProps(record) {
864
- return {
865
- disabled: true,
866
- name: record.name
867
- };
868
- }
869
- };
870
- return react_1["default"].createElement(antd_1.Table, {
871
- dataSource: (value === null || value === void 0 ? void 0 : value.showOrderInfo) || [],
872
- columns: columnMap[type] || [],
873
- rowSelection: rowSelection,
874
- rowKey: rowKeyMap[type] || "billNo",
875
- size: "small",
876
- pagination: false,
877
- scroll: {
878
- x: "100%"
879
- },
880
- locale: {
881
- emptyText: "暂无数据"
882
- }
883
- });
884
- };
885
- // interface MsgItemType {
886
- // msgRuleId: string
887
- // msgType: string
888
- // ruleName: string
889
- // status: string
890
- // }
891
- exports.MsgContent = function (_a) {
892
- var _b = _a.horizontal,
893
- horizontal = _b === void 0 ? true : _b,
894
- _c = _a.list,
895
- list = _c === void 0 ? [] : _c,
896
- valueKey = _a.valueKey,
897
- failValue = _a.failValue,
898
- _d = _a.options,
899
- options = _d === void 0 ? [] : _d;
900
- var getColorByStatus = function getColorByStatus(value) {
901
- var _a;
902
- return ((_a = options.find(function (innerItem) {
903
- return value === innerItem.label || value === innerItem.oldValue;
904
- })) === null || _a === void 0 ? void 0 : _a.color) || "#000";
905
- };
906
- var detailContent = function detailContent(item) {
907
- var _a;
908
- return react_1["default"].createElement("div", null, react_1["default"].createElement("div", {
909
- style: {
910
- textAlign: "left"
911
- }
912
- }, ((_a = item.msgReceivers) === null || _a === void 0 ? void 0 : _a.length) ? item.msgReceivers.map(function (msgItem, index) {
913
- return react_1["default"].createElement("div", {
914
- key: index,
915
- style: {
916
- color: getColorByStatus(msgItem.status)
917
- }
918
- }, msgItem.failReason ? msgItem.name + "\uFF0C" + msgItem.status + "\uFF0C\u5931\u8D25\u539F\u56E0\uFF1A" + msgItem.failReason : msgItem.name + "\uFF0C" + msgItem.status + ";");
919
- }) : item.failReason && react_1["default"].createElement("div", {
920
- style: {
921
- color: getColorByStatus(item.status)
922
- }
923
- }, "\u5931\u8D25\u539F\u56E0\uFF1A", item.failReason)));
924
- };
925
- return react_1["default"].createElement(antd_1.Space, {
926
- direction: !horizontal ? "vertical" : "horizontal"
927
- }, Array.isArray(list) ? (list || []).map(function (item, index) {
928
- var _a;
929
- var color = getColorByStatus(item[valueKey]);
930
- var currentOption = options.find(function (option) {
931
- return item[valueKey] === option.value;
932
- });
933
- var key = item.msgType || "ding";
934
- var formatMsgContent = react_1["default"].createElement("span", {
935
- key: index
936
- }, kmkf_utils_2.msgTypeCh[key], "-", item.ruleName, "-", currentOption ? currentOption.label : (item === null || item === void 0 ? void 0 : item[valueKey]) || "");
937
- return react_1["default"].createElement("div", {
938
- key: "wrap_" + index,
939
- style: {
940
- color: color,
941
- cursor: "pointer"
942
- }
943
- }, ((_a = item.msgReceivers) === null || _a === void 0 ? void 0 : _a.some(function (msgItem) {
944
- return Array.isArray(failValue) ? failValue.includes(msgItem === null || msgItem === void 0 ? void 0 : msgItem.status) : (msgItem === null || msgItem === void 0 ? void 0 : msgItem.status) === failValue;
945
- })) || item.failReason ? react_1["default"].createElement(antd_1.Popover, {
946
- content: detailContent(item),
947
- overlayStyle: {
948
- zIndex: 9999
949
- }
950
- }, formatMsgContent) : formatMsgContent);
951
- }) : null);
952
- };
953
- //获取付款凭证
954
- exports.AlipayBill = function (props) {
955
- var value = props.value,
956
- platform = props.platform;
957
- var _a = react_1.useState(false),
958
- visible = _a[0],
959
- setVisible = _a[1];
960
- var _b = react_1.useState(""),
961
- msg = _b[0],
962
- setMsg = _b[1];
963
- var _c = react_1.useState(false),
964
- hasUrl = _c[0],
965
- setHasUrl = _c[1];
966
- var voucherHandle = function voucherHandle(e) {
967
- return __awaiter(void 0, void 0, void 0, function () {
968
- var params, res, data, msg;
969
- return __generator(this, function (_a) {
970
- switch (_a.label) {
971
- case 0:
972
- e.stopPropagation();
973
- params = {
974
- alipayBillReceiptDetailId: value
975
- };
976
- return [4 /*yield*/, api_1.getAlipayBillReceipt(params)];
977
- case 1:
978
- res = _a.sent();
979
- data = res.data, msg = res.message;
980
- if (data) {
981
- setHasUrl(true);
982
- if (["fxg"].includes(platform)) {
983
- setMsg(data);
984
- setVisible(true);
985
- } else {
986
- window.open(data);
987
- }
988
- } else {
989
- setHasUrl(false);
990
- setMsg(msg);
991
- setVisible(true);
992
- }
993
- return [2 /*return*/];
994
- }
995
- });
996
- });
997
- };
998
-
999
- var closeHandle = function closeHandle(e) {
1000
- e.stopPropagation();
1001
- setVisible(false);
1002
- };
1003
- return react_1["default"].createElement(react_1["default"].Fragment, null, react_1["default"].createElement("span", {
1004
- style: {
1005
- color: "#1890ff",
1006
- cursor: "pointer"
1007
- },
1008
- onClick: voucherHandle
1009
- }, value), react_1["default"].createElement(antd_1.Modal, {
1010
- title: "\u4ED8\u6B3E\u51ED\u8BC1",
1011
- visible: visible,
1012
- footer: false,
1013
- onCancel: closeHandle
1014
- }, ["fxg"].includes(platform) && hasUrl ? react_1["default"].createElement("div", null, "\u8BF7\u590D\u5236\u94FE\u63A5\u5728\u6D4F\u89C8\u5668\u4E0A\u6253\u5F00\uFF0C\u94FE\u63A5\uFF1A", react_1["default"].createElement(Paragraph, {
1015
- copyable: true
1016
- }, msg)) : msg));
1017
- };