tplus-portaltouch 3.47.3 → 3.47.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.
@@ -0,0 +1,1515 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = undefined;
7
+
8
+ var _assign = require('babel-runtime/core-js/object/assign');
9
+
10
+ var _assign2 = _interopRequireDefault(_assign);
11
+
12
+ var _extends2 = require('babel-runtime/helpers/extends');
13
+
14
+ var _extends3 = _interopRequireDefault(_extends2);
15
+
16
+ var _stringify = require('babel-runtime/core-js/json/stringify');
17
+
18
+ var _stringify2 = _interopRequireDefault(_stringify);
19
+
20
+ var _promise = require('babel-runtime/core-js/promise');
21
+
22
+ var _promise2 = _interopRequireDefault(_promise);
23
+
24
+ var _regenerator = require('babel-runtime/regenerator');
25
+
26
+ var _regenerator2 = _interopRequireDefault(_regenerator);
27
+
28
+ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
29
+
30
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
31
+
32
+ var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
33
+
34
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
35
+
36
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
37
+
38
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
39
+
40
+ var _createClass2 = require('babel-runtime/helpers/createClass');
41
+
42
+ var _createClass3 = _interopRequireDefault(_createClass2);
43
+
44
+ var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
45
+
46
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
47
+
48
+ var _inherits2 = require('babel-runtime/helpers/inherits');
49
+
50
+ var _inherits3 = _interopRequireDefault(_inherits2);
51
+
52
+ var _class, _class2, _temp; /*
53
+ * @Description:
54
+ * @Date: 2019-08-13 08:42:18
55
+ * @LastEditTime: 2022-04-21 15:16:36
56
+ * @LastEditors: chenlongad
57
+ * @modify:修改跳转到T+的查询方案方式
58
+ */
59
+
60
+
61
+ var _react = require('react');
62
+
63
+ var _react2 = _interopRequireDefault(_react);
64
+
65
+ var _mobxReact = require('mobx-react');
66
+
67
+ var _mobx = require('mobx');
68
+
69
+ var _antd = require('antd');
70
+
71
+ var _mutantsMicrofx = require('mutants-microfx');
72
+
73
+ var _tplusComponentsTouch = require('tplus-components-touch');
74
+
75
+ var _tplusApi = require('tplus-api');
76
+
77
+ var _tplusPoslogin = require('tplus-poslogin');
78
+
79
+ var _mutantsUtil = require('mutants-util');
80
+
81
+ var _propTypes = require('prop-types');
82
+
83
+ var _propTypes2 = _interopRequireDefault(_propTypes);
84
+
85
+ var _ModifyPassApi = require('../../api/ModifyPassApi');
86
+
87
+ var _data = require('./data');
88
+
89
+ var _data2 = _interopRequireDefault(_data);
90
+
91
+ var _middleWare = require('../../middleWare');
92
+
93
+ var _middleWare2 = _interopRequireDefault(_middleWare);
94
+
95
+ var _verticalPortal = require('./verticalPortal');
96
+
97
+ var _verticalPortal2 = _interopRequireDefault(_verticalPortal);
98
+
99
+ var _horizontalPadPortal = require('./horizontalPadPortal');
100
+
101
+ var _horizontalPadPortal2 = _interopRequireDefault(_horizontalPadPortal);
102
+
103
+ require('./index.less');
104
+
105
+ var _rxjs = require('rxjs');
106
+
107
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
108
+
109
+ var hasElectron = _mutantsMicrofx.env.platform === _mutantsMicrofx.env.constant.platform.electron;
110
+ var Content = _tplusComponentsTouch.Layout.Content;
111
+
112
+ var HTTP_PROXY_URL = 'http://tfproxy.chanjet.com/?url=';
113
+ var CC_FRAME_CONF = { id: 'external-frame-cc', identOnly: '_pos_web_', initConnect: 'initConnect', HsyLoadFinish: 'HsyLoadFinish', HsyRouterClean: 'HsyRouterClean', HsyRouterJump: 'HsyRouterJump' };
114
+
115
+ var _default = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_Component) {
116
+ (0, _inherits3.default)(_default, _Component);
117
+
118
+ function _default(props) {
119
+ var _this3 = this;
120
+
121
+ (0, _classCallCheck3.default)(this, _default);
122
+
123
+ var _this2 = (0, _possibleConstructorReturn3.default)(this, (_default.__proto__ || (0, _getPrototypeOf2.default)(_default)).call(this, props));
124
+
125
+ _this2.ccFrameStore = {};
126
+ _this2.catchOfflineData = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
127
+ var offlineSys, isLoginAfter, downloadCatcherDay, currentDay, downProgress, result;
128
+ return _regenerator2.default.wrap(function _callee$(_context) {
129
+ while (1) {
130
+ switch (_context.prev = _context.next) {
131
+ case 0:
132
+ offlineSys = _this2.context.stores.offlineSys;
133
+ isLoginAfter = _mutantsMicrofx.localStore.get("isLoginAfter");
134
+ downloadCatcherDay = _mutantsMicrofx.localStore.get("downloadCatcherDay");
135
+ currentDay = Math.ceil(new Date() / 1000 / 60 / 60 / 24);
136
+
137
+ if (!(isLoginAfter == 1)) {
138
+ _context.next = 24;
139
+ break;
140
+ }
141
+
142
+ if (!(!downloadCatcherDay || currentDay > downloadCatcherDay)) {
143
+ _context.next = 23;
144
+ break;
145
+ }
146
+
147
+ _context.prev = 6;
148
+
149
+ downProgress = function downProgress(params) {
150
+ _tplusComponentsTouch.Loading.transfer(params);
151
+ };
152
+
153
+ _tplusComponentsTouch.Loading.show({
154
+ text: '离线数据下载中,请稍等...',
155
+ delay: 0,
156
+ showProgress: true
157
+ });
158
+ _context.next = 11;
159
+ return offlineSys.downloadCatcherData(downProgress);
160
+
161
+ case 11:
162
+ result = _context.sent;
163
+
164
+ if (result) _mutantsMicrofx.localStore.set("downloadCatcherDay", currentDay);
165
+ _tplusComponentsTouch.Loading.hide();
166
+ _context.next = 20;
167
+ break;
168
+
169
+ case 16:
170
+ _context.prev = 16;
171
+ _context.t0 = _context['catch'](6);
172
+
173
+ console.log('downloadCatcherData下载离线数据', _context.t0);
174
+ _tplusComponentsTouch.Loading.hide();
175
+
176
+ case 20:
177
+ _context.prev = 20;
178
+
179
+ _tplusComponentsTouch.Loading.hide();
180
+ return _context.finish(20);
181
+
182
+ case 23:
183
+ _mutantsMicrofx.localStore.set("isLoginAfter", 0);
184
+
185
+ case 24:
186
+ case 'end':
187
+ return _context.stop();
188
+ }
189
+ }
190
+ }, _callee, _this3, [[6, 16, 20, 23]]);
191
+ }));
192
+
193
+ _this2.getOperation = function () {
194
+ return new _promise2.default(function (resolve, reject) {
195
+ var homeOperation = _ModifyPassApi.Request.homeOperation,
196
+ functionData = _ModifyPassApi.Request.functionData;
197
+
198
+ homeOperation().then(function (operations) {
199
+ _mutantsMicrofx.localStore.set('operationsAuth', (0, _stringify2.default)(operations));
200
+ _this2.setState({ operations: operations || [] });
201
+ resolve();
202
+ }).catch(function (err) {
203
+ console.log('homeOperation.error======', err);
204
+ _tplusComponentsTouch.Loading.hide();
205
+ resolve();
206
+ });
207
+ functionData().then(function (data) {
208
+ (0, _tplusPoslogin.PosSetData)(data);
209
+ });
210
+ });
211
+ };
212
+
213
+ _this2.initPageData = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
214
+ var _this2$context, _this2$context$stores, stores, _this2$context$headHo, addClass, hasUseOffline;
215
+
216
+ return _regenerator2.default.wrap(function _callee2$(_context2) {
217
+ while (1) {
218
+ switch (_context2.prev = _context2.next) {
219
+ case 0:
220
+ _this2$context = _this2.context, _this2$context$stores = _this2$context.stores, stores = _this2$context$stores === undefined ? {} : _this2$context$stores, _this2$context$headHo = _this2$context.headHook;
221
+ _this2$context$headHo = _this2$context$headHo === undefined ? {} : _this2$context$headHo;
222
+ addClass = _this2$context$headHo.addClass;
223
+ hasUseOffline = (0, _tplusPoslogin.PosInitData)('IsOfflineCash') === "1" && !_mutantsUtil.platform.otherOfflineStatus;
224
+ ; //是否允许离线
225
+ // const hasUseOffline = true;
226
+
227
+ if (!(hasUseOffline == true)) {
228
+ _context2.next = 8;
229
+ break;
230
+ }
231
+
232
+ _context2.next = 8;
233
+ return _this2.catchOfflineData();
234
+
235
+ case 8:
236
+ _tplusComponentsTouch.Loading.show({
237
+ text: '权限加载中,请稍等...',
238
+ delay: 2500
239
+ });
240
+ //权限加载
241
+ _context2.prev = 9;
242
+ _context2.next = 12;
243
+ return _this2.getOperation();
244
+
245
+ case 12:
246
+ _context2.next = 17;
247
+ break;
248
+
249
+ case 14:
250
+ _context2.prev = 14;
251
+ _context2.t0 = _context2['catch'](9);
252
+
253
+ _tplusComponentsTouch.Loading.hide();
254
+
255
+ case 17:
256
+ _context2.prev = 17;
257
+
258
+ _tplusComponentsTouch.Loading.hide();
259
+ return _context2.finish(17);
260
+
261
+ case 20:
262
+ addClass && addClass(_this2.state.id, 'portalHead');
263
+ // 初始化参数设置。
264
+ stores.setStore.initSetParams().then(function (ret) {
265
+ // 在客户端中,如果开启了副屏设置,尝试这打开副屏。
266
+ if (_this2.getScreenType() === true) {
267
+ if (_this2.isHorizontalSunMi) {
268
+ _this2.sunMiPresentationInit(ret);
269
+ return;
270
+ }
271
+ console.log('副屏页面打开之前,user信息', (0, _stringify2.default)(stores.user));
272
+ window.open('vicescreen?ts=' + new Date().getTime(), 'screen');
273
+ setTimeout(function () {
274
+ console.log('副屏页面打开之后,user信息', (0, _stringify2.default)(stores.user));
275
+ }, 3000);
276
+ }
277
+ });
278
+
279
+ case 22:
280
+ case 'end':
281
+ return _context2.stop();
282
+ }
283
+ }
284
+ }, _callee2, _this3, [[9, 14, 17, 20]]);
285
+ }));
286
+
287
+ _this2.loadHsyPage = function () {
288
+ if (_this2.isHsyIframeInclude) {
289
+ _this2.initHsyBasicPageInfo();
290
+ _this2.initHsyFrameWin();
291
+ }
292
+ };
293
+
294
+ _this2.sunMiPresentationInit = function (result) {
295
+ //SunMi初始化参数设置。
296
+ //副屏幕交互。硬件改动20200428 需要在商米页面加载成功后才能发送 初始化命令
297
+ // 进行主副屏数据交互 初始化
298
+ console.log(result);
299
+
300
+ var _ref3 = _mutantsMicrofx.stores.user.options.get('store') || {},
301
+ _ref3$storeName = _ref3.storeName,
302
+ storeName = _ref3$storeName === undefined ? '' : _ref3$storeName;
303
+
304
+ var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
305
+ RE_POSParamType = _enumController$getEn.RE_POSParamType;
306
+
307
+ var DUAL_SCREEN_SETTING = RE_POSParamType.DUAL_SCREEN_SETTING;
308
+
309
+ var filterResult = result && result.filter ? result.filter(function (settingItem) {
310
+ return settingItem.ParamType === DUAL_SCREEN_SETTING;
311
+ }) : [];
312
+ window.sunMi_PresentationManager && window.sunMi_PresentationManager.sharedPreferencesSet("setting_setData", filterResult).then(function () {
313
+ console.log("缓存数据成功");
314
+ window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 0, storeName: storeName });
315
+ });
316
+ };
317
+
318
+ _this2.getTcBasicInfoInit = function () {
319
+ var userStore = _tplusApi.User.restore();
320
+ var sid = userStore.sid;
321
+ var tplusUrl = _this2.tplusSiteUrl;
322
+ if (!tplusUrl) {
323
+ var msg = "请用admin登录,在服务器配置–地址配置处,设置“内部或外部网络访问T+服务器的地址”!";
324
+ _tplusComponentsTouch.ModalWraper.warning({
325
+ title: '温馨提示',
326
+ content: msg,
327
+ okText: '确定',
328
+ okType: 'primary'
329
+ });
330
+ return false;
331
+ }
332
+ if (tplusUrl.substring(tplusUrl.length - 1) !== '/') {
333
+ tplusUrl += '/';
334
+ }
335
+ var ossjumpUrl = tplusUrl + 'view/portal/portal.html?t=' + new Date().getTime();
336
+ if (sid) {
337
+ ossjumpUrl = tplusUrl + 'view/ossjump.html?t=' + new Date().getTime() + '&sid=' + sid;
338
+ }
339
+ var postMsgUrl = ossjumpUrl;
340
+ var user = _this2.context.stores.user;
341
+
342
+ var loginInfo = user.options.get('loginInfo');
343
+
344
+ var _ref4 = loginInfo || {},
345
+ UserCode = _ref4.UserCode,
346
+ AccountNum = _ref4.AccountNum,
347
+ posCode = _ref4.posCode,
348
+ TplusStoreId = _ref4.TplusStoreId;
349
+
350
+ var uid = _this2.tplusEncode(UserCode);
351
+ var pwd = _this2.tplusEncode(user.options.get("password"));
352
+ var accNum = _this2.tplusEncode(AccountNum || '');
353
+ var code = _this2.tplusEncode(posCode);
354
+ var store = _this2.tplusEncode(TplusStoreId + '');
355
+ ossjumpUrl += '&fromApp=nretail&way=inframe&user=' + uid + '&pwd=' + pwd + '&accNum=' + accNum + '&posCode=' + code + '&storeID=' + store;
356
+ return { ossjumpUrl: ossjumpUrl, postMessageUrl: postMsgUrl };
357
+ };
358
+
359
+ _this2.getScreenType = function () {
360
+ var flag = false;
361
+ if (_this2.hasElectron === true || _this2.isHorizontalSunMi) {
362
+ var data = _mutantsMicrofx.localStore.get('setting_setData') || [];
363
+ data = data.filter(function (item) {
364
+ return item.Name === 'EnableDoubleScreen';
365
+ });
366
+ data = data && data.length > 0 ? data.shift() : null;
367
+ if (data && data.Value === '1') {
368
+ flag = true;
369
+ }
370
+ }
371
+ return flag;
372
+ };
373
+
374
+ _this2.saveLog = function (name) {
375
+ var saveLogo = _ModifyPassApi.Request.saveLogo;
376
+
377
+ name = "进入模块:" + name;
378
+ saveLogo('进入模块', undefined, name);
379
+ };
380
+
381
+ _this2.handelClick = function () {
382
+ var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
383
+ var type = values.key,
384
+ isModal = values.isModal,
385
+ iframe = values.iframe,
386
+ app = values.app,
387
+ title = values.title,
388
+ Name = values.Name,
389
+ style = values.style,
390
+ search = values.search,
391
+ tmenuCode = values.tmenuCode;
392
+ var _this2$state = _this2.state,
393
+ operations = _this2$state.operations,
394
+ isHsyLoadFinish = _this2$state.isHsyLoadFinish;
395
+
396
+ var controllable = operations.find(function (vv) {
397
+ return vv.Name === Name;
398
+ });
399
+
400
+ var _ref5 = controllable || {},
401
+ Visibility = _ref5.Visibility,
402
+ HoldFunctionAuth = _ref5.HoldFunctionAuth,
403
+ Title = _ref5.Title,
404
+ MenuCode = _ref5.MenuCode;
405
+
406
+ var errorTip = void 0;
407
+
408
+ // 离线模式
409
+ if (!_mutantsMicrofx.stores.offlineSys.shouldOpenHomeOperation(Name)) {
410
+ _tplusComponentsTouch.Message.warn("离线模式下此操作不可用", { duration: 3 });
411
+ return;
412
+ }
413
+
414
+ // 会员拉新
415
+ if (type == 'memberRecruitment' && (_this2.isEnablePromotion == false || _this2.isEnableMember == false)) {
416
+ _tplusComponentsTouch.Message.warn("您还未开通会员/促销管理,请立即开通", { duration: 3 });
417
+ return;
418
+ }
419
+
420
+ // 会员消费查询
421
+ if (type == 'memberConsumDetail' && _this2.isEnableMember == false) {
422
+ _tplusComponentsTouch.Message.warn("您还未开通会员管理,请立即开通", { duration: 3 });
423
+ return;
424
+ }
425
+
426
+ // 更多
427
+ if (type == 'more') {
428
+ return _this2.setState({ showMoreModal: true });
429
+ }
430
+
431
+ if (!Title) {
432
+ return _tplusComponentsTouch.ModalWraper.warning({
433
+ title: '提示',
434
+ content: '您的权限配置请求失败,请重新登录',
435
+ onOk: function onOk() {
436
+ _tplusApi.User.logout();
437
+ },
438
+
439
+ okType: 'primary'
440
+ });
441
+ }
442
+
443
+ if (!Visibility) {
444
+ errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
445
+ } else if (!HoldFunctionAuth) {
446
+ errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
447
+ }
448
+ var portalStore = _this2.context.stores.portalStore;
449
+
450
+ if (errorTip) {
451
+ return _tplusComponentsTouch.Message.warn(errorTip);
452
+ }
453
+ if (isModal) {
454
+ return _mutantsMicrofx.stores.modalRouter.show({ url: '/' + type, width: 800, title: title });
455
+ }
456
+ // 支持页面内打开,减少再次加载页面的时间。
457
+ if (iframe === true) return _this2.toFramePage({ type: type, app: app, title: title, style: style, search: search, MenuCode: MenuCode, tmenuCode: tmenuCode, isHsyLoadFinish: isHsyLoadFinish });
458
+ switch (type) {
459
+ case 'cashier':
460
+ portalStore.checkDuty().then(function (onDutyMessage) {
461
+ if (!!onDutyMessage) {
462
+ var Code = onDutyMessage.Code,
463
+ IdShiftVoucher = onDutyMessage.IdShiftVoucher,
464
+ Shift = onDutyMessage.Shift,
465
+ IdDailyVoucher = onDutyMessage.IdDailyVoucher,
466
+ DailyCode = onDutyMessage.DailyCode;
467
+
468
+ (0, _tplusPoslogin.PosSetData)({ ShiftCode: Code, IdShiftVoucher: IdShiftVoucher, Shift: Shift, IdDailyVoucher: IdDailyVoucher, DailyCode: DailyCode });
469
+ console.log('onDutyMessage======', onDutyMessage);
470
+ _this2.saveLog(title);
471
+ _mutantsMicrofx.history.push('/RE/RE01');
472
+ }
473
+ }).catch(function (data) {
474
+ console.log("进入前台收银检查是否当班返回错误", data);
475
+ });
476
+ break;
477
+ case 'onDuty':
478
+ portalStore.onDuty().then(function (onDutyMessage) {
479
+ if (onDutyMessage && onDutyMessage.shift) {
480
+ _middleWare2.default.execute('onDuty');
481
+ }
482
+ });
483
+ break;
484
+ case 'offDuty':
485
+ _mutantsMicrofx.history.push('/offDuty?type=offDuty');
486
+ break;
487
+ case 'settleDialy':
488
+ if (portalStore.bPosDaily()) {
489
+ _mutantsMicrofx.history.push('/offDuty?type=settleDaily');
490
+ } else {
491
+ portalStore.onMakerDaily();
492
+ }
493
+ break;
494
+ default:
495
+ _mutantsMicrofx.history.push('/' + type);
496
+ break;
497
+ }
498
+ };
499
+
500
+ _this2.toFramePage = function (params) {
501
+ var _ref6 = params || {},
502
+ app = _ref6.app,
503
+ title = _ref6.title,
504
+ style = _ref6.style,
505
+ search = _ref6.search,
506
+ tmenuCode = _ref6.tmenuCode,
507
+ MenuCode = _ref6.MenuCode,
508
+ isHsyLoadFinish = _ref6.isHsyLoadFinish;
509
+
510
+ switch (app) {
511
+ case 'cc':
512
+ var sh = '';
513
+ if (!isHsyLoadFinish && !_this2.isMobileEnvironment) {
514
+ return _tplusComponentsTouch.Message.warn('正在加载资源中,请稍后。');
515
+ }
516
+ if (!search) {
517
+ return _tplusComponentsTouch.Message.warn('正在紧急研发中...');
518
+ } else if (search && search.length > 0) {
519
+ sh = search.length > 1 && MenuCode ? search.find(function (v) {
520
+ return v.menu === MenuCode;
521
+ }) : search[0];
522
+ sh = sh || search[0];
523
+ }
524
+ if (!sh) {
525
+ return _tplusComponentsTouch.Message.warn('传递参数有误,请查证。');
526
+ }
527
+ _this2.toHsyPage((0, _extends3.default)({}, style, sh));
528
+ break;
529
+ case 'tc':
530
+ if (tmenuCode || MenuCode) {
531
+ _this2.saveLog(title);
532
+ if (MenuCode) {
533
+ _this2.toTplusPage(MenuCode, search);
534
+ } else {
535
+ _this2.toTplusPage(tmenuCode, search);
536
+ }
537
+ }
538
+ break;
539
+ }
540
+ };
541
+
542
+ _this2.getTplusUrlFromCloudServer = function () {
543
+ //获取T+服务器配置地址。
544
+ var userStore = _tplusApi.User.restore();
545
+ var data = 'accesstoken=' + ('' + userStore.accessToken) + '&cloudOrgId=' + ('' + userStore.orgId);
546
+ var url = '' + HTTP_PROXY_URL + encodeURIComponent('http://mns.chanapp.chanjet.com/web/WebServer/get?' + ('' + data));
547
+ console.log(url);
548
+ var fetchHeader = {
549
+ headers: {
550
+ 'Content-Type': 'application/x-www-form-urlencoded'
551
+ }
552
+ };
553
+ return new _promise2.default(function (resolve, reject) {
554
+ fetch(url, fetchHeader).then(function (response) {
555
+ return response.json();
556
+ }).then(function (json) {
557
+ console.log(json);
558
+ resolve(json);
559
+ }).catch(function (ex) {
560
+ console.log(ex);
561
+ reject(err);
562
+ });
563
+ });
564
+ };
565
+
566
+ _this2.toTplusPage = function () {
567
+ var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(tmenuCode, search) {
568
+ var ret, _ref8, ossjumpUrl, postMessageUrl, dsearchPlanID, portalStore, menu, ciaToken, external_frame_tc, win, loadTcURL;
569
+
570
+ return _regenerator2.default.wrap(function _callee3$(_context3) {
571
+ while (1) {
572
+ switch (_context3.prev = _context3.next) {
573
+ case 0:
574
+ ret = _this2.getTcBasicInfoInit();
575
+
576
+ if (!(ret === false)) {
577
+ _context3.next = 3;
578
+ break;
579
+ }
580
+
581
+ return _context3.abrupt('return');
582
+
583
+ case 3:
584
+ _ref8 = ret || {}, ossjumpUrl = _ref8.ossjumpUrl, postMessageUrl = _ref8.postMessageUrl;
585
+ dsearchPlanID = '';
586
+
587
+ if (!(search && search.id)) {
588
+ _context3.next = 10;
589
+ break;
590
+ }
591
+
592
+ portalStore = _this2.context.stores.portalStore;
593
+ _context3.next = 9;
594
+ return portalStore.getSearchPlanId(search);
595
+
596
+ case 9:
597
+ dsearchPlanID = _context3.sent;
598
+
599
+ case 10:
600
+ menu = _this2.tplusEncode(tmenuCode);
601
+
602
+ ossjumpUrl += '&menu=' + menu + '&fromUrl=' + _this2.tplusEncode(location.origin);
603
+ if (dsearchPlanID) {
604
+ ossjumpUrl += '&searchPlanID=' + _this2.tplusEncode(dsearchPlanID);
605
+ }
606
+
607
+ // 添加CiaToken
608
+ _context3.prev = 13;
609
+ _context3.next = 16;
610
+ return (0, _tplusApi.getCIACode)();
611
+
612
+ case 16:
613
+ ciaToken = _context3.sent;
614
+
615
+ ciaToken = _this2.tplusEncode(ciaToken);
616
+ ossjumpUrl += '&ciaToken=' + ciaToken;
617
+ _context3.next = 24;
618
+ break;
619
+
620
+ case 21:
621
+ _context3.prev = 21;
622
+ _context3.t0 = _context3['catch'](13);
623
+
624
+ console.log("获取CiaToken失败", _context3.t0);
625
+
626
+ case 24:
627
+ if (!_this2.isHorizontalSunMi) {
628
+ _context3.next = 28;
629
+ break;
630
+ }
631
+
632
+ window.android_CommonFun.openWebUrlByOutBrowser(ossjumpUrl);
633
+ _context3.next = 36;
634
+ break;
635
+
636
+ case 28:
637
+ if (!(_this2.new_retail_app == 'tc' || _this2.new_retail_app == 'tczsy' || _this2.new_retail_app == 'tcyzj')) {
638
+ _context3.next = 31;
639
+ break;
640
+ }
641
+
642
+ _mutantsMicrofx.nativeMs.useDefaultBrowser(ossjumpUrl);
643
+ return _context3.abrupt('return');
644
+
645
+ case 31:
646
+ external_frame_tc = document.getElementById('external-frame-tc');
647
+ win = external_frame_tc.contentWindow;
648
+ loadTcURL = _this2.state.loadTcURL;
649
+
650
+ if (loadTcURL) {
651
+ win && win.postMessage({ doType: 'openMenuFromPos', tmenuCode: tmenuCode, ossjumpUrl: ossjumpUrl, dsearchPlanID: dsearchPlanID }, postMessageUrl);
652
+ _this2.setState({ loadTcPage: true });
653
+ } else {
654
+ _this2.setState({ loadTcURL: ossjumpUrl, loadTcPage: true });
655
+ }
656
+ rx$.changeHsy.next({
657
+ back: true, fn: function fn() {
658
+ win && win.postMessage({ doType: 'closeCurrentMenuFromPos' }, postMessageUrl);
659
+ _this2.setState({ loadTcPage: false });
660
+ rx$.changeHsy.next({ back: false });
661
+ }
662
+ });
663
+
664
+ case 36:
665
+ case 'end':
666
+ return _context3.stop();
667
+ }
668
+ }
669
+ }, _callee3, _this3, [[13, 21]]);
670
+ }));
671
+
672
+ return function (_x2, _x3) {
673
+ return _ref7.apply(this, arguments);
674
+ };
675
+ }();
676
+
677
+ _this2.toHsyPage = function () {
678
+ var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(params) {
679
+ var content_only, bar_bg, bar_active_bg, menu, secondRouter, activePrompt, closePrompt, closeable, leavePrompt, lock, pageId, pageParams, path, tabId, tabLabel, pageType, _k, filter, IdWarehouse, WarehouseName, IsPerformanceDistribution, _ref10, _ref10$IdStore, IdStore, _ref10$PosId, PosId, _ref11, _ref11$storeName, storeName, commonArgs, actionUrl, cc_url, CC_WEB_URL, _hsyPage;
680
+
681
+ return _regenerator2.default.wrap(function _callee4$(_context4) {
682
+ while (1) {
683
+ switch (_context4.prev = _context4.next) {
684
+ case 0:
685
+ content_only = params.content_only, bar_bg = params.bar_bg, bar_active_bg = params.bar_active_bg, menu = params.menu, secondRouter = params.secondRouter, activePrompt = params.activePrompt, closePrompt = params.closePrompt, closeable = params.closeable, leavePrompt = params.leavePrompt, lock = params.lock, pageId = params.pageId, pageParams = params.pageParams, path = params.path, tabId = params.tabId, tabLabel = params.tabLabel, pageType = params.pageType, _k = params._k;
686
+ filter = {};
687
+ //对仓库参数的处理
688
+
689
+ IdWarehouse = _this2.idWarehouse;
690
+ WarehouseName = _this2.warehouseName;
691
+ IsPerformanceDistribution = _this2.performanceDistribution === 'SHIPPER_STORE' || false;
692
+ _ref10 = _mutantsMicrofx.stores.user.options.get('loginInfo') || {}, _ref10$IdStore = _ref10.IdStore, IdStore = _ref10$IdStore === undefined ? '' : _ref10$IdStore, _ref10$PosId = _ref10.PosId, PosId = _ref10$PosId === undefined ? '' : _ref10$PosId;
693
+ _ref11 = _mutantsMicrofx.stores.user.options.get('store') || {}, _ref11$storeName = _ref11.storeName, storeName = _ref11$storeName === undefined ? '' : _ref11$storeName;
694
+ _context4.t0 = pageType;
695
+ _context4.next = _context4.t0 === 'voucher' ? 10 : _context4.t0 === 'report' ? 14 : 18;
696
+ break;
697
+
698
+ case 10:
699
+ filter = {
700
+ defaultValue: {
701
+ storeId: {
702
+ id: IdStore,
703
+ storeName: storeName
704
+ },
705
+ warehouseId: {
706
+ id: IdWarehouse,
707
+ name: WarehouseName
708
+ }
709
+ }
710
+ //要货单特殊处理
711
+ };if (menu == 'require-goods-new') {
712
+ filter = {
713
+ defaultValue: {
714
+ storeId: {
715
+ id: IdStore,
716
+ storeName: storeName
717
+ },
718
+ requireWarehouseId: {
719
+ id: IdWarehouse,
720
+ name: WarehouseName
721
+ }
722
+ }
723
+ };
724
+ }
725
+ if (menu == 'pre-sell') {
726
+ filter = {
727
+ storeId: [{ id: IdStore, storeName: storeName }],
728
+ orderStatusEnum: 'WAIT_DELIVERY'
729
+ };
730
+ }
731
+ return _context4.abrupt('break', 18);
732
+
733
+ case 14:
734
+ filter = {
735
+ filterValue: {
736
+ storeId: {
737
+ value: {
738
+ id: IdStore,
739
+ storeName: storeName
740
+ }
741
+ },
742
+ warehouseId: {
743
+ value: [{
744
+ id: IdWarehouse,
745
+ name: WarehouseName
746
+ }]
747
+ }
748
+ }
749
+ // 收银统计表
750
+ };if (IsPerformanceDistribution && menu == 'retail-cash-report') {
751
+ filter = {
752
+ filterValue: {
753
+ deliveryStoreId: {
754
+ value: {
755
+ id: IdStore,
756
+ storeName: storeName
757
+ }
758
+ },
759
+ warehouseId: {
760
+ value: [{
761
+ id: IdWarehouse,
762
+ name: WarehouseName
763
+ }]
764
+ }
765
+ }
766
+ };
767
+ }
768
+ // 售后、配送
769
+ if (menu == 'return-order' || menu == 'order-manage') {
770
+ filter = {
771
+ filterValue: {
772
+ storeId: {
773
+ value: {
774
+ id: IdStore,
775
+ storeName: storeName
776
+ }
777
+ },
778
+ deliveryWarehouseId: {
779
+ value: [{
780
+ id: IdWarehouse,
781
+ name: WarehouseName
782
+ }]
783
+ }
784
+ }
785
+ };
786
+ }
787
+ return _context4.abrupt('break', 18);
788
+
789
+ case 18:
790
+ bar_bg = encodeURIComponent(bar_bg);
791
+ bar_active_bg = encodeURIComponent(bar_active_bg);
792
+ menu = secondRouter ? menu + '/' + _this2.randomWord(true, 13) : menu;
793
+ pageId = menu;
794
+ pageParams = (0, _assign2.default)(pageParams, filter);
795
+ path = encodeURIComponent(path);
796
+ _k = _this2.randomWord(false, 6);
797
+
798
+ commonArgs = '?posid=' + PosId + '&content_only=' + content_only + '&bar_bg=' + bar_bg + '&bar_active_bg=' + bar_active_bg;
799
+ actionUrl = '#/' + menu + '?activePrompt=' + activePrompt + '&closePrompt=' + closePrompt + '&closeable=' + closeable + '&leavePrompt=' + leavePrompt + '&lock=' + lock + '&pageId=' + pageId + '&pageParams=' + encodeURIComponent((0, _stringify2.default)(pageParams)) + '&path=' + path + '&tabId=' + tabId + '&tabLabel=' + encodeURIComponent(tabLabel) + '&_k=' + _k;
800
+ cc_url = _this2.hsy_domain.replace('#/', '') + commonArgs + actionUrl;
801
+
802
+ console.log('web_hsy_url:', cc_url);
803
+
804
+ if (!_this2.isHorizontalSunMi) {
805
+ _context4.next = 37;
806
+ break;
807
+ }
808
+
809
+ _context4.next = 32;
810
+ return _tplusApi.User.getLoginCCMidWebUrl(cc_url);
811
+
812
+ case 32:
813
+ CC_WEB_URL = _context4.sent;
814
+
815
+ console.log('CC_WEB_URL:', CC_WEB_URL);
816
+ window.android_CommonFun.openWebUrlByOutBrowser(CC_WEB_URL);
817
+ _context4.next = 42;
818
+ break;
819
+
820
+ case 37:
821
+ _this2.ccFrameStore && _this2.ccFrameStore.sendMessage({ type: CC_FRAME_CONF.HsyRouterJump, pageId: pageId, pageParams: pageParams, extStateParams: { closeable: closeable, tabLabel: tabLabel }, _ident_only_: CC_FRAME_CONF.identOnly });
822
+ if (_this2.state.showMoreModal === true) {
823
+ _this2.setState({ showMoreModal: false });
824
+ }
825
+ _hsyPage = document.getElementById(CC_FRAME_CONF.id);
826
+
827
+ if (_hsyPage) _hsyPage.style.top = '60px';
828
+ rx$.changeHsy.next({
829
+ back: true, fn: function fn() {
830
+ if (_hsyPage) _hsyPage.style.top = '-100%';
831
+ rx$.changeHsy.next({ back: false });
832
+ // 在打开页签之前,关闭之前的,返回键的回调函数
833
+ _this2.ccFrameStore && _this2.ccFrameStore.sendMessage({ type: CC_FRAME_CONF.HsyRouterClean, _ident_only_: CC_FRAME_CONF.identOnly });
834
+ }
835
+ });
836
+
837
+ case 42:
838
+ case 'end':
839
+ return _context4.stop();
840
+ }
841
+ }
842
+ }, _callee4, _this3);
843
+ }));
844
+
845
+ return function (_x4) {
846
+ return _ref9.apply(this, arguments);
847
+ };
848
+ }();
849
+
850
+ _this2.randomWord = function (only, digits) {
851
+ var str = "";
852
+ var number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
853
+ var letter = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
854
+ var arr = only ? [].concat(number) : [].concat(number, letter);
855
+ for (var i = 0; i < digits; i++) {
856
+ var pos = Math.round(Math.random() * (arr.length - 1));
857
+ str += arr[pos];
858
+ }
859
+ return str;
860
+ };
861
+
862
+ _this2.closeFrameModal = function () {
863
+ _this2.setState({ showModal: false });
864
+ };
865
+
866
+ _this2.closeMoreModal = function () {
867
+ _this2.setState({ showMoreModal: false });
868
+ };
869
+
870
+ _this2.tplusEncode = function (code) {
871
+ var c = String.fromCharCode(code.charCodeAt(0) + code.length);
872
+ for (var i = 1; i < code.length; i++) {
873
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
874
+ }
875
+ var ret = _this2.TplusBase64Encode(c);
876
+ return ret;
877
+ };
878
+
879
+ _this2.TplusBase64Encode = function (input) {
880
+ var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
881
+ var output = "";
882
+ var chr1 = void 0,
883
+ chr2 = void 0,
884
+ chr3 = void 0,
885
+ enc1 = void 0,
886
+ enc2 = void 0,
887
+ enc3 = void 0,
888
+ enc4 = void 0;
889
+ var i = 0;
890
+ input = _this2._utf8_encode(input);
891
+ while (i < input.length) {
892
+ chr1 = input.charCodeAt(i++);
893
+ chr2 = input.charCodeAt(i++);
894
+ chr3 = input.charCodeAt(i++);
895
+ enc1 = chr1 >> 2;
896
+ enc2 = (chr1 & 3) << 4 | chr2 >> 4;
897
+ enc3 = (chr2 & 15) << 2 | chr3 >> 6;
898
+ enc4 = chr3 & 63;
899
+ if (isNaN(chr2)) {
900
+ enc3 = enc4 = 64;
901
+ } else if (isNaN(chr3)) {
902
+ enc4 = 64;
903
+ }
904
+ output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
905
+ }
906
+ return output;
907
+ };
908
+
909
+ _this2._utf8_encode = function (string) {
910
+ string = string.replace(/\r\n/g, "\n");
911
+ var utftext = "";
912
+ for (var n = 0; n < string.length; n++) {
913
+ var c = string.charCodeAt(n);
914
+ if (c < 128) {
915
+ utftext += String.fromCharCode(c);
916
+ } else if (c > 127 && c < 2048) {
917
+ utftext += String.fromCharCode(c >> 6 | 192);
918
+ utftext += String.fromCharCode(c & 63 | 128);
919
+ } else {
920
+ utftext += String.fromCharCode(c >> 12 | 224);
921
+ utftext += String.fromCharCode(c >> 6 & 63 | 128);
922
+ utftext += String.fromCharCode(c & 63 | 128);
923
+ }
924
+ }
925
+ return utftext;
926
+ };
927
+
928
+ _this2.operationControl = function () {
929
+ var menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
930
+ var operations = _this2.state.operations;
931
+
932
+ menu.forEach(function (v) {
933
+ if (v.sub) {
934
+ return _this2.operationControl(v.sub);
935
+ }
936
+ var controllable = operations.find(function (vv) {
937
+ return vv.Name === v.Name;
938
+ });
939
+
940
+ var _ref12 = controllable || {},
941
+ Visibility = _ref12.Visibility,
942
+ HoldFunctionAuth = _ref12.HoldFunctionAuth,
943
+ Title = _ref12.Title;
944
+
945
+ var errorTip = void 0;
946
+ if (!Visibility) {
947
+ errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
948
+ } else if (!HoldFunctionAuth) {
949
+ errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
950
+ }
951
+ v.errorTip = errorTip;
952
+ });
953
+ return menu;
954
+ };
955
+
956
+ _this2.createLeftNode = function () {
957
+ var menu = _this2.leftMenu;
958
+ var width = menu.length == 0 ? _this2.isMobileEnvironment & !_this2.isNewRetailBCPosTC ? 5 : 4 : 7;
959
+ if (menu.length == 0) {
960
+ return _react2.default.createElement(
961
+ _antd.Col,
962
+ { xl: width, md: width, className: 'portal-left-col', key: 'left' },
963
+ _react2.default.createElement('div', { className: 'portal-left-content' })
964
+ );
965
+ }
966
+
967
+ var menuNode = menu.map(function (v) {
968
+ return v.container ? _react2.default.createElement(
969
+ 'div',
970
+ { style: v.container.style, className: v.container.className, key: v.container.className },
971
+ v.sub.map(function (vv) {
972
+ var item = vv;
973
+ if (vv.maybe === true) {
974
+ item = _this2.showStorePrice ? vv : vv.second;
975
+ }
976
+ return _react2.default.createElement(
977
+ 'div',
978
+ {
979
+ className: 'member-item ' + item.className + ' ' + (item.disabled ? 'menu-item-disabled' : ''),
980
+ key: item.className,
981
+ onClick: _this2.handelClick.bind(_this2, item)
982
+ },
983
+ !!item.title && _react2.default.createElement(
984
+ 'h1',
985
+ null,
986
+ item.title
987
+ ),
988
+ !!item.label && _react2.default.createElement(
989
+ 'p',
990
+ null,
991
+ item.label
992
+ ),
993
+ !!item.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: item.icon })
994
+ );
995
+ })
996
+ ) : _react2.default.createElement(
997
+ 'div',
998
+ {
999
+ className: 'member-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1000
+ key: v.className,
1001
+ onClick: _this2.handelClick.bind(_this2, v)
1002
+ },
1003
+ v.title && _react2.default.createElement(
1004
+ 'h1',
1005
+ null,
1006
+ v.title
1007
+ ),
1008
+ v.label && _react2.default.createElement(
1009
+ 'p',
1010
+ null,
1011
+ v.label
1012
+ ),
1013
+ v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1014
+ );
1015
+ });
1016
+ return _react2.default.createElement(
1017
+ _antd.Col,
1018
+ { xl: 7, md: 7, className: 'portal-left-col', key: 'left' },
1019
+ _react2.default.createElement(
1020
+ 'div',
1021
+ { className: 'portal-left-content' },
1022
+ menuNode
1023
+ )
1024
+ );
1025
+ };
1026
+
1027
+ _this2.createCenterNode = function () {
1028
+ var menuLeftNode = _this2.centerLeftMenu.map(function (v) {
1029
+ return _react2.default.createElement(
1030
+ 'div',
1031
+ {
1032
+ className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1033
+ style: v.style,
1034
+ key: v.className,
1035
+ onClick: _this2.handelClick.bind(_this2, v)
1036
+ },
1037
+ v.title && _react2.default.createElement(
1038
+ 'h1',
1039
+ null,
1040
+ v.title
1041
+ ),
1042
+ v.label && _react2.default.createElement(
1043
+ 'p',
1044
+ null,
1045
+ v.label
1046
+ ),
1047
+ v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon }),
1048
+ v.disabled && _react2.default.createElement('div', { className: 'item-disabled-placeholder' })
1049
+ );
1050
+ });
1051
+ var menuRightNode = _this2.centerRightMenu.map(function (v) {
1052
+ return v.container ? _react2.default.createElement(
1053
+ 'div',
1054
+ { style: v.container.style, className: v.container.className, key: v.container.className },
1055
+ v.sub.map(function (vv) {
1056
+ return _react2.default.createElement(
1057
+ 'div',
1058
+ {
1059
+ className: 'worktop-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
1060
+ key: vv.className,
1061
+ onClick: _this2.handelClick.bind(_this2, vv)
1062
+ },
1063
+ vv.title && _react2.default.createElement(
1064
+ 'h1',
1065
+ null,
1066
+ vv.title
1067
+ ),
1068
+ vv.label && _react2.default.createElement(
1069
+ 'p',
1070
+ null,
1071
+ vv.label
1072
+ ),
1073
+ vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
1074
+ );
1075
+ })
1076
+ ) : _react2.default.createElement(
1077
+ 'div',
1078
+ {
1079
+ className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1080
+ key: v.className,
1081
+ onClick: _this2.handelClick.bind(_this2, v)
1082
+ },
1083
+ v.title && _react2.default.createElement(
1084
+ 'h1',
1085
+ null,
1086
+ v.title
1087
+ ),
1088
+ v.label && _react2.default.createElement(
1089
+ 'p',
1090
+ null,
1091
+ v.label
1092
+ ),
1093
+ v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1094
+ );
1095
+ });
1096
+ return _react2.default.createElement(
1097
+ 'div',
1098
+ null,
1099
+ _react2.default.createElement(
1100
+ 'div',
1101
+ { className: 'worktop-container-left' },
1102
+ menuLeftNode
1103
+ ),
1104
+ _react2.default.createElement(
1105
+ 'div',
1106
+ { className: 'worktop-container-right' },
1107
+ menuRightNode
1108
+ )
1109
+ );
1110
+ };
1111
+
1112
+ _this2.createRightNode = function () {
1113
+ var width = _this2.leftMenu.length == 0 ? _this2.isMobileEnvironment & !_this2.isNewRetailBCPosTC ? 9 : 10 : 7;
1114
+ var node = _this2.rightMenu.map(function (v) {
1115
+ return v.container ? _react2.default.createElement(
1116
+ 'div',
1117
+ { style: v.container.style, className: v.container.className, key: v.container.className },
1118
+ v.sub.map(function (vv) {
1119
+ return _react2.default.createElement(
1120
+ 'div',
1121
+ {
1122
+ className: 'stock-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
1123
+ key: vv.className,
1124
+ onClick: _this2.handelClick.bind(_this2, vv)
1125
+ },
1126
+ vv.title && _react2.default.createElement(
1127
+ 'h1',
1128
+ null,
1129
+ vv.title
1130
+ ),
1131
+ vv.label && _react2.default.createElement(
1132
+ 'p',
1133
+ null,
1134
+ vv.label
1135
+ ),
1136
+ vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
1137
+ );
1138
+ })
1139
+ ) : _react2.default.createElement(
1140
+ 'div',
1141
+ {
1142
+ className: 'stock-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1143
+ style: v.style,
1144
+ key: v.className,
1145
+ onClick: _this2.handelClick.bind(_this2, v)
1146
+ },
1147
+ !!v.title && _react2.default.createElement(
1148
+ 'h1',
1149
+ null,
1150
+ v.title
1151
+ ),
1152
+ !!v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1153
+ );
1154
+ });
1155
+ return _react2.default.createElement(
1156
+ _antd.Col,
1157
+ { xl: width, md: width, className: 'portal-right-col', key: 'right' },
1158
+ _react2.default.createElement(
1159
+ 'div',
1160
+ { className: 'portal-right-content' },
1161
+ node
1162
+ )
1163
+ );
1164
+ };
1165
+
1166
+ _this2.createMoreNode = function () {
1167
+ var arrs = _this2.getMoreNodeInfo();
1168
+ var items = _this2.isNewRetailBCPosTC ? arrs.sub_tc : arrs.sub_cc || [];
1169
+ var node = items.length > 0 && items.map(function (v) {
1170
+ return _react2.default.createElement(
1171
+ 'div',
1172
+ {
1173
+ className: 'modal-quick ' + v.className,
1174
+ style: v.style,
1175
+ key: v.className,
1176
+ onClick: _this2.handelClick.bind(_this2, v)
1177
+ },
1178
+ !!v.icon && _react2.default.createElement(
1179
+ 'div',
1180
+ { className: 'quick' },
1181
+ _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1182
+ ),
1183
+ !!v.title && _react2.default.createElement(
1184
+ 'h1',
1185
+ null,
1186
+ v.title
1187
+ )
1188
+ );
1189
+ });
1190
+ return node;
1191
+ };
1192
+
1193
+ _this2.getMoreNodeInfo = function () {
1194
+ if (_this2.isNewRetailBCPosTC) {
1195
+ return _this2.centerRightMenu.find(function (v) {
1196
+ return v.sub && v.sub.find(function (vv) {
1197
+ return vv.key == 'more';
1198
+ });
1199
+ }).sub[1] || {};
1200
+ } else {
1201
+ return _this2.centerRightMenu.find(function (v) {
1202
+ return v.sub && v.sub.find(function (vv) {
1203
+ return vv.key == 'more';
1204
+ });
1205
+ }).sub[1] || {};
1206
+ }
1207
+ };
1208
+
1209
+ _this2.hasElectron = hasElectron;
1210
+ var hsyPageLoadIsFinish = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('hsyPageLoadIsFinish');
1211
+ _this2.state = {
1212
+ id: Date.now(),
1213
+ operations: [],
1214
+ showModal: false,
1215
+ showMoreModal: false,
1216
+ isHsyLoadFinish: !!hsyPageLoadIsFinish,
1217
+ loadTcPage: false,
1218
+ loadTcURL: '',
1219
+ modalURL: ''
1220
+ };
1221
+
1222
+ var _ref13 = _mutantsUtil.platform || {},
1223
+ isVerticalTouch = _ref13.isVerticalTouch,
1224
+ isHorizontalPad = _ref13.isHorizontalPad,
1225
+ isHorizontalSunMi = _ref13.isHorizontalSunMi,
1226
+ isNewRetailBCPosTC = _ref13.isNewRetailBCPosTC;
1227
+
1228
+ _this2.isVerticalTouch = !!isVerticalTouch;
1229
+ _this2.isHorizontalPad = !!isHorizontalPad;
1230
+ _this2.isHorizontalSunMi = !!isHorizontalSunMi;
1231
+ _this2.isMobileEnvironment = !!isHorizontalPad || !!isHorizontalSunMi;
1232
+ _this2.FuPingIsLoaded = false;
1233
+ _this2.isNewRetailBCPosTC = !!isNewRetailBCPosTC;
1234
+ _this2.new_retail_app = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('newRetailAppType');
1235
+ _this2.hsy_domain = _tplusApi.User && _tplusApi.User.getWebEntry();
1236
+ // 是否嵌套好生意的iframe
1237
+ _this2.isHsyIframeInclude = !_this2.isVerticalTouch && !_this2.isMobileEnvironment;
1238
+ //获取初始化参数
1239
+ _this2.isEnableMember = !!(0, _tplusPoslogin.PosInitData)('isEnableMember'); //是否开启会员
1240
+ _this2.isEnablePromotion = !!(0, _tplusPoslogin.PosInitData)('isEnablePromotion'); //是否开启促销
1241
+ _this2.isOfflineCash = (0, _tplusPoslogin.PosInitData)('IsOfflineCash');
1242
+ _this2.tplusSiteUrl = (0, _tplusPoslogin.PosInitData)("TplusSite") || (0, _tplusPoslogin.PosInitData)("tplusinnersite");
1243
+ _this2.idWarehouse = (0, _tplusPoslogin.PosInitData)('IdWarehouse') || '';
1244
+ _this2.warehouseName = (0, _tplusPoslogin.PosInitData)('WarehouseName') || '';
1245
+ _this2.performanceDistribution = (0, _tplusPoslogin.PosInitData)('PerformanceDistribution');
1246
+ _this2.showStorePrice = (0, _tplusPoslogin.PosInitData)('ShowStorePrice');
1247
+
1248
+ //首页布局
1249
+ _this2.leftMenu = _this2.getMenuByPosition('left');
1250
+ _this2.centerLeftMenu = _this2.getMenuByPosition('centerLeft');
1251
+ _this2.centerRightMenu = _this2.getMenuByPosition('centerRight');
1252
+ _this2.rightMenu = _this2.getMenuByPosition('right');
1253
+ _this2.randomWord = _this2.randomWord.bind(_this2);
1254
+ return _this2;
1255
+ }
1256
+
1257
+ (0, _createClass3.default)(_default, [{
1258
+ key: 'getMenuByPosition',
1259
+ value: function getMenuByPosition(position) {
1260
+ var leftMenu = _data2.default.leftMenu,
1261
+ centerLeftMenu = _data2.default.centerLeftMenu,
1262
+ centerRightMenu = _data2.default.centerRightMenu,
1263
+ rightMenu = _data2.default.rightMenu,
1264
+ leftMenuTC = _data2.default.leftMenuTC,
1265
+ rightMenuTC = _data2.default.rightMenuTC,
1266
+ centerLeftMenuMobileCC = _data2.default.centerLeftMenuMobileCC,
1267
+ centerLeftMenuMobileTC = _data2.default.centerLeftMenuMobileTC,
1268
+ centerRightMenuMobileCC = _data2.default.centerRightMenuMobileCC,
1269
+ centerRightMenuMobileTC = _data2.default.centerRightMenuMobileTC,
1270
+ rightMenuMobileTC = _data2.default.rightMenuMobileTC,
1271
+ rightMenuMobileCC = _data2.default.rightMenuMobileCC;
1272
+
1273
+ switch (position) {
1274
+ case "left":
1275
+ {
1276
+ return this.getMenuByEnvironment(leftMenu, leftMenuTC, [], []);
1277
+ }
1278
+ case "centerLeft":
1279
+ {
1280
+ return this.getMenuByEnvironment(centerLeftMenu, centerLeftMenu, centerLeftMenuMobileTC, centerLeftMenuMobileCC);
1281
+ }
1282
+ case "centerRight":
1283
+ {
1284
+ return this.getMenuByEnvironment(centerRightMenu, centerRightMenu, centerRightMenuMobileTC, centerRightMenuMobileCC);
1285
+ }
1286
+ case "right":
1287
+ {
1288
+ return this.getMenuByEnvironment(rightMenu, rightMenuTC, rightMenuMobileTC, rightMenuMobileCC);
1289
+ }
1290
+ }
1291
+ }
1292
+ }, {
1293
+ key: 'getMenuByEnvironment',
1294
+ value: function getMenuByEnvironment(ccMenu, tcMenu, tcMobilMenu, ccMobilMenu) {
1295
+ if (this.isNewRetailBCPosTC) {
1296
+ return tcMenu;
1297
+ } else {
1298
+ return ccMenu;
1299
+ }
1300
+ }
1301
+ }, {
1302
+ key: 'componentDidMount',
1303
+ value: function componentDidMount() {
1304
+ var _this4 = this;
1305
+
1306
+ this.initPageData();
1307
+ //加载好生意界面
1308
+ var hsyPageLoadIsFinish = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('hsyPageLoadIsFinish');
1309
+ if (hsyPageLoadIsFinish == 'true') {
1310
+ this.loadHsyPage();
1311
+ } else {
1312
+ setTimeout(function () {
1313
+ _this4.loadHsyPage();
1314
+ }, 1000);
1315
+ }
1316
+ }
1317
+
1318
+ // 初始化加载hsy
1319
+
1320
+ }, {
1321
+ key: 'initHsyFrameWin',
1322
+
1323
+
1324
+ // 初始化好生意iframe
1325
+ value: function initHsyFrameWin() {
1326
+ var _this = this;
1327
+ this.ccFrameStore = new _mutantsMicrofx.stores.IframeStore(document.getElementById(CC_FRAME_CONF.id), this.hsy_domain, function (e, instance) {
1328
+ console.log(e, instance, 'cciframe 接收消息');
1329
+ if (e.data && e.data.type === CC_FRAME_CONF.HsyLoadFinish) {
1330
+ //记录好生意界面是否加载完成
1331
+ var hsyPageLoadIsFinish = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('hsyPageLoadIsFinish');
1332
+ if (!(hsyPageLoadIsFinish == 'true')) {
1333
+ _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.set('hsyPageLoadIsFinish', true);
1334
+ _this.setState({ isHsyLoadFinish: true });
1335
+ }
1336
+ }
1337
+ }, function (e, instance) {
1338
+ console.log("ccFrameWin 加载成功========>", e, instance);
1339
+ instance.sendMessage({ type: CC_FRAME_CONF.initConnect, _ident_only_: CC_FRAME_CONF.identOnly });
1340
+ }, CC_FRAME_CONF.identOnly);
1341
+ }
1342
+ // 初始化商米副屏
1343
+
1344
+ }, {
1345
+ key: 'initHsyBasicPageInfo',
1346
+
1347
+
1348
+ // 初始化智+模块信息
1349
+ value: function initHsyBasicPageInfo() {
1350
+ console.log('start create iframe-hsyPage');
1351
+ var hsyPageLoadIsFinish = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('hsyPageLoadIsFinish');
1352
+ var _hsyPage = document.getElementById(CC_FRAME_CONF.id);
1353
+ if (hsyPageLoadIsFinish == 'true' && _hsyPage) return;
1354
+ var theme = _mutantsMicrofx.stores.portalStore.themeStore;
1355
+ var color = '#FF8C25';
1356
+ switch (theme) {
1357
+ case 'orange':
1358
+ color = "#FF8C25";
1359
+ break;
1360
+ case 'blue':
1361
+ color = "#3491FF";
1362
+ break;
1363
+ case 'dark':
1364
+ color = "#26A0DE";
1365
+ break;
1366
+ case 'pink':
1367
+ color = "#FF6B8C";
1368
+ break;
1369
+ }
1370
+ var _height = document.body.clientHeight;
1371
+
1372
+ var _ref14 = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('StoreKey') || {},
1373
+ _ref14$PosId = _ref14.PosId,
1374
+ PosId = _ref14$PosId === undefined ? '' : _ref14$PosId;
1375
+
1376
+ var cc_url = this.hsy_domain.replace('#/', '') + '?fromApp=nretail&posid=' + PosId + '&content_only=true&bar_bg=' + encodeURIComponent('#FFFFFF') + '&bar_active_bg=' + encodeURIComponent(color);
1377
+ var iframe = document.createElement('iframe');
1378
+ iframe.width = '100%';
1379
+ iframe.height = _height - 60 + 'px';
1380
+ iframe.setAttribute("scrolling", "yes");
1381
+ iframe.setAttribute("frameborder", 0);
1382
+ iframe.style.position = 'absolute';
1383
+ iframe.src = cc_url;
1384
+ iframe.id = CC_FRAME_CONF.id;
1385
+ document.body.appendChild(iframe);
1386
+ console.log('finish create iframe-hsyPage succeed.');
1387
+ }
1388
+
1389
+ //初始化tc、tcyzj、tczsy信息
1390
+
1391
+ }, {
1392
+ key: 'componentWillUnmount',
1393
+ value: function componentWillUnmount() {
1394
+ if (this.isHsyIframeInclude && typeof this.ccFrameStore.destroy == 'function') {
1395
+ this.ccFrameStore.destroy();
1396
+ }
1397
+ var _context$headHook = this.context.headHook;
1398
+ _context$headHook = _context$headHook === undefined ? {} : _context$headHook;
1399
+ var removeClass = _context$headHook.removeClass;
1400
+
1401
+ removeClass && removeClass(this.state.id, 'portalHead');
1402
+ }
1403
+ }, {
1404
+ key: 'componentWillReceiveProps',
1405
+ value: function componentWillReceiveProps() {
1406
+ if (this.getScreenType() === true) {
1407
+ if (this.isHorizontalSunMi && this.FuPingIsLoaded) {
1408
+ window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 1 });
1409
+ } else {
1410
+ _mutantsMicrofx.nativeMs && _mutantsMicrofx.nativeMs.setIpcRendererMethod('ReplyScreen', { step: 1 });
1411
+ }
1412
+ }
1413
+ }
1414
+
1415
+ // 获取副屏的状态
1416
+
1417
+ }, {
1418
+ key: 'menuClick',
1419
+ value: function menuClick(item, e) {
1420
+ _mutantsMicrofx.history.push(item.path);
1421
+ }
1422
+
1423
+ //跳转其他页面,以内嵌形式打开
1424
+
1425
+
1426
+ //跳转到T+
1427
+
1428
+
1429
+ //跳转CC
1430
+
1431
+ }, {
1432
+ key: 'render',
1433
+ value: function render() {
1434
+ var _state = this.state,
1435
+ showModal = _state.showModal,
1436
+ showMoreModal = _state.showMoreModal,
1437
+ modalURL = _state.modalURL,
1438
+ loadTcPage = _state.loadTcPage,
1439
+ loadTcURL = _state.loadTcURL;
1440
+
1441
+ var screenHeight = window.screen.availHeight - 100;
1442
+ var htmlContent = null;
1443
+ if (this.isVerticalTouch) {
1444
+ htmlContent = _react2.default.createElement(_verticalPortal2.default, { handelClick: this.handelClick });
1445
+ } else {
1446
+ htmlContent = _react2.default.createElement(
1447
+ _tplusComponentsTouch.Layout,
1448
+ { style: { height: '100%' }, className: 'portal-content' },
1449
+ _react2.default.createElement(
1450
+ Content,
1451
+ { style: { paddingLeft: '50px', paddingRight: '50px' }, className: 'portal-container portal-container-center' },
1452
+ _react2.default.createElement(
1453
+ _antd.Row,
1454
+ { className: 'portal-content-row' },
1455
+ this.createLeftNode(),
1456
+ _react2.default.createElement(
1457
+ _antd.Col,
1458
+ { xl: 10, md: 10, className: 'portal-center-col', key: 'center' },
1459
+ _react2.default.createElement(
1460
+ 'div',
1461
+ { className: 'portal-center-content' },
1462
+ this.createCenterNode()
1463
+ )
1464
+ ),
1465
+ this.createRightNode()
1466
+ )
1467
+ ),
1468
+ _react2.default.createElement(
1469
+ 'div',
1470
+ { className: loadTcPage ? 'portal-hsy-tc-container' : 'portal-hsy-tc-container portal-hsy-tc-container-hide' },
1471
+ _react2.default.createElement('iframe', { src: loadTcURL, width: '100%', height: '93%', frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true', id: 'external-frame-tc' })
1472
+ ),
1473
+ this.isMobileEnvironment && _react2.default.createElement(
1474
+ _antd.Modal,
1475
+ {
1476
+ visible: showModal,
1477
+ onCancel: this.closeFrameModal,
1478
+ width: '99%',
1479
+ height: '99%',
1480
+ footer: null
1481
+ },
1482
+ _react2.default.createElement('iframe', { src: modalURL, width: '100%', height: screenHeight, frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true' })
1483
+ ),
1484
+ _react2.default.createElement(
1485
+ _antd.Modal,
1486
+ {
1487
+ title: '更多',
1488
+ className: 'portal-container-modal-more',
1489
+ visible: showMoreModal,
1490
+ onCancel: this.closeMoreModal,
1491
+ width: 800,
1492
+ height: 375,
1493
+ footer: null,
1494
+ centered: true,
1495
+ maskClosable: false,
1496
+ keyboard: false
1497
+ },
1498
+ this.createMoreNode()
1499
+ )
1500
+ );
1501
+ }
1502
+ return htmlContent;
1503
+ }
1504
+ }]);
1505
+ return _default;
1506
+ }(_react.Component), _class2.propTypes = {
1507
+ routes: _propTypes2.default.array
1508
+ }, _class2.contextTypes = {
1509
+ stores: _propTypes2.default.object,
1510
+ infoRender: _propTypes2.default.func,
1511
+ headHook: _propTypes2.default.object
1512
+ }, _temp)) || _class;
1513
+
1514
+ exports.default = _default;
1515
+ //# sourceMappingURL=index.js.map