@fle-ui/plus-im-record 0.0.8-beta.3 → 0.0.8-beta.4
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.
- package/es/ChatMessageItem/index.less +4 -1
- package/es/GoodsCard/index.less +1 -0
- package/es/GoodsOrderCard/index.less +1 -0
- package/es/OrderGoodsCard/index.d.ts +8 -0
- package/es/OrderGoodsCard/index.js +85 -0
- package/es/OrderGoodsCard/index.less +61 -0
- package/es/ParseSession/index.js +23 -9
- package/es/ParseSession/index.less +2 -2
- package/es/api/index.d.ts +4 -0
- package/es/api/index.js +4 -0
- package/es/index.d.ts +4 -1
- package/lib/ChatMessageItem/index.less +4 -1
- package/lib/GoodsCard/index.less +1 -0
- package/lib/GoodsOrderCard/index.less +1 -0
- package/lib/OrderGoodsCard/index.d.ts +8 -0
- package/lib/OrderGoodsCard/index.js +95 -0
- package/lib/OrderGoodsCard/index.less +61 -0
- package/lib/ParseSession/index.js +23 -9
- package/lib/ParseSession/index.less +2 -2
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.js +4 -0
- package/lib/index.d.ts +4 -1
- package/package.json +2 -2
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
white-space: break-spaces;
|
|
65
65
|
overflow: hidden;
|
|
66
66
|
max-width: 375px;
|
|
67
|
-
min-width:
|
|
67
|
+
min-width: 24px;
|
|
68
68
|
border-radius: 2px 6px 6px 6px;
|
|
69
69
|
background: #fff;
|
|
70
70
|
}
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
border-radius: 6px 2px 6px 6px;
|
|
99
99
|
background: #dbe6ff;
|
|
100
100
|
}
|
|
101
|
+
.@{prefix}-ref-body {
|
|
102
|
+
border-left: 3px solid #c2d4ff;
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
// 对话-H5
|
package/es/GoodsCard/index.less
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import { fallbackImg } from '../common/const';
|
|
10
|
+
import './index.less';
|
|
11
|
+
import { ImContext } from '..';
|
|
12
|
+
var OrderGoodsCard = function OrderGoodsCard(props) {
|
|
13
|
+
var _props$prefix = props.prefix,
|
|
14
|
+
prefix = _props$prefix === void 0 ? 'fx-chart-messages-item' : _props$prefix,
|
|
15
|
+
_props$orderSn = props.orderSn,
|
|
16
|
+
orderSn = _props$orderSn === void 0 ? '' : _props$orderSn,
|
|
17
|
+
messageId = props.messageId;
|
|
18
|
+
var _useState = useState([]),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
data = _useState2[0],
|
|
21
|
+
setData = _useState2[1];
|
|
22
|
+
var _useState3 = useState(false),
|
|
23
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
+
isExpand = _useState4[0],
|
|
25
|
+
setIsExpand = _useState4[1];
|
|
26
|
+
var _useContext = useContext(ImContext),
|
|
27
|
+
api = _useContext.api;
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
if (orderSn && messageId) {
|
|
30
|
+
api.getOrderGoods({
|
|
31
|
+
orderSn: orderSn,
|
|
32
|
+
messageId: messageId
|
|
33
|
+
}).then(function (_ref) {
|
|
34
|
+
var data = _ref.data;
|
|
35
|
+
setData(data || []);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, [orderSn, messageId]);
|
|
39
|
+
function formatOrderPrice(item) {
|
|
40
|
+
var currencyStr = item.currencyStr || '积分';
|
|
41
|
+
if (Number(item.price || 0) > 0 && Number(item.score || 0) > 0) {
|
|
42
|
+
return "".concat(item.score).concat(currencyStr, " + ").concat(item.price, "\u5143");
|
|
43
|
+
}
|
|
44
|
+
if (Number(item.price || 0) > 0) {
|
|
45
|
+
return "".concat(item.price, "\u5143");
|
|
46
|
+
}
|
|
47
|
+
if (Number(item.score || 0) > 0) {
|
|
48
|
+
return "".concat(item.score).concat(currencyStr);
|
|
49
|
+
}
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: classNames("".concat(prefix, "-order-goods"))
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "".concat(prefix, "-order-goods-summary")
|
|
56
|
+
}, "\u60A8\u597D\uFF0C\u8BF7\u9009\u62E9\u60A8\u8981\u54A8\u8BE2\u7684\u5546\u54C1\uFF1A"), data === null || data === void 0 ? void 0 : data.slice(0, isExpand ? data === null || data === void 0 ? void 0 : data.length : 5).map(function (item, index) {
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
key: +index,
|
|
59
|
+
className: "".concat(prefix, "-order-goods-item")
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "".concat(prefix, "-order-goods-item-img"),
|
|
62
|
+
style: {
|
|
63
|
+
background: "url(".concat(item.pic || fallbackImg, ") 0 0 / cover no-repeat")
|
|
64
|
+
}
|
|
65
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "".concat(prefix, "-order-goods-item-right")
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "".concat(prefix, "-order-goods-item-title two-line-text")
|
|
69
|
+
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
style: {
|
|
71
|
+
display: 'flex',
|
|
72
|
+
justifyContent: 'space-between',
|
|
73
|
+
gap: 8
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "".concat(prefix, "-order-goods-item-price")
|
|
77
|
+
}, item.applicationId === 7 ? null : formatOrderPrice(item)))));
|
|
78
|
+
}), (data === null || data === void 0 ? void 0 : data.length) > 5 && /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "".concat(prefix, "-order-goods-expand"),
|
|
80
|
+
onClick: function onClick() {
|
|
81
|
+
return setIsExpand(!isExpand);
|
|
82
|
+
}
|
|
83
|
+
}, isExpand ? '收起' : '展开全部', " ", "(".concat(data === null || data === void 0 ? void 0 : data.length, ")")));
|
|
84
|
+
};
|
|
85
|
+
export default OrderGoodsCard;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@prefix: chart-messages-item;
|
|
2
|
+
|
|
3
|
+
.@{prefix}-order-goods {
|
|
4
|
+
max-width: 272px;
|
|
5
|
+
min-width: 200px;
|
|
6
|
+
padding: 12px;
|
|
7
|
+
padding-bottom: 6px;
|
|
8
|
+
&-summary {
|
|
9
|
+
margin-bottom: 8px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-item {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-flow: row;
|
|
15
|
+
padding: 8px 0;
|
|
16
|
+
&:not(:last-child) {
|
|
17
|
+
border-bottom: 1px solid #eee;
|
|
18
|
+
}
|
|
19
|
+
&-img {
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
width: 60px;
|
|
23
|
+
height: 60px;
|
|
24
|
+
margin-right: 6px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
object-fit: fill;
|
|
27
|
+
}
|
|
28
|
+
img {
|
|
29
|
+
width: 100%;
|
|
30
|
+
object-fit: contain;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-right {
|
|
34
|
+
flex: 1;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
&-title {
|
|
38
|
+
line-height: 1.2;
|
|
39
|
+
margin-top: 2px;
|
|
40
|
+
margin-bottom: 4px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&-price {
|
|
44
|
+
min-height: 14px;
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: #6e7789;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&-btn {
|
|
50
|
+
font-size: 12px !important;
|
|
51
|
+
padding: 0 !important;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-expand {
|
|
56
|
+
color: var(--prc);
|
|
57
|
+
text-align: center;
|
|
58
|
+
padding-top: 8px;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/es/ParseSession/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { downloadByUrl, getSimplifyMsg } from '../common/utils';
|
|
|
26
26
|
import Icon from '../Icon';
|
|
27
27
|
import GoodsCard from '../GoodsCard';
|
|
28
28
|
import GoodsOrderCard from '../GoodsOrderCard';
|
|
29
|
+
import OrderGoodsCard from '../OrderGoodsCard';
|
|
29
30
|
import { ImContext } from '..';
|
|
30
31
|
import { pauseAllAudio, pauseOtherVideo } from '../audioAndVideoTool';
|
|
31
32
|
import AudioPlayer from './AudioPlayer';
|
|
@@ -113,7 +114,7 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
113
114
|
className: "".concat(prefix, "-ref-audio-body")
|
|
114
115
|
}, /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
115
116
|
style: {
|
|
116
|
-
backgroundColor: '#
|
|
117
|
+
backgroundColor: msg.flow === 'in' ? '#f7f7f7' : 'rgba(255, 255, 255, 0.5)',
|
|
117
118
|
borderRadius: 4,
|
|
118
119
|
width: 80
|
|
119
120
|
},
|
|
@@ -331,7 +332,6 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
331
332
|
return null;
|
|
332
333
|
};
|
|
333
334
|
var renderAudio = function renderAudio() {
|
|
334
|
-
var flow = msg.flow;
|
|
335
335
|
var duration = Math.floor(attach.content.dur) || 0;
|
|
336
336
|
return /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
337
337
|
prefix: prefix || '',
|
|
@@ -389,7 +389,11 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
389
389
|
href: addUrlSearch(attach.content.url, "download=".concat(attach.content.fileName)),
|
|
390
390
|
target: "_blank",
|
|
391
391
|
rel: "noreferrer"
|
|
392
|
-
}, attach.content.fileName), /*#__PURE__*/React.createElement("span",
|
|
392
|
+
}, attach.content.fileName), /*#__PURE__*/React.createElement("span", {
|
|
393
|
+
style: {
|
|
394
|
+
fontSize: 12
|
|
395
|
+
}
|
|
396
|
+
}, parseFileSize(attach.content.size))));
|
|
393
397
|
};
|
|
394
398
|
var renderOrderCard = function renderOrderCard() {
|
|
395
399
|
var _attach$content8, _attach$content9;
|
|
@@ -406,11 +410,19 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
406
410
|
content: attach.content || {}
|
|
407
411
|
});
|
|
408
412
|
};
|
|
413
|
+
var renderOrderGoods = function renderOrderGoods() {
|
|
414
|
+
var _attach$content10;
|
|
415
|
+
return /*#__PURE__*/React.createElement(OrderGoodsCard, {
|
|
416
|
+
prefix: prefix,
|
|
417
|
+
orderSn: (_attach$content10 = attach.content) === null || _attach$content10 === void 0 ? void 0 : _attach$content10.orderSn,
|
|
418
|
+
messageId: msg.idClient
|
|
419
|
+
});
|
|
420
|
+
};
|
|
409
421
|
var renderChartRecord = function renderChartRecord() {
|
|
410
|
-
var _attach$
|
|
411
|
-
var records = ((_attach$
|
|
412
|
-
var msgIds = ((_attach$
|
|
413
|
-
var title = (_attach$
|
|
422
|
+
var _attach$content11, _attach$content12, _attach$content13;
|
|
423
|
+
var records = ((_attach$content11 = attach.content) === null || _attach$content11 === void 0 ? void 0 : _attach$content11.items) || [];
|
|
424
|
+
var msgIds = ((_attach$content12 = attach.content) === null || _attach$content12 === void 0 ? void 0 : _attach$content12.msgIds) || [];
|
|
425
|
+
var title = (_attach$content13 = attach.content) === null || _attach$content13 === void 0 ? void 0 : _attach$content13.title;
|
|
414
426
|
var list = records.filter(function (v) {
|
|
415
427
|
var _v$attach;
|
|
416
428
|
return ![imMsgTypes.event].includes((_v$attach = v.attach) === null || _v$attach === void 0 ? void 0 : _v$attach.type);
|
|
@@ -441,10 +453,10 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
441
453
|
})), "\u7CFB\u7EDF\u8F6C\u53D1"));
|
|
442
454
|
};
|
|
443
455
|
var renderOfflineSupport = function renderOfflineSupport() {
|
|
444
|
-
var _attach$
|
|
456
|
+
var _attach$content14, _attach$content15;
|
|
445
457
|
return /*#__PURE__*/React.createElement("div", {
|
|
446
458
|
className: "".concat(prefix, "-text")
|
|
447
|
-
}, (_attach$
|
|
459
|
+
}, (_attach$content14 = attach.content) === null || _attach$content14 === void 0 ? void 0 : _attach$content14.supportDesc, ((_attach$content15 = attach.content) === null || _attach$content15 === void 0 ? void 0 : _attach$content15.contact) && /*#__PURE__*/React.createElement("a", {
|
|
448
460
|
href: "tel:".concat(attach.content.contact),
|
|
449
461
|
rel: "noreferrer"
|
|
450
462
|
}, attach.content.contact));
|
|
@@ -480,6 +492,8 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
480
492
|
return renderChartRecord();
|
|
481
493
|
case imMsgTypes.offlineSupport:
|
|
482
494
|
return renderOfflineSupport();
|
|
495
|
+
case imMsgTypes.orderGoods:
|
|
496
|
+
return renderOrderGoods();
|
|
483
497
|
default:
|
|
484
498
|
return '';
|
|
485
499
|
}
|
package/es/api/index.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ interface ApiMethods {
|
|
|
25
25
|
getContact: (params: {
|
|
26
26
|
msgId?: string;
|
|
27
27
|
}) => Promise<any>;
|
|
28
|
+
getOrderGoods: (data: {
|
|
29
|
+
orderSn?: any;
|
|
30
|
+
messageId?: string;
|
|
31
|
+
}) => Promise<any>;
|
|
28
32
|
}
|
|
29
33
|
export declare const apiCreate: (_env?: Env, token?: string) => ApiMethods;
|
|
30
34
|
export {};
|
package/es/api/index.js
CHANGED
|
@@ -38,6 +38,10 @@ export var apiCreate = function apiCreate(_env, token) {
|
|
|
38
38
|
getCSOrder: function getCSOrder(data) {
|
|
39
39
|
return service.post('/ll/provider/message/order/get', data);
|
|
40
40
|
},
|
|
41
|
+
// 获取订单商品信息
|
|
42
|
+
getOrderGoods: function getOrderGoods(data) {
|
|
43
|
+
return service.post('/ll/provider/message/after-sales-agent/goods/list', data);
|
|
44
|
+
},
|
|
41
45
|
// 获取联系人信息(表单)
|
|
42
46
|
getContact: function getContact(params) {
|
|
43
47
|
return service.get('/ll/provider/message/contact/get', {
|
package/es/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
white-space: break-spaces;
|
|
65
65
|
overflow: hidden;
|
|
66
66
|
max-width: 375px;
|
|
67
|
-
min-width:
|
|
67
|
+
min-width: 24px;
|
|
68
68
|
border-radius: 2px 6px 6px 6px;
|
|
69
69
|
background: #fff;
|
|
70
70
|
}
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
border-radius: 6px 2px 6px 6px;
|
|
99
99
|
background: #dbe6ff;
|
|
100
100
|
}
|
|
101
|
+
.@{prefix}-ref-body {
|
|
102
|
+
border-left: 3px solid #c2d4ff;
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
// 对话-H5
|
package/lib/GoodsCard/index.less
CHANGED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _const = require("../common/const");
|
|
11
|
+
require("./index.less");
|
|
12
|
+
var _ = require("..");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
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."); }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
var OrderGoodsCard = function OrderGoodsCard(props) {
|
|
23
|
+
var _props$prefix = props.prefix,
|
|
24
|
+
prefix = _props$prefix === void 0 ? 'fx-chart-messages-item' : _props$prefix,
|
|
25
|
+
_props$orderSn = props.orderSn,
|
|
26
|
+
orderSn = _props$orderSn === void 0 ? '' : _props$orderSn,
|
|
27
|
+
messageId = props.messageId;
|
|
28
|
+
var _useState = (0, _react.useState)([]),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
data = _useState2[0],
|
|
31
|
+
setData = _useState2[1];
|
|
32
|
+
var _useState3 = (0, _react.useState)(false),
|
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
|
+
isExpand = _useState4[0],
|
|
35
|
+
setIsExpand = _useState4[1];
|
|
36
|
+
var _useContext = (0, _react.useContext)(_.ImContext),
|
|
37
|
+
api = _useContext.api;
|
|
38
|
+
(0, _react.useEffect)(function () {
|
|
39
|
+
if (orderSn && messageId) {
|
|
40
|
+
api.getOrderGoods({
|
|
41
|
+
orderSn: orderSn,
|
|
42
|
+
messageId: messageId
|
|
43
|
+
}).then(function (_ref) {
|
|
44
|
+
var data = _ref.data;
|
|
45
|
+
setData(data || []);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, [orderSn, messageId]);
|
|
49
|
+
function formatOrderPrice(item) {
|
|
50
|
+
var currencyStr = item.currencyStr || '积分';
|
|
51
|
+
if (Number(item.price || 0) > 0 && Number(item.score || 0) > 0) {
|
|
52
|
+
return "".concat(item.score).concat(currencyStr, " + ").concat(item.price, "\u5143");
|
|
53
|
+
}
|
|
54
|
+
if (Number(item.price || 0) > 0) {
|
|
55
|
+
return "".concat(item.price, "\u5143");
|
|
56
|
+
}
|
|
57
|
+
if (Number(item.score || 0) > 0) {
|
|
58
|
+
return "".concat(item.score).concat(currencyStr);
|
|
59
|
+
}
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: (0, _classnames.default)("".concat(prefix, "-order-goods"))
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
className: "".concat(prefix, "-order-goods-summary")
|
|
66
|
+
}, "\u60A8\u597D\uFF0C\u8BF7\u9009\u62E9\u60A8\u8981\u54A8\u8BE2\u7684\u5546\u54C1\uFF1A"), data === null || data === void 0 ? void 0 : data.slice(0, isExpand ? data === null || data === void 0 ? void 0 : data.length : 5).map(function (item, index) {
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
key: +index,
|
|
69
|
+
className: "".concat(prefix, "-order-goods-item")
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
71
|
+
className: "".concat(prefix, "-order-goods-item-img"),
|
|
72
|
+
style: {
|
|
73
|
+
background: "url(".concat(item.pic || _const.fallbackImg, ") 0 0 / cover no-repeat")
|
|
74
|
+
}
|
|
75
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
+
className: "".concat(prefix, "-order-goods-item-right")
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: "".concat(prefix, "-order-goods-item-title two-line-text")
|
|
79
|
+
}, item.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
+
style: {
|
|
81
|
+
display: 'flex',
|
|
82
|
+
justifyContent: 'space-between',
|
|
83
|
+
gap: 8
|
|
84
|
+
}
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: "".concat(prefix, "-order-goods-item-price")
|
|
87
|
+
}, item.applicationId === 7 ? null : formatOrderPrice(item)))));
|
|
88
|
+
}), (data === null || data === void 0 ? void 0 : data.length) > 5 && /*#__PURE__*/_react.default.createElement("div", {
|
|
89
|
+
className: "".concat(prefix, "-order-goods-expand"),
|
|
90
|
+
onClick: function onClick() {
|
|
91
|
+
return setIsExpand(!isExpand);
|
|
92
|
+
}
|
|
93
|
+
}, isExpand ? '收起' : '展开全部', " ", "(".concat(data === null || data === void 0 ? void 0 : data.length, ")")));
|
|
94
|
+
};
|
|
95
|
+
var _default = exports.default = OrderGoodsCard;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@prefix: chart-messages-item;
|
|
2
|
+
|
|
3
|
+
.@{prefix}-order-goods {
|
|
4
|
+
max-width: 272px;
|
|
5
|
+
min-width: 200px;
|
|
6
|
+
padding: 12px;
|
|
7
|
+
padding-bottom: 6px;
|
|
8
|
+
&-summary {
|
|
9
|
+
margin-bottom: 8px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-item {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-flow: row;
|
|
15
|
+
padding: 8px 0;
|
|
16
|
+
&:not(:last-child) {
|
|
17
|
+
border-bottom: 1px solid #eee;
|
|
18
|
+
}
|
|
19
|
+
&-img {
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
width: 60px;
|
|
23
|
+
height: 60px;
|
|
24
|
+
margin-right: 6px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
object-fit: fill;
|
|
27
|
+
}
|
|
28
|
+
img {
|
|
29
|
+
width: 100%;
|
|
30
|
+
object-fit: contain;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-right {
|
|
34
|
+
flex: 1;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
&-title {
|
|
38
|
+
line-height: 1.2;
|
|
39
|
+
margin-top: 2px;
|
|
40
|
+
margin-bottom: 4px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&-price {
|
|
44
|
+
min-height: 14px;
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: #6e7789;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&-btn {
|
|
50
|
+
font-size: 12px !important;
|
|
51
|
+
padding: 0 !important;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-expand {
|
|
56
|
+
color: var(--prc);
|
|
57
|
+
text-align: center;
|
|
58
|
+
padding-top: 8px;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -16,6 +16,7 @@ var _utils2 = require("../common/utils");
|
|
|
16
16
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
17
17
|
var _GoodsCard = _interopRequireDefault(require("../GoodsCard"));
|
|
18
18
|
var _GoodsOrderCard = _interopRequireDefault(require("../GoodsOrderCard"));
|
|
19
|
+
var _OrderGoodsCard = _interopRequireDefault(require("../OrderGoodsCard"));
|
|
19
20
|
var _2 = require("..");
|
|
20
21
|
var _audioAndVideoTool = require("../audioAndVideoTool");
|
|
21
22
|
var _AudioPlayer = _interopRequireDefault(require("./AudioPlayer"));
|
|
@@ -115,7 +116,7 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
115
116
|
className: "".concat(prefix, "-ref-audio-body")
|
|
116
117
|
}, /*#__PURE__*/_react.default.createElement(_AudioPlayer.default, {
|
|
117
118
|
style: {
|
|
118
|
-
backgroundColor: '#
|
|
119
|
+
backgroundColor: msg.flow === 'in' ? '#f7f7f7' : 'rgba(255, 255, 255, 0.5)',
|
|
119
120
|
borderRadius: 4,
|
|
120
121
|
width: 80
|
|
121
122
|
},
|
|
@@ -333,7 +334,6 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
333
334
|
return null;
|
|
334
335
|
};
|
|
335
336
|
var renderAudio = function renderAudio() {
|
|
336
|
-
var flow = msg.flow;
|
|
337
337
|
var duration = Math.floor(attach.content.dur) || 0;
|
|
338
338
|
return /*#__PURE__*/_react.default.createElement(_AudioPlayer.default, {
|
|
339
339
|
prefix: prefix || '',
|
|
@@ -391,7 +391,11 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
391
391
|
href: (0, _utils.addUrlSearch)(attach.content.url, "download=".concat(attach.content.fileName)),
|
|
392
392
|
target: "_blank",
|
|
393
393
|
rel: "noreferrer"
|
|
394
|
-
}, attach.content.fileName), /*#__PURE__*/_react.default.createElement("span",
|
|
394
|
+
}, attach.content.fileName), /*#__PURE__*/_react.default.createElement("span", {
|
|
395
|
+
style: {
|
|
396
|
+
fontSize: 12
|
|
397
|
+
}
|
|
398
|
+
}, (0, _utils.parseFileSize)(attach.content.size))));
|
|
395
399
|
};
|
|
396
400
|
var renderOrderCard = function renderOrderCard() {
|
|
397
401
|
var _attach$content8, _attach$content9;
|
|
@@ -408,11 +412,19 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
408
412
|
content: attach.content || {}
|
|
409
413
|
});
|
|
410
414
|
};
|
|
415
|
+
var renderOrderGoods = function renderOrderGoods() {
|
|
416
|
+
var _attach$content10;
|
|
417
|
+
return /*#__PURE__*/_react.default.createElement(_OrderGoodsCard.default, {
|
|
418
|
+
prefix: prefix,
|
|
419
|
+
orderSn: (_attach$content10 = attach.content) === null || _attach$content10 === void 0 ? void 0 : _attach$content10.orderSn,
|
|
420
|
+
messageId: msg.idClient
|
|
421
|
+
});
|
|
422
|
+
};
|
|
411
423
|
var renderChartRecord = function renderChartRecord() {
|
|
412
|
-
var _attach$
|
|
413
|
-
var records = ((_attach$
|
|
414
|
-
var msgIds = ((_attach$
|
|
415
|
-
var title = (_attach$
|
|
424
|
+
var _attach$content11, _attach$content12, _attach$content13;
|
|
425
|
+
var records = ((_attach$content11 = attach.content) === null || _attach$content11 === void 0 ? void 0 : _attach$content11.items) || [];
|
|
426
|
+
var msgIds = ((_attach$content12 = attach.content) === null || _attach$content12 === void 0 ? void 0 : _attach$content12.msgIds) || [];
|
|
427
|
+
var title = (_attach$content13 = attach.content) === null || _attach$content13 === void 0 ? void 0 : _attach$content13.title;
|
|
416
428
|
var list = records.filter(function (v) {
|
|
417
429
|
var _v$attach;
|
|
418
430
|
return ![_const.imMsgTypes.event].includes((_v$attach = v.attach) === null || _v$attach === void 0 ? void 0 : _v$attach.type);
|
|
@@ -443,10 +455,10 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
443
455
|
})), "\u7CFB\u7EDF\u8F6C\u53D1"));
|
|
444
456
|
};
|
|
445
457
|
var renderOfflineSupport = function renderOfflineSupport() {
|
|
446
|
-
var _attach$
|
|
458
|
+
var _attach$content14, _attach$content15;
|
|
447
459
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
448
460
|
className: "".concat(prefix, "-text")
|
|
449
|
-
}, (_attach$
|
|
461
|
+
}, (_attach$content14 = attach.content) === null || _attach$content14 === void 0 ? void 0 : _attach$content14.supportDesc, ((_attach$content15 = attach.content) === null || _attach$content15 === void 0 ? void 0 : _attach$content15.contact) && /*#__PURE__*/_react.default.createElement("a", {
|
|
450
462
|
href: "tel:".concat(attach.content.contact),
|
|
451
463
|
rel: "noreferrer"
|
|
452
464
|
}, attach.content.contact));
|
|
@@ -482,6 +494,8 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
482
494
|
return renderChartRecord();
|
|
483
495
|
case _const.imMsgTypes.offlineSupport:
|
|
484
496
|
return renderOfflineSupport();
|
|
497
|
+
case _const.imMsgTypes.orderGoods:
|
|
498
|
+
return renderOrderGoods();
|
|
485
499
|
default:
|
|
486
500
|
return '';
|
|
487
501
|
}
|
package/lib/api/index.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ interface ApiMethods {
|
|
|
25
25
|
getContact: (params: {
|
|
26
26
|
msgId?: string;
|
|
27
27
|
}) => Promise<any>;
|
|
28
|
+
getOrderGoods: (data: {
|
|
29
|
+
orderSn?: any;
|
|
30
|
+
messageId?: string;
|
|
31
|
+
}) => Promise<any>;
|
|
28
32
|
}
|
|
29
33
|
export declare const apiCreate: (_env?: Env, token?: string) => ApiMethods;
|
|
30
34
|
export {};
|
package/lib/api/index.js
CHANGED
|
@@ -45,6 +45,10 @@ var apiCreate = exports.apiCreate = function apiCreate(_env, token) {
|
|
|
45
45
|
getCSOrder: function getCSOrder(data) {
|
|
46
46
|
return service.post('/ll/provider/message/order/get', data);
|
|
47
47
|
},
|
|
48
|
+
// 获取订单商品信息
|
|
49
|
+
getOrderGoods: function getOrderGoods(data) {
|
|
50
|
+
return service.post('/ll/provider/message/after-sales-agent/goods/list', data);
|
|
51
|
+
},
|
|
48
52
|
// 获取联系人信息(表单)
|
|
49
53
|
getContact: function getContact(params) {
|
|
50
54
|
return service.get('/ll/provider/message/contact/get', {
|
package/lib/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fle-ui/plus-im-record",
|
|
3
|
-
"version": "0.0.8-beta.
|
|
3
|
+
"version": "0.0.8-beta.4",
|
|
4
4
|
"description": "@fle-ui/plus-im-record",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fle-ui",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=17.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "78d824169602d37feb9b5a79180d91f31a381814"
|
|
49
49
|
}
|