tplus-components-touch 3.45.1 → 3.45.2

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.
Files changed (51) hide show
  1. package/dist/components/commonForm/addressPicker/index.js +241 -0
  2. package/dist/components/commonForm/addressPicker/index.js.map +1 -0
  3. package/dist/components/commonForm/autoComplete/index.js +260 -0
  4. package/dist/components/commonForm/autoComplete/index.js.map +1 -0
  5. package/dist/components/commonForm/datePicker/index.js +92 -0
  6. package/dist/components/commonForm/datePicker/index.js.map +1 -0
  7. package/dist/components/commonForm/formControl/index.js +144 -0
  8. package/dist/components/commonForm/formControl/index.js.map +1 -0
  9. package/dist/components/commonForm/inputNumber/index.js +272 -0
  10. package/dist/components/commonForm/inputNumber/index.js.map +1 -0
  11. package/dist/components/commonForm/radio/index.js +132 -0
  12. package/dist/components/commonForm/radio/index.js.map +1 -0
  13. package/dist/components/input/tplusInput/index.js +81 -0
  14. package/dist/components/input/tplusInput/index.js.map +1 -0
  15. package/dist/components/input/tplusInput/inputContent.js +128 -0
  16. package/dist/components/input/tplusInput/inputContent.js.map +1 -0
  17. package/dist/components/input/tplusInput/inputs.js +151 -0
  18. package/dist/components/input/tplusInput/inputs.js.map +1 -0
  19. package/dist/components/input/utils/index.js +26 -0
  20. package/dist/components/input/utils/index.js.map +1 -0
  21. package/dist/components/settlement/moreCzkTable/index.js +156 -0
  22. package/dist/components/settlement/moreCzkTable/index.js.map +1 -0
  23. package/dist/components/settlement/prototypeTable/index.js +353 -0
  24. package/dist/components/settlement/prototypeTable/index.js.map +1 -0
  25. package/dist/components/settlement/prototypeTable/utils.js +14 -0
  26. package/dist/components/settlement/prototypeTable/utils.js.map +1 -0
  27. package/dist/components/settlement/settlementStore.js +2819 -0
  28. package/dist/components/settlement/settlementStore.js.map +1 -0
  29. package/dist/components/settlement/utils.js +249 -0
  30. package/dist/components/settlement/utils.js.map +1 -0
  31. package/dist/components/socket/index.js +221 -0
  32. package/dist/components/socket/index.js.map +1 -0
  33. package/dist/components/spin/index.js +95 -0
  34. package/dist/components/spin/index.js.map +1 -0
  35. package/dist/components/test/index.js +330 -0
  36. package/dist/components/test/index.js.map +1 -0
  37. package/dist/components/ticon/iconfont/iconfont.js +35 -0
  38. package/dist/components/ticon/iconfont/iconfont.js.map +1 -0
  39. package/dist/components/ticon/index.js +60 -0
  40. package/dist/components/ticon/index.js.map +1 -0
  41. package/dist/components/touchScroll/index.js +186 -0
  42. package/dist/components/touchScroll/index.js.map +1 -0
  43. package/dist/components/touchTable/AuthProcess.js +42 -0
  44. package/dist/components/touchTable/AuthProcess.js.map +1 -0
  45. package/dist/components/touchTable/generateWater.js +59 -0
  46. package/dist/components/touchTable/generateWater.js.map +1 -0
  47. package/dist/components/touchTable/index.js +1140 -0
  48. package/dist/components/touchTable/index.js.map +1 -0
  49. package/dist/components/touchTable/utils.js +14 -0
  50. package/dist/components/touchTable/utils.js.map +1 -0
  51. package/package.json +1 -1
@@ -0,0 +1,2819 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Member = exports.PayMode = exports.default = undefined;
7
+
8
+ var _isInteger = require('babel-runtime/core-js/number/is-integer');
9
+
10
+ var _isInteger2 = _interopRequireDefault(_isInteger);
11
+
12
+ var _defineProperty = require('babel-runtime/core-js/object/define-property');
13
+
14
+ var _defineProperty2 = _interopRequireDefault(_defineProperty);
15
+
16
+ var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor');
17
+
18
+ var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
19
+
20
+ var _stringify = require('babel-runtime/core-js/json/stringify');
21
+
22
+ var _stringify2 = _interopRequireDefault(_stringify);
23
+
24
+ var _promise = require('babel-runtime/core-js/promise');
25
+
26
+ var _promise2 = _interopRequireDefault(_promise);
27
+
28
+ var _regenerator = require('babel-runtime/regenerator');
29
+
30
+ var _regenerator2 = _interopRequireDefault(_regenerator);
31
+
32
+ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
33
+
34
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
35
+
36
+ var _extends2 = require('babel-runtime/helpers/extends');
37
+
38
+ var _extends3 = _interopRequireDefault(_extends2);
39
+
40
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
41
+
42
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
43
+
44
+ var _createClass2 = require('babel-runtime/helpers/createClass');
45
+
46
+ var _createClass3 = _interopRequireDefault(_createClass2);
47
+
48
+ var _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _class2, _temp, _initialiseProps, _desc2, _value2, _class3, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _desc3, _value3, _class5, _descriptor17, _descriptor18, _descriptor19, _descriptor20, _descriptor21;
49
+
50
+ var _mobx = require('mobx');
51
+
52
+ var _mutantsMicrofx = require('mutants-microfx');
53
+
54
+ var _find2 = require('lodash/find');
55
+
56
+ var _find3 = _interopRequireDefault(_find2);
57
+
58
+ var _remove2 = require('lodash/remove');
59
+
60
+ var _remove3 = _interopRequireDefault(_remove2);
61
+
62
+ var _each2 = require('lodash/each');
63
+
64
+ var _each3 = _interopRequireDefault(_each2);
65
+
66
+ var _map2 = require('lodash/map');
67
+
68
+ var _map3 = _interopRequireDefault(_map2);
69
+
70
+ var _join2 = require('lodash/join');
71
+
72
+ var _join3 = _interopRequireDefault(_join2);
73
+
74
+ var _trim2 = require('lodash/trim');
75
+
76
+ var _trim3 = _interopRequireDefault(_trim2);
77
+
78
+ var _filter2 = require('lodash/filter');
79
+
80
+ var _filter3 = _interopRequireDefault(_filter2);
81
+
82
+ var _findIndex2 = require('lodash/findIndex');
83
+
84
+ var _findIndex3 = _interopRequireDefault(_findIndex2);
85
+
86
+ var _findLastIndex2 = require('lodash/findLastIndex');
87
+
88
+ var _findLastIndex3 = _interopRequireDefault(_findLastIndex2);
89
+
90
+ var _findKey2 = require('lodash/findKey');
91
+
92
+ var _findKey3 = _interopRequireDefault(_findKey2);
93
+
94
+ var _tplusPoslogin = require('tplus-poslogin');
95
+
96
+ var _utils = require('./utils');
97
+
98
+ var _tplusApi = require('tplus-api');
99
+
100
+ var _cloneDeep = require('lodash/cloneDeep');
101
+
102
+ var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
103
+
104
+ var _message = require('../message');
105
+
106
+ var _message2 = _interopRequireDefault(_message);
107
+
108
+ var _mutantsUtil = require('mutants-util');
109
+
110
+ var _tplusComponentsTouch = require('tplus-components-touch');
111
+
112
+ var _moment = require('moment');
113
+
114
+ var _moment2 = _interopRequireDefault(_moment);
115
+
116
+ var _reduce2 = require('lodash/reduce');
117
+
118
+ var _reduce3 = _interopRequireDefault(_reduce2);
119
+
120
+ var _settlementApi = require('./settlementApi');
121
+
122
+ var _settlementApi2 = _interopRequireDefault(_settlementApi);
123
+
124
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
125
+
126
+ function _initDefineProp(target, property, descriptor, context) {
127
+ if (!descriptor) return;
128
+ (0, _defineProperty2.default)(target, property, {
129
+ enumerable: descriptor.enumerable,
130
+ configurable: descriptor.configurable,
131
+ writable: descriptor.writable,
132
+ value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
133
+ });
134
+ }
135
+
136
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
137
+ var desc = {};
138
+ Object['ke' + 'ys'](descriptor).forEach(function (key) {
139
+ desc[key] = descriptor[key];
140
+ });
141
+ desc.enumerable = !!desc.enumerable;
142
+ desc.configurable = !!desc.configurable;
143
+
144
+ if ('value' in desc || desc.initializer) {
145
+ desc.writable = true;
146
+ }
147
+
148
+ desc = decorators.slice().reverse().reduce(function (desc, decorator) {
149
+ return decorator(target, property, desc) || desc;
150
+ }, desc);
151
+
152
+ if (context && desc.initializer !== void 0) {
153
+ desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
154
+ desc.initializer = undefined;
155
+ }
156
+
157
+ if (desc.initializer === void 0) {
158
+ Object['define' + 'Property'](target, property, desc);
159
+ desc = null;
160
+ }
161
+
162
+ return desc;
163
+ }
164
+
165
+ function _initializerWarningHelper(descriptor, context) {
166
+ throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
167
+ }
168
+
169
+ var t = _mutantsMicrofx.i18n.getFixedT(null, 'newretail');
170
+
171
+ var SettlementStore = (_class = (_temp = _class2 = function () {
172
+ // 预售都是全款;预订是否全款,在点击确认支付时计算订金和商品金额计算得出
173
+ function SettlementStore() {
174
+ (0, _classCallCheck3.default)(this, SettlementStore);
175
+
176
+ _initialiseProps.call(this);
177
+
178
+ this.paymode = new PayMode();
179
+ var params = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('cloudPrintArguments');
180
+ if (params) this.cloudPrintArguments = params;
181
+ this.setNewStyle();
182
+ this.SettlementApi = _settlementApi2.default;
183
+ } //type==2
184
+
185
+
186
+ (0, _createClass3.default)(SettlementStore, [{
187
+ key: 'initPaymodes',
188
+ value: function initPaymodes(event, type, isIntegralExchange) {
189
+ this.isIntegralExchange = isIntegralExchange;
190
+ this.paymode.setPaymodes(type, isIntegralExchange);
191
+ this.updateEvent = event;
192
+ }
193
+ }, {
194
+ key: 'init',
195
+ value: function init(context, amounthandler, datasource, storeinfo, bquick, amount, type, data, payModeKey) {
196
+ var _this2 = this;
197
+
198
+ this.setNewStyle();
199
+ this.type = type;
200
+ if (context) {
201
+ this.context = context;
202
+ this.amountHandler = amounthandler;
203
+ this.dataSource = datasource;
204
+ this.storeInfo = storeinfo;
205
+ this.dto = context.viewModel.data;
206
+ (0, _mobx.runInAction)(function () {
207
+ // 单品金额抹零
208
+ if (global.DealSingleRowAmountSettingProcessorBlock) {
209
+ global.DealSingleRowAmountSettingProcessorBlock.execute(_this2.dto);
210
+ }
211
+
212
+ var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
213
+ PayStyle = _enumController$getEn.PayStyle;
214
+
215
+ var isQuickCash = bquick && payModeKey == PayStyle.xianjin;
216
+
217
+ // 成交金额抹零
218
+ if (global.DealAmountSettingProcessorBlock) {
219
+ global.DealAmountSettingProcessorBlock.execute(_this2.dto, isQuickCash);
220
+ }
221
+ });
222
+ // this.member=context.stores && context.stores.memberStore && context.stores.memberStore.member;
223
+ this.member = this.dto.Member; //stores.selectMemberStore.selectMemberInfo;
224
+
225
+ this.paymode.isNotFullBook = false;
226
+ this.paymode.isNotFullOnlyBook = false;
227
+ //预订按比例收取订金处理
228
+ var value = this.dto.TotalTaxAmount;
229
+
230
+ var _getLoginInfo = this.getLoginInfo(),
231
+ PreSellOrBook = _getLoginInfo.PreSellOrBook,
232
+ PercentageWhenBook = _getLoginInfo.PercentageWhenBook;
233
+
234
+ var _ref = this.dto || {},
235
+ IdbusiType = _ref.IdbusiType,
236
+ DistributionMode = _ref.DistributionMode;
237
+
238
+ if (IdbusiType == 38 && PreSellOrBook == 'BOOK' && PercentageWhenBook < 100 && (!DistributionMode.Id || DistributionMode.Id == 'ON_SITE_PICKUP')) {
239
+ this.paymode.bookMaxValue = value;
240
+ this.paymode.isNotFullBook = true;
241
+ this.paymode.isNotFullOnlyBook = true;
242
+ value = value * PercentageWhenBook / 100;
243
+ }
244
+ if (IdbusiType == 38 && PreSellOrBook == 'BOOK') {
245
+ (0, _mobx.runInAction)(function () {
246
+ _this2.dto.PrepaidAmount = value;
247
+ });
248
+ }
249
+ //预订计算快递或同城配送运费
250
+ if (IdbusiType == 38 && PreSellOrBook != 'DISABLED' && (DistributionMode.Id == 'ELECTRONIC' || DistributionMode.Id == 'CITY_DISTRIBUTE')) {
251
+ value += this.dto.BuyerPayFreight || 0;
252
+ }
253
+ //预订取货应补款金额
254
+ if (IdbusiType == 39) {
255
+ value = _mutantsMicrofx.stores.drawerStore.thisWaitPaidAmount;
256
+ if (_mutantsMicrofx.stores.drawerStore.totalWaitPaidAmount > 0) {
257
+ this.paymode.isNotFullBook = true;
258
+ this.paymode.bookMaxValue = _mutantsMicrofx.stores.drawerStore.totalWaitPaidAmount;
259
+ }
260
+ }
261
+
262
+ this.brefund = this.paymode.setAmount(value, this.dto.OnlinePaymentAmount);
263
+ } else {
264
+ this.brefund = this.paymode.setAmount(amount, 0);
265
+ this.dto = data;
266
+ }
267
+ this.paymode.clean();
268
+
269
+ //this.dto.TotalTaxAmount<0;
270
+ this.bquick = !!bquick;
271
+ this.boriginReturn = JSON.getCellValue(this.dto, "IsOriginalReturn");
272
+ if (this.boriginReturn) {
273
+ this.initByOriginReturn();
274
+ }
275
+ if (this.newStyle) {
276
+ this.setModes();
277
+ }
278
+ }
279
+ }, {
280
+ key: 'setModes',
281
+ value: function setModes() {
282
+ var _this3 = this;
283
+
284
+ (0, _each3.default)(this.paymode.paymodes, function (p) {
285
+ if ((0, _findIndex3.default)(_this3.paymode.thePaymodes, function (mode) {
286
+ return p.paymentType == mode.paymentType;
287
+ }) == -1) {
288
+ _this3.addPay(p.paymentType);
289
+ }
290
+ });
291
+ if (!this.boriginReturn && this.paymode.thePaymodes.length > 0) {
292
+ this.changeValue(this.paymode.thePaymodes[0].paymethodId, 0, true);
293
+ }
294
+ }
295
+ }, {
296
+ key: 'amountChanged',
297
+ value: function amountChanged(amount) {
298
+ if (this.type == 1) {
299
+ this.brefund = this.paymode.setAmount(amount, 0);
300
+ }
301
+ }
302
+ }, {
303
+ key: 'initByOriginReturn',
304
+ value: function initByOriginReturn() {
305
+ var _this4 = this;
306
+
307
+ var _enumController$getEn2 = _mutantsUtil.enumController.getEnumOj(),
308
+ PayStyle = _enumController$getEn2.PayStyle;
309
+
310
+ var _ref2 = _mutantsUtil.platform || {},
311
+ isNewRetailBCPos = _ref2.isNewRetailBCPos;
312
+
313
+ console.log(this.dto, 'dto==========');
314
+ this.paymode.checkList = [];
315
+ (0, _each3.default)(this.dto.RetailPaymentDetails, function (detail) {
316
+ var themode = (0, _find3.default)(_this4.paymode.paymodes, { 'idSettleStyle': detail.IdsettleStyle });
317
+ if (detail.SettleStyle.Code === PayStyle.hyczk && !themode) {
318
+ _tplusComponentsTouch.ModalWraper.info({
319
+ title: '温馨提示',
320
+ content: '没有储值结算方式,请在后台添加储值余额结算方式。',
321
+ okText: '确定',
322
+ okType: 'primary'
323
+ });
324
+ }
325
+ if (themode && themode.paymentType && themode.paymentType != PayStyle.hyczk) {
326
+ var newmode = (0, _extends3.default)({}, _this4.genNewMode(themode.paymentType, false, detail.Amount), {
327
+ authCode: detail.PaymentCode,
328
+ steadCashIntegral: detail.SteadCashIntegral,
329
+ overchargesAmount: detail.OverchargesAmount,
330
+ boriginReturn: true,
331
+ thirdPaymentReturnInfo: detail.ThirdPaymentReturnInfo
332
+ });
333
+ _this4.paymode.currentMode = newmode;
334
+ if (themode.paymentType == PayStyle.djq) {
335
+ (0, _each3.default)(_this4.dto.RetailCouponDetails, function (djq) {
336
+ if (isNewRetailBCPos) {
337
+ var _ref3 = djq || {},
338
+ displayText = _ref3.displayText,
339
+ promoRuleId = _ref3.promoRuleId,
340
+ dateMount = _ref3.dateMount,
341
+ promoMethodEnum = _ref3.promoMethodEnum,
342
+ discountPct = _ref3.discountPct,
343
+ promoId = _ref3.promoId,
344
+ id = _ref3.id;
345
+
346
+ _this4.addDjq(djq.CouponCode, djq.CouponTitle, true, null, djq.ReductionAmount, djq.EnableAmount, djq.LastTS, true, false, _this4.dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, null, id, true);
347
+ return;
348
+ }
349
+ _this4.addDjq(djq.CouponCode, djq.CouponTitle, true, null, djq.ReductionAmount, djq.EnableAmount, djq.LastTS, true, false);
350
+ });
351
+ }
352
+ _this4.paymode.thePaymodes.push(newmode);
353
+ }
354
+ });
355
+ (0, _each3.default)(this.dto.RetailStorageDetails, function (detail) {
356
+ var balanceAmount = null;
357
+ var storageCardNo = null;
358
+ var meStorageCardId = null;
359
+ detail.DynamicPropertyKeys.forEach(function (ele, index) {
360
+ if (ele === "mestoragecard") {
361
+ balanceAmount = detail.DynamicPropertyValues[index].BalanceStorage - detail.StoragePaymentAmount;
362
+ storageCardNo = detail.DynamicPropertyValues[index].StorageCardNo;
363
+ meStorageCardId = detail.DynamicPropertyValues[index].MeStorageCardId;
364
+ }
365
+ });
366
+ var newmode = (0, _extends3.default)({}, _this4.genNewMode(PayStyle.hyczk, false, detail.StoragePaymentAmount), {
367
+ member: new Member(detail.Member ? detail.Member : null),
368
+ authCode: detail.Password ? detail.Password : null,
369
+ balance: balanceAmount,
370
+ boriginReturn: true,
371
+ meStorageCardId: meStorageCardId ? meStorageCardId : detail.MeStorageCardId,
372
+ storageCardNo: storageCardNo ? storageCardNo : detail.StorageCardNo
373
+ });
374
+ _this4.paymode.thePaymodes.push(newmode);
375
+ });
376
+ this.paymode.calcReserved();
377
+ }
378
+ }, {
379
+ key: 'clean',
380
+ value: function clean() {
381
+ this.bquick = false;
382
+ this.paymode.clean();
383
+ }
384
+ }, {
385
+ key: 'quickSettle',
386
+ value: function quickSettle(key) {
387
+ this.addPay(key, null, true);
388
+ }
389
+
390
+ //outer call
391
+ //(type===PayStyle.hyczk || type===PayStyle.jfczk || type===PayStyle.jfdx || type===PayStyle.djq)
392
+
393
+ }, {
394
+ key: 'changeFocusAndAddPay',
395
+ value: function changeFocusAndAddPay(type, bookType) {
396
+ var _this5 = this;
397
+
398
+ var _enumController$getEn3 = _mutantsUtil.enumController.getEnumOj(),
399
+ PayStyle = _enumController$getEn3.PayStyle;
400
+
401
+ this.paymode.currentFocus = type;
402
+ if (this.paymode.currentMode) {
403
+ if (type == PayStyle.jfdx) {
404
+ if (this.newStyle) {
405
+ var index = (0, _findIndex3.default)(this.paymode.thePaymodes, function (m) {
406
+ return m.paymentType == PayStyle.jfdx;
407
+ });
408
+ this.paymode.thePaymodes.splice(index, 1, this.paymode.currentMode);
409
+ this.paymode.calcReserved();
410
+ } else {
411
+ this.addPayDirectly(this.paymode.currentMode);
412
+ }
413
+
414
+ //抵现积分
415
+ this.SettlementApi.CalculdateIntegralSteadCash({ IntegralSteadCashParams: {
416
+ Idmember: this.paymode.currentMode.memberId,
417
+ TotalTaxAmount: this.paymode.amount,
418
+ BalanceTaxAmount: this.paymode.currentMode.value
419
+ } }).then(function (result) {
420
+ // this.paymode.currentMode.steadCashIntegral=result.Integral;
421
+ // this.paymode.currentMode.perIntegral=result.perIntegral;
422
+ // this.paymode.currentMode.cashAmount=result.cashAmount;
423
+ _this5.paymode.currentMode.integralCashOverOrderAmount = result.integralCashOverOrderAmount;
424
+ _this5.paymode.currentMode.overchargesAmount = result.Amount - _this5.paymode.currentMode.value;
425
+ });
426
+ } else {
427
+ this.addPayDirectly(this.paymode.currentMode);
428
+ }
429
+ } else {
430
+ this.addPay(type, bookType);
431
+ }
432
+ }
433
+
434
+ // 设置密码后更新会员信息
435
+
436
+
437
+ // 查看会员卡信息
438
+
439
+ }, {
440
+ key: 'getLoginInfo',
441
+ value: function getLoginInfo() {
442
+ return _mutantsMicrofx.stores.user.options.get('loginInfo');
443
+ }
444
+ }, {
445
+ key: 'loadCzk',
446
+ value: function loadCzk(v, returnType) {
447
+ var _this6 = this;
448
+
449
+ if ((0, _trim3.default)(v) === "") {
450
+ (0, _mobx.runInAction)(function () {
451
+ _this6.paymode.currentMode.errinfo = "请输入储值卡";
452
+ });
453
+ return;
454
+ }
455
+ var isOnlyEnabled = returnType ? false : true; //非原单退货为false,其他true
456
+ return this.SettlementApi.getCardInfoByCardNo(v, isOnlyEnabled).then(function () {
457
+ var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(result) {
458
+ var data, m;
459
+ return _regenerator2.default.wrap(function _callee$(_context) {
460
+ while (1) {
461
+ switch (_context.prev = _context.next) {
462
+ case 0:
463
+ data = result.data;
464
+ m = data && data.length && data[0];
465
+
466
+ if (!(result && result.data.length)) {
467
+ _context.next = 25;
468
+ break;
469
+ }
470
+
471
+ if (!(result.data.length === 1)) {
472
+ _context.next = 14;
473
+ break;
474
+ }
475
+
476
+ if (!(m.CardTypeEnum === 'BALANCE_CARD')) {
477
+ _context.next = 10;
478
+ break;
479
+ }
480
+
481
+ _this6.paymode.updateCardInfo(m);
482
+ _this6.handleCzkData(m);
483
+ return _context.abrupt('return', result.data);
484
+
485
+ case 10:
486
+ _context.next = 12;
487
+ return _this6.SettlementApi.validateRetailStorageCard({ dto: _this6.dto, meStorageCardId: m.MeStorageCardId }).then(function (result1) {
488
+ var data1 = result1.data ? JSON.parse(result1.data)[0] : {};
489
+ if (data1.enable) {
490
+ _this6.paymode.updateCardInfo(m);
491
+ _this6.handleCzkData(m);
492
+ return result1.data;
493
+ } else {
494
+ _message2.default.warn(data1.disableReason);
495
+ }
496
+ });
497
+
498
+ case 12:
499
+ _context.next = 25;
500
+ break;
501
+
502
+ case 14:
503
+ if (!(result.data && result.data.length === 1)) {
504
+ _context.next = 19;
505
+ break;
506
+ }
507
+
508
+ _this6.paymode.updateCardInfo(result.data[0]);
509
+ return _context.abrupt('return', result.data);
510
+
511
+ case 19:
512
+ if (!(result.data && result.data.length > 1)) {
513
+ _context.next = 23;
514
+ break;
515
+ }
516
+
517
+ return _context.abrupt('return', result.data);
518
+
519
+ case 23:
520
+ _message2.default.warn('没有可用储值卡!');
521
+ return _context.abrupt('return', false);
522
+
523
+ case 25:
524
+ case 'end':
525
+ return _context.stop();
526
+ }
527
+ }
528
+ }, _callee, _this6);
529
+ }));
530
+
531
+ return function (_x) {
532
+ return _ref4.apply(this, arguments);
533
+ };
534
+ }());
535
+ }
536
+ }, {
537
+ key: 'addDjq',
538
+ value: function addDjq(promoCouponCode, name, IsEnable, nominalAmount, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id, unCheck, count) {
539
+ var djq = {
540
+ code: promoCouponCode,
541
+ promoCouponCode: promoCouponCode,
542
+ name: name,
543
+ IsEnable: IsEnable,
544
+ nominalAmount: nominalAmount,
545
+ amount: amount,
546
+ doorsill: doorsill, //:"无门槛"
547
+ LastTS: LastTS,
548
+ checked: checked,
549
+ IsRepelWithPoints: IsRepelWithPoints,
550
+ UMemberID: UMemberID,
551
+ expired: expired, //还剩多少过期
552
+ displayText: displayText,
553
+ promoMethodEnum: promoMethodEnum,
554
+ discountPct: discountPct,
555
+ promoId: promoId,
556
+ promoRuleId: promoRuleId,
557
+ couponCategoryEnum: couponCategoryEnum,
558
+ id: id,
559
+ count: count === 1 && (couponCategoryEnum === 'RIGUP' || couponCategoryEnum === 'UN_MATCH' || couponCategoryEnum === "PREPARING" || couponCategoryEnum === 'PROMO_LIMITED' || couponCategoryEnum === 'COUPON_CONFLICT') ? 1 : null
560
+ };
561
+ this.paymode.currentMode.djqs.push(djq);
562
+ // let copyData = _clonedeep(this.data[targetIndex]);
563
+ !unCheck && !this.boriginReturn && this.paymode.calcDjqValue(djq);
564
+ }
565
+ }, {
566
+ key: 'setCurrentMode',
567
+ value: function setCurrentMode(id, type, append) {
568
+ var _enumController$getEn4 = _mutantsUtil.enumController.getEnumOj(),
569
+ PayStyle = _enumController$getEn4.PayStyle;
570
+
571
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { paymethodId: id });
572
+ if (mode) {
573
+ this.paymode.currentMode = mode;
574
+ if (this.newStyle) {
575
+ this.afterSetCurrentMode(type);
576
+ }
577
+ } else {
578
+ this.paymode.currentMode = this.genNewMode(type, append);
579
+ this.afterSetCurrentMode(type);
580
+ }
581
+ }
582
+ }, {
583
+ key: 'afterSetCurrentMode',
584
+ value: function afterSetCurrentMode(type) {
585
+ var _this7 = this;
586
+
587
+ var _enumController$getEn5 = _mutantsUtil.enumController.getEnumOj(),
588
+ PayStyle = _enumController$getEn5.PayStyle;
589
+
590
+ if (type == PayStyle.djq) {
591
+ this.paymode.calcDjqValue();
592
+ } else if (type == PayStyle.jfdx) {
593
+ //获取可兑换的金额
594
+ if (this.newStyle) {
595
+ var themode = (0, _find3.default)(this.paymode.thePaymodes, { paymentType: PayStyle.jfdx });
596
+ if (themode && parseFloat(themode.value || 0) != 0) {
597
+ this.paymode.currentMode.value = themode.value;
598
+ }
599
+ }
600
+
601
+ //积分抵现不包含运费
602
+ var BuyerPayFreight = this.dto.BuyerPayFreight;
603
+ var DistributionMode = this.dto.DistributionMode;
604
+ var IdbusiType = this.dto.IdbusiType;
605
+
606
+ var _getLoginInfo2 = this.getLoginInfo(),
607
+ PreSellOrBook = _getLoginInfo2.PreSellOrBook,
608
+ PercentageWhenBook = _getLoginInfo2.PercentageWhenBook;
609
+
610
+ var value = 0;
611
+ if ((DistributionMode.Id == 'ELECTRONIC' || DistributionMode.Id == 'CITY_DISTRIBUTE') && BuyerPayFreight && BuyerPayFreight > 0) {
612
+ value = (0, _utils.getFixedNumber)(Math.Minus(this.paymode.amount, BuyerPayFreight));
613
+ } else if (IdbusiType == 38 && PreSellOrBook == 'BOOK' && PercentageWhenBook < 100 && (!DistributionMode.Id || DistributionMode.Id == 'ON_SITE_PICKUP')) {
614
+ //预订场景下:现场提货,且订金比例非100%时,积分抵现按全款计算(因为只有全款才能使用积分抵现)
615
+ value = this.paymode.bookMaxValue;
616
+ } else {
617
+ value = this.paymode.amount;
618
+ }
619
+
620
+ this.SettlementApi.CalculdateIntegralSteadCash({ IntegralSteadCashParams: {
621
+ Idmember: this.paymode.currentMode.memberId,
622
+ TotalTaxAmount: value,
623
+ BalanceTaxAmount: value
624
+ } }).then(function (result) {
625
+ _this7.paymode.currentMode.member.setExchangable(result.MaxAmount);
626
+ _this7.paymode.currentMode.perIntegral = result.perIntegral;
627
+ _this7.paymode.currentMode.cashAmount = result.cashAmount;
628
+ _this7.paymode.currentMode.integralCashOverOrderAmount = result.integralCashOverOrderAmount;
629
+ _this7.updateEvent();
630
+ if (_this7.checkReceived(_this7.paymode.currentMode, "exchangable")) {
631
+ (0, _mobx.runInAction)(function () {
632
+ _this7.paymode.currentMode.errinfo = '余额不足';
633
+ });
634
+ }
635
+ });
636
+ }
637
+ }
638
+ }, {
639
+ key: 'checkReceived',
640
+ value: function checkReceived(mode, name) {
641
+ return !this.brefund && parseFloat(mode.value) > parseFloat(mode.maxamount || mode.member[name] || 0);
642
+ }
643
+ }, {
644
+ key: 'genNewMode',
645
+ value: function genNewMode(type, notwithm, v, isQuick) {
646
+ var _enumController$getEn6 = _mutantsUtil.enumController.getEnumOj(),
647
+ PayStyle = _enumController$getEn6.PayStyle;
648
+
649
+ var value = (0, _utils.getFixedNumber)(v || (this.brefund ? this.paymode.receivable : Math.max(this.paymode.receivable, 0)));
650
+ var themode = (0, _find3.default)(this.paymode.paymodes, { 'paymentType': type });
651
+ var memberId = this.member && this.member.ID ? this.member.ID : null;
652
+ var mode = (0, _mobx.observable)({
653
+ paymethodId: this.paymode.counter,
654
+ name: themode.name,
655
+ exchangeRate: themode.exchangeRate,
656
+ calDirection: themode.calDirection,
657
+ thridPayment: themode.thridPayment,
658
+ value: value,
659
+ value2: (0, _utils.getFixedNumber)(themode.calDirection == "88" ? value / themode.exchangeRate : value * themode.exchangeRate),
660
+ value3: value,
661
+ order: this.paymode.thePaymodes.length + 1,
662
+ paymentType: type,
663
+ djqs: [],
664
+ card: null,
665
+ memberId: !notwithm ? memberId : null,
666
+ member: new Member(!notwithm ? this.member : null),
667
+ authCode: '',
668
+ steadCashIntegral: null,
669
+ errinfo: '',
670
+ maxamount: this.paymode.amount,
671
+ virtualPay: themode.virtualPay
672
+ });
673
+ if (type == PayStyle.hyczk) {
674
+ if (!mode.storageCardNo) {
675
+ (0, _mobx.runInAction)(function () {
676
+ mode.errinfo = '未录入手机号或储值卡号';
677
+ });
678
+ } else if (this.checkReceived(mode, "balance")) {
679
+ (0, _mobx.runInAction)(function () {
680
+ mode.errinfo = '余额不足';
681
+ });
682
+ }
683
+ }
684
+ if (type == PayStyle.hyczk || type == PayStyle.jfdx || type == PayStyle.djq) {
685
+ this.setMaxAmount(type, mode);
686
+ }
687
+ console.log('\u5F53\u524D\u64CD\u4F5C\u7ED3\u7B97\u65B9\u5F0F\u4FE1\u606F:' + mode);
688
+ return mode;
689
+ }
690
+ }, {
691
+ key: 'setMaxAmount',
692
+ value: function setMaxAmount(type, mode) {
693
+ var _this8 = this;
694
+
695
+ var _enumController$getEn7 = _mutantsUtil.enumController.getEnumOj(),
696
+ PayStyle = _enumController$getEn7.PayStyle;
697
+
698
+ var sum = 0;
699
+ if (type == PayStyle.hyczk) {
700
+ (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
701
+ return m.paymentType == type;
702
+ }), function (q) {
703
+ sum = Math.Add(sum, q.value);
704
+ });
705
+ } else if (type == PayStyle.djq || type == PayStyle.jfdx) {
706
+ (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
707
+ return m.paymentType == PayStyle.djq || m.paymentType == PayStyle.jfdx;
708
+ }), function (q) {
709
+ sum = Math.Add(sum, q.value);
710
+ });
711
+ }
712
+
713
+ this.amountHandler && this.amountHandler(type).then(function () {
714
+ (0, _mobx.runInAction)(function () {
715
+
716
+ //预售储值结算应包含运费
717
+ var BuyerPayFreight = _this8.dto.BuyerPayFreight;
718
+ var DistributionMode = _this8.dto.DistributionMode;
719
+ var value = 0;
720
+ if ((DistributionMode.Id == 'ELECTRONIC' || DistributionMode.Id == 'CITY_DISTRIBUTE') && BuyerPayFreight && BuyerPayFreight > 0 && type == PayStyle.hyczk) {
721
+ value = (0, _utils.getFixedNumber)(parseFloat(_this8.context.viewModel.getViewItem('Voucher').availableAmount) + parseFloat(BuyerPayFreight));
722
+ } else {
723
+ value = _this8.context.viewModel.getViewItem('Voucher').availableAmount;
724
+ }
725
+ mode.maxamount = (0, _utils.getFixedNumber)(Math.Minus(value, sum));
726
+ _this8.updateEvent();
727
+ });
728
+ });
729
+ }
730
+ }, {
731
+ key: 'changeFocusOnly',
732
+ value: function changeFocusOnly(type) {
733
+ this.paymode.currentFocus = type;
734
+ }
735
+ }, {
736
+ key: 'changeClickFocusOnly',
737
+ value: function changeClickFocusOnly(type) {
738
+ this.paymode.currentFocus = type;
739
+ // 获取焦点时带入剩余的值
740
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymentType': type });
741
+ if (mode) {
742
+ var shouldSetValue = (0, _utils.getFixedNumber)(parseFloat(this.paymode.receivable) + parseFloat(mode.value));
743
+ mode.value = shouldSetValue;
744
+ mode.value2 = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? shouldSetValue / mode.exchangeRate : shouldSetValue * mode.exchangeRate);
745
+ mode.value3 = shouldSetValue;
746
+ this.paymode.calcReserved('bookPay'); //参数multiPay代表复合结算
747
+ }
748
+ }
749
+ }, {
750
+ key: 'changeValue',
751
+ value: function changeValue(index, value, blur, type) {
752
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymethodId': index });
753
+ var v = blur ? (0, _utils.getFixedNumber)(value) : isNaN(value) && value != '-' ? 0.00 : value;
754
+ if (mode) {
755
+ if (mode.exchangeRate != 1) {
756
+ if ((0, _utils.getFixedNumber)(mode.calDirection == "88" ? mode.value3 / mode.exchangeRate : mode.value3 * mode.exchangeRate) != v) {
757
+ mode.value = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? v * mode.exchangeRate : v / mode.exchangeRate);
758
+ } else {
759
+ mode.value = mode.value3;
760
+ }
761
+ mode.value2 = v;
762
+ } else {
763
+ mode.value = v;
764
+ mode.value2 = v;
765
+ }
766
+
767
+ this.paymode.calcReserved(type);
768
+ }
769
+ }
770
+ }, {
771
+ key: 'addPayDirectly',
772
+ value: function addPayDirectly(pay) {
773
+ var _enumController$getEn8 = _mutantsUtil.enumController.getEnumOj(),
774
+ PayStyle = _enumController$getEn8.PayStyle;
775
+
776
+ if (!(0, _find3.default)(this.paymode.thePaymodes, { paymethodId: pay.paymethodId })) {
777
+ var pos = this.paymode.thePaymodes.length;
778
+ if (pay.paymentType == PayStyle.hyczk) {
779
+ var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
780
+ return m.paymethodId != pay.paymethodId && m.paymentType == PayStyle.hyczk;
781
+ });
782
+ pos = index == -1 ? pos : index + 1;
783
+ }
784
+ // this.paymode.thePaymodes.push(pay);
785
+ this.paymode.thePaymodes.splice(pos, 0, pay);
786
+ }
787
+ this.paymode.calcReserved();
788
+ }
789
+ }, {
790
+ key: 'addPay',
791
+ value: function addPay(type, bookType, isQuick) {
792
+ var _enumController$getEn9 = _mutantsUtil.enumController.getEnumOj(),
793
+ PayStyle = _enumController$getEn9.PayStyle;
794
+
795
+ var pos = this.paymode.thePaymodes.length;
796
+ if (type == PayStyle.hyczk) {
797
+ var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
798
+ return m.paymentType == PayStyle.hyczk;
799
+ });
800
+ pos = index == -1 ? pos : index + 1;
801
+ }
802
+ this.paymode.thePaymodes.splice(pos, 0, this.genNewMode(type, this.newStyle && type == PayStyle.hyczk, undefined, isQuick));
803
+ this.paymode.calcReserved(bookType);
804
+ }
805
+ }, {
806
+ key: 'delPay',
807
+ value: function delPay(index, bookType) {
808
+ var _enumController$getEn10 = _mutantsUtil.enumController.getEnumOj(),
809
+ PayStyle = _enumController$getEn10.PayStyle;
810
+
811
+ (0, _remove3.default)(this.paymode.thePaymodes, function (mode) {
812
+ return mode.paymethodId === index;
813
+ });
814
+ this.paymode.currentFocus = -1;
815
+ this.paymode.calcReserved(bookType);
816
+ }
817
+
818
+ // 获取储值是否重复, 在commit方法中使用
819
+
820
+ }, {
821
+ key: 'findStorageBillValidate',
822
+ value: function findStorageBillValidate() {
823
+ var _this9 = this;
824
+
825
+ var _enumController$getEn11 = _mutantsUtil.enumController.getEnumOj(),
826
+ PayStyle = _enumController$getEn11.PayStyle;
827
+
828
+ (0, _mobx.runInAction)(function () {
829
+ _this9.dto.StorageMutiSettleDetails = [];
830
+ var thePaymodes = _this9.newStyle ? (0, _filter3.default)(_this9.paymode.thePaymodes, function (mode) {
831
+ return parseFloat(mode.value) != 0;
832
+ }) : _this9.paymode.thePaymodes;
833
+ (0, _each3.default)(thePaymodes, function (mode) {
834
+ var themode = (0, _find3.default)(_this9.paymode.paymodes, { 'paymentType': mode.paymentType });
835
+
836
+ var value = parseFloat(mode.value);
837
+ var giveChange = null;
838
+ if (mode.paymentType == PayStyle.xianjin && _this9.paymode.receivable < 0 && value > Math.abs(_this9.paymode.receivable)) {
839
+ value = Math.Add(value, _this9.paymode.receivable);
840
+ giveChange = Math.abs(_this9.paymode.receivable);
841
+ }
842
+ _this9.dto.StorageMutiSettleDetails.push({
843
+ Code: mode.paymethodId,
844
+ StorageAmount: value,
845
+ GiveChange: giveChange,
846
+ IdsettleStyle: themode.idSettleStyle,
847
+ IdbankAccount: themode.idBankAccount,
848
+ PaymentCode: mode.authCode,
849
+ DynamicPropertyKeys: [],
850
+ DynamicPropertyValues: [],
851
+ DataSource: { Id: _this9.dataSource }
852
+ });
853
+ });
854
+ });
855
+ return this.SettlementApi.findStorageBillValidate((0, _extends3.default)({}, this.dto));
856
+ }
857
+
858
+ //判断是否重复弹框
859
+
860
+ }, {
861
+ key: 'commit',
862
+ value: function () {
863
+ var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(bTest) {
864
+ var status, paylist, ret, _ref6, _ref6$data, code, returnMsg, state, ret1, ret2;
865
+
866
+ return _regenerator2.default.wrap(function _callee2$(_context2) {
867
+ while (1) {
868
+ switch (_context2.prev = _context2.next) {
869
+ case 0:
870
+ console.log('settlementStore.commit开始,参数:' + bTest);
871
+
872
+ if (!bTest) {
873
+ _context2.next = 3;
874
+ break;
875
+ }
876
+
877
+ return _context2.abrupt('return', _promise2.default.resolve(true));
878
+
879
+ case 3:
880
+ status = this.type;
881
+ _context2.prev = 4;
882
+ paylist = this.paymode.thePaymodes.filter(function (v) {
883
+ return !!v.thridPayment && Math.abs(v.value) > 0;
884
+ }) || [];
885
+
886
+ if (!(paylist && paylist.length > 1)) {
887
+ _context2.next = 9;
888
+ break;
889
+ }
890
+
891
+ _message2.default.warn('二开支付目前仅支持单一结算方式。');
892
+ return _context2.abrupt('return', _promise2.default.resolve(false));
893
+
894
+ case 9:
895
+ if (!(status == 1)) {
896
+ _context2.next = 30;
897
+ break;
898
+ }
899
+
900
+ _context2.next = 12;
901
+ return this.findStorageBillValidate();
902
+
903
+ case 12:
904
+ ret = _context2.sent;
905
+ _ref6 = ret || {}, _ref6$data = _ref6.data;
906
+ _ref6$data = _ref6$data === undefined ? {} : _ref6$data;
907
+ code = _ref6$data.code, returnMsg = _ref6$data.returnMsg;
908
+
909
+ if (!(code && code == 10001)) {
910
+ _context2.next = 24;
911
+ break;
912
+ }
913
+
914
+ _context2.next = 19;
915
+ return this.repeatStorageModal(returnMsg);
916
+
917
+ case 19:
918
+ state = _context2.sent;
919
+
920
+ if (!(state === false)) {
921
+ _context2.next = 22;
922
+ break;
923
+ }
924
+
925
+ return _context2.abrupt('return', _promise2.default.resolve(false));
926
+
927
+ case 22:
928
+ _context2.next = 28;
929
+ break;
930
+
931
+ case 24:
932
+ _context2.next = 26;
933
+ return this.saveMember();
934
+
935
+ case 26:
936
+ ret1 = _context2.sent;
937
+
938
+ if (ret1 === false) {
939
+ _promise2.default.resolve(false);
940
+ }
941
+
942
+ case 28:
943
+ _context2.next = 39;
944
+ break;
945
+
946
+ case 30:
947
+ _context2.next = 32;
948
+ return _mutantsMicrofx.stores.offlineSys.generatorCode(this.dto);
949
+
950
+ case 32:
951
+ _context2.next = 34;
952
+ return this.save();
953
+
954
+ case 34:
955
+ ret2 = _context2.sent;
956
+
957
+ if (!(ret2 === false)) {
958
+ _context2.next = 37;
959
+ break;
960
+ }
961
+
962
+ return _context2.abrupt('return', _promise2.default.resolve(false));
963
+
964
+ case 37:
965
+ _context2.next = 39;
966
+ return _mutantsMicrofx.stores.offlineSys.retailSequenceUpload();
967
+
968
+ case 39:
969
+ return _context2.abrupt('return', _promise2.default.resolve(true));
970
+
971
+ case 42:
972
+ _context2.prev = 42;
973
+ _context2.t0 = _context2['catch'](4);
974
+
975
+ console.error('settlementStore.commit失败,错误信息:' + _context2.t0);
976
+ //其他支付失败时,处理二开支付情况。
977
+ this.thirdPayRefund(status == 1 ? 2 : 1);
978
+ return _context2.abrupt('return', _promise2.default.resolve(_context2.t0));
979
+
980
+ case 47:
981
+ case 'end':
982
+ return _context2.stop();
983
+ }
984
+ }
985
+ }, _callee2, this, [[4, 42]]);
986
+ }));
987
+
988
+ function commit(_x2) {
989
+ return _ref5.apply(this, arguments);
990
+ }
991
+
992
+ return commit;
993
+ }()
994
+ }, {
995
+ key: 'handlePrint',
996
+ value: function handlePrint(resp) {
997
+ // 储值打印
998
+ return (0, _tplusComponentsTouch.printDispatch)(_tplusComponentsTouch.DoNameList.DO_STORAGE_PRINT, resp, {});
999
+ }
1000
+ }, {
1001
+ key: 'saveMember',
1002
+ value: function () {
1003
+ var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
1004
+ var _this10 = this;
1005
+
1006
+ var _enumController$getEn12, PayStyle, TradeType, IPMSG, dtoParams, payList, payment, tradeType, ret, _ref8, type, data, msg, code;
1007
+
1008
+ return _regenerator2.default.wrap(function _callee3$(_context3) {
1009
+ while (1) {
1010
+ switch (_context3.prev = _context3.next) {
1011
+ case 0:
1012
+ _enumController$getEn12 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn12.PayStyle, TradeType = _enumController$getEn12.TradeType;
1013
+
1014
+ (0, _mobx.runInAction)(function () {
1015
+ _this10.dto.StorageMutiSettleDetails = [];
1016
+ var thePaymodes = _this10.newStyle ? (0, _filter3.default)(_this10.paymode.thePaymodes, function (mode) {
1017
+ return parseFloat(mode.value) != 0;
1018
+ }) : _this10.paymode.thePaymodes;
1019
+ (0, _each3.default)(thePaymodes, function (mode) {
1020
+ var themode = (0, _find3.default)(_this10.paymode.paymodes, { 'paymentType': mode.paymentType });
1021
+
1022
+ var value = parseFloat(mode.value);
1023
+ var giveChange = null;
1024
+ if (mode.paymentType == PayStyle.xianjin && _this10.paymode.receivable < 0 && value > Math.abs(_this10.paymode.receivable)) {
1025
+ value = Math.Add(value, _this10.paymode.receivable);
1026
+ giveChange = Math.abs(_this10.paymode.receivable);
1027
+ }
1028
+ _this10.dto.StorageMutiSettleDetails.push({
1029
+ Code: mode.paymethodId,
1030
+ StorageAmount: value,
1031
+ GiveChange: giveChange,
1032
+ IdsettleStyle: themode.idSettleStyle,
1033
+ IdbankAccount: themode.idBankAccount,
1034
+ PaymentCode: mode.authCode,
1035
+ DynamicPropertyKeys: [],
1036
+ DynamicPropertyValues: [],
1037
+ DataSource: { Id: _this10.dataSource },
1038
+ ThirdPaymentInfo: themode.thridPayment || null,
1039
+ ThirdPaymentReturnInfo: mode.thirdPaymentReturnInfo || null
1040
+ });
1041
+ });
1042
+ });
1043
+ // cc结算调用
1044
+ IPMSG = {};
1045
+
1046
+ if (!!window.localStorage.IPMSG) {
1047
+ IPMSG = JSON.parse(window.localStorage.IPMSG);
1048
+ }
1049
+ dtoParams = this.dto;
1050
+ //处理存在二开支付情况
1051
+
1052
+ payList = dtoParams.StorageMutiSettleDetails.filter(function (v) {
1053
+ return v.ThirdPaymentInfo;
1054
+ });
1055
+
1056
+ if (!(payList && payList.length > 0)) {
1057
+ _context3.next = 19;
1058
+ break;
1059
+ }
1060
+
1061
+ payment = payList[0];
1062
+ tradeType = payment && payment.StorageAmount > 0 ? TradeType.PAY : TradeType.REFUND;
1063
+ _context3.next = 11;
1064
+ return this.thirdPay(2, payment, tradeType, dtoParams);
1065
+
1066
+ case 11:
1067
+ ret = _context3.sent;
1068
+ _ref8 = ret || {}, type = _ref8.type, data = _ref8.data, msg = _ref8.msg, code = _ref8.code;
1069
+
1070
+ if (!(type === true)) {
1071
+ _context3.next = 17;
1072
+ break;
1073
+ }
1074
+
1075
+ dtoParams = data;
1076
+ _context3.next = 19;
1077
+ break;
1078
+
1079
+ case 17:
1080
+ _message2.default.warn('\u5237\u5361\u652F\u4ED8\u5931\u8D25,\u9519\u8BEF\u7801:' + code);
1081
+ return _context3.abrupt('return', false);
1082
+
1083
+ case 19:
1084
+ this.dtoParams = dtoParams;
1085
+ console.log('储值结算信息:', dtoParams);
1086
+ return _context3.abrupt('return', this.SettlementApi.INewRetailMemberStorageSave({ dto: dtoParams }).then(function (resp) {
1087
+ _this10.handlePrint(resp);
1088
+ }));
1089
+
1090
+ case 22:
1091
+ case 'end':
1092
+ return _context3.stop();
1093
+ }
1094
+ }
1095
+ }, _callee3, this);
1096
+ }));
1097
+
1098
+ function saveMember() {
1099
+ return _ref7.apply(this, arguments);
1100
+ }
1101
+
1102
+ return saveMember;
1103
+ }()
1104
+ }, {
1105
+ key: 'save',
1106
+ value: function () {
1107
+ var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
1108
+ var _this11 = this;
1109
+
1110
+ var _enumController$getEn13, PayStyle, TradeType, IPMSG, RetailTypeEnum, _getLoginInfo3, PreSellOrBook, PercentageWhenBook, _ref10, IdbusiType, DistributionMode, prepaidAmount, fullPayment, dtoParams, payList, payment, tradeType, ret, _ref11, type, data, msg, code;
1111
+
1112
+ return _regenerator2.default.wrap(function _callee4$(_context4) {
1113
+ while (1) {
1114
+ switch (_context4.prev = _context4.next) {
1115
+ case 0:
1116
+ _enumController$getEn13 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn13.PayStyle, TradeType = _enumController$getEn13.TradeType;
1117
+
1118
+ (0, _mobx.runInAction)(function () {
1119
+ _this11.dto.RetailPaymentDetails = [];
1120
+ _this11.dto.RetailStorageDetails = [];
1121
+ _this11.dto.RetailCouponDetails = [];
1122
+ var czkSum = 0;
1123
+ var count = 0;
1124
+ var thePaymodes = _this11.newStyle ? (0, _filter3.default)(_this11.paymode.thePaymodes, function (mode) {
1125
+ return parseFloat(mode.value) != 0;
1126
+ }) : _this11.paymode.thePaymodes;
1127
+ (0, _each3.default)(thePaymodes, function (mode, index) {
1128
+ var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': mode.paymentType });
1129
+ if (mode.paymentType == PayStyle.hyczk) {
1130
+ czkSum = Math.Add(czkSum, mode.value);
1131
+ _this11.dto.RetailStorageDetails.push({
1132
+ Code: mode.paymethodId,
1133
+ MeStorageCardId: mode.meStorageCardId,
1134
+ StoragePaymentAmount: mode.value,
1135
+ IsOrigReturn: false,
1136
+ BalanceStorage: mode.balance,
1137
+ Idmember: mode.memberId,
1138
+ DynamicPropertyKeys: [],
1139
+ DynamicPropertyValues: [],
1140
+ DataSource: { Id: _this11.dataSource },
1141
+ Password: mode.authCode
1142
+ });
1143
+ } else {
1144
+ var value = parseFloat(mode.value);
1145
+ var giveChange = null;
1146
+ if (mode.paymentType == PayStyle.xianjin && _this11.paymode.receivable < 0 && value > Math.abs(_this11.paymode.receivable)) {
1147
+ value = Math.Add(value, _this11.paymode.receivable);
1148
+ giveChange = Math.abs(_this11.paymode.receivable);
1149
+ }
1150
+ _this11.dto.RetailPaymentDetails.push({
1151
+ Code: mode.paymethodId,
1152
+ OrigAmount: mode.exchangeRate != 1 ? mode.value2 : value,
1153
+ Amount: value,
1154
+ GiveChange: giveChange,
1155
+ IdsettleStyle: themode.idSettleStyle,
1156
+ IdbankAccount: themode.idBankAccount,
1157
+ Idcurrency: themode.idCurrency,
1158
+ ExchangeRate: themode.exchangeRate,
1159
+ PaymentCode: mode.authCode,
1160
+ SteadCashIntegral: mode.steadCashIntegral,
1161
+ OverchargesAmount: mode.overchargesAmount,
1162
+ DynamicPropertyKeys: [],
1163
+ DynamicPropertyValues: [],
1164
+ DataSource: { Id: _this11.dataSource },
1165
+ ThirdPaymentInfo: themode.thridPayment || null,
1166
+ ThirdPaymentReturnInfo: mode.thirdPaymentReturnInfo || null
1167
+ });
1168
+ if (mode.paymentType == PayStyle.djq) {
1169
+ (0, _each3.default)(_this11.paymode.checkList && _this11.paymode.checkList.length ? _this11.paymode.checkList : mode.djqs, function (djq) {
1170
+ _this11.dto.RetailCouponDetails.push({
1171
+ CouponCode: djq.promoCouponCode,
1172
+ ReductionAmount: djq.amount,
1173
+ EnableAmount: djq.doorsill,
1174
+ CouponTitle: djq.name,
1175
+ IdMember: djq.UMemberID ? mode.memberId : null,
1176
+ LastTS: djq.LastTS,
1177
+ PromotionId: djq.promoId,
1178
+ PromotionRuleId: djq.promoRuleId,
1179
+ PromoCouponAllocatedId: djq.id,
1180
+ DataSource: { Id: _this11.dataSource }
1181
+ });
1182
+ });
1183
+ }
1184
+ }
1185
+ });
1186
+ if (_this11.dto.RetailStorageDetails.length > 0) {
1187
+ var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': PayStyle.hyczk });
1188
+ _this11.dto.RetailPaymentDetails.push({
1189
+ Code: _this11.paymode.counter,
1190
+ OrigAmount: czkSum,
1191
+ Amount: czkSum,
1192
+ IdsettleStyle: themode.idSettleStyle,
1193
+ IdbankAccount: themode.idBankAccount,
1194
+ DynamicPropertyKeys: [],
1195
+ DynamicPropertyValues: [],
1196
+ DataSource: { Id: _this11.dataSource },
1197
+ RetailStorageDetails: _this11.dto.RetailStorageDetails
1198
+ });
1199
+ }
1200
+ });
1201
+ console.log('\u7ED3\u7B97\u6570\u636E\uFF1A', this.dto);
1202
+ // cc结算调用
1203
+ IPMSG = {};
1204
+
1205
+ if (!!window.localStorage.IPMSG) {
1206
+ IPMSG = JSON.parse(window.localStorage.IPMSG);
1207
+ }
1208
+ RetailTypeEnum = this.dto.IdbusiType == 36 ? "INTEGRAL_EXCHANGE" : "NORMAL";
1209
+ _getLoginInfo3 = this.getLoginInfo(), PreSellOrBook = _getLoginInfo3.PreSellOrBook, PercentageWhenBook = _getLoginInfo3.PercentageWhenBook;
1210
+ _ref10 = this.dto || {}, IdbusiType = _ref10.IdbusiType, DistributionMode = _ref10.DistributionMode;
1211
+
1212
+ if (IdbusiType == 38 && PreSellOrBook == 'BOOK' && PercentageWhenBook < 100 && (!DistributionMode.Id || DistributionMode.Id == 'ON_SITE_PICKUP')) {
1213
+ prepaidAmount = (0, _utils.getFixedNumber)(this.dto.RetailPaymentDetails.reduce(function (c, item) {
1214
+ return c + (item.Amount || 0);
1215
+ }, 0));
1216
+ fullPayment = (0, _utils.getFixedNumber)(this.dto.RetailDetails.reduce(function (c, item) {
1217
+ return c + (item.TaxAmount || 0);
1218
+ }, 0));
1219
+
1220
+ this.isFull = fullPayment == prepaidAmount; // 是否全款
1221
+ (0, _mobx.runInAction)(function () {
1222
+ _this11.dto.PrepaidAmount = prepaidAmount;
1223
+ });
1224
+ }
1225
+ _context4.t1 = this.dto.IdbusiType == 37;
1226
+
1227
+ if (!_context4.t1) {
1228
+ _context4.next = 14;
1229
+ break;
1230
+ }
1231
+
1232
+ _context4.next = 13;
1233
+ return this.checkIntegralExchangeReturn(this.dto.RetailDetails[0].ReturnSourceId);
1234
+
1235
+ case 13:
1236
+ _context4.t1 = _context4.sent;
1237
+
1238
+ case 14:
1239
+ _context4.t0 = _context4.t1;
1240
+
1241
+ if (_context4.t0) {
1242
+ _context4.next = 17;
1243
+ break;
1244
+ }
1245
+
1246
+ _context4.t0 = this.dto.IdbusiType != 37;
1247
+
1248
+ case 17:
1249
+ if (!_context4.t0) {
1250
+ _context4.next = 36;
1251
+ break;
1252
+ }
1253
+
1254
+ dtoParams = (0, _extends3.default)({}, this.dto.cut(), { RetailOms: { RetailTypeEnum: RetailTypeEnum } });
1255
+ //处理存在二开支付情况
1256
+
1257
+ payList = dtoParams.RetailPaymentDetails.filter(function (v) {
1258
+ return v.ThirdPaymentInfo;
1259
+ });
1260
+
1261
+ if (!(payList && payList.length > 0)) {
1262
+ _context4.next = 33;
1263
+ break;
1264
+ }
1265
+
1266
+ payment = payList[0];
1267
+ tradeType = payment && payment.Amount > 0 ? TradeType.PAY : TradeType.REFUND;
1268
+ _context4.next = 25;
1269
+ return this.thirdPay(1, payment, tradeType, dtoParams);
1270
+
1271
+ case 25:
1272
+ ret = _context4.sent;
1273
+ _ref11 = ret || {}, type = _ref11.type, data = _ref11.data, msg = _ref11.msg, code = _ref11.code;
1274
+
1275
+ if (!(type === true)) {
1276
+ _context4.next = 31;
1277
+ break;
1278
+ }
1279
+
1280
+ dtoParams = data;
1281
+ _context4.next = 33;
1282
+ break;
1283
+
1284
+ case 31:
1285
+ _message2.default.warn('\u5237\u5361\u652F\u4ED8\u5931\u8D25,\u9519\u8BEF\u7801:' + code);
1286
+ return _context4.abrupt('return', false);
1287
+
1288
+ case 33:
1289
+ this.dtoParams = dtoParams;
1290
+ console.log('结算信息:', dtoParams);
1291
+ return _context4.abrupt('return', this.SettlementApi.retailPosSettle({ dto: dtoParams, cip: IPMSG.query || "" }).then(function (resp) {
1292
+ var _ref12 = resp || {},
1293
+ ID = _ref12.ID;
1294
+
1295
+ _this11.setDtoID(ID);
1296
+ _this11.billID = ID;
1297
+ _this11.paymode.checkList = [];
1298
+ }));
1299
+
1300
+ case 36:
1301
+ case 'end':
1302
+ return _context4.stop();
1303
+ }
1304
+ }
1305
+ }, _callee4, this);
1306
+ }));
1307
+
1308
+ function save() {
1309
+ return _ref9.apply(this, arguments);
1310
+ }
1311
+
1312
+ return save;
1313
+ }()
1314
+
1315
+ //裁剪二开支付数据
1316
+
1317
+ }, {
1318
+ key: 'removeThirdPayDto',
1319
+ value: function removeThirdPayDto(dto) {
1320
+ var data = (0, _extends3.default)({}, dto);
1321
+ delete data['DynamicPropertyKeys'];
1322
+ delete data['DynamicPropertyValues'];
1323
+ return data;
1324
+ }
1325
+
1326
+ /**
1327
+ * 二开支付
1328
+ * vType:1零售单、2储值单
1329
+ * payment:结算方式
1330
+ * trade:00表示结算、02表示退款
1331
+ * dto:结算数据集合
1332
+ */
1333
+
1334
+ }, {
1335
+ key: 'thirdPay',
1336
+ value: function () {
1337
+ var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(vType, payment, trade, dto) {
1338
+ var cto, params, ret, _ref14, Code, _Message, Result, _ref15, ThirdPaymentReturnInfo;
1339
+
1340
+ return _regenerator2.default.wrap(function _callee5$(_context5) {
1341
+ while (1) {
1342
+ switch (_context5.prev = _context5.next) {
1343
+ case 0:
1344
+ _context5.prev = 0;
1345
+ cto = this.removeThirdPayDto(dto);
1346
+ params = { VoucherType: vType, Payment: payment, TradeType: trade, dto: cto };
1347
+
1348
+ console.log('刷卡信息:', (0, _stringify2.default)(params));
1349
+ _context5.next = 6;
1350
+ return new _promise2.default(function (resolve, reject) {
1351
+ _mutantsMicrofx.nativeMs.setIpcRendererMethod('ThirdPayment', (0, _extends3.default)({}, params), function (res) {
1352
+ return resolve(res);
1353
+ });
1354
+ });
1355
+
1356
+ case 6:
1357
+ ret = _context5.sent;
1358
+
1359
+ console.log('刷卡返回信息:', ret);
1360
+ ret = JSON.parse(ret);
1361
+ _ref14 = ret || {}, Code = _ref14.Code, _Message = _ref14.Message, Result = _ref14.Result;
1362
+
1363
+ if (!(Code > 0)) {
1364
+ _context5.next = 14;
1365
+ break;
1366
+ }
1367
+
1368
+ return _context5.abrupt('return', { type: false, data: null, msg: _Message, code: Code });
1369
+
1370
+ case 14:
1371
+ if (!(trade == '00')) {
1372
+ _context5.next = 20;
1373
+ break;
1374
+ }
1375
+
1376
+ _ref15 = Result || {}, ThirdPaymentReturnInfo = _ref15.ThirdPaymentReturnInfo;
1377
+
1378
+ if (vType == 1) {
1379
+ dto.RetailPaymentDetails.forEach(function (v) {
1380
+ if (v.ThirdPaymentInfo != null && Math.abs(v.Amount) > 0) {
1381
+ v.ThirdPaymentReturnInfo = ThirdPaymentReturnInfo;
1382
+ }
1383
+ });
1384
+ } else if (vType == 2) {
1385
+ dto.StorageMutiSettleDetails.forEach(function (v) {
1386
+ if (v.ThirdPaymentInfo != null && Math.abs(v.StorageAmount) > 0) {
1387
+ v.ThirdPaymentReturnInfo = ThirdPaymentReturnInfo;
1388
+ }
1389
+ });
1390
+ }
1391
+ return _context5.abrupt('return', { type: true, data: dto, msg: _Message, code: Code });
1392
+
1393
+ case 20:
1394
+ if (!(trade == '02')) {
1395
+ _context5.next = 22;
1396
+ break;
1397
+ }
1398
+
1399
+ return _context5.abrupt('return', { type: true, data: dto, msg: _Message, code: Code });
1400
+
1401
+ case 22:
1402
+ _context5.next = 27;
1403
+ break;
1404
+
1405
+ case 24:
1406
+ _context5.prev = 24;
1407
+ _context5.t0 = _context5['catch'](0);
1408
+ return _context5.abrupt('return', { type: false, data: null, msg: _context5.t0, code: '9999' });
1409
+
1410
+ case 27:
1411
+ case 'end':
1412
+ return _context5.stop();
1413
+ }
1414
+ }
1415
+ }, _callee5, this, [[0, 24]]);
1416
+ }));
1417
+
1418
+ function thirdPay(_x3, _x4, _x5, _x6) {
1419
+ return _ref13.apply(this, arguments);
1420
+ }
1421
+
1422
+ return thirdPay;
1423
+ }()
1424
+
1425
+ //二开支付强制退款情况
1426
+
1427
+ }, {
1428
+ key: 'thirdPayRefund',
1429
+ value: function () {
1430
+ var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type) {
1431
+ var _this12 = this;
1432
+
1433
+ var dto, pay, payment, _enumController$getEn14, TradeType;
1434
+
1435
+ return _regenerator2.default.wrap(function _callee7$(_context7) {
1436
+ while (1) {
1437
+ switch (_context7.prev = _context7.next) {
1438
+ case 0:
1439
+ dto = type == 1 ? this.dtoParams.RetailPaymentDetails : this.dtoParams.StorageMutiSettleDetails;
1440
+ pay = dto && dto.filter(function (v) {
1441
+ return v.ThirdPaymentInfo;
1442
+ });
1443
+
1444
+ if (pay && pay.length > 0) {
1445
+ setTimeout(function () {
1446
+ _message2.default.warn("支付出现异常,将发起刷卡退款。", { duration: 4.5 });
1447
+ }, 1000);
1448
+ payment = pay[0];
1449
+ _enumController$getEn14 = _mutantsUtil.enumController.getEnumOj(), TradeType = _enumController$getEn14.TradeType;
1450
+
1451
+ setTimeout((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6() {
1452
+ var ret, _ref18, msg;
1453
+
1454
+ return _regenerator2.default.wrap(function _callee6$(_context6) {
1455
+ while (1) {
1456
+ switch (_context6.prev = _context6.next) {
1457
+ case 0:
1458
+ _context6.next = 2;
1459
+ return _this12.thirdPay(type, payment, TradeType.REFUND, dto);
1460
+
1461
+ case 2:
1462
+ ret = _context6.sent;
1463
+ _ref18 = ret || {}, msg = _ref18.msg;
1464
+
1465
+ console.log('\u5237\u5361\u652F\u4ED8\u9000\u6B3E:' + msg);
1466
+
1467
+ case 5:
1468
+ case 'end':
1469
+ return _context6.stop();
1470
+ }
1471
+ }
1472
+ }, _callee6, _this12);
1473
+ })), 4500);
1474
+ }
1475
+
1476
+ case 3:
1477
+ case 'end':
1478
+ return _context7.stop();
1479
+ }
1480
+ }
1481
+ }, _callee7, this);
1482
+ }));
1483
+
1484
+ function thirdPayRefund(_x7) {
1485
+ return _ref16.apply(this, arguments);
1486
+ }
1487
+
1488
+ return thirdPayRefund;
1489
+ }()
1490
+ }, {
1491
+ key: 'setDtoID',
1492
+ value: function setDtoID(id) {
1493
+ this.context.viewModel.data.ID = id;
1494
+ }
1495
+ }, {
1496
+ key: 'querySettleResult',
1497
+ value: function () {
1498
+ var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8() {
1499
+ return _regenerator2.default.wrap(function _callee8$(_context8) {
1500
+ while (1) {
1501
+ switch (_context8.prev = _context8.next) {
1502
+ case 0:
1503
+ _context8.prev = 0;
1504
+ _context8.t0 = _promise2.default;
1505
+ _context8.next = 4;
1506
+ return this.SettlementApi.QuerySettleResult({ RetailCode: this.dto.Code });
1507
+
1508
+ case 4:
1509
+ _context8.t1 = _context8.sent;
1510
+ return _context8.abrupt('return', _context8.t0.resolve.call(_context8.t0, _context8.t1));
1511
+
1512
+ case 8:
1513
+ _context8.prev = 8;
1514
+ _context8.t2 = _context8['catch'](0);
1515
+ return _context8.abrupt('return', _promise2.default.resolve({ Flag: "1" }));
1516
+
1517
+ case 11:
1518
+ case 'end':
1519
+ return _context8.stop();
1520
+ }
1521
+ }
1522
+ }, _callee8, this, [[0, 8]]);
1523
+ }));
1524
+
1525
+ function querySettleResult() {
1526
+ return _ref19.apply(this, arguments);
1527
+ }
1528
+
1529
+ return querySettleResult;
1530
+ }()
1531
+ }, {
1532
+ key: 'setCookie',
1533
+ value: function setCookie(key, val) {
1534
+ var exp = new Date();
1535
+ exp.setTime((0, _moment2.default)().endOf('day').valueOf());
1536
+ document.cookie = key + '=' + val + ';expires=' + exp.toGMTString();
1537
+ }
1538
+ }, {
1539
+ key: 'getAllCookies',
1540
+ value: function getAllCookies() {
1541
+ var cookies = document.cookie.split(/;\s/g);
1542
+ var cookieObj = {};
1543
+ cookies.forEach(function (item) {
1544
+ var key = item.split('=')[0];
1545
+ cookieObj[key] = item.split('=')[1];
1546
+ });
1547
+ return cookieObj;
1548
+ }
1549
+ }, {
1550
+ key: 'validePwd',
1551
+ value: function () {
1552
+ var _ref20 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(value) {
1553
+ var _ref21, isNewRetailBCPos, cook1, cook2, message, memberStorageId, _paymode$currentMode, cardTypeEnum, memberId, meStorageCardId, cardStatusEnum, checkPaymentPasswordParams, checkPaymentPasswordId, result, count, _result;
1554
+
1555
+ return _regenerator2.default.wrap(function _callee9$(_context9) {
1556
+ while (1) {
1557
+ switch (_context9.prev = _context9.next) {
1558
+ case 0:
1559
+ _ref21 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref21.isNewRetailBCPos;
1560
+ _context9.prev = 1;
1561
+
1562
+ if (!isNewRetailBCPos) {
1563
+ _context9.next = 23;
1564
+ break;
1565
+ }
1566
+
1567
+ cook1 = this.getAllCookies()['errorPwd'];
1568
+ cook2 = cook1 && JSON.parse(cook1);
1569
+ message = '密码输入错误';
1570
+ memberStorageId = this.paymode.currentMode.meStorageCardId;
1571
+
1572
+ if (!cook2) {
1573
+ _context9.next = 12;
1574
+ break;
1575
+ }
1576
+
1577
+ if (!cook2.hasOwnProperty(memberStorageId + "")) {
1578
+ _context9.next = 12;
1579
+ break;
1580
+ }
1581
+
1582
+ if (!(cook2[memberStorageId] > 3)) {
1583
+ _context9.next = 12;
1584
+ break;
1585
+ }
1586
+
1587
+ message = '今日密码错误已达上限,不可使用储值消费,请明日再试,如忘记请重置密码或修改密码。';
1588
+ return _context9.abrupt('return', _promise2.default.resolve(message));
1589
+
1590
+ case 12:
1591
+ _paymode$currentMode = this.paymode.currentMode, cardTypeEnum = _paymode$currentMode.cardTypeEnum, memberId = _paymode$currentMode.memberId, meStorageCardId = _paymode$currentMode.meStorageCardId, cardStatusEnum = _paymode$currentMode.cardStatusEnum;
1592
+ checkPaymentPasswordParams = {};
1593
+ checkPaymentPasswordId = null;
1594
+
1595
+ if (cardTypeEnum === 'BALANCE_CARD') {
1596
+ checkPaymentPasswordParams = {
1597
+ md5Password: _tplusApi.User.pwdEncrypt(value.pwd),
1598
+ cardType: cardTypeEnum
1599
+ };
1600
+ checkPaymentPasswordId = memberId;
1601
+ } else {
1602
+ if (cardStatusEnum === 'BINDING' && this.member && this.member.ID === memberId) {
1603
+ checkPaymentPasswordParams = {
1604
+ md5Password: _tplusApi.User.pwdEncrypt(value.pwd),
1605
+ password: value.pwd,
1606
+ cardType: cardTypeEnum
1607
+ };
1608
+ checkPaymentPasswordId = meStorageCardId;
1609
+ } else {
1610
+ checkPaymentPasswordParams = {
1611
+ password: value.pwd,
1612
+ cardType: cardTypeEnum
1613
+ };
1614
+ checkPaymentPasswordId = meStorageCardId;
1615
+ }
1616
+ }
1617
+ _context9.next = 18;
1618
+ return this.SettlementApi.checkPaymentPassword(checkPaymentPasswordParams, checkPaymentPasswordId);
1619
+
1620
+ case 18:
1621
+ result = _context9.sent;
1622
+
1623
+ if (!result.data) {
1624
+ if (cook2) {
1625
+ if (cook2.hasOwnProperty(memberStorageId + "")) {
1626
+ count = cook2[memberStorageId];
1627
+
1628
+ cook2[memberStorageId] = count + 1;
1629
+ } else {
1630
+ cook2[memberStorageId] = 1;
1631
+ }
1632
+ } else {
1633
+ cook2 = {};
1634
+ cook2[memberStorageId] = 1;
1635
+ }
1636
+ this.setCookie('errorPwd', '', -1);
1637
+ this.setCookie('errorPwd', (0, _stringify2.default)(cook2));
1638
+ }
1639
+ return _context9.abrupt('return', _promise2.default.resolve(result.data ? "" : message));
1640
+
1641
+ case 23:
1642
+ _context9.next = 25;
1643
+ return this.SettlementApi.CheckoutMemberPassword({ "CheckoutParams": {
1644
+ "Idmember": value.id,
1645
+ "Password": value.pwd
1646
+ } });
1647
+
1648
+ case 25:
1649
+ _result = _context9.sent;
1650
+ return _context9.abrupt('return', _promise2.default.resolve(_result.Success ? "" : _result.Message));
1651
+
1652
+ case 27:
1653
+ _context9.next = 32;
1654
+ break;
1655
+
1656
+ case 29:
1657
+ _context9.prev = 29;
1658
+ _context9.t0 = _context9['catch'](1);
1659
+ return _context9.abrupt('return', "failed");
1660
+
1661
+ case 32:
1662
+ case 'end':
1663
+ return _context9.stop();
1664
+ }
1665
+ }
1666
+ }, _callee9, this, [[1, 29]]);
1667
+ }));
1668
+
1669
+ function validePwd(_x8) {
1670
+ return _ref20.apply(this, arguments);
1671
+ }
1672
+
1673
+ return validePwd;
1674
+ }()
1675
+ }]);
1676
+ return SettlementStore;
1677
+ }(), _initialiseProps = function _initialiseProps() {
1678
+ var _this13 = this;
1679
+
1680
+ this.paymode = null;
1681
+ this.dto = null;
1682
+ this.dtoParams = null;
1683
+ this.member = null;
1684
+ this.brefund = false;
1685
+ this.bquick = false;
1686
+ this.boriginReturn = false;
1687
+
1688
+ _initDefineProp(this, 'newStyle', _descriptor, this);
1689
+
1690
+ this.isFull = true;
1691
+
1692
+ _initDefineProp(this, 'setNewStyle', _descriptor2, this);
1693
+
1694
+ _initDefineProp(this, 'queryPwd', _descriptor3, this);
1695
+
1696
+ _initDefineProp(this, 'updateMemberInfo', _descriptor4, this);
1697
+
1698
+ _initDefineProp(this, 'updateCurrentMode', _descriptor5, this);
1699
+
1700
+ _initDefineProp(this, 'updateCardInfo', _descriptor6, this);
1701
+
1702
+ this.handleCzkData = function (m) {
1703
+ if (!m || !m.StorageCardNo) {
1704
+ (0, _mobx.runInAction)(function () {
1705
+ _this13.paymode.currentMode.errinfo = "无效的会员卡号";
1706
+ });
1707
+ } else {
1708
+ (0, _mobx.runInAction)(function () {
1709
+ _this13.paymode.currentMode.errinfo = "";
1710
+ _this13.paymode.currentMode.memberId = m.ID;
1711
+ _this13.paymode.currentMode.value = (0, _utils.getFixedNumber)(_this13.brefund ? _this13.paymode.receivable : Math.max(_this13.paymode.receivable, 0));
1712
+ _this13.updateEvent();
1713
+ var message = '';
1714
+ var sum = (0, _reduce3.default)(_this13.paymode.thePaymodes, function (total, cur) {
1715
+ return total + cur.value;
1716
+ }, 0);
1717
+ // 对于卡不用判断会员的一些信息
1718
+ // if (global.CheckMemberStorageProcessorBlock ) {
1719
+ // message= CheckMemberStorageProcessorBlock.execute(m);
1720
+ // }
1721
+ if (!String.isNullOrEmpty(message)) {
1722
+ _this13.paymode.currentMode.errinfo = message;
1723
+ } else if (_this13.checkReceived(_this13.paymode.currentMode, "balance")) {
1724
+ _this13.paymode.currentMode.errinfo = "余额不足";
1725
+ } else if (_this13.paymode.amount > 0 && parseFloat(_this13.paymode.amount) !== sum && _this13.paymode.currentMode.value == 0) {
1726
+ _this13.paymode.currentMode.errinfo = "实收金额必须录入";
1727
+ } else {
1728
+ // 查询成功后将焦点移入下一个输入框
1729
+ setTimeout(function () {
1730
+ var nextInput = document.querySelector('.czk .received .input');
1731
+ nextInput && nextInput.select();
1732
+ }, 300);
1733
+ }
1734
+ });
1735
+ }
1736
+ };
1737
+
1738
+ this.getCouponList = function (coupon_code) {
1739
+ var _enumController$getEn15 = _mutantsUtil.enumController.getEnumOj(),
1740
+ PayStyle = _enumController$getEn15.PayStyle,
1741
+ Differentiate = _enumController$getEn15.Differentiate;
1742
+
1743
+ var couponApplyRule = (0, _tplusPoslogin.PosInitData)('CouponApplyRule');
1744
+
1745
+ var _enumController$getEn16 = _mutantsUtil.enumController.getEnumOj(),
1746
+ CouponApplyRule = _enumController$getEn16.CouponApplyRule;
1747
+
1748
+ if (couponApplyRule == CouponApplyRule.SHOWN_BY_CUSTOMER && !!coupon_code || couponApplyRule != CouponApplyRule.SHOWN_BY_CUSTOMER) {
1749
+ var dto = _this13.dto;
1750
+ var promoVoucher = {};
1751
+ _this13.paymode.clearDjqs();
1752
+ _this13.paymode.reCalculationDjqs();
1753
+ promoVoucher.coupon_code = coupon_code || "";
1754
+ promoVoucher.boName = "Retail";
1755
+ promoVoucher.voucherId = dto.ID;
1756
+ var onlinePaymentAmount = 0;
1757
+ if (dto.OnlinePaymentAmount) {
1758
+ onlinePaymentAmount = dto.OnlinePaymentAmount;
1759
+ }
1760
+ promoVoucher.promoLinks = (0, _filter3.default)(_this13.paymode.currentMode.djqs, function (djq) {
1761
+ return djq.checked;
1762
+ });
1763
+ promoVoucher.totalAmountWithTax = Math.Minus(dto.TotalTaxAmount, onlinePaymentAmount);
1764
+ promoVoucher.redBlueFlagEnum = "BLUE";
1765
+ promoVoucher.meMemberId = dto.Idmember;
1766
+ promoVoucher.storeFactorId = dto.Idstore;
1767
+ promoVoucher.voucherDetailList = [];
1768
+ dto.RetailDetails.forEach(function (item) {
1769
+ var detailDTO = {};
1770
+ detailDTO.uuid = item.Code;
1771
+ detailDTO.detailBoName = "RetailDetail";
1772
+ detailDTO.voucherDetailId = item.ID;
1773
+ detailDTO.productId = item.Idinventory;
1774
+ detailDTO.uomId = item.Idunit;
1775
+ detailDTO.productSpecId = item.ProductSpecId;
1776
+ detailDTO.isManualFreeGift = item.IsPresent;
1777
+ detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
1778
+ detailDTO.IsManualChangePrice = item.IsManualChangePrice;
1779
+ // if(detailDTO.IsManualChangePrice)//如果是手工改价
1780
+ // {
1781
+ // detailDTO.listPrice = item.TaxPrice;
1782
+ // detailDTO.netAmountWithTax = item.TaxAmount;
1783
+ // }
1784
+ // else
1785
+ // {
1786
+ var bookingQuantity = 0;
1787
+ if (item.BookingQuantity) {
1788
+ bookingQuantity = item.BookingQuantity;
1789
+ }
1790
+ detailDTO.listPrice = JSON.getCellValue(item, "listPrice");
1791
+ detailDTO.netAmountWithTax = Math.Multiply(detailDTO.listPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
1792
+ //}
1793
+ detailDTO.taxRate = item.TaxRate;
1794
+ detailDTO.quantity = item.Quantity;
1795
+
1796
+ detailDTO.amountWithTax = item.RetailAmount;
1797
+ // 促销 start
1798
+ if (item.PromotionDetails && item.PromotionDetails.length != 0) {
1799
+ var promoLinks = [];
1800
+ item.PromotionDetails.forEach(function (promotion) {
1801
+ promoLinks.push({
1802
+ promoId: promotion.IdSalesPromotionDTO,
1803
+ promoRuleId: promotion.PromotionRuleId
1804
+ });
1805
+ });
1806
+ if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
1807
+ }
1808
+ // 促销 end
1809
+ promoVoucher.voucherDetailList.push(detailDTO);
1810
+ });
1811
+ return _this13.SettlementApi.findUsefulCouponPromoList(promoVoucher).then(function (result) {
1812
+ if (result && result.length != 0) {
1813
+ result.forEach(function (element) {
1814
+ var _ref22 = element || {},
1815
+ couponCode = _ref22.couponCode,
1816
+ name = _ref22.name,
1817
+ tieredAmountResult = _ref22.tieredAmountResult,
1818
+ fromDate = _ref22.fromDate,
1819
+ dateMount = _ref22.dateMount,
1820
+ promoMethodEnum = _ref22.promoMethodEnum,
1821
+ discountPct = _ref22.discountPct,
1822
+ nominalAmount = _ref22.nominalAmount,
1823
+ promoId = _ref22.promoId,
1824
+ id = _ref22.id;
1825
+
1826
+ var condValue = tieredAmountResult.condValue,
1827
+ promoDiscount = tieredAmountResult.promoDiscount,
1828
+ displayText = tieredAmountResult.displayText,
1829
+ promoRuleId = tieredAmountResult.promoRuleId,
1830
+ couponCategoryEnum = tieredAmountResult.couponCategoryEnum;
1831
+
1832
+ if (result.IsRepelWithPoints && (0, _find3.default)(_this13.paymode.thePaymodes, function (themode) {
1833
+ return themode.paymentType == PayStyle.jfdx;
1834
+ })) {
1835
+ _message2.default.error(Differentiate.COUPON + '\uFF08' + result.SN + '\uFF09\u4E0D\u53EF\u4E0E\u79EF\u5206\u4E00\u8D77\u4F7F\u7528');
1836
+ } else {
1837
+ var IsEnable = couponCategoryEnum === 'RIGUP' || couponCategoryEnum === 'UN_MATCH' || couponCategoryEnum === "PREPARING" || couponCategoryEnum === 'PROMO_LIMITED' || couponCategoryEnum === 'COUPON_CONFLICT' ? false : true;
1838
+ _this13.addDjq(couponCode, name, IsEnable, promoMethodEnum == "CASH_COUPON" && nominalAmount, promoDiscount, condValue, null, false, !result.IsRepelWithPoints, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id, true, 1);
1839
+ }
1840
+ });
1841
+ if (promoVoucher.coupon_code) {
1842
+ _this13.paymode.calcDjqCheckValue(_this13.paymode.currentMode.djqs[0], _this13.dto, 'single');
1843
+ }
1844
+ } else {
1845
+ if (promoVoucher.coupon_code) {
1846
+ _message2.default.info(Differentiate.COUPON + '\u53F7\u4E0D\u5B58\u5728\uFF01');
1847
+ _this13.getCouponList();
1848
+ } else {
1849
+ _message2.default.info('\u6CA1\u6709\u627E\u5230\u53EF\u4F7F\u7528\u7684' + Differentiate.COUPON + '\uFF01');
1850
+ }
1851
+ }
1852
+ });
1853
+ }
1854
+ };
1855
+
1856
+ this.getSettleGift = function () {
1857
+ return _this13.SettlementApi.executeRightsForPos(_this13.billID);
1858
+ };
1859
+
1860
+ this.getRefWareHouseList = function () {
1861
+ return _this13.SettlementApi.getRefWareHouseList();
1862
+ };
1863
+
1864
+ this.checkCoupon = function () {
1865
+ var _ref23 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(sn) {
1866
+ var _ref24, isNewRetailBCPos, _enumController$getEn17, PayStyle, Differentiate, params;
1867
+
1868
+ return _regenerator2.default.wrap(function _callee10$(_context10) {
1869
+ while (1) {
1870
+ switch (_context10.prev = _context10.next) {
1871
+ case 0:
1872
+ _ref24 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref24.isNewRetailBCPos;
1873
+
1874
+ if (!isNewRetailBCPos) {
1875
+ _context10.next = 7;
1876
+ break;
1877
+ }
1878
+
1879
+ _context10.next = 4;
1880
+ return _this13.getCouponList(sn, 'sinlge');
1881
+
1882
+ case 4:
1883
+ return _context10.abrupt('return', _context10.sent);
1884
+
1885
+ case 7:
1886
+ _enumController$getEn17 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn17.PayStyle, Differentiate = _enumController$getEn17.Differentiate;
1887
+ params = { request: {
1888
+ Uid: _this13.paymode.currentMode.member.uid || '',
1889
+ SN: sn,
1890
+ StoreCode: _this13.dto.Idstore,
1891
+ Inventories: (0, _map3.default)((0, _filter3.default)(_this13.dto.RetailDetails, function (d) {
1892
+ return d.Quantity > 0 && !d.IsPresent;
1893
+ }), function (detail) {
1894
+ return {
1895
+ IdInventory: detail.Inventory.ID,
1896
+ IdUnit: detail.Idunit,
1897
+ Code: detail.Inventory.Code,
1898
+ FreeItem0: JSON.getCellValue(detail, "freeitem0"),
1899
+ FreeItem1: JSON.getCellValue(detail, "freeitem1"),
1900
+ FreeItem2: JSON.getCellValue(detail, "freeitem2"),
1901
+ FreeItem3: JSON.getCellValue(detail, "freeitem3"),
1902
+ FreeItem4: JSON.getCellValue(detail, "freeitem4"),
1903
+ FreeItem5: JSON.getCellValue(detail, "freeitem5"),
1904
+ FreeItem6: JSON.getCellValue(detail, "freeitem6"),
1905
+ FreeItem7: JSON.getCellValue(detail, "freeitem7"),
1906
+ FreeItem8: JSON.getCellValue(detail, "freeitem8"),
1907
+ FreeItem9: JSON.getCellValue(detail, "freeitem9")
1908
+ };
1909
+ }),
1910
+ // inventoryCodes:_join(_map(this.dto.RetailDetails,(detail)=>{return detail.Inventory.Code;}),','),
1911
+ InventoryClassCodes: (0, _join3.default)((0, _map3.default)((0, _filter3.default)(_this13.dto.RetailDetails, function (d) {
1912
+ return d.Quantity > 0;
1913
+ }), function (detail) {
1914
+ return (detail.Inventory.InventoryClass || { Code: '' }).Code;
1915
+ }), ','),
1916
+ Amount: _this13.paymode.amount
1917
+ } };
1918
+ return _context10.abrupt('return', _this13.SettlementApi.CheckCoupon(params).then(function (result) {
1919
+ if ((0, _find3.default)(_this13.paymode.currentMode.djqs, function (djq) {
1920
+ return djq.code == result.SN;
1921
+ })) {
1922
+ _message2.default.info(Differentiate.COUPON + '\u5DF2\u6DFB\u52A0');
1923
+ } else if (result.IsRepelWithPoints && (0, _find3.default)(_this13.paymode.thePaymodes, function (themode) {
1924
+ return themode.paymentType == PayStyle.jfdx;
1925
+ })) {
1926
+ _message2.default.error(Differentiate.COUPON + '\uFF08' + result.SN + '\uFF09\u4E0D\u53EF\u4E0E\u79EF\u5206\u4E00\u8D77\u4F7F\u7528');
1927
+ } else {
1928
+ _this13.addDjq(result.SN, result.Title, result.ReduceAmount, result.StartAmount, result.LastTS, false, !result.IsRepelWithPoints, result.UMemberID);
1929
+ }
1930
+ }));
1931
+
1932
+ case 10:
1933
+ case 'end':
1934
+ return _context10.stop();
1935
+ }
1936
+ }
1937
+ }, _callee10, _this13);
1938
+ }));
1939
+
1940
+ return function (_x9) {
1941
+ return _ref23.apply(this, arguments);
1942
+ };
1943
+ }();
1944
+
1945
+ this.repeatStorageModal = function (content) {
1946
+ return new _promise2.default(function (resolve, reject) {
1947
+ _tplusComponentsTouch.ModalWraper.confirm({
1948
+ title: '',
1949
+ okText: '继续储值',
1950
+ className: 'repeat-modal',
1951
+ zIndex: 1007,
1952
+ content: content,
1953
+ onOk: function () {
1954
+ var _ref25 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11() {
1955
+ var ret;
1956
+ return _regenerator2.default.wrap(function _callee11$(_context11) {
1957
+ while (1) {
1958
+ switch (_context11.prev = _context11.next) {
1959
+ case 0:
1960
+ _context11.next = 2;
1961
+ return _this13.saveMember();
1962
+
1963
+ case 2:
1964
+ ret = _context11.sent;
1965
+
1966
+ if (ret === false) {
1967
+ resolve(false);
1968
+ } else {
1969
+ resolve(true);
1970
+ }
1971
+
1972
+ case 4:
1973
+ case 'end':
1974
+ return _context11.stop();
1975
+ }
1976
+ }
1977
+ }, _callee11, _this13);
1978
+ }));
1979
+
1980
+ return function onOk() {
1981
+ return _ref25.apply(this, arguments);
1982
+ };
1983
+ }(),
1984
+ onCancel: function onCancel() {
1985
+ resolve(false);
1986
+ }
1987
+ });
1988
+ });
1989
+ };
1990
+
1991
+ this.checkIntegralExchangeReturn = function (id) {
1992
+ return new _promise2.default(function (resolve, reject) {
1993
+ _this13.SettlementApi.GetNewIntegralExchange({ param: { refVoucherId: id } }).then(function (resp) {
1994
+ if (resp && resp.expireIntegral > 0) {
1995
+ _tplusComponentsTouch.ModalWraper.confirm({
1996
+ className: 'tplus-confirm-modal',
1997
+ title: "温馨提示",
1998
+ content: '\u5B58\u5728\u5DF2\u7ECF\u8FC7\u671F\u7684\u79EF\u5206' + resp.expireIntegral + '\u9000\u8D27\u540E\u79EF\u5206\u4E0D\u4F1A\u8FD4\u8FD8\u3002\u662F\u5426\u7EE7\u7EED\u9000\u8D27\uFF1F',
1999
+ cancelable: false,
2000
+ onOk: function onOk() {
2001
+ resolve(true);
2002
+ },
2003
+ onCancel: function onCancel() {
2004
+ reject(false);
2005
+ }
2006
+ });
2007
+ } else {
2008
+ resolve(true);
2009
+ }
2010
+ });
2011
+ });
2012
+ };
2013
+ }, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'newStyle', [_mobx.observable], {
2014
+ enumerable: true,
2015
+ initializer: function initializer() {
2016
+ return true;
2017
+ }
2018
+ }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'setNewStyle', [_mobx.action], {
2019
+ enumerable: true,
2020
+ initializer: function initializer() {
2021
+ var _this14 = this;
2022
+
2023
+ return function () {
2024
+ var voucherDefaultPosMode = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') || 'touch';
2025
+ _this14.newStyle = voucherDefaultPosMode == 'voucher';
2026
+ };
2027
+ }
2028
+ }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, 'queryPwd', [_mobx.action], {
2029
+ enumerable: true,
2030
+ initializer: function initializer() {
2031
+ var _this15 = this;
2032
+
2033
+ return function (newPass, newPassConfirm) {
2034
+ if (!newPass || !newPassConfirm) {
2035
+ return _message2.default.warn('您还有未填写项');
2036
+ }
2037
+ if (newPass !== newPassConfirm) {
2038
+ return _message2.default.warn('您两次输入的密码不一致');
2039
+ }
2040
+ var idstore = (0, _tplusPoslogin.PosInitData)('storeID');
2041
+ return _this15.SettlementApi.setWalletPayPassword({
2042
+ Idstore: idstore,
2043
+ meMemberId: _this15.paymode.currentMode.memberId,
2044
+ oldPassword: null,
2045
+ newPassword: _tplusApi.User.pwdEncrypt(newPassConfirm),
2046
+ dataSource: "POS"
2047
+ }).then(function (resp) {
2048
+ if (resp.successful) {
2049
+ return true;
2050
+ }
2051
+ });
2052
+ };
2053
+ }
2054
+ }), _applyDecoratedDescriptor(_class.prototype, 'initByOriginReturn', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'initByOriginReturn'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'quickSettle', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'quickSettle'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changeFocusAndAddPay', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'changeFocusAndAddPay'), _class.prototype), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, 'updateMemberInfo', [_mobx.action], {
2055
+ enumerable: true,
2056
+ initializer: function initializer() {
2057
+ var _this16 = this;
2058
+
2059
+ return function () {
2060
+ var _ref26 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(_this) {
2061
+ var _getLoginInfo4, IdStore, StoreCode, resp;
2062
+
2063
+ return _regenerator2.default.wrap(function _callee12$(_context12) {
2064
+ while (1) {
2065
+ switch (_context12.prev = _context12.next) {
2066
+ case 0:
2067
+ _getLoginInfo4 = _this16.getLoginInfo(), IdStore = _getLoginInfo4.IdStore, StoreCode = _getLoginInfo4.StoreCode;
2068
+ _context12.next = 3;
2069
+ return _this16.SettlementApi.GetUmemberDTO({ Idmember: _this16.member.ID, IdStore: IdStore, StoreCode: StoreCode });
2070
+
2071
+ case 3:
2072
+ resp = _context12.sent;
2073
+
2074
+ _this.member = resp;
2075
+ _this.paymode.updateMemberStorageCardNo(resp.StorageCardNo, resp.WalletEnabled);
2076
+ return _context12.abrupt('return', _promise2.default.resolve(resp));
2077
+
2078
+ case 7:
2079
+ case 'end':
2080
+ return _context12.stop();
2081
+ }
2082
+ }
2083
+ }, _callee12, _this16);
2084
+ }));
2085
+
2086
+ return function (_x10) {
2087
+ return _ref26.apply(this, arguments);
2088
+ };
2089
+ }();
2090
+ }
2091
+ }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, 'updateCurrentMode', [_mobx.action], {
2092
+ enumerable: true,
2093
+ initializer: function initializer() {
2094
+ var _this17 = this;
2095
+
2096
+ return function () {
2097
+ var _ref27 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(memberId, returnType) {
2098
+ var isOnlyEnabled, result;
2099
+ return _regenerator2.default.wrap(function _callee13$(_context13) {
2100
+ while (1) {
2101
+ switch (_context13.prev = _context13.next) {
2102
+ case 0:
2103
+ isOnlyEnabled = returnType ? false : true; //非原单退货为false,其他true
2104
+ // 查看会员卡信息
2105
+
2106
+ _context13.next = 3;
2107
+ return _this17.SettlementApi.getCardInfoByMemberId(memberId, isOnlyEnabled);
2108
+
2109
+ case 3:
2110
+ result = _context13.sent;
2111
+
2112
+ if (!(result && result.data.length)) {
2113
+ _context13.next = 21;
2114
+ break;
2115
+ }
2116
+
2117
+ if (!(result.data.length === 1)) {
2118
+ _context13.next = 10;
2119
+ break;
2120
+ }
2121
+
2122
+ _this17.paymode.updateCardInfo(result.data[0]);
2123
+ return _context13.abrupt('return', result.data);
2124
+
2125
+ case 10:
2126
+ if (!(result.data && result.data.length === 1)) {
2127
+ _context13.next = 15;
2128
+ break;
2129
+ }
2130
+
2131
+ _this17.paymode.updateCardInfo(result.data[0]);
2132
+ return _context13.abrupt('return', result.data);
2133
+
2134
+ case 15:
2135
+ if (!(result.data && result.data.length > 1)) {
2136
+ _context13.next = 19;
2137
+ break;
2138
+ }
2139
+
2140
+ return _context13.abrupt('return', result.data);
2141
+
2142
+ case 19:
2143
+ _message2.default.warn('没有可用储值卡!');
2144
+ return _context13.abrupt('return', false);
2145
+
2146
+ case 21:
2147
+ case 'end':
2148
+ return _context13.stop();
2149
+ }
2150
+ }
2151
+ }, _callee13, _this17);
2152
+ }));
2153
+
2154
+ return function (_x11, _x12) {
2155
+ return _ref27.apply(this, arguments);
2156
+ };
2157
+ }();
2158
+ }
2159
+ }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, 'updateCardInfo', [_mobx.action], {
2160
+ enumerable: true,
2161
+ initializer: function initializer() {
2162
+ var _this18 = this;
2163
+
2164
+ return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14() {
2165
+ var ctMode, cardNo, result;
2166
+ return _regenerator2.default.wrap(function _callee14$(_context14) {
2167
+ while (1) {
2168
+ switch (_context14.prev = _context14.next) {
2169
+ case 0:
2170
+ ctMode = _this18.paymode && _this18.paymode.currentMode;
2171
+ cardNo = ctMode && ctMode.storageCardNo;
2172
+ _context14.next = 4;
2173
+ return _this18.SettlementApi.getCardInfoByCardNo(cardNo);
2174
+
2175
+ case 4:
2176
+ result = _context14.sent;
2177
+
2178
+ _this18.paymode.updateCardInfo(result && result.data);
2179
+
2180
+ case 6:
2181
+ case 'end':
2182
+ return _context14.stop();
2183
+ }
2184
+ }
2185
+ }, _callee14, _this18);
2186
+ }));
2187
+ }
2188
+ }), _applyDecoratedDescriptor(_class.prototype, 'addDjq', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'addDjq'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changeFocusOnly', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'changeFocusOnly'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changeClickFocusOnly', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'changeClickFocusOnly'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changeValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'changeValue'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'addPayDirectly', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'addPayDirectly'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'addPay', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'addPay'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'delPay', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'delPay'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setDtoID', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'setDtoID'), _class.prototype)), _class);
2189
+ exports.default = SettlementStore;
2190
+ var PayMode = exports.PayMode = (_class3 = function () {
2191
+ //预订场景下,现场提货,且选项设置订金比例非100% or 取货最大补款数大于0时 为 true
2192
+ function PayMode() {
2193
+ // this.amount=getFixedNumber(amount);
2194
+ // this.calcReserved();
2195
+
2196
+ (0, _classCallCheck3.default)(this, PayMode);
2197
+ this._counter = 0;
2198
+ this.amount = 0;
2199
+ this.onlineamount = 0;
2200
+ this.maxamount = 0;
2201
+
2202
+ _initDefineProp(this, 'currentFocus', _descriptor7, this);
2203
+
2204
+ _initDefineProp(this, 'received', _descriptor8, this);
2205
+
2206
+ _initDefineProp(this, 'receivable', _descriptor9, this);
2207
+
2208
+ _initDefineProp(this, 'paymodes', _descriptor10, this);
2209
+
2210
+ _initDefineProp(this, 'thePaymodes', _descriptor11, this);
2211
+
2212
+ this.bookMaxValue = 0;
2213
+ this.isNotFullBook = false;
2214
+ this.isNotFullOnlyBook = false;
2215
+
2216
+ _initDefineProp(this, 'storageCardNo', _descriptor12, this);
2217
+
2218
+ _initDefineProp(this, 'balance', _descriptor13, this);
2219
+
2220
+ this.currentMode = null;
2221
+ this.checkList = [];
2222
+ this.settle = {
2223
+ name: "复合结算",
2224
+ hotKey: "Ctrl+M"
2225
+ };
2226
+
2227
+ _initDefineProp(this, 'calcCheckList', _descriptor14, this);
2228
+
2229
+ _initDefineProp(this, 'setCouponNum', _descriptor15, this);
2230
+
2231
+ _initDefineProp(this, 'addDjqs', _descriptor16, this);
2232
+ }
2233
+ // @observable store = null;
2234
+ //只是预订场景下,现场提货,且选项设置订金比例非100%时 为 true
2235
+ //应收
2236
+
2237
+
2238
+ (0, _createClass3.default)(PayMode, [{
2239
+ key: 'clean',
2240
+ value: function clean() {
2241
+ this.thePaymodes = [];
2242
+ this.calcReserved();
2243
+ }
2244
+ }, {
2245
+ key: 'clear',
2246
+ value: function clear() {
2247
+ this.thePaymodes = [];
2248
+ this.calcReserved();
2249
+ this.paymodes = [];
2250
+ }
2251
+ }, {
2252
+ key: 'setAmount',
2253
+ value: function setAmount(a, o) {
2254
+ this.amount = (0, _utils.getFixedNumber)((a || 0) - (o || 0));
2255
+ this.onlineamount = (0, _utils.getFixedNumber)(o || 0);
2256
+ this.calcReserved();
2257
+ return this.amount < 0;
2258
+ }
2259
+ }, {
2260
+ key: 'calcReserved',
2261
+ value: function calcReserved(type) {
2262
+ var sum = 0;
2263
+ (0, _each3.default)(this.thePaymodes, function (mode) {
2264
+ sum = Math.Add(sum, mode.value == "" ? 0 : mode.value);
2265
+ });
2266
+ this.received = (0, _utils.getFixedNumber)(sum);
2267
+ if (type === 'bookPay' && this.isNotFullBook) {
2268
+ if (this.amount <= sum && sum <= this.bookMaxValue) {
2269
+ this.receivable = (0, _utils.getFixedNumber)(0);
2270
+ }
2271
+ if (sum < this.amount) {
2272
+ this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
2273
+ }
2274
+ if (sum > this.bookMaxValue) {
2275
+ this.receivable = (0, _utils.getFixedNumber)(this.bookMaxValue - sum);
2276
+ }
2277
+ } else {
2278
+ this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
2279
+ }
2280
+ }
2281
+ }, {
2282
+ key: 'updateMemberStorageCardNo',
2283
+ value: function updateMemberStorageCardNo(storageCardNo, walletEnabled) {
2284
+ this.currentMode.storageCardNo = storageCardNo;
2285
+ this.currentMode.walletEnabled = walletEnabled;
2286
+ }
2287
+ }, {
2288
+ key: 'updateCardInfo',
2289
+ value: function updateCardInfo(m) {
2290
+ this.currentMode.cardStatusEnum = m.CardStatusEnum;
2291
+ this.currentMode.isNeedPassword = m.IsNeedPassword;
2292
+ this.currentMode.meStorageCardId = m.MeStorageCardId;
2293
+ this.currentMode.storageCardNo = m.StorageCardNo;
2294
+ this.currentMode.balance = m.BalanceStorage;
2295
+ this.currentMode.rawbalance = m.BalanceStorage;
2296
+ this.currentMode.cardTypeEnum = m.CardTypeEnum;
2297
+ this.currentMode.walletEnabled = m.WalletEnabled;
2298
+ this.currentMode.memberId = m.ID;
2299
+ this.currentMode.freePaymentPasswordStore = m.FreePaymentPasswordStore;
2300
+ }
2301
+ }, {
2302
+ key: 'calcDjqCheckValue',
2303
+ value: function calcDjqCheckValue(q1, dto, params) {
2304
+ var _this19 = this;
2305
+
2306
+ var useLimitPerOrder = (0, _tplusPoslogin.PosInitData)('UseLimitPerOrder');
2307
+ var qList = (0, _filter3.default)(this.currentMode.djqs, function (djq) {
2308
+ return djq.checked;
2309
+ });
2310
+ if (qList.length === useLimitPerOrder && !q1.checked) {
2311
+ _message2.default.warn('本单最多可用' + useLimitPerOrder + '张');
2312
+ return;
2313
+ }
2314
+ if (params === 'single') {
2315
+ this.checkList = [];
2316
+ }
2317
+
2318
+ var _enumController$getEn18 = _mutantsUtil.enumController.getEnumOj(),
2319
+ PayStyle = _enumController$getEn18.PayStyle,
2320
+ Differentiate = _enumController$getEn18.Differentiate;
2321
+
2322
+ if (q1) {
2323
+ if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
2324
+ _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
2325
+ return;
2326
+ }
2327
+ var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
2328
+ return djq.promoCouponCode == q1.promoCouponCode;
2329
+ });
2330
+ if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
2331
+ _message2.default.error("本单金额低于使用门槛,该券不可使用。");
2332
+ return;
2333
+ }
2334
+ //判断是否是选择优惠券 //CC优惠券只能使用一个
2335
+ // if (q1 && !q1.checked && isNewRetailBCPos) {
2336
+ // // 检查是否有已经选定优惠券 并且去除选定的优惠券
2337
+ // this.currentMode.djqs.forEach((djq, index) => {
2338
+ // if (djq.checked) this.currentMode.djqs[index].checked = false;
2339
+ // })
2340
+ // }
2341
+ q && (q.checked = !q.checked);
2342
+ }
2343
+ var sum = 0;
2344
+ // console.log(this.store, 'stores-------');
2345
+ if (!q1.checked) {
2346
+ this.checkList.forEach(function (ele, i) {
2347
+ if (ele.id === q1.id) {
2348
+ _this19.checkList.splice(i, 1);
2349
+ }
2350
+ });
2351
+ } else {
2352
+ this.checkList.push(q1);
2353
+ }
2354
+
2355
+ this.checkList.forEach(function (ele) {
2356
+ sum = Math.Add(sum, ele.amount);
2357
+ });
2358
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
2359
+ console.log(this.receivable, sum, Math.min(this.receivable, sum, this.currentMode.maxamount), 'sum---------');
2360
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - Math.min(this.receivable, sum, this.currentMode.maxamount));
2361
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
2362
+ if (params === 'single') {
2363
+ return;
2364
+ }
2365
+ var promoVoucher = {};
2366
+ promoVoucher.boName = "Retail";
2367
+ // promoVoucher.promoLinks = _filter(this.currentMode.djqs,djq=>djq.checked);
2368
+ promoVoucher.meMemberId = this.currentMode.member.id;
2369
+ promoVoucher.storeFactorId = (0, _tplusPoslogin.PosInitData)('storeID');
2370
+ promoVoucher.voucherDetailList = [];
2371
+ dto.RetailDetails.forEach(function (item) {
2372
+ var detailDTO = {};
2373
+ detailDTO.uuid = item.Code;
2374
+ detailDTO.detailBoName = "RetailDetail";
2375
+ detailDTO.voucherDetailId = item.ID;
2376
+ detailDTO.productId = item.Idinventory;
2377
+ detailDTO.uomId = item.Idunit;
2378
+ detailDTO.productSpecId = item.ProductSpecId;
2379
+ detailDTO.isManualFreeGift = item.IsPresent;
2380
+ detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
2381
+ detailDTO.IsManualChangePrice = item.IsManualChangePrice;
2382
+
2383
+ // if(detailDTO.IsManualChangePrice)//如果是手工改价
2384
+ // {
2385
+ // detailDTO.listPrice = item.TaxPrice;
2386
+ // detailDTO.netAmountWithTax = item.TaxAmount;
2387
+ // }
2388
+ // else
2389
+ // {
2390
+
2391
+ var bookingQuantity = 0;
2392
+ if (item.BookingQuantity) {
2393
+ bookingQuantity = item.BookingQuantity;
2394
+ }
2395
+ detailDTO.listPrice = JSON.getCellValue(item, "listPrice");
2396
+ detailDTO.netAmountWithTax = Math.Multiply(detailDTO.listPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
2397
+ detailDTO.taxRate = item.TaxRate;
2398
+ detailDTO.quantity = item.Quantity;
2399
+
2400
+ detailDTO.amountWithTax = item.RetailAmount;
2401
+ // 促销 start
2402
+ if (item.PromotionDetails && item.PromotionDetails.length != 0) {
2403
+ var promoLinks = [];
2404
+ item.PromotionDetails.forEach(function (promotion) {
2405
+ promoLinks.push({
2406
+ promoId: promotion.IdSalesPromotionDTO,
2407
+ promoRuleId: promotion.PromotionRuleId
2408
+ });
2409
+ });
2410
+ if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
2411
+ }
2412
+ // 促销 end
2413
+ promoVoucher.voucherDetailList.push(detailDTO);
2414
+ });
2415
+ promoVoucher.promoLinks = this.checkList;
2416
+ return this.SettlementApi.findUsefulCouponPromoList(promoVoucher).then(function (result) {
2417
+ if (result && result.length != 0) {
2418
+ result.forEach(function (element, index) {
2419
+ var djq1 = false;
2420
+ _this19.currentMode.djqs.forEach(function (djq) {
2421
+ if (element.id === djq.id) {
2422
+ djq1 = true;
2423
+ }
2424
+ });
2425
+
2426
+ var _ref29 = element || {},
2427
+ couponCode = _ref29.couponCode,
2428
+ name = _ref29.name,
2429
+ tieredAmountResult = _ref29.tieredAmountResult,
2430
+ fromDate = _ref29.fromDate,
2431
+ dateMount = _ref29.dateMount,
2432
+ promoMethodEnum = _ref29.promoMethodEnum,
2433
+ discountPct = _ref29.discountPct,
2434
+ nominalAmount = _ref29.nominalAmount,
2435
+ promoId = _ref29.promoId,
2436
+ id = _ref29.id,
2437
+ doorsill = _ref29.doorsill;
2438
+
2439
+ var condValue = tieredAmountResult.condValue,
2440
+ promoDiscount = tieredAmountResult.promoDiscount,
2441
+ displayText = tieredAmountResult.displayText,
2442
+ promoRuleId = tieredAmountResult.promoRuleId,
2443
+ couponCategoryEnum = tieredAmountResult.couponCategoryEnum;
2444
+
2445
+ if (!djq1) {
2446
+ // this.currentMode.djqs.push({
2447
+ // promoCouponCode: element.CouponCode,
2448
+ // name: element.CouponTitle,
2449
+ // IsEnable: true,
2450
+ // amount: element.ReductionAmount,
2451
+ // doorsill: element.EnableAmount,
2452
+ // LastTS: element.LastTS,
2453
+ // checked: false,
2454
+ // IsRepelWithPoints: true,
2455
+ // UMemberID: dto.Idmember,
2456
+ // expired: null,
2457
+ // displayText,
2458
+ // promoMethodEnum,
2459
+ // discountPct,
2460
+ // promoId,
2461
+ // promoRuleId,
2462
+ // couponCategoryEnum: tieredAmountResult.couponCategoryEnum,
2463
+ // id
2464
+ // })
2465
+ _this19.addDjqs(couponCode, name, true, nominalAmount, promoDiscount, doorsill, element.LastTS, false, true, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, tieredAmountResult.couponCategoryEnum, id);
2466
+ djq1 = false;
2467
+ } else {
2468
+ _this19.setCouponNum(element.id, couponCategoryEnum, promoMethodEnum, nominalAmount, promoDiscount);
2469
+ // this.currentMode.djqs[0].couponCategoryEnum = 'couponCategoryEnum';
2470
+ // djq1.couponCategoryEnum = element.tieredAmountResult.couponCategoryEnum
2471
+ }
2472
+ });
2473
+ }
2474
+ // 优惠券【6052098985043】与【6120822326451】不可叠加使用
2475
+ });
2476
+ //this.receivable = getFixedNumber(this.receivable - sum);
2477
+ }
2478
+ }, {
2479
+ key: 'calcDjqValue',
2480
+ value: function calcDjqValue(q1) {
2481
+ var _enumController$getEn19 = _mutantsUtil.enumController.getEnumOj(),
2482
+ Differentiate = _enumController$getEn19.Differentiate;
2483
+
2484
+ if (q1) {
2485
+ if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
2486
+ _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
2487
+ return;
2488
+ }
2489
+ var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
2490
+ return djq.code == q1.code;
2491
+ });
2492
+ if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
2493
+ _message2.default.error("本单金额低于使用门槛,该券不可使用。");
2494
+ return;
2495
+ }
2496
+ //判断是否是选择优惠券 //CC优惠券只能使用一个
2497
+ // if (q1 && !q1.checked && isNewRetailBCPos) {
2498
+ // // 检查是否有已经选定优惠券 并且去除选定的优惠券
2499
+ // this.currentMode.djqs.forEach((djq, index) => {
2500
+ // if (djq.checked) this.currentMode.djqs[index].checked = false;
2501
+ // })
2502
+ // }
2503
+ q && (q.checked = !q.checked);
2504
+ }
2505
+ var sum = 0;
2506
+ // console.log(this.store, 'stores-------');
2507
+ (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
2508
+ return djq.checked;
2509
+ }), function (q) {
2510
+ sum = Math.Add(sum, q.amount);
2511
+ });
2512
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
2513
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
2514
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
2515
+
2516
+ //this.receivable = getFixedNumber(this.receivable - sum);
2517
+ }
2518
+ }, {
2519
+ key: 'reCalculationDjqs',
2520
+ value: function reCalculationDjqs() {
2521
+ var sum = 0;
2522
+ (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
2523
+ return djq.checked;
2524
+ }), function (q) {
2525
+ sum = Math.Add(sum, q.amount);
2526
+ });
2527
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
2528
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
2529
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
2530
+ this.currentMode.maxamount = this.currentMode.receivable || this.currentMode.receivable;
2531
+ }
2532
+ }, {
2533
+ key: 'clearDjqs',
2534
+ value: function clearDjqs() {
2535
+ this.currentMode.djqs = [];
2536
+ }
2537
+ }, {
2538
+ key: 'setCurrentModeValue',
2539
+ value: function setCurrentModeValue(v, max) {
2540
+ this.currentMode.value = parseFloat(v) || 0;
2541
+ this.currentMode.errinfo = '';
2542
+ var sum = this.amount;
2543
+
2544
+ var _enumController$getEn20 = _mutantsUtil.enumController.getEnumOj(),
2545
+ PayStyle = _enumController$getEn20.PayStyle;
2546
+
2547
+ this.thePaymodes && this.thePaymodes.forEach(function (mode) {
2548
+ if (mode.paymentType === PayStyle.hyczk) {
2549
+ sum -= mode.value;
2550
+ }
2551
+ });
2552
+
2553
+ if (this.amount > 0 && (v === '' || v === '0.00') && sum !== 0) {
2554
+ this.currentMode.errinfo = "实收金额必须录入";
2555
+ } else if (Math.abs(parseFloat(v)) > Math.abs((0, _utils.getFixedNumber)(sum))) {
2556
+ this.currentMode.errinfo = "实收不应大于应收";
2557
+ } else if (parseFloat(v) > 0 && parseFloat(v) > (max || 0)) {
2558
+ this.currentMode.errinfo = "余额不足";
2559
+ }
2560
+ // 如果是积分抵现的一些判断
2561
+ if (this.currentMode.paymentType === PayStyle.jfdx) {
2562
+ if (this.currentMode.integralCashOverOrderAmount === true) {
2563
+ this.currentMode.steadCashIntegral = Math.ceil(this.currentMode.value / this.currentMode.cashAmount) * this.currentMode.perIntegral;
2564
+ } else if (this.currentMode.integralCashOverOrderAmount === false) {
2565
+ var v1 = this.currentMode.value / this.currentMode.cashAmount;
2566
+ if ((0, _isInteger2.default)(v1)) {
2567
+ this.currentMode.steadCashIntegral = Math.floor(this.currentMode.value / this.currentMode.cashAmount) * this.currentMode.perIntegral;
2568
+ } else {
2569
+ this.currentMode.errinfo = '\u8BF7\u6309\u7167\u79EF\u5206\u62B5\u73B0\u89C4\u5219' + this.currentMode.perIntegral + '\u79EF\u5206\u62B5\u7528' + this.currentMode.cashAmount + '\u5143\u8F93\u5165\u91D1\u989D';
2570
+ }
2571
+ }
2572
+ }
2573
+ }
2574
+ }, {
2575
+ key: 'calcMemberBalance',
2576
+ value: function calcMemberBalance() {
2577
+ this.currentMode.balance = this.currentMode.rawbalance - this.currentMode.value;
2578
+ }
2579
+ }, {
2580
+ key: 'setPaymodes',
2581
+ value: function () {
2582
+ var _ref30 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15(type, isIntegralExchange) {
2583
+ var _this20 = this;
2584
+
2585
+ var _ref31, isHorizontalPad, isHorizontalSunMi, isMobileEnvironment, _enumController$getEn21, settleStyleType, PayStyle, memberStoreCode, settlementCode, param, modes;
2586
+
2587
+ return _regenerator2.default.wrap(function _callee15$(_context15) {
2588
+ while (1) {
2589
+ switch (_context15.prev = _context15.next) {
2590
+ case 0:
2591
+ // 是否移动端判断
2592
+ _ref31 = _mutantsUtil.platform || {}, isHorizontalPad = _ref31.isHorizontalPad, isHorizontalSunMi = _ref31.isHorizontalSunMi;
2593
+ isMobileEnvironment = !!isHorizontalPad || !!isHorizontalSunMi;
2594
+ _enumController$getEn21 = _mutantsUtil.enumController.getEnumOj(), settleStyleType = _enumController$getEn21.settleStyleType, PayStyle = _enumController$getEn21.PayStyle;
2595
+ memberStoreCode = settleStyleType.memberStoreCode, settlementCode = settleStyleType.settlementCode;
2596
+ param = { 'settleStyleType': type == 1 ? memberStoreCode : settlementCode, isIntegralExchange: isIntegralExchange };
2597
+ _context15.next = 7;
2598
+ return _settlementApi2.default.GetNewStoreSettleStyles({ param: param });
2599
+
2600
+ case 7:
2601
+ modes = _context15.sent;
2602
+
2603
+ if (modes) {
2604
+ (0, _mobx.runInAction)(function () {
2605
+ var paymodes = [];
2606
+ var settleLists = modes.SettleStyles;
2607
+ settleLists = isMobileEnvironment ? settleLists.filter(function (v) {
2608
+ return !v.ThirdPaymentInfo;
2609
+ }) : settleLists;
2610
+ (0, _each3.default)(settleLists, function (mode, index) {
2611
+ //产品需求确认会员储值卡结算方式前端展示统一调整为“储值卡" tuzha by 2020-07-08
2612
+ if (mode.Code == PayStyle.hyczk) {
2613
+ mode.Name = '储值卡';
2614
+ }
2615
+ paymodes.push({
2616
+ name: mode.Name,
2617
+ isDefault: mode.IsDefaultSettleStyle,
2618
+ isQuick: (0, _findIndex3.default)(modes.QuickSettleStyles, { 'Code': mode.Code }) >= 0,
2619
+ orderBy: 1,
2620
+ paymentType: mode.Code,
2621
+ offlineDisable: mode.offlineDisable,
2622
+ idSettleStyle: mode.IdSettleStyle,
2623
+ idBankAccount: mode.IdBankAccount,
2624
+ exchangeRate: mode.Currency ? mode.Currency.ExchangeRate : 1,
2625
+ idCurrency: mode.Currency ? mode.Currency.ID : -1,
2626
+ calDirection: mode.Currency ? mode.Currency.CalDirection.Id : "88",
2627
+ virtualPay: mode.VirtualPay,
2628
+ thridPayment: mode.ThirdPaymentInfo
2629
+ });
2630
+ });
2631
+ _this20.paymodes = paymodes;
2632
+ });
2633
+ }
2634
+
2635
+ case 9:
2636
+ case 'end':
2637
+ return _context15.stop();
2638
+ }
2639
+ }
2640
+ }, _callee15, this);
2641
+ }));
2642
+
2643
+ function setPaymodes(_x13, _x14) {
2644
+ return _ref30.apply(this, arguments);
2645
+ }
2646
+
2647
+ return setPaymodes;
2648
+ }()
2649
+ }, {
2650
+ key: 'charge',
2651
+ get: function get() {
2652
+ return Math.abs(this.receivable);
2653
+ }
2654
+ }, {
2655
+ key: 'counter',
2656
+ get: function get() {
2657
+ return ++this._counter;
2658
+ }
2659
+ }]);
2660
+ return PayMode;
2661
+ }(), (_descriptor7 = _applyDecoratedDescriptor(_class3.prototype, 'currentFocus', [_mobx.observable], {
2662
+ enumerable: true,
2663
+ initializer: function initializer() {
2664
+ return "";
2665
+ }
2666
+ }), _descriptor8 = _applyDecoratedDescriptor(_class3.prototype, 'received', [_mobx.observable], {
2667
+ enumerable: true,
2668
+ initializer: function initializer() {
2669
+ return 0;
2670
+ }
2671
+ }), _descriptor9 = _applyDecoratedDescriptor(_class3.prototype, 'receivable', [_mobx.observable], {
2672
+ enumerable: true,
2673
+ initializer: function initializer() {
2674
+ return 0;
2675
+ }
2676
+ }), _descriptor10 = _applyDecoratedDescriptor(_class3.prototype, 'paymodes', [_mobx.observable], {
2677
+ enumerable: true,
2678
+ initializer: function initializer() {
2679
+ return [];
2680
+ }
2681
+ }), _descriptor11 = _applyDecoratedDescriptor(_class3.prototype, 'thePaymodes', [_mobx.observable], {
2682
+ enumerable: true,
2683
+ initializer: function initializer() {
2684
+ return [];
2685
+ }
2686
+ }), _descriptor12 = _applyDecoratedDescriptor(_class3.prototype, 'storageCardNo', [_mobx.observable], {
2687
+ enumerable: true,
2688
+ initializer: function initializer() {
2689
+ return null;
2690
+ }
2691
+ }), _descriptor13 = _applyDecoratedDescriptor(_class3.prototype, 'balance', [_mobx.observable], {
2692
+ enumerable: true,
2693
+ initializer: function initializer() {
2694
+ return null;
2695
+ }
2696
+ }), _applyDecoratedDescriptor(_class3.prototype, 'clean', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'clean'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'clear', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'clear'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'calcReserved', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'calcReserved'), _class3.prototype), _descriptor14 = _applyDecoratedDescriptor(_class3.prototype, 'calcCheckList', [_mobx.action], {
2697
+ enumerable: true,
2698
+ initializer: function initializer() {
2699
+ var _this21 = this;
2700
+
2701
+ return function () {
2702
+ _this21.checkList = [];
2703
+ };
2704
+ }
2705
+ }), _applyDecoratedDescriptor(_class3.prototype, 'updateMemberStorageCardNo', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'updateMemberStorageCardNo'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'updateCardInfo', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'updateCardInfo'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'calcDjqCheckValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'calcDjqCheckValue'), _class3.prototype), _descriptor15 = _applyDecoratedDescriptor(_class3.prototype, 'setCouponNum', [_mobx.action], {
2706
+ enumerable: true,
2707
+ initializer: function initializer() {
2708
+ var _this22 = this;
2709
+
2710
+ return function (id, couponNum, promoMethodEnum, nominalAmount, promoDiscount) {
2711
+ _this22.currentMode.djqs.forEach(function (ele) {
2712
+ if (ele.id === id) {
2713
+ ele.amount = promoDiscount;
2714
+ promoMethodEnum == "CASH_COUPON" && (ele.nominalAmount = nominalAmount);
2715
+ ele.couponCategoryEnum = couponNum;
2716
+ var IsEnable = ele.couponCategoryEnum === 'RIGUP' || ele.couponCategoryEnum === 'UN_MATCH' || ele.couponCategoryEnum === "PREPARING" || ele.couponCategoryEnum === 'PROMO_LIMITED' || ele.couponCategoryEnum === 'COUPON_CONFLICT' ? false : true;
2717
+ ele.IsEnable = IsEnable;
2718
+ }
2719
+ });
2720
+ };
2721
+ }
2722
+ }), _descriptor16 = _applyDecoratedDescriptor(_class3.prototype, 'addDjqs', [_mobx.action], {
2723
+ enumerable: true,
2724
+ initializer: function initializer() {
2725
+ var _this23 = this;
2726
+
2727
+ return function (promoCouponCode, name, IsEnable, nominalAmount, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id) {
2728
+ var djq = {
2729
+ promoCouponCode: promoCouponCode,
2730
+ name: name,
2731
+ IsEnable: IsEnable,
2732
+ nominalAmount: nominalAmount,
2733
+ amount: amount,
2734
+ doorsill: doorsill,
2735
+ LastTS: LastTS,
2736
+ checked: checked,
2737
+ IsRepelWithPoints: IsRepelWithPoints,
2738
+ UMemberID: UMemberID,
2739
+ expired: expired,
2740
+ displayText: displayText,
2741
+ promoMethodEnum: promoMethodEnum,
2742
+ discountPct: discountPct,
2743
+ promoId: promoId,
2744
+ promoRuleId: promoRuleId,
2745
+ couponCategoryEnum: couponCategoryEnum,
2746
+ id: id
2747
+ };
2748
+ _this23.currentMode.djqs.push(djq);
2749
+ };
2750
+ }
2751
+ }), _applyDecoratedDescriptor(_class3.prototype, 'calcDjqValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'calcDjqValue'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'reCalculationDjqs', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'reCalculationDjqs'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'clearDjqs', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'clearDjqs'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'setCurrentModeValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'setCurrentModeValue'), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, 'calcMemberBalance', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'calcMemberBalance'), _class3.prototype)), _class3);
2752
+ var Member = exports.Member = (_class5 = function () {
2753
+ function Member(m) {
2754
+ var _this24 = this;
2755
+
2756
+ (0, _classCallCheck3.default)(this, Member);
2757
+
2758
+ _initDefineProp(this, 'cardNo', _descriptor17, this);
2759
+
2760
+ _initDefineProp(this, 'balance', _descriptor18, this);
2761
+
2762
+ _initDefineProp(this, 'exchangable', _descriptor19, this);
2763
+
2764
+ _initDefineProp(this, 'meStorageCardId', _descriptor20, this);
2765
+
2766
+ _initDefineProp(this, 'storageCardNo', _descriptor21, this);
2767
+
2768
+ if (m) {
2769
+ this.id = m.ID;
2770
+ this.uid = m.Uid;
2771
+ this.type = m.MemberType ? m.MemberType.Name : "普通";
2772
+ this.rawbalance = m.BalanceStorage;
2773
+ var index = (0, _findIndex3.default)(m.DynamicPropertyKeys, function (key) {
2774
+ return key == 'canusedbalancestorage';
2775
+ });
2776
+ (0, _mobx.runInAction)(function () {
2777
+ _this24.cardNo = m.CardCode;
2778
+ if (index >= 0) {
2779
+ _this24.balance = parseFloat(m.DynamicPropertyValues[index]);
2780
+ } else {
2781
+ _this24.balance = _this24.rawbalance;
2782
+ }
2783
+ });
2784
+ this.needPwd = m.MemberType ? m.MemberType.IsNeedPwd : false;
2785
+ this.NeedModifyPassword = m.NeedModifyPassword;
2786
+ this.bonusPoints = m.BalanceIntegral;
2787
+ }
2788
+ }
2789
+
2790
+ (0, _createClass3.default)(Member, [{
2791
+ key: 'setExchangable',
2792
+ value: function setExchangable(v) {
2793
+ this.exchangable = v;
2794
+ }
2795
+ }, {
2796
+ key: 'setCardNo',
2797
+ value: function setCardNo(v) {
2798
+ this.cardNo = v;
2799
+ this.id = null;
2800
+ }
2801
+ }]);
2802
+ return Member;
2803
+ }(), (_descriptor17 = _applyDecoratedDescriptor(_class5.prototype, 'cardNo', [_mobx.observable], {
2804
+ enumerable: true,
2805
+ initializer: null
2806
+ }), _descriptor18 = _applyDecoratedDescriptor(_class5.prototype, 'balance', [_mobx.observable], {
2807
+ enumerable: true,
2808
+ initializer: null
2809
+ }), _descriptor19 = _applyDecoratedDescriptor(_class5.prototype, 'exchangable', [_mobx.observable], {
2810
+ enumerable: true,
2811
+ initializer: null
2812
+ }), _descriptor20 = _applyDecoratedDescriptor(_class5.prototype, 'meStorageCardId', [_mobx.observable], {
2813
+ enumerable: true,
2814
+ initializer: null
2815
+ }), _descriptor21 = _applyDecoratedDescriptor(_class5.prototype, 'storageCardNo', [_mobx.observable], {
2816
+ enumerable: true,
2817
+ initializer: null
2818
+ }), _applyDecoratedDescriptor(_class5.prototype, 'setExchangable', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class5.prototype, 'setExchangable'), _class5.prototype), _applyDecoratedDescriptor(_class5.prototype, 'setCardNo', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class5.prototype, 'setCardNo'), _class5.prototype)), _class5);
2819
+ //# sourceMappingURL=settlementStore.js.map