tplus-member 3.28.4 → 3.28.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/member/ShopMember.js +9 -1
- package/dist/member/ShopMember.js.map +1 -1
- package/dist/member/ShopMember.less +21 -6
- package/dist/member/index.js +129 -115
- package/dist/member/index.js.map +1 -1
- package/dist/member/memberTab.js +36 -5
- package/dist/member/memberTab.js.map +1 -1
- package/package.json +1 -1
package/dist/member/index.js
CHANGED
@@ -109,11 +109,11 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
109
109
|
function MemberTag(props) {
|
110
110
|
(0, _classCallCheck3.default)(this, MemberTag);
|
111
111
|
|
112
|
-
var
|
112
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (MemberTag.__proto__ || (0, _getPrototypeOf2.default)(MemberTag)).call(this, props));
|
113
113
|
|
114
|
-
_initialiseProps.call(
|
114
|
+
_initialiseProps.call(_this);
|
115
115
|
|
116
|
-
|
116
|
+
_this.hasElectron = hasElectron;
|
117
117
|
|
118
118
|
var _ref = _mutantsMicrofx.stores.user.options.get('loginInfo') || {},
|
119
119
|
isMemberInputType = _ref.isMemberInputType,
|
@@ -122,41 +122,44 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
122
122
|
ICCardServer = _ref.ICCardServer,
|
123
123
|
ICCardPassword = _ref.ICCardPassword;
|
124
124
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
_this.isMemberInputType = parseInt(isMemberInputType); // '0'为不禁用 '1'为禁用
|
126
|
+
_this.isStorageCardInputType = MemberMeStorageCardInputByKeyBoard; // 仅储值卡是否禁用键盘输入,'0'为不禁用 '1'为禁用
|
127
|
+
_this.openFaceRecognition = parseInt(OpenFaceRecognition); // 启用人脸识别:0禁用 1为启用
|
128
|
+
_this.iCCardServer = parseInt(ICCardServer); // 启用IC卡:0为禁用 1为启用
|
129
|
+
_this.iCCardPassword = ICCardPassword; //IC卡密码
|
130
|
+
_this.ms = _api2.default;
|
131
131
|
//移动端环境下,没有读取IC卡的方式。
|
132
132
|
|
133
133
|
var _ref2 = _mutantsUtil.platform || {},
|
134
134
|
isHorizontalPad = _ref2.isHorizontalPad,
|
135
135
|
isHorizontalSunMi = _ref2.isHorizontalSunMi;
|
136
136
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
137
|
+
_this.isHorizontalPad = !!isHorizontalPad;
|
138
|
+
_this.isHorizontalSunMi = !!isHorizontalSunMi;
|
139
|
+
_this.isMobileEnvironment = !!isHorizontalPad || !!isHorizontalSunMi;
|
140
|
+
_this.handleReadICard = _this.handleReadICard.bind(_this);
|
141
141
|
|
142
142
|
//记录键盘录入信息的开始时间
|
143
|
-
|
144
|
-
|
143
|
+
_this.keypressStime = null;
|
144
|
+
_this.iseyboardKEnter = false; //是否为键盘输入
|
145
145
|
|
146
146
|
var _ref3 = _mutantsUtil.platform || {},
|
147
147
|
isNewRetailBCPos = _ref3.isNewRetailBCPos;
|
148
148
|
|
149
|
-
|
149
|
+
_this.state = {
|
150
150
|
isCC: !!isNewRetailBCPos,
|
151
151
|
isShowBirthdayTip: false
|
152
152
|
};
|
153
|
-
|
153
|
+
|
154
|
+
//是否单据模式
|
155
|
+
_this.isVoucherMode = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') == 'voucher';
|
156
|
+
return _this;
|
154
157
|
}
|
155
158
|
|
156
159
|
(0, _createClass3.default)(MemberTag, [{
|
157
160
|
key: 'componentWillReact',
|
158
161
|
value: function componentWillReact() {
|
159
|
-
var
|
162
|
+
var _this2 = this;
|
160
163
|
|
161
164
|
var _ref4 = this.context.viewModel || {},
|
162
165
|
_ref4$data = _ref4.data;
|
@@ -173,8 +176,8 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
173
176
|
var memberChangeData = (0, _keys2.default)(selectMemberInfo).length ? selectMemberInfo : undefined;
|
174
177
|
|
175
178
|
var memberChange = function memberChange(data) {
|
176
|
-
|
177
|
-
|
179
|
+
_this2.setState({ newAvatar: '' });
|
180
|
+
_this2.props.memberChange(data);
|
178
181
|
};
|
179
182
|
if ((typeof memberChangeData === 'undefined' ? 'undefined' : (0, _typeof3.default)(memberChangeData)) === 'object') {
|
180
183
|
var deepCloneMember = JSON.parse((0, _stringify2.default)(memberChangeData));
|
@@ -224,7 +227,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
224
227
|
|
225
228
|
//IC卡连接
|
226
229
|
value: function connectRfCard() {
|
227
|
-
var
|
230
|
+
var _this3 = this;
|
228
231
|
|
229
232
|
//客户端环境下,并开启了启用IC卡。
|
230
233
|
if (this.hasElectron === true && this.iCCardServer === 1) {
|
@@ -235,7 +238,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
235
238
|
} else {
|
236
239
|
result = { connectCardStatus: true, connectCardError: '' };
|
237
240
|
}
|
238
|
-
|
241
|
+
_this3.setState(result);
|
239
242
|
});
|
240
243
|
}
|
241
244
|
}
|
@@ -245,7 +248,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
245
248
|
}, {
|
246
249
|
key: 'readRfCard',
|
247
250
|
value: function readRfCard() {
|
248
|
-
var
|
251
|
+
var _this4 = this;
|
249
252
|
|
250
253
|
//客户端环境下,并开启了启用IC卡。
|
251
254
|
if (this.hasElectron === true && this.iCCardServer === 1) {
|
@@ -262,10 +265,10 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
262
265
|
_mutantsMicrofx.nativeMs.setIpcRendererMethod('ReadRfCard', (0, _extends3.default)({}, params), function (ret) {
|
263
266
|
if (ret.status === 0) {
|
264
267
|
_tplusComponentsTouch.Message.error(ret.value);
|
265
|
-
|
268
|
+
_this4.connectRfCard(); //读取失败后,重新连接一下。
|
266
269
|
return;
|
267
270
|
} else if (ret.status === 1) {
|
268
|
-
|
271
|
+
_this4.searchMember(ret.value);
|
269
272
|
}
|
270
273
|
});
|
271
274
|
}
|
@@ -295,7 +298,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
295
298
|
}, {
|
296
299
|
key: 'render',
|
297
300
|
value: function render() {
|
298
|
-
var
|
301
|
+
var _this5 = this;
|
299
302
|
|
300
303
|
var _state2 = this.state,
|
301
304
|
memberPhoto = _state2.memberPhoto,
|
@@ -369,10 +372,10 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
369
372
|
placeholder: '\u626B\u63CF/\u8F93\u5165\u4F1A\u5458\u53F7',
|
370
373
|
value: searchValue,
|
371
374
|
ref: function ref(el) {
|
372
|
-
return
|
375
|
+
return _this5.inputSearch = el && el.input;
|
373
376
|
},
|
374
377
|
onChange: function onChange(e) {
|
375
|
-
return
|
378
|
+
return _this5.handleSearch(e.target.value);
|
376
379
|
},
|
377
380
|
onFocus: this.handleFocus,
|
378
381
|
onBlur: this.handleBlur,
|
@@ -393,7 +396,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
393
396
|
'div',
|
394
397
|
{ className: 'openFaceRecognition-box' },
|
395
398
|
_react2.default.createElement(_tplusComponentsTouch.Ticon, { className: 'icon', onClick: function onClick() {
|
396
|
-
return
|
399
|
+
return _this5.loadFaceRecognition(2);
|
397
400
|
}, type: 'renlianshibie' }),
|
398
401
|
_react2.default.createElement(_tplusComponentsTouch.Spin, {
|
399
402
|
className: 'face-spin',
|
@@ -405,7 +408,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
405
408
|
|
406
409
|
/* 扫描组件 */
|
407
410
|
this.isHorizontalPad && _react2.default.createElement(_tplusComponentsTouch.Scan, { ref: function ref(scan) {
|
408
|
-
return
|
411
|
+
return _this5.scanObj = scan;
|
409
412
|
}, onChange: this.onScanResult })
|
410
413
|
)
|
411
414
|
),
|
@@ -434,13 +437,13 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
434
437
|
_react2.default.createElement(_tplusComponentsTouch.Ticon, { type: 'cuowuda', className: 'cuowudaIcon' })
|
435
438
|
),
|
436
439
|
memberCareInfo && memberCareInfo.isTicket && _react2.default.createElement(_tplusComponentsTouch.Ticon, { type: 'cuowuda', onClick: function onClick() {
|
437
|
-
|
440
|
+
_this5.setIsShowBirthdayTip();
|
438
441
|
}, className: 'cuowudaIcon' })
|
439
442
|
),
|
440
443
|
_react2.default.createElement(
|
441
444
|
'div',
|
442
445
|
{ className: 'second member-hotkey-info', onClick: function onClick() {
|
443
|
-
return
|
446
|
+
return _this5.openShowModal(0);
|
444
447
|
} },
|
445
448
|
_react2.default.createElement(
|
446
449
|
'div',
|
@@ -512,7 +515,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
512
515
|
_react2.default.createElement(
|
513
516
|
_button2.default,
|
514
517
|
{ type: 'primary', onClick: function onClick() {
|
515
|
-
return
|
518
|
+
return _this5.loadFaceRecognition(1);
|
516
519
|
}, className: 'btn', disabled: inShopLoading },
|
517
520
|
!inShopLoading && '到店会员',
|
518
521
|
_react2.default.createElement(_tplusComponentsTouch.Spin, {
|
@@ -667,7 +670,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
667
670
|
}, _class2.defaultProps = {
|
668
671
|
memberChange: function memberChange() {}
|
669
672
|
}, _initialiseProps = function _initialiseProps() {
|
670
|
-
var
|
673
|
+
var _this6 = this;
|
671
674
|
|
672
675
|
this.state = {
|
673
676
|
searchValue: '',
|
@@ -685,15 +688,15 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
685
688
|
};
|
686
689
|
|
687
690
|
this.controllerEvent = function (methodName, methodArgs) {
|
688
|
-
|
691
|
+
_this6.context.onEvent({ 'controllerEvent': _mutantsAppfx.Action.fromJS(_this6.context.viewModel, methodName) }, 'controllerEvent', methodArgs);
|
689
692
|
};
|
690
693
|
|
691
694
|
this.resetInShopMemberTimer = function (count) {
|
692
|
-
|
695
|
+
_this6.timer && clearTimeout(_this6.timer);
|
693
696
|
if (!count) return;
|
694
697
|
var time = 5 * 60 * 1000;
|
695
|
-
|
696
|
-
|
698
|
+
_this6.timer = setTimeout(function () {
|
699
|
+
_this6.getInStoreMemberCount();
|
697
700
|
}, time);
|
698
701
|
};
|
699
702
|
|
@@ -702,11 +705,11 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
702
705
|
isNewRetailBCPos = _ref7.isNewRetailBCPos;
|
703
706
|
|
704
707
|
if (!isNewRetailBCPos) {
|
705
|
-
if (!
|
708
|
+
if (!_this6.openFaceRecognition) {
|
706
709
|
_tplusComponentsTouch.Message.warn('未启用人脸识别,需要先开启人脸识别功能');
|
707
710
|
return;
|
708
711
|
}
|
709
|
-
|
712
|
+
_this6.setState({
|
710
713
|
memberPhoto: true,
|
711
714
|
titleModal: '选择头像'
|
712
715
|
});
|
@@ -716,31 +719,31 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
716
719
|
this.openShowModal = function (status, res) {
|
717
720
|
var title = '';
|
718
721
|
|
719
|
-
var _ref8 =
|
722
|
+
var _ref8 = _this6.context.viewModel || {},
|
720
723
|
_ref8$data = _ref8.data;
|
721
724
|
|
722
725
|
_ref8$data = _ref8$data === undefined ? {} : _ref8$data;
|
723
726
|
var _ref8$data$Member = _ref8$data.Member,
|
724
727
|
Member = _ref8$data$Member === undefined ? {} : _ref8$data$Member;
|
725
|
-
var newAvatar =
|
728
|
+
var newAvatar = _this6.state.newAvatar;
|
726
729
|
|
727
730
|
var jsMember = (0, _mobx.toJS)(Member);
|
728
731
|
var updateMember = newAvatar ? (0, _extends3.default)({}, jsMember, { ImageFile: newAvatar }) : jsMember;
|
729
732
|
switch (status) {
|
730
733
|
case 0:
|
731
734
|
title = '会员详情';
|
732
|
-
|
735
|
+
_this6.setState({ viewMemberInfo: updateMember });
|
733
736
|
break;
|
734
737
|
case 1:
|
735
738
|
title = '到店会员';
|
736
|
-
|
739
|
+
_this6.setState({ viewMemberInfo: res });
|
737
740
|
break;
|
738
741
|
case 2:
|
739
742
|
title = '人脸识别';
|
740
|
-
|
743
|
+
_this6.setState({ viewMemberInfo: res });
|
741
744
|
break;
|
742
745
|
}
|
743
|
-
|
746
|
+
_this6.setState({
|
744
747
|
status: status,
|
745
748
|
memberShow: true,
|
746
749
|
titleModal: title
|
@@ -748,9 +751,9 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
748
751
|
};
|
749
752
|
|
750
753
|
this.openCloseModal = function () {
|
751
|
-
var setMemberFocus =
|
754
|
+
var setMemberFocus = _this6.props.setMemberFocus;
|
752
755
|
|
753
|
-
var memberStore =
|
756
|
+
var memberStore = _this6.context.viewModel && _this6.context.viewModel.items.find(function (el) {
|
754
757
|
return el.name == 'MemberStore';
|
755
758
|
});
|
756
759
|
var uiState = memberStore.uiState;
|
@@ -764,7 +767,7 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
764
767
|
title: '关闭会员',
|
765
768
|
content: '' + (IsIntegralExchange ? "关闭会员将会清空商品信息!" : "确定要关闭该会员吗?"),
|
766
769
|
onOk: function onOk() {
|
767
|
-
|
770
|
+
_this6.ms.clearSeletMember();
|
768
771
|
_mutantsMicrofx.stores.selectMemberStore.clearMemberCare();
|
769
772
|
typeof setMemberFocus == 'function' && setMemberFocus();
|
770
773
|
}
|
@@ -772,87 +775,98 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
772
775
|
};
|
773
776
|
|
774
777
|
this.handleCloseBirthdayModal = function () {
|
775
|
-
|
778
|
+
_this6.ms.changeBirthdayShow(false);
|
776
779
|
};
|
777
780
|
|
778
781
|
this.handleMemberCareModal = function () {
|
779
|
-
|
782
|
+
_this6.setState({ isMemberCareModal: true });
|
780
783
|
};
|
781
784
|
|
782
785
|
this.handleMemberCareModalCancel = function () {
|
783
|
-
|
786
|
+
_this6.setState({ isMemberCareModal: false });
|
784
787
|
};
|
785
788
|
|
786
789
|
this.handleSearch = function (val) {
|
787
|
-
|
790
|
+
_this6.setState({ searchValue: val });
|
788
791
|
};
|
789
792
|
|
790
793
|
this.handleFocus = function (el) {
|
791
|
-
if (
|
792
|
-
|
793
|
-
|
794
|
-
|
794
|
+
if (_this6.isMemberInputType) return;
|
795
|
+
if (_this6.isVoucherMode) {
|
796
|
+
_tplusComponentsTouch.Keyboard.open(function (v) {
|
797
|
+
var value = _tplusComponentsTouch.Keyboard.getNewValue(_this6.inputSearch, _this6.inputSearch.value, v);
|
798
|
+
_this6.handleSearch(value);
|
799
|
+
}, function () {
|
800
|
+
_this6.searchMember(undefined, 'ok');
|
801
|
+
}, _this6.keyboardClose, 'ByMember', _mutantsMicrofx.localStore.get('ByMember'))();
|
802
|
+
} else {
|
803
|
+
_tplusComponentsTouch.Keyboard.open2(function (v) {
|
804
|
+
var value = _tplusComponentsTouch.Keyboard.getNewValue(_this6.inputSearch, _this6.inputSearch.value, v);
|
805
|
+
_this6.handleSearch(value);
|
806
|
+
}, function () {
|
807
|
+
_this6.searchMember(undefined, 'ok');
|
808
|
+
}, _this6.keyboardClose, 'ByMember', _mutantsMicrofx.localStore.get('ByMember'));
|
795
809
|
}
|
796
|
-
_tplusComponentsTouch.Keyboard.open2(function (v) {
|
797
|
-
var value = _tplusComponentsTouch.Keyboard.getNewValue(_this7.inputSearch, _this7.inputSearch.value, v);
|
798
|
-
_this7.handleSearch(value);
|
799
|
-
}, cb, _this7.keyboardClose, 'ByMember', _mutantsMicrofx.localStore.get('ByMember'));
|
800
810
|
};
|
801
811
|
|
802
812
|
this.keyboardClose = function () {
|
803
|
-
|
813
|
+
_this6.inputSearch.blur();
|
804
814
|
};
|
805
815
|
|
806
816
|
this.handleBlur = function () {
|
807
|
-
|
817
|
+
if (_this6.isVoucherMode) {
|
818
|
+
_tplusComponentsTouch.Keyboard.close();
|
819
|
+
} else {
|
820
|
+
_tplusComponentsTouch.Keyboard.close2();
|
821
|
+
}
|
808
822
|
};
|
809
823
|
|
810
824
|
this.handleReadICard = function () {
|
811
|
-
|
825
|
+
_this6.readRfCard();
|
812
826
|
};
|
813
827
|
|
814
828
|
this.handleShowModal = function (type, params) {
|
815
829
|
if (params) {
|
816
|
-
|
830
|
+
_this6.setState({ dtMember: params, memberShow: type });
|
817
831
|
} else {
|
818
|
-
|
832
|
+
_this6.setState({ memberShow: type });
|
819
833
|
}
|
820
834
|
};
|
821
835
|
|
822
836
|
this.handlePhotoModal = function (type, newAvatar) {
|
823
837
|
if (newAvatar) {
|
824
|
-
|
838
|
+
_this6.setState({
|
825
839
|
newAvatar: newAvatar,
|
826
840
|
memberPhoto: type
|
827
841
|
});
|
828
842
|
} else {
|
829
|
-
|
843
|
+
_this6.setState({ memberPhoto: type });
|
830
844
|
}
|
831
845
|
};
|
832
846
|
|
833
847
|
this.searchMember = function (val, type) {
|
834
848
|
if (!_mutantsMicrofx.stores.offlineSys.shouldInOffline()) return;
|
835
|
-
if (!
|
836
|
-
var searchValue =
|
849
|
+
if (!_this6.ms || _this6.searchLoading) return;
|
850
|
+
var searchValue = _this6.state.searchValue;
|
837
851
|
|
838
852
|
val = val || (searchValue || '').trim();
|
839
853
|
if (!val) return;
|
840
|
-
var _props2 =
|
854
|
+
var _props2 = _this6.props,
|
841
855
|
memberSearched = _props2.memberSearched,
|
842
856
|
selectMemberSuccess = _props2.selectMemberSuccess,
|
843
857
|
setMemberFocus = _props2.setMemberFocus,
|
844
858
|
getMemberBirthday = _props2.getMemberBirthday,
|
845
859
|
getMeStorageCard = _props2.getMeStorageCard;
|
846
860
|
|
847
|
-
|
848
|
-
|
849
|
-
|
861
|
+
_this6.searchLoading = true;
|
862
|
+
_this6.setState({ searchVisible: true });
|
863
|
+
_this6.ms.getSearchMember({
|
850
864
|
currentPage: 1,
|
851
865
|
pageSize: 10,
|
852
866
|
key: val,
|
853
867
|
isSingleMember: false
|
854
868
|
}).then(function (ret) {
|
855
|
-
|
869
|
+
_this6.searchLoading = false;
|
856
870
|
|
857
871
|
var _ref9 = ret || {},
|
858
872
|
columnInfo = _ref9.ColumnInfo,
|
@@ -860,11 +874,11 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
860
874
|
|
861
875
|
var data = JSON.parse(Data) || [];
|
862
876
|
var info = data[0];
|
863
|
-
|
864
|
-
if (info && info.MemberType.IsStorage &&
|
877
|
+
_this6.setState({ searchVisible: false, columnInfo: columnInfo });
|
878
|
+
if (info && info.MemberType.IsStorage && _this6.isStorageCardInputType && _this6.iseyboardKEnter) {
|
865
879
|
getMeStorageCard && getMeStorageCard(true);
|
866
|
-
|
867
|
-
|
880
|
+
_this6.handleSearch('');
|
881
|
+
_this6.keypressStime = null;
|
868
882
|
} else {
|
869
883
|
getMeStorageCard && getMeStorageCard(false);
|
870
884
|
}
|
@@ -877,18 +891,18 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
877
891
|
onHide: function onHide() {},
|
878
892
|
listArr: data
|
879
893
|
});
|
880
|
-
|
894
|
+
_this6.setState({
|
881
895
|
searchValue: null
|
882
896
|
});
|
883
897
|
} else {
|
884
898
|
memberSearched && memberSearched(info, 'searched');
|
885
899
|
(0, _utils.userInfoFormat)(info);
|
886
900
|
if ((0, _utils.errMessageTip)(info)) return;
|
887
|
-
|
901
|
+
_this6.ms.seletMember(info, true);
|
888
902
|
setTimeout(function () {
|
889
|
-
return
|
903
|
+
return _this6.setState({ searchValue: '' });
|
890
904
|
}, 0);
|
891
|
-
|
905
|
+
_this6.handleBlur();
|
892
906
|
selectMemberSuccess && selectMemberSuccess();
|
893
907
|
getMemberBirthday && getMemberBirthday(info.ID, function (result) {
|
894
908
|
_mutantsMicrofx.stores.selectMemberStore.changeMemberCare(result);
|
@@ -897,58 +911,58 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
897
911
|
} else {
|
898
912
|
if (type === 'ok') {
|
899
913
|
_tplusComponentsTouch.Message.warn('会员不存在');
|
900
|
-
if (
|
914
|
+
if (_this6.isMobileEnvironment) {
|
901
915
|
setTimeout(function () {
|
902
|
-
return
|
916
|
+
return _this6.setState({ searchValue: '' });
|
903
917
|
}, 0);
|
904
918
|
}
|
905
919
|
typeof setMemberFocus == 'function' && setMemberFocus();
|
906
920
|
}
|
907
921
|
}
|
908
922
|
}).catch(function (err) {
|
909
|
-
|
910
|
-
|
923
|
+
_this6.setState({ searchVisible: false });
|
924
|
+
_this6.searchLoading = false;
|
911
925
|
memberSearched && memberSearched(undefined, 'err');
|
912
926
|
});
|
913
927
|
};
|
914
928
|
|
915
929
|
this.getInStoreMemberCount = function () {
|
916
|
-
if (!
|
917
|
-
|
930
|
+
if (!_this6.ms) return;
|
931
|
+
_this6.ms.getInStoreMemberCount().then(function (res) {
|
918
932
|
var _ref10 = res || {},
|
919
933
|
_ref10$data = _ref10.data;
|
920
934
|
|
921
935
|
_ref10$data = _ref10$data === undefined ? {} : _ref10$data;
|
922
936
|
var shopPerson = _ref10$data.data;
|
923
937
|
|
924
|
-
|
925
|
-
|
938
|
+
_this6.setState({ shopPerson: shopPerson });
|
939
|
+
_this6.resetInShopMemberTimer(shopPerson);
|
926
940
|
});
|
927
941
|
};
|
928
942
|
|
929
943
|
this.onKeyPressed = function (e) {
|
930
944
|
var keyCode = e && e.keyCode;
|
931
945
|
if (keyCode === 13) {
|
932
|
-
if (
|
933
|
-
var stime =
|
946
|
+
if (_this6.isMemberInputType) {
|
947
|
+
var stime = _this6.keypressStime;
|
934
948
|
var etime = Date.parse(new Date());
|
935
949
|
if (etime - stime > 300) {
|
936
|
-
|
937
|
-
|
950
|
+
_this6.handleSearch('');
|
951
|
+
_this6.keypressStime = null;
|
938
952
|
return _tplusComponentsTouch.Message.warn('未启用键盘录入功能');
|
939
953
|
}
|
940
|
-
|
954
|
+
_this6.keypressStime = null;
|
941
955
|
}
|
942
|
-
|
943
|
-
if (
|
944
|
-
|
956
|
+
_this6.iseyboardKEnter = Date.parse(new Date()) - _this6.keypressStime > 300;
|
957
|
+
if (_this6.isStorageCardInputType) {
|
958
|
+
_this6.keypressStime = null;
|
945
959
|
}
|
946
|
-
if (
|
947
|
-
|
948
|
-
} else if (
|
949
|
-
|
950
|
-
} else if (
|
951
|
-
|
960
|
+
if (_this6.searchLoading) return;
|
961
|
+
_this6.searchMember(undefined, 'ok');
|
962
|
+
} else if (_this6.isMemberInputType && !_this6.keypressStime && !(keyCode == 8)) {
|
963
|
+
_this6.keypressStime = Date.parse(new Date());
|
964
|
+
} else if (_this6.isStorageCardInputType && !_this6.keypressStime && !(keyCode == 8) && !_this6.isMemberInputType) {
|
965
|
+
_this6.keypressStime = Date.parse(new Date());
|
952
966
|
}
|
953
967
|
};
|
954
968
|
|
@@ -976,35 +990,35 @@ var MemberTag = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_
|
|
976
990
|
|
977
991
|
this.loadFaceRecognition = function (type) {
|
978
992
|
// type = 1:到店会员 type = 2:POS机人脸识别
|
979
|
-
|
980
|
-
|
981
|
-
|
993
|
+
_this6.setState({ faceLoading: type === 2, inShopLoading: type === 1 });
|
994
|
+
_this6.ms.loadInStoreMember(String(type)).then(function (res) {
|
995
|
+
_this6.setState({ faceLoading: false, inShopLoading: false });
|
982
996
|
|
983
997
|
var _ref12 = res || {},
|
984
998
|
Data = _ref12.Data;
|
985
999
|
|
986
1000
|
if (!JSON.parse(Data).length) {
|
987
1001
|
var tipMessage = ['当前没有到店会员', '未识别到人脸信息'];
|
988
|
-
type === 1 &&
|
1002
|
+
type === 1 && _this6.setState({ shopPerson: 0 });
|
989
1003
|
return _tplusComponentsTouch.Message.info(tipMessage[type - 1]);
|
990
1004
|
}
|
991
|
-
type === 1 &&
|
992
|
-
|
1005
|
+
type === 1 && _this6.getInStoreMemberCount();
|
1006
|
+
_this6.openShowModal(type, res);
|
993
1007
|
}).catch(function (err) {
|
994
|
-
|
1008
|
+
_this6.setState({ faceLoading: false, inShopLoading: false });
|
995
1009
|
console.log(err);
|
996
1010
|
});
|
997
1011
|
};
|
998
1012
|
|
999
1013
|
this.changeScanProduct = function () {
|
1000
|
-
if (
|
1014
|
+
if (_this6.scanObj) _this6.scanObj.startScan();
|
1001
1015
|
};
|
1002
1016
|
|
1003
1017
|
this.onScanResult = function (res) {
|
1004
|
-
|
1018
|
+
_this6.setState({
|
1005
1019
|
searchValue: res
|
1006
1020
|
}, function () {
|
1007
|
-
|
1021
|
+
_this6.onKeyPressed({ keyCode: 13 });
|
1008
1022
|
});
|
1009
1023
|
};
|
1010
1024
|
|