tplus-components-touch 3.20.5 → 3.20.6

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 (48) hide show
  1. package/dist/components/commonForm/addressPicker/index.js +230 -0
  2. package/dist/components/commonForm/addressPicker/index.js.map +1 -0
  3. package/dist/components/commonForm/autoComplete/index.js +241 -0
  4. package/dist/components/commonForm/autoComplete/index.js.map +1 -0
  5. package/dist/components/commonForm/datePicker/index.js +89 -0
  6. package/dist/components/commonForm/datePicker/index.js.map +1 -0
  7. package/dist/components/commonForm/formControl/index.js +140 -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/prototypeTable/index.js +349 -0
  22. package/dist/components/settlement/prototypeTable/index.js.map +1 -0
  23. package/dist/components/settlement/prototypeTable/utils.js +14 -0
  24. package/dist/components/settlement/prototypeTable/utils.js.map +1 -0
  25. package/dist/components/settlement/settlement.less +0 -3
  26. package/dist/components/settlement/settlementStore.js +2119 -0
  27. package/dist/components/settlement/settlementStore.js.map +1 -0
  28. package/dist/components/settlement/utils.js +249 -0
  29. package/dist/components/settlement/utils.js.map +1 -0
  30. package/dist/components/spin/index.js +95 -0
  31. package/dist/components/spin/index.js.map +1 -0
  32. package/dist/components/test/index.js +330 -0
  33. package/dist/components/test/index.js.map +1 -0
  34. package/dist/components/ticon/iconfont/iconfont.js +35 -0
  35. package/dist/components/ticon/iconfont/iconfont.js.map +1 -0
  36. package/dist/components/ticon/index.js +60 -0
  37. package/dist/components/ticon/index.js.map +1 -0
  38. package/dist/components/touchScroll/index.js +182 -0
  39. package/dist/components/touchScroll/index.js.map +1 -0
  40. package/dist/components/touchTable/AuthProcess.js +42 -0
  41. package/dist/components/touchTable/AuthProcess.js.map +1 -0
  42. package/dist/components/touchTable/generateWater.js +59 -0
  43. package/dist/components/touchTable/generateWater.js.map +1 -0
  44. package/dist/components/touchTable/index.js +1101 -0
  45. package/dist/components/touchTable/index.js.map +1 -0
  46. package/dist/components/touchTable/utils.js +14 -0
  47. package/dist/components/touchTable/utils.js.map +1 -0
  48. package/package.json +1 -1
@@ -0,0 +1,2119 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Member = exports.PayMode = exports.default = undefined;
7
+
8
+ var _defineProperty = require('babel-runtime/core-js/object/define-property');
9
+
10
+ var _defineProperty2 = _interopRequireDefault(_defineProperty);
11
+
12
+ var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor');
13
+
14
+ var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
15
+
16
+ var _stringify = require('babel-runtime/core-js/json/stringify');
17
+
18
+ var _stringify2 = _interopRequireDefault(_stringify);
19
+
20
+ var _promise = require('babel-runtime/core-js/promise');
21
+
22
+ var _promise2 = _interopRequireDefault(_promise);
23
+
24
+ var _regenerator = require('babel-runtime/regenerator');
25
+
26
+ var _regenerator2 = _interopRequireDefault(_regenerator);
27
+
28
+ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
29
+
30
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
31
+
32
+ var _extends2 = require('babel-runtime/helpers/extends');
33
+
34
+ var _extends3 = _interopRequireDefault(_extends2);
35
+
36
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
37
+
38
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
39
+
40
+ var _createClass2 = require('babel-runtime/helpers/createClass');
41
+
42
+ var _createClass3 = _interopRequireDefault(_createClass2);
43
+
44
+ var _desc, _value, _class, _descriptor, _descriptor2, _desc2, _value2, _class3, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _desc3, _value3, _class5, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15;
45
+
46
+ var _mobx = require('mobx');
47
+
48
+ var _mutantsMicrofx = require('mutants-microfx');
49
+
50
+ var _find2 = require('lodash/find');
51
+
52
+ var _find3 = _interopRequireDefault(_find2);
53
+
54
+ var _remove2 = require('lodash/remove');
55
+
56
+ var _remove3 = _interopRequireDefault(_remove2);
57
+
58
+ var _each2 = require('lodash/each');
59
+
60
+ var _each3 = _interopRequireDefault(_each2);
61
+
62
+ var _map2 = require('lodash/map');
63
+
64
+ var _map3 = _interopRequireDefault(_map2);
65
+
66
+ var _join2 = require('lodash/join');
67
+
68
+ var _join3 = _interopRequireDefault(_join2);
69
+
70
+ var _trim2 = require('lodash/trim');
71
+
72
+ var _trim3 = _interopRequireDefault(_trim2);
73
+
74
+ var _filter2 = require('lodash/filter');
75
+
76
+ var _filter3 = _interopRequireDefault(_filter2);
77
+
78
+ var _findIndex2 = require('lodash/findIndex');
79
+
80
+ var _findIndex3 = _interopRequireDefault(_findIndex2);
81
+
82
+ var _findLastIndex2 = require('lodash/findLastIndex');
83
+
84
+ var _findLastIndex3 = _interopRequireDefault(_findLastIndex2);
85
+
86
+ var _findKey2 = require('lodash/findKey');
87
+
88
+ var _findKey3 = _interopRequireDefault(_findKey2);
89
+
90
+ var _tplusPoslogin = require('tplus-poslogin');
91
+
92
+ var _utils = require('./utils');
93
+
94
+ var _tplusApi = require('tplus-api');
95
+
96
+ var _message = require('../message');
97
+
98
+ var _message2 = _interopRequireDefault(_message);
99
+
100
+ var _mutantsUtil = require('mutants-util');
101
+
102
+ var _moment = require('moment');
103
+
104
+ var _moment2 = _interopRequireDefault(_moment);
105
+
106
+ var _tplusComponentsTouch = require('tplus-components-touch');
107
+
108
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
109
+
110
+ function _initDefineProp(target, property, descriptor, context) {
111
+ if (!descriptor) return;
112
+ (0, _defineProperty2.default)(target, property, {
113
+ enumerable: descriptor.enumerable,
114
+ configurable: descriptor.configurable,
115
+ writable: descriptor.writable,
116
+ value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
117
+ });
118
+ }
119
+
120
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
121
+ var desc = {};
122
+ Object['ke' + 'ys'](descriptor).forEach(function (key) {
123
+ desc[key] = descriptor[key];
124
+ });
125
+ desc.enumerable = !!desc.enumerable;
126
+ desc.configurable = !!desc.configurable;
127
+
128
+ if ('value' in desc || desc.initializer) {
129
+ desc.writable = true;
130
+ }
131
+
132
+ desc = decorators.slice().reverse().reduce(function (desc, decorator) {
133
+ return decorator(target, property, desc) || desc;
134
+ }, desc);
135
+
136
+ if (context && desc.initializer !== void 0) {
137
+ desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
138
+ desc.initializer = undefined;
139
+ }
140
+
141
+ if (desc.initializer === void 0) {
142
+ Object['define' + 'Property'](target, property, desc);
143
+ desc = null;
144
+ }
145
+
146
+ return desc;
147
+ }
148
+
149
+ function _initializerWarningHelper(descriptor, context) {
150
+ throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
151
+ }
152
+
153
+ var t = _mutantsMicrofx.i18n.getFixedT(null, 'newretail');
154
+
155
+ var SettlementStore = (_class = function () {
156
+ //type==2
157
+ function SettlementStore() {
158
+ var _this2 = this;
159
+
160
+ (0, _classCallCheck3.default)(this, SettlementStore);
161
+ this.paymode = null;
162
+ this.dto = null;
163
+ this.member = null;
164
+ this.brefund = false;
165
+ this.bquick = false;
166
+ this.boriginReturn = false;
167
+ this.newStyle = true;
168
+
169
+ _initDefineProp(this, 'queryPwd', _descriptor, this);
170
+
171
+ _initDefineProp(this, 'updateMemberInfo', _descriptor2, this);
172
+
173
+ this.getCouponList = function (coupon_code) {
174
+ var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
175
+ PayStyle = _enumController$getEn.PayStyle,
176
+ Differentiate = _enumController$getEn.Differentiate;
177
+
178
+ var couponApplyRule = (0, _tplusPoslogin.PosInitData)('CouponApplyRule');
179
+
180
+ var _enumController$getEn2 = _mutantsUtil.enumController.getEnumOj(),
181
+ CouponApplyRule = _enumController$getEn2.CouponApplyRule;
182
+
183
+ if (couponApplyRule == CouponApplyRule.SHOWN_BY_CUSTOMER && !!coupon_code || couponApplyRule != CouponApplyRule.SHOWN_BY_CUSTOMER) {
184
+ var dto = _this2.dto;
185
+ var promoVoucher = {};
186
+ _this2.paymode.clearDjqs();
187
+ _this2.paymode.reCalculationDjqs();
188
+ // promoVoucher.bizDate = dto.VoucherDate;
189
+ // promoVoucher.bizDate = new Date().getTime();
190
+ promoVoucher.coupon_code = coupon_code || "";
191
+ promoVoucher.boName = "Retail";
192
+ promoVoucher.voucherId = dto.ID;
193
+ var onlinePaymentAmount = 0;
194
+ if (dto.OnlinePaymentAmount) {
195
+ onlinePaymentAmount = dto.OnlinePaymentAmount;
196
+ }
197
+ promoVoucher.totalAmountWithTax = Math.Minus(dto.TotalTaxAmount, onlinePaymentAmount);
198
+ promoVoucher.redBlueFlagEnum = "BLUE";
199
+ promoVoucher.meMemberId = dto.Idmember;
200
+ promoVoucher.storeFactorId = dto.Idstore;
201
+ promoVoucher.voucherDetailList = [];
202
+ dto.RetailDetails.forEach(function (item) {
203
+ var detailDTO = {};
204
+ detailDTO.uuid = item.Code;
205
+ detailDTO.detailBoName = "RetailDetail";
206
+ detailDTO.voucherDetailId = item.ID;
207
+ detailDTO.productId = item.Idinventory;
208
+ detailDTO.uomId = item.Idunit;
209
+ detailDTO.productSpecId = item.ProductSpecId;
210
+ detailDTO.isManualFreeGift = item.IsPresent;
211
+ detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
212
+
213
+ if (detailDTO.IsManualChangePrice) //如果是手工改价
214
+ {
215
+ detailDTO.listPrice = item.TaxPrice;
216
+ detailDTO.netAmountWithTax = item.TaxAmount;
217
+ } else {
218
+ var bookingQuantity = 0;
219
+ if (item.BookingQuantity) {
220
+ bookingQuantity = item.BookingQuantity;
221
+ }
222
+ detailDTO.listPrice = item.MemberPrice;
223
+ detailDTO.netAmountWithTax = Math.Multiply(item.MemberPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
224
+ }
225
+ detailDTO.taxRate = item.TaxRate;
226
+ detailDTO.quantity = item.Quantity;
227
+
228
+ detailDTO.amountWithTax = item.RetailAmount;
229
+ // 促销 start
230
+ if (item.PromotionDetails && item.PromotionDetails.length != 0) {
231
+ var promoLinks = [];
232
+ item.PromotionDetails.forEach(function (promotion) {
233
+ promoLinks.push({
234
+ promoId: promotion.IdSalesPromotionDTO,
235
+ promoRuleId: promotion.PromotionRuleId
236
+ });
237
+ });
238
+ if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
239
+ }
240
+ // 促销 end
241
+ promoVoucher.voucherDetailList.push(detailDTO);
242
+ });
243
+
244
+ return (0, _tplusApi.ccApi)((0, _extends3.default)({}, promoVoucher), 'promotion/PromoCalculate/findUsefulCouponPromoList', false, false, { method: 'post', timeout_skip: true }).then(function (result) {
245
+ if (result && result.length != 0) {
246
+ result.forEach(function (element) {
247
+ var _ref = element || {},
248
+ couponCode = _ref.couponCode,
249
+ name = _ref.name,
250
+ tieredAmountResult = _ref.tieredAmountResult,
251
+ fromDate = _ref.fromDate,
252
+ dateMount = _ref.dateMount,
253
+ promoMethodEnum = _ref.promoMethodEnum,
254
+ discountPct = _ref.discountPct,
255
+ nominalAmount = _ref.nominalAmount,
256
+ promoId = _ref.promoId,
257
+ id = _ref.id;
258
+
259
+ var condValue = tieredAmountResult.condValue,
260
+ promoDiscount = tieredAmountResult.promoDiscount,
261
+ displayText = tieredAmountResult.displayText,
262
+ promoRuleId = tieredAmountResult.promoRuleId;
263
+
264
+ if ((0, _find3.default)(_this2.paymode.currentMode.djqs, function (djq) {
265
+ return djq.code == couponCode;
266
+ })) {
267
+ _message2.default.info(Differentiate.COUPON + '\u5DF2\u6DFB\u52A0');
268
+ } else if (result.IsRepelWithPoints && (0, _find3.default)(_this2.paymode.thePaymodes, function (themode) {
269
+ return themode.paymentType == PayStyle.jfdx;
270
+ })) {
271
+ _message2.default.error(Differentiate.COUPON + '\uFF08' + result.SN + '\uFF09\u4E0D\u53EF\u4E0E\u79EF\u5206\u4E00\u8D77\u4F7F\u7528');
272
+ } else {
273
+ _this2.addDjq(couponCode, name, promoMethodEnum == "CASH_COUPON" ? nominalAmount : promoDiscount, condValue, null, false, !result.IsRepelWithPoints, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, id, true);
274
+ }
275
+ });
276
+ if (promoVoucher.coupon_code) {
277
+ _this2.paymode.calcDjqValue(_this2.paymode.currentMode.djqs[0]);
278
+ }
279
+ } else {
280
+ if (promoVoucher.coupon_code) {
281
+ _message2.default.info(Differentiate.COUPON + '\u53F7\u4E0D\u5B58\u5728\uFF01');
282
+ _this2.getCouponList();
283
+ } else {
284
+ _message2.default.info('\u6CA1\u6709\u627E\u5230\u53EF\u4F7F\u7528\u7684' + Differentiate.COUPON + '\uFF01');
285
+ }
286
+ }
287
+ });
288
+ }
289
+ };
290
+
291
+ this.getSettleGift = function () {
292
+ return (0, _tplusApi.ccApi)({}, '/marketingtool/paygift/executeRightsForPos/' + _this2.billID, false, false, { method: 'get', timeout_skip: true });
293
+ };
294
+
295
+ this.checkCoupon = function () {
296
+ var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(sn) {
297
+ var _ref3, isNewRetailBCPos, _enumController$getEn3, PayStyle, Differentiate;
298
+
299
+ return _regenerator2.default.wrap(function _callee$(_context) {
300
+ while (1) {
301
+ switch (_context.prev = _context.next) {
302
+ case 0:
303
+ _ref3 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref3.isNewRetailBCPos;
304
+
305
+ if (!isNewRetailBCPos) {
306
+ _context.next = 7;
307
+ break;
308
+ }
309
+
310
+ _context.next = 4;
311
+ return _this2.getCouponList(sn);
312
+
313
+ case 4:
314
+ return _context.abrupt('return', _context.sent);
315
+
316
+ case 7:
317
+ _enumController$getEn3 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn3.PayStyle, Differentiate = _enumController$getEn3.Differentiate;
318
+ return _context.abrupt('return', (0, _tplusApi.tApi)({ request: {
319
+ Uid: _this2.paymode.currentMode.member.uid || '',
320
+ SN: sn,
321
+ StoreCode: _this2.dto.Idstore,
322
+ Inventories: (0, _map3.default)((0, _filter3.default)(_this2.dto.RetailDetails, function (d) {
323
+ return d.Quantity > 0 && !d.IsPresent;
324
+ }), function (detail) {
325
+ return {
326
+ IdInventory: detail.Inventory.ID,
327
+ IdUnit: detail.Idunit,
328
+ Code: detail.Inventory.Code,
329
+ FreeItem0: JSON.getCellValue(detail, "freeitem0"),
330
+ FreeItem1: JSON.getCellValue(detail, "freeitem1"),
331
+ FreeItem2: JSON.getCellValue(detail, "freeitem2"),
332
+ FreeItem3: JSON.getCellValue(detail, "freeitem3"),
333
+ FreeItem4: JSON.getCellValue(detail, "freeitem4"),
334
+ FreeItem5: JSON.getCellValue(detail, "freeitem5"),
335
+ FreeItem6: JSON.getCellValue(detail, "freeitem6"),
336
+ FreeItem7: JSON.getCellValue(detail, "freeitem7"),
337
+ FreeItem8: JSON.getCellValue(detail, "freeitem8"),
338
+ FreeItem9: JSON.getCellValue(detail, "freeitem9")
339
+ };
340
+ }),
341
+ // inventoryCodes:_join(_map(this.dto.RetailDetails,(detail)=>{return detail.Inventory.Code;}),','),
342
+ InventoryClassCodes: (0, _join3.default)((0, _map3.default)((0, _filter3.default)(_this2.dto.RetailDetails, function (d) {
343
+ return d.Quantity > 0;
344
+ }), function (detail) {
345
+ return (detail.Inventory.InventoryClass || { Code: '' }).Code;
346
+ }), ','),
347
+ Amount: _this2.paymode.amount
348
+ } }, 'chanjet.AA.DR.coupon.CheckCoupon', false, false).then(function (result) {
349
+ if ((0, _find3.default)(_this2.paymode.currentMode.djqs, function (djq) {
350
+ return djq.code == result.SN;
351
+ })) {
352
+ _message2.default.info(Differentiate.COUPON + '\u5DF2\u6DFB\u52A0');
353
+ } else if (result.IsRepelWithPoints && (0, _find3.default)(_this2.paymode.thePaymodes, function (themode) {
354
+ return themode.paymentType == PayStyle.jfdx;
355
+ })) {
356
+ _message2.default.error(Differentiate.COUPON + '\uFF08' + result.SN + '\uFF09\u4E0D\u53EF\u4E0E\u79EF\u5206\u4E00\u8D77\u4F7F\u7528');
357
+ } else {
358
+ _this2.addDjq(result.SN, result.Title, result.ReduceAmount, result.StartAmount, result.LastTS, false, !result.IsRepelWithPoints, result.UMemberID);
359
+ }
360
+ }));
361
+
362
+ case 9:
363
+ case 'end':
364
+ return _context.stop();
365
+ }
366
+ }
367
+ }, _callee, _this2);
368
+ }));
369
+
370
+ return function (_x) {
371
+ return _ref2.apply(this, arguments);
372
+ };
373
+ }();
374
+
375
+ this.checkIntegralExchangeReturn = function (id) {
376
+ return new _promise2.default(function (resolve, reject) {
377
+ (0, _tplusApi.tApi)({ param: { refVoucherId: id } }, 'chanjet.RE.NewPos.GetNewIntegralExchange', false, false, { timeout_skip: true }).then(function (resp) {
378
+ if (resp && resp.expireIntegral > 0) {
379
+ _tplusComponentsTouch.ModalWraper.confirm({
380
+ className: 'tplus-confirm-modal',
381
+ title: "温馨提示",
382
+ 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',
383
+ cancelable: false,
384
+ onOk: function onOk() {
385
+ resolve(true);
386
+ },
387
+ onCancel: function onCancel() {
388
+ reject(false);
389
+ }
390
+ });
391
+ } else {
392
+ resolve(true);
393
+ }
394
+ });
395
+ });
396
+ };
397
+
398
+ this.paymode = new PayMode();
399
+ var params = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('cloudPrintArguments');
400
+ if (params) this.cloudPrintArguments = params;
401
+ this.printUtil = new _tplusComponentsTouch.PrintUtil();
402
+ this.newStyle = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') == 'voucher';
403
+ }
404
+
405
+ (0, _createClass3.default)(SettlementStore, [{
406
+ key: 'initPaymodes',
407
+ value: function initPaymodes(event, type, isIntegralExchange) {
408
+ this.isIntegralExchange = isIntegralExchange;
409
+ this.paymode.setPaymodes(type, isIntegralExchange);
410
+ this.updateEvent = event;
411
+ }
412
+ }, {
413
+ key: 'init',
414
+ value: function init(context, amounthandler, datasource, storeinfo, bquick, amount, type, data) {
415
+ var _this3 = this;
416
+
417
+ this.newStyle = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') == 'voucher';
418
+ this.type = type;
419
+ if (context) {
420
+ this.context = context;
421
+ this.amountHandler = amounthandler;
422
+ this.dataSource = datasource;
423
+ this.storeInfo = storeinfo;
424
+ this.dto = context.viewModel.data;
425
+ (0, _mobx.runInAction)(function () {
426
+ // 单品金额抹零
427
+ if (global.DealSingleRowAmountSettingProcessorBlock) {
428
+ global.DealSingleRowAmountSettingProcessorBlock.execute(_this3.dto);
429
+ }
430
+ // 成交金额抹零
431
+ if (global.DealAmountSettingProcessorBlock) {
432
+ global.DealAmountSettingProcessorBlock.execute(_this3.dto);
433
+ }
434
+ });
435
+ // this.member=context.stores && context.stores.memberStore && context.stores.memberStore.member;
436
+ this.member = this.dto.Member; //stores.selectMemberStore.selectMemberInfo;
437
+ this.brefund = this.paymode.setAmount(this.dto.TotalTaxAmount, this.dto.OnlinePaymentAmount);
438
+ } else {
439
+ this.brefund = this.paymode.setAmount(amount, 0);
440
+ this.dto = data;
441
+ }
442
+ this.paymode.clean();
443
+
444
+ //this.dto.TotalTaxAmount<0;
445
+ this.bquick = !!bquick;
446
+ this.boriginReturn = JSON.getCellValue(this.dto, "IsOriginalReturn");
447
+ if (this.boriginReturn) {
448
+ this.initByOriginReturn();
449
+ }
450
+ if (this.newStyle) {
451
+ this.setModes();
452
+ }
453
+ }
454
+ }, {
455
+ key: 'setModes',
456
+ value: function setModes() {
457
+ var _this4 = this;
458
+
459
+ (0, _each3.default)(this.paymode.paymodes, function (p) {
460
+ if ((0, _findIndex3.default)(_this4.paymode.thePaymodes, function (mode) {
461
+ return p.paymentType == mode.paymentType;
462
+ }) == -1) {
463
+ _this4.addPay(p.paymentType);
464
+ }
465
+ });
466
+ if (!this.boriginReturn && this.paymode.thePaymodes.length > 0) {
467
+ this.changeValue(this.paymode.thePaymodes[0].paymethodId, 0, true);
468
+ }
469
+ }
470
+ }, {
471
+ key: 'amountChanged',
472
+ value: function amountChanged(amount) {
473
+ if (this.type == 1) {
474
+ this.brefund = this.paymode.setAmount(amount, 0);
475
+ }
476
+ }
477
+ }, {
478
+ key: 'initByOriginReturn',
479
+ value: function initByOriginReturn() {
480
+ var _this5 = this;
481
+
482
+ var _enumController$getEn4 = _mutantsUtil.enumController.getEnumOj(),
483
+ PayStyle = _enumController$getEn4.PayStyle;
484
+
485
+ var _ref4 = _mutantsUtil.platform || {},
486
+ isNewRetailBCPos = _ref4.isNewRetailBCPos;
487
+
488
+ (0, _each3.default)(this.dto.RetailPaymentDetails, function (detail) {
489
+ var themode = (0, _find3.default)(_this5.paymode.paymodes, { 'idSettleStyle': detail.IdsettleStyle });
490
+ if (detail.SettleStyle.Code === PayStyle.hyczk && !themode) {
491
+ _tplusComponentsTouch.ModalWraper.info({
492
+ title: '温馨提示',
493
+ content: '没有储值结算方式,请在后台添加储值余额结算方式。',
494
+ okText: '确定',
495
+ okType: 'primary'
496
+ });
497
+ }
498
+ if (themode && themode.paymentType && themode.paymentType != PayStyle.hyczk) {
499
+ var newmode = (0, _extends3.default)({}, _this5.genNewMode(themode.paymentType, false, detail.Amount), {
500
+ authCode: detail.PaymentCode,
501
+ steadCashIntegral: detail.SteadCashIntegral,
502
+ overchargesAmount: detail.OverchargesAmount,
503
+ boriginReturn: true
504
+ });
505
+ _this5.paymode.currentMode = newmode;
506
+ if (themode.paymentType == PayStyle.djq) {
507
+ (0, _each3.default)(_this5.dto.RetailCouponDetails, function (djq) {
508
+ if (isNewRetailBCPos) {
509
+ var _ref5 = djq || {},
510
+ displayText = _ref5.displayText,
511
+ promoRuleId = _ref5.promoRuleId,
512
+ dateMount = _ref5.dateMount,
513
+ promoMethodEnum = _ref5.promoMethodEnum,
514
+ discountPct = _ref5.discountPct,
515
+ promoId = _ref5.promoId,
516
+ id = _ref5.id;
517
+
518
+ _this5.addDjq(djq.CouponCode, djq.CouponTitle, djq.ReductionAmount, djq.EnableAmount, djq.LastTS, true, false, _this5.dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, id, true);
519
+ return;
520
+ }
521
+ _this5.addDjq(djq.CouponCode, djq.CouponTitle, djq.ReductionAmount, djq.EnableAmount, djq.LastTS, true, false);
522
+ });
523
+ }
524
+ _this5.paymode.thePaymodes.push(newmode);
525
+ }
526
+ });
527
+ (0, _each3.default)(this.dto.RetailStorageDetails, function (detail) {
528
+ var balanceAmount = detail.Member.BalanceStorage;
529
+ balanceAmount = balanceAmount - detail.StoragePaymentAmount;
530
+ var newmode = (0, _extends3.default)({}, _this5.genNewMode(PayStyle.hyczk, false, detail.StoragePaymentAmount), {
531
+ member: new Member(detail.Member),
532
+ authCode: detail.Password,
533
+ balance: balanceAmount,
534
+ boriginReturn: true
535
+ });
536
+ _this5.paymode.thePaymodes.push(newmode);
537
+ });
538
+ this.paymode.calcReserved();
539
+ }
540
+ }, {
541
+ key: 'clean',
542
+ value: function clean() {
543
+ this.bquick = false;
544
+ this.paymode.clean();
545
+ }
546
+ }, {
547
+ key: 'quickSettle',
548
+ value: function quickSettle(key) {
549
+ this.addPay(key);
550
+ }
551
+
552
+ //outer call
553
+ //(type===PayStyle.hyczk || type===PayStyle.jfczk || type===PayStyle.jfdx || type===PayStyle.djq)
554
+
555
+ }, {
556
+ key: 'changeFocusAndAddPay',
557
+ value: function changeFocusAndAddPay(type) {
558
+ var _this6 = this;
559
+
560
+ var _enumController$getEn5 = _mutantsUtil.enumController.getEnumOj(),
561
+ PayStyle = _enumController$getEn5.PayStyle;
562
+
563
+ this.paymode.currentFocus = type;
564
+ if (this.paymode.currentMode) {
565
+ if (type == PayStyle.jfdx) {
566
+ if (this.newStyle) {
567
+ var index = (0, _findIndex3.default)(this.paymode.thePaymodes, function (m) {
568
+ return m.paymentType == PayStyle.jfdx;
569
+ });
570
+ this.paymode.thePaymodes.splice(index, 1, this.paymode.currentMode);
571
+ this.paymode.calcReserved();
572
+ } else {
573
+ this.addPayDirectly(this.paymode.currentMode);
574
+ }
575
+
576
+ //抵现积分
577
+ (0, _tplusApi.tApi)({ IntegralSteadCashParams: {
578
+ Idmember: this.paymode.currentMode.member.id,
579
+ TotalTaxAmount: this.paymode.amount,
580
+ BalanceTaxAmount: this.paymode.currentMode.value
581
+ } }, 'AA.DR.newRetailMember.CalculdateIntegralSteadCash', false, false).then(function (result) {
582
+ _this6.paymode.currentMode.steadCashIntegral = result.Integral;
583
+ _this6.paymode.currentMode.overchargesAmount = result.Amount - _this6.paymode.currentMode.value;
584
+ });
585
+ } else {
586
+ this.addPayDirectly(this.paymode.currentMode);
587
+ }
588
+ } else {
589
+ this.addPay(type);
590
+ }
591
+ }
592
+
593
+ // 设置密码后更新会员信息
594
+
595
+ }, {
596
+ key: 'getLoginInfo',
597
+ value: function getLoginInfo() {
598
+ var _ref6 = _mutantsMicrofx.localStore.get('user') || {},
599
+ _ref6$loginInfo = _ref6.loginInfo,
600
+ loginInfo = _ref6$loginInfo === undefined ? {} : _ref6$loginInfo;
601
+
602
+ return loginInfo;
603
+ }
604
+ }, {
605
+ key: 'loadCzk',
606
+ value: function loadCzk(v) {
607
+ var _this7 = this;
608
+
609
+ if ((0, _trim3.default)(v) === "") {
610
+ (0, _mobx.runInAction)(function () {
611
+ _this7.paymode.currentMode.member = new Member(null);
612
+ _this7.paymode.currentMode.errinfo = "请输入储值卡";
613
+ });
614
+ return;
615
+ }
616
+ var IdStore = this.storeInfo.storeID;
617
+ var StoreCode = this.storeInfo.storeCode; //_find(this.storeInfo.storeInfos,(store)=>{return store.ID==IdStore;}).Code;
618
+
619
+ var _ref7 = _mutantsUtil.platform || {},
620
+ isNewRetailBCPos = _ref7.isNewRetailBCPos;
621
+
622
+ var address = '';
623
+ if (isNewRetailBCPos) {
624
+ // address = '/member/memberProfile/FindByStorageCode/'+v;
625
+ address = '/member/MeMemberWallet/FindByStorageCode';
626
+ return (0, _tplusApi.ccApi)({ code: v }, address, false, false, { method: 'get', timeout_skip: true }).then(function (result) {
627
+ var data = result.data;
628
+ var m = data;
629
+
630
+ var _ref8 = _mutantsUtil.platform || {},
631
+ isNewRetailBCPos = _ref8.isNewRetailBCPos;
632
+
633
+ if (isNewRetailBCPos) {
634
+ _this7.paymode && _this7.paymode.currentMode.member.setMeStorageCardId(m.MeStorageCardId);
635
+ _this7.paymode && _this7.paymode.currentMode.member.setStorageCardNo(m.StorageCardNo);
636
+ _this7.paymode && (_this7.paymode.currentMode.MeStorageCardId = m.MeStorageCardId);
637
+ _this7.paymode && (_this7.paymode.currentMode.StorageCardNo = m.StorageCardNo);
638
+ }
639
+ if (!m || !m.ID) {
640
+ (0, _mobx.runInAction)(function () {
641
+ _this7.paymode.currentMode.errinfo = "无效的会员卡号";
642
+ });
643
+ } else {
644
+ (0, _mobx.runInAction)(function () {
645
+ _this7.paymode.currentMode.errinfo = "";
646
+ _this7.paymode.currentMode.member = new Member(m);
647
+ _this7.paymode.currentMode.value = (0, _utils.getFixedNumber)(_this7.brefund ? _this7.paymode.receivable : Math.max(_this7.paymode.receivable, 0));
648
+ _this7.updateEvent();
649
+ var message = '';
650
+ if (global.CheckMemberStorageProcessorBlock) {
651
+ message = CheckMemberStorageProcessorBlock.execute(m);
652
+ }
653
+ if (!String.isNullOrEmpty(message)) {
654
+ _this7.paymode.currentMode.errinfo = message;
655
+ } else if (_this7.checkReceived(_this7.paymode.currentMode, "balance")) {
656
+ _this7.paymode.currentMode.errinfo = "余额不足";
657
+ } else if (_this7.paymode.amount > 0 && _this7.paymode.currentMode.value == 0) {
658
+ _this7.paymode.currentMode.errinfo = "实收金额必须录入";
659
+ } else {
660
+ // 查询成功后将焦点移入下一个输入框
661
+ var nextInput = document.querySelector('.czk .received .input');
662
+ nextInput && nextInput.focus();
663
+ }
664
+ });
665
+ }
666
+ });
667
+ } else {
668
+ address = 'AA.DR.newRetailMember.SearchMember';
669
+ return (0, _tplusApi.tApi)({ SearchParams: { Key: v, IsSingleMember: true, IdStore: IdStore, StoreCode: StoreCode } }, address, false, false).then(function (result) {
670
+ var data = JSON.parse(result.Data);
671
+ var m = data && data.length > 0 && data[0];
672
+
673
+ var _ref9 = _mutantsUtil.platform || {},
674
+ isNewRetailBCPos = _ref9.isNewRetailBCPos;
675
+
676
+ if (isNewRetailBCPos) {
677
+ _this7.paymode && _this7.paymode.currentMode.member.setMeStorageCardId(m.MeStorageCardId);
678
+ _this7.paymode && _this7.paymode.currentMode.member.setStorageCardNo(m.StorageCardNo);
679
+ _this7.paymode && (_this7.paymode.currentMode.MeStorageCardId = m.MeStorageCardId);
680
+ _this7.paymode && (_this7.paymode.currentMode.StorageCardNo = m.StorageCardNo);
681
+ }
682
+ if (!m || !m.ID) {
683
+ (0, _mobx.runInAction)(function () {
684
+ _this7.paymode.currentMode.errinfo = "无效的会员卡号";
685
+ });
686
+ } else {
687
+ (0, _mobx.runInAction)(function () {
688
+ _this7.paymode.currentMode.errinfo = "";
689
+ _this7.paymode.currentMode.member = new Member(m);
690
+ _this7.paymode.currentMode.value = (0, _utils.getFixedNumber)(_this7.brefund ? _this7.paymode.receivable : Math.max(_this7.paymode.receivable, 0));
691
+ _this7.updateEvent();
692
+ var message = '';
693
+ if (global.CheckMemberStorageProcessorBlock) {
694
+ message = CheckMemberStorageProcessorBlock.execute(data[0]);
695
+ }
696
+ if (!String.isNullOrEmpty(message)) {
697
+ _this7.paymode.currentMode.errinfo = message;
698
+ } else if (_this7.checkReceived(_this7.paymode.currentMode, "balance")) {
699
+ _this7.paymode.currentMode.errinfo = "余额不足";
700
+ } else if (_this7.paymode.amount > 0 && _this7.paymode.currentMode.value == 0) {
701
+ _this7.paymode.currentMode.errinfo = "实收金额必须录入";
702
+ } else {
703
+ // 查询成功后将焦点移入下一个输入框
704
+ var nextInput = document.querySelector('.czk .received .input');
705
+ nextInput && nextInput.focus();
706
+ }
707
+ });
708
+ }
709
+ });
710
+ }
711
+ }
712
+ }, {
713
+ key: 'addDjq',
714
+ value: function addDjq(code, name, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, id, unCheck) {
715
+ var djq = {
716
+ code: code,
717
+ name: name,
718
+ amount: amount,
719
+ doorsill: doorsill, //:"无门槛"
720
+ LastTS: LastTS,
721
+ checked: checked,
722
+ IsRepelWithPoints: IsRepelWithPoints,
723
+ UMemberID: UMemberID,
724
+ expired: expired, //还剩多少过期
725
+ displayText: displayText,
726
+ promoMethodEnum: promoMethodEnum,
727
+ discountPct: discountPct,
728
+ promoId: promoId,
729
+ promoRuleId: promoRuleId,
730
+ id: id
731
+ };
732
+ this.paymode.currentMode.djqs.push(djq);
733
+ !unCheck && !this.boriginReturn && this.paymode.calcDjqValue(djq);
734
+ }
735
+ }, {
736
+ key: 'setCurrentMode',
737
+ value: function setCurrentMode(id, type, append) {
738
+ var _enumController$getEn6 = _mutantsUtil.enumController.getEnumOj(),
739
+ PayStyle = _enumController$getEn6.PayStyle;
740
+
741
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { paymethodId: id });
742
+ if (mode) {
743
+ this.paymode.currentMode = mode;
744
+ if (this.newStyle) {
745
+ this.afterSetCurrentMode(type);
746
+ }
747
+ } else {
748
+ this.paymode.currentMode = this.genNewMode(type, append);
749
+ this.afterSetCurrentMode(type);
750
+ }
751
+ }
752
+ }, {
753
+ key: 'afterSetCurrentMode',
754
+ value: function afterSetCurrentMode(type) {
755
+ var _this8 = this;
756
+
757
+ var _enumController$getEn7 = _mutantsUtil.enumController.getEnumOj(),
758
+ PayStyle = _enumController$getEn7.PayStyle;
759
+
760
+ if (type == PayStyle.djq) {
761
+ this.paymode.calcDjqValue();
762
+ } else if (type == PayStyle.jfdx) {
763
+ //获取可兑换的金额
764
+ if (this.newStyle) {
765
+ var themode = (0, _find3.default)(this.paymode.thePaymodes, { paymentType: PayStyle.jfdx });
766
+ if (themode && parseFloat(themode.value || 0) != 0) {
767
+ this.paymode.currentMode.value = themode.value;
768
+ }
769
+ }
770
+
771
+ (0, _tplusApi.tApi)({ IntegralSteadCashParams: {
772
+ Idmember: this.paymode.currentMode.member.id,
773
+ TotalTaxAmount: this.paymode.amount,
774
+ BalanceTaxAmount: this.paymode.amount
775
+ } }, 'AA.DR.newRetailMember.CalculdateIntegralSteadCash', false, false).then(function (result) {
776
+ _this8.paymode.currentMode.member.setExchangable(result.MaxAmount);
777
+ _this8.updateEvent();
778
+ if (_this8.checkReceived(_this8.paymode.currentMode, "exchangable")) {
779
+ (0, _mobx.runInAction)(function () {
780
+ _this8.paymode.currentMode.errinfo = '余额不足';
781
+ });
782
+ }
783
+ });
784
+ }
785
+ }
786
+ }, {
787
+ key: 'checkReceived',
788
+ value: function checkReceived(mode, name) {
789
+ return !this.brefund && parseFloat(mode.value) > parseFloat(mode.maxamount || mode.member[name] || 0);
790
+ }
791
+ }, {
792
+ key: 'genNewMode',
793
+ value: function genNewMode(type, notwithm, v) {
794
+ var _enumController$getEn8 = _mutantsUtil.enumController.getEnumOj(),
795
+ PayStyle = _enumController$getEn8.PayStyle;
796
+
797
+ var value = (0, _utils.getFixedNumber)(v || (this.brefund ? this.paymode.receivable : Math.max(this.paymode.receivable, 0)));
798
+ var themode = (0, _find3.default)(this.paymode.paymodes, { 'paymentType': type });
799
+ var mode = (0, _mobx.observable)({
800
+ paymethodId: this.paymode.counter,
801
+ name: themode.name,
802
+ exchangeRate: themode.exchangeRate,
803
+ calDirection: themode.calDirection,
804
+ value: value,
805
+ value2: (0, _utils.getFixedNumber)(themode.calDirection == "88" ? value / themode.exchangeRate : value * themode.exchangeRate),
806
+ value3: value,
807
+ order: this.paymode.thePaymodes.length + 1,
808
+ paymentType: type,
809
+ djqs: [],
810
+ member: new Member(!notwithm ? this.member : null),
811
+ authCode: '',
812
+ steadCashIntegral: null,
813
+ errinfo: '',
814
+ maxamount: this.paymode.amount
815
+ });
816
+ if (type == PayStyle.hyczk) {
817
+ if (!mode.member.id) {
818
+ (0, _mobx.runInAction)(function () {
819
+ mode.errinfo = '未录入储值卡';
820
+ });
821
+ } else if (this.checkReceived(mode, "balance")) {
822
+ (0, _mobx.runInAction)(function () {
823
+ mode.errinfo = '余额不足';
824
+ });
825
+ }
826
+ }
827
+ if (type == PayStyle.hyczk || type == PayStyle.jfdx || type == PayStyle.djq) {
828
+ this.setMaxAmount(type, mode);
829
+ }
830
+ console.log(mode);
831
+ return mode;
832
+ }
833
+ }, {
834
+ key: 'setMaxAmount',
835
+ value: function setMaxAmount(type, mode) {
836
+ var _this9 = this;
837
+
838
+ var _enumController$getEn9 = _mutantsUtil.enumController.getEnumOj(),
839
+ PayStyle = _enumController$getEn9.PayStyle;
840
+
841
+ var sum = 0;
842
+ if (type == PayStyle.hyczk) {
843
+ (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
844
+ return m.paymentType == type;
845
+ }), function (q) {
846
+ sum = Math.Add(sum, q.value);
847
+ });
848
+ } else if (type == PayStyle.djq || type == PayStyle.jfdx) {
849
+ (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
850
+ return m.paymentType == PayStyle.djq || m.paymentType == PayStyle.jfdx;
851
+ }), function (q) {
852
+ sum = Math.Add(sum, q.value);
853
+ });
854
+ }
855
+
856
+ this.amountHandler && this.amountHandler(type).then(function () {
857
+ (0, _mobx.runInAction)(function () {
858
+ mode.maxamount = (0, _utils.getFixedNumber)(Math.Minus(_this9.context.viewModel.getViewItem('Voucher').availableAmount, sum));
859
+ _this9.updateEvent();
860
+ });
861
+ });
862
+ }
863
+ }, {
864
+ key: 'changeFocusOnly',
865
+ value: function changeFocusOnly(type) {
866
+ this.paymode.currentFocus = type;
867
+ // 获取焦点时带入剩余的值
868
+ // let mode=_find(this.paymode.thePaymodes,{'paymentType':type});
869
+ // if(mode && this.isIntegralExchange){
870
+ // const shouldSetValue =getFixedNumber(parseFloat(this.paymode.receivable) + parseFloat(mode.value));
871
+ // mode.value = shouldSetValue;
872
+ // mode.value2 = getFixedNumber(mode.calDirection=="88"?shouldSetValue / mode.exchangeRate:(shouldSetValue * mode.exchangeRate));
873
+ // mode.value3 = shouldSetValue;
874
+ // this.paymode.calcReserved();
875
+ // }
876
+ }
877
+ }, {
878
+ key: 'changeClickFocusOnly',
879
+ value: function changeClickFocusOnly(type) {
880
+ this.paymode.currentFocus = type;
881
+ // 获取焦点时带入剩余的值
882
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymentType': type });
883
+ if (mode) {
884
+ var shouldSetValue = (0, _utils.getFixedNumber)(parseFloat(this.paymode.receivable) + parseFloat(mode.value));
885
+ mode.value = shouldSetValue;
886
+ mode.value2 = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? shouldSetValue / mode.exchangeRate : shouldSetValue * mode.exchangeRate);
887
+ mode.value3 = shouldSetValue;
888
+ this.paymode.calcReserved();
889
+ }
890
+ }
891
+ }, {
892
+ key: 'changeValue',
893
+ value: function changeValue(index, value, blur) {
894
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymethodId': index });
895
+ var v = blur ? (0, _utils.getFixedNumber)(value) : isNaN(value) && value != '-' ? 0.00 : value;
896
+ if (mode) {
897
+ if (mode.exchangeRate != 1) {
898
+ if ((0, _utils.getFixedNumber)(mode.calDirection == "88" ? mode.value3 / mode.exchangeRate : mode.value3 * mode.exchangeRate) != v) {
899
+ mode.value = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? v * mode.exchangeRate : v / mode.exchangeRate);
900
+ } else {
901
+ mode.value = mode.value3;
902
+ }
903
+ mode.value2 = v;
904
+ } else {
905
+ mode.value = v;
906
+ mode.value2 = v;
907
+ }
908
+
909
+ this.paymode.calcReserved();
910
+ }
911
+ }
912
+ }, {
913
+ key: 'addPayDirectly',
914
+ value: function addPayDirectly(pay) {
915
+ var _enumController$getEn10 = _mutantsUtil.enumController.getEnumOj(),
916
+ PayStyle = _enumController$getEn10.PayStyle;
917
+
918
+ if (!(0, _find3.default)(this.paymode.thePaymodes, { paymethodId: pay.paymethodId })) {
919
+ var pos = this.paymode.thePaymodes.length;
920
+ if (pay.paymentType == PayStyle.hyczk) {
921
+ var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
922
+ return m.paymethodId != pay.paymethodId && m.paymentType == PayStyle.hyczk;
923
+ });
924
+ pos = index == -1 ? pos : index + 1;
925
+ }
926
+ // this.paymode.thePaymodes.push(pay);
927
+ this.paymode.thePaymodes.splice(pos, 0, pay);
928
+ }
929
+ this.paymode.calcReserved();
930
+ }
931
+ }, {
932
+ key: 'addPay',
933
+ value: function addPay(type) {
934
+ var _enumController$getEn11 = _mutantsUtil.enumController.getEnumOj(),
935
+ PayStyle = _enumController$getEn11.PayStyle;
936
+
937
+ var pos = this.paymode.thePaymodes.length;
938
+ if (type == PayStyle.hyczk) {
939
+ var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
940
+ return m.paymentType == PayStyle.hyczk;
941
+ });
942
+ pos = index == -1 ? pos : index + 1;
943
+ }
944
+ // this.paymode.thePaymodes.push(this.genNewMode(type) );
945
+ this.paymode.thePaymodes.splice(pos, 0, this.genNewMode(type, this.newStyle && type == PayStyle.hyczk));
946
+ this.paymode.calcReserved();
947
+ }
948
+ }, {
949
+ key: 'delPay',
950
+ value: function delPay(index) {
951
+ var _this10 = this;
952
+
953
+ (0, _remove3.default)(this.paymode.thePaymodes, function (mode) {
954
+ if (mode.paymethodId === index) {
955
+ _this10.paymode.amount = _this10.paymode.amount + mode.value;
956
+ }
957
+ return mode.paymethodId === index;
958
+ });
959
+ this.paymode.currentFocus = -1;
960
+ this.paymode.calcReserved();
961
+ }
962
+ }, {
963
+ key: 'commit',
964
+ value: function () {
965
+ var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(bTest) {
966
+ return _regenerator2.default.wrap(function _callee2$(_context2) {
967
+ while (1) {
968
+ switch (_context2.prev = _context2.next) {
969
+ case 0:
970
+ console.log('settlementStore.commit开始,参数:' + bTest);
971
+
972
+ if (!bTest) {
973
+ _context2.next = 3;
974
+ break;
975
+ }
976
+
977
+ return _context2.abrupt('return', _promise2.default.resolve(true));
978
+
979
+ case 3:
980
+ _context2.prev = 3;
981
+
982
+ if (!(this.type == 1)) {
983
+ _context2.next = 9;
984
+ break;
985
+ }
986
+
987
+ _context2.next = 7;
988
+ return this.saveMember();
989
+
990
+ case 7:
991
+ _context2.next = 11;
992
+ break;
993
+
994
+ case 9:
995
+ _context2.next = 11;
996
+ return this.save();
997
+
998
+ case 11:
999
+ return _context2.abrupt('return', _promise2.default.resolve(true));
1000
+
1001
+ case 14:
1002
+ _context2.prev = 14;
1003
+ _context2.t0 = _context2['catch'](3);
1004
+
1005
+ console.error('settlementStore.commit失败,错误信息:' + _context2.t0);
1006
+ return _context2.abrupt('return', _promise2.default.resolve(_context2.t0));
1007
+
1008
+ case 18:
1009
+ console.error('settlementStore.commit失败,错误信息:' + err);
1010
+
1011
+ case 19:
1012
+ case 'end':
1013
+ return _context2.stop();
1014
+ }
1015
+ }
1016
+ }, _callee2, this, [[3, 14]]);
1017
+ }));
1018
+
1019
+ function commit(_x2) {
1020
+ return _ref10.apply(this, arguments);
1021
+ }
1022
+
1023
+ return commit;
1024
+ }()
1025
+ }, {
1026
+ key: 'saveMember',
1027
+ value: function saveMember() {
1028
+ var _this11 = this;
1029
+
1030
+ var _enumController$getEn12 = _mutantsUtil.enumController.getEnumOj(),
1031
+ PayStyle = _enumController$getEn12.PayStyle;
1032
+
1033
+ (0, _mobx.runInAction)(function () {
1034
+ _this11.dto.StorageMutiSettleDetails = [];
1035
+ var thePaymodes = _this11.newStyle ? (0, _filter3.default)(_this11.paymode.thePaymodes, function (mode) {
1036
+ return parseFloat(mode.value) != 0;
1037
+ }) : _this11.paymode.thePaymodes;
1038
+ (0, _each3.default)(thePaymodes, function (mode) {
1039
+ var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': mode.paymentType });
1040
+
1041
+ var value = parseFloat(mode.value);
1042
+ var giveChange = null;
1043
+ if (mode.paymentType == PayStyle.xianjin && _this11.paymode.receivable < 0 && value > Math.abs(_this11.paymode.receivable)) {
1044
+ value = Math.Add(value, _this11.paymode.receivable);
1045
+ giveChange = Math.abs(_this11.paymode.receivable);
1046
+ }
1047
+ _this11.dto.StorageMutiSettleDetails.push({
1048
+ Code: mode.paymethodId,
1049
+ StorageAmount: value,
1050
+ GiveChange: giveChange,
1051
+ IdsettleStyle: themode.idSettleStyle,
1052
+ IdbankAccount: themode.idBankAccount,
1053
+ PaymentCode: mode.authCode,
1054
+ DynamicPropertyKeys: [],
1055
+ DynamicPropertyValues: [],
1056
+ DataSource: { Id: _this11.dataSource }
1057
+ });
1058
+ });
1059
+ });
1060
+ // cc结算调用
1061
+ var IPMSG = {};
1062
+ if (!!window.localStorage.IPMSG) {
1063
+ IPMSG = JSON.parse(window.localStorage.IPMSG);
1064
+ }
1065
+ return (0, _tplusApi.tApi)({ dto: this.dto }, 'chanjet.ME.INewRetailMemberStorage.Save', false, false).then(function (resp) {
1066
+ var _ref11 = _mutantsUtil.platform || {},
1067
+ isHorizontalPad = _ref11.isHorizontalPad,
1068
+ isHorizontalSunMi = _ref11.isHorizontalSunMi;
1069
+
1070
+ if (isHorizontalPad === true) {
1071
+ // pad打印
1072
+ //执行移动端云打印
1073
+ if (_this11.cloudPrintArguments) {
1074
+ var _ref12 = _this11.cloudPrintArguments || {},
1075
+ Open = _ref12.Open,
1076
+ Key = _ref12.Key,
1077
+ Sign = _ref12.Sign,
1078
+ Name = _ref12.Name,
1079
+ Card = _ref12.Card;
1080
+
1081
+ if (!Open) {
1082
+ _message2.default.warn(t('云打印未启用,请设置。'));
1083
+ return;
1084
+ }
1085
+ _this11.printUtil.doStoragePrint({ Key: Key, Sign: Sign, Name: Name, Card: Card }, resp.ID, function (s) {
1086
+ var msg = s.msg,
1087
+ ret = s.ret;
1088
+
1089
+ if (ret === 0) {
1090
+ _message2.default.success(t('打印储值小票成功。'));
1091
+ } else if (ret === -1) {
1092
+ _message2.default.error(t(msg));
1093
+ } else {
1094
+ _message2.default.error(t('打印储值小票失败。'));
1095
+ }
1096
+ });
1097
+ } else {
1098
+ _message2.default.warn(t('云打印未启用,请设置。'));
1099
+ }
1100
+ return;
1101
+ } else if (isHorizontalSunMi === true) {
1102
+ _this11.printUtil.doStoragePrint({}, resp.ID, function (s) {
1103
+ var msg = s.msg,
1104
+ ret = s.ret;
1105
+
1106
+ if (ret === 0) {
1107
+ _message2.default.success(t('打印储值小票成功。'));
1108
+ } else if (ret === -1) {
1109
+ _message2.default.error(t(msg));
1110
+ } else {
1111
+ _message2.default.error(t('打印储值小票失败。'));
1112
+ }
1113
+ });
1114
+ return;
1115
+ } else {
1116
+ if (global.StoragePrintProcessBlock) {
1117
+ var _ref13 = _mutantsUtil.platform || {},
1118
+ isNewRetailBCPos = _ref13.isNewRetailBCPos;
1119
+
1120
+ if (isNewRetailBCPos) {
1121
+ global.StoragePrintProcessBlock.execute(resp);
1122
+ } else {
1123
+ global.StoragePrintProcessBlock.execute(resp.ID);
1124
+ }
1125
+ return;
1126
+ } else {
1127
+ _message2.default.warn(t('打印小票只能在客户端中执行'));
1128
+ return;
1129
+ }
1130
+ }
1131
+ });
1132
+ }
1133
+ }, {
1134
+ key: 'save',
1135
+ value: function () {
1136
+ var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
1137
+ var _this12 = this;
1138
+
1139
+ var _enumController$getEn13, PayStyle, _ref16, isNewRetailBCPos, IPMSG, RetailTypeEnum;
1140
+
1141
+ return _regenerator2.default.wrap(function _callee3$(_context3) {
1142
+ while (1) {
1143
+ switch (_context3.prev = _context3.next) {
1144
+ case 0:
1145
+ _enumController$getEn13 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn13.PayStyle;
1146
+
1147
+ (0, _mobx.runInAction)(function () {
1148
+ _this12.dto.RetailPaymentDetails = [];
1149
+ _this12.dto.RetailStorageDetails = [];
1150
+ _this12.dto.RetailCouponDetails = [];
1151
+ var czkSum = 0;
1152
+ var Idmember = _this12.dto.Idmember;
1153
+ var count = 0;
1154
+ var thePaymodes = _this12.newStyle ? (0, _filter3.default)(_this12.paymode.thePaymodes, function (mode) {
1155
+ return parseFloat(mode.value) != 0;
1156
+ }) : _this12.paymode.thePaymodes;
1157
+ (0, _each3.default)(thePaymodes, function (mode, index) {
1158
+ var themode = (0, _find3.default)(_this12.paymode.paymodes, { 'paymentType': mode.paymentType });
1159
+ if (mode.paymentType == PayStyle.hyczk) {
1160
+ if (!Idmember) {
1161
+ Idmember = mode.member.id;
1162
+ }
1163
+ czkSum = Math.Add(czkSum, mode.value);
1164
+ var MeStorageCardId = mode.member.MeStorageCardId ? mode.member.MeStorageCardId : _this12.member.MeStorageCardId;
1165
+ _this12.dto.RetailStorageDetails.push({
1166
+ Code: mode.paymethodId,
1167
+ MeStorageCardId: MeStorageCardId,
1168
+ StoragePaymentAmount: mode.value,
1169
+ IsOrigReturn: false,
1170
+ BalanceStorage: mode.balance,
1171
+ Idmember: mode.member.id,
1172
+ DynamicPropertyKeys: [],
1173
+ DynamicPropertyValues: [],
1174
+ DataSource: { Id: _this12.dataSource },
1175
+ Password: mode.authCode
1176
+ });
1177
+ } else {
1178
+ var value = parseFloat(mode.value);
1179
+ var giveChange = null;
1180
+ if (mode.paymentType == PayStyle.xianjin && _this12.paymode.receivable < 0 && value > Math.abs(_this12.paymode.receivable)) {
1181
+ value = Math.Add(value, _this12.paymode.receivable);
1182
+ giveChange = Math.abs(_this12.paymode.receivable);
1183
+ }
1184
+ _this12.dto.RetailPaymentDetails.push({
1185
+ Code: mode.paymethodId,
1186
+ OrigAmount: mode.exchangeRate != 1 ? mode.value2 : value,
1187
+ Amount: value,
1188
+ GiveChange: giveChange,
1189
+ IdsettleStyle: themode.idSettleStyle,
1190
+ IdbankAccount: themode.idBankAccount,
1191
+ Idcurrency: themode.idCurrency,
1192
+ ExchangeRate: themode.exchangeRate,
1193
+ PaymentCode: mode.authCode,
1194
+ SteadCashIntegral: mode.steadCashIntegral,
1195
+ OverchargesAmount: mode.overchargesAmount,
1196
+ DynamicPropertyKeys: [],
1197
+ DynamicPropertyValues: [],
1198
+ DataSource: { Id: _this12.dataSource }
1199
+ });
1200
+ if (mode.paymentType == PayStyle.djq) {
1201
+ (0, _each3.default)(mode.djqs, function (djq) {
1202
+ if (djq.checked) {
1203
+ _this12.dto.RetailCouponDetails.push({
1204
+ CouponCode: djq.code,
1205
+ ReductionAmount: djq.amount,
1206
+ EnableAmount: djq.doorsill,
1207
+ CouponTitle: djq.name,
1208
+ IdMember: djq.UMemberID ? mode.member.id : null,
1209
+ LastTS: djq.LastTS,
1210
+ PromotionId: djq.promoId,
1211
+ PromotionRuleId: djq.promoRuleId,
1212
+ PromoCouponAllocatedId: djq.id,
1213
+ DataSource: { Id: _this12.dataSource }
1214
+ });
1215
+ }
1216
+ });
1217
+ }
1218
+ }
1219
+ });
1220
+
1221
+ var _ref15 = _mutantsUtil.platform || {},
1222
+ isNewRetailBCPos = _ref15.isNewRetailBCPos;
1223
+
1224
+ if (_this12.dto.RetailStorageDetails.length > 0) {
1225
+ var themode = (0, _find3.default)(_this12.paymode.paymodes, { 'paymentType': PayStyle.hyczk });
1226
+ if (isNewRetailBCPos) {
1227
+ // this.dto.RetailStorageDetails && this.dto.RetailStorageDetails.forEach((value, index) => {
1228
+ // value.MeStorageCardId = (mode.MeStorageCardId ? mode.MeStorageCardId : this.member.MeStorageCardId);
1229
+ // })
1230
+ _this12.dto.RetailPaymentDetails.push({
1231
+ Code: _this12.paymode.counter,
1232
+ OrigAmount: czkSum,
1233
+ Amount: czkSum,
1234
+ IdsettleStyle: themode.idSettleStyle,
1235
+ IdbankAccount: themode.idBankAccount,
1236
+ DynamicPropertyKeys: [],
1237
+ DynamicPropertyValues: [],
1238
+ DataSource: { Id: _this12.dataSource },
1239
+ RetailStorageDetails: _this12.dto.RetailStorageDetails
1240
+ });
1241
+ } else {
1242
+ _this12.dto.RetailPaymentDetails.push({
1243
+ Code: _this12.paymode.counter,
1244
+ OrigAmount: czkSum,
1245
+ Amount: czkSum,
1246
+ IdsettleStyle: themode.idSettleStyle,
1247
+ IdbankAccount: themode.idBankAccount,
1248
+ DynamicPropertyKeys: [],
1249
+ DynamicPropertyValues: [],
1250
+ DataSource: { Id: _this12.dataSource }
1251
+ });
1252
+ }
1253
+ _this12.dto.Idmember = Idmember;
1254
+ }
1255
+ });
1256
+ _ref16 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref16.isNewRetailBCPos;
1257
+
1258
+ console.log('bc_pos\u73AF\u5883:' + isNewRetailBCPos + ',\u7ED3\u7B97\u6570\u636E\uFF1A', this.dto);
1259
+
1260
+ if (!isNewRetailBCPos) {
1261
+ _context3.next = 20;
1262
+ break;
1263
+ }
1264
+
1265
+ // cc结算调用
1266
+ IPMSG = {};
1267
+
1268
+ if (!!window.localStorage.IPMSG) {
1269
+ IPMSG = JSON.parse(window.localStorage.IPMSG);
1270
+ }
1271
+ RetailTypeEnum = this.dto.IdbusiType == 36 ? "INTEGRAL_EXCHANGE" : "NORMAL";
1272
+ _context3.t1 = this.dto.IdbusiType == 37;
1273
+
1274
+ if (!_context3.t1) {
1275
+ _context3.next = 13;
1276
+ break;
1277
+ }
1278
+
1279
+ _context3.next = 12;
1280
+ return this.checkIntegralExchangeReturn(this.dto.RetailDetails[0].ReturnSourceId);
1281
+
1282
+ case 12:
1283
+ _context3.t1 = _context3.sent;
1284
+
1285
+ case 13:
1286
+ _context3.t0 = _context3.t1;
1287
+
1288
+ if (_context3.t0) {
1289
+ _context3.next = 16;
1290
+ break;
1291
+ }
1292
+
1293
+ _context3.t0 = this.dto.IdbusiType != 37;
1294
+
1295
+ case 16:
1296
+ if (!_context3.t0) {
1297
+ _context3.next = 18;
1298
+ break;
1299
+ }
1300
+
1301
+ return _context3.abrupt('return', (0, _tplusApi.ccApi)({ dto: (0, _extends3.default)({}, this.dto.cut(), { RetailOms: { RetailTypeEnum: RetailTypeEnum } }), cip: IPMSG.query || "" }, '/retail/RetailPos/settle', false, false, { method: 'post', timeout_skip: true }).then(function (resp) {
1302
+ _this12.setDtoID(resp.ID);
1303
+ _this12.billID = resp.ID;
1304
+ }));
1305
+
1306
+ case 18:
1307
+ _context3.next = 21;
1308
+ break;
1309
+
1310
+ case 20:
1311
+ return _context3.abrupt('return', (0, _tplusApi.tApi)({ dto: this.dto.cut() }, 'chanjet.RE.newRetail.Settle', false, false, { timeout_skip: true }).then(function (resp) {
1312
+ _this12.setDtoID(resp.ID);
1313
+ _this12.billID = resp.ID;
1314
+ }));
1315
+
1316
+ case 21:
1317
+ case 'end':
1318
+ return _context3.stop();
1319
+ }
1320
+ }
1321
+ }, _callee3, this);
1322
+ }));
1323
+
1324
+ function save() {
1325
+ return _ref14.apply(this, arguments);
1326
+ }
1327
+
1328
+ return save;
1329
+ }()
1330
+ }, {
1331
+ key: 'setDtoID',
1332
+ value: function setDtoID(id) {
1333
+ this.context.viewModel.data.ID = id;
1334
+ }
1335
+ }, {
1336
+ key: 'querySettleResult',
1337
+ value: function () {
1338
+ var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
1339
+ return _regenerator2.default.wrap(function _callee4$(_context4) {
1340
+ while (1) {
1341
+ switch (_context4.prev = _context4.next) {
1342
+ case 0:
1343
+ _context4.prev = 0;
1344
+ _context4.t0 = _promise2.default;
1345
+ _context4.next = 4;
1346
+ return (0, _tplusApi.tApi)({ RetailCode: this.dto.Code }, 'chanjet.RE.newRetail.QuerySettleResult', false, false, { timeout_skip: true });
1347
+
1348
+ case 4:
1349
+ _context4.t1 = _context4.sent;
1350
+ return _context4.abrupt('return', _context4.t0.resolve.call(_context4.t0, _context4.t1));
1351
+
1352
+ case 8:
1353
+ _context4.prev = 8;
1354
+ _context4.t2 = _context4['catch'](0);
1355
+ return _context4.abrupt('return', _promise2.default.resolve({ Flag: "1" }));
1356
+
1357
+ case 11:
1358
+ case 'end':
1359
+ return _context4.stop();
1360
+ }
1361
+ }
1362
+ }, _callee4, this, [[0, 8]]);
1363
+ }));
1364
+
1365
+ function querySettleResult() {
1366
+ return _ref17.apply(this, arguments);
1367
+ }
1368
+
1369
+ return querySettleResult;
1370
+ }()
1371
+ }, {
1372
+ key: 'setCookie',
1373
+ value: function setCookie(key, val) {
1374
+ var exp = new Date();
1375
+ exp.setTime((0, _moment2.default)().endOf('day').valueOf());
1376
+ document.cookie = key + '=' + val + ';expires=' + exp.toGMTString();
1377
+ }
1378
+ }, {
1379
+ key: 'getAllCookies',
1380
+ value: function getAllCookies() {
1381
+ var cookies = document.cookie.split(/;\s/g);
1382
+ var cookieObj = {};
1383
+ cookies.forEach(function (item) {
1384
+ var key = item.split('=')[0];
1385
+ cookieObj[key] = item.split('=')[1];
1386
+ });
1387
+ return cookieObj;
1388
+ }
1389
+ }, {
1390
+ key: 'validePwd',
1391
+ value: function () {
1392
+ var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(value) {
1393
+ var _ref19, isNewRetailBCPos, cook1, cook2, message, result, count, _result;
1394
+
1395
+ return _regenerator2.default.wrap(function _callee5$(_context5) {
1396
+ while (1) {
1397
+ switch (_context5.prev = _context5.next) {
1398
+ case 0:
1399
+ _ref19 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref19.isNewRetailBCPos;
1400
+ _context5.prev = 1;
1401
+
1402
+ if (!isNewRetailBCPos) {
1403
+ _context5.next = 18;
1404
+ break;
1405
+ }
1406
+
1407
+ cook1 = this.getAllCookies()['errorPwd'];
1408
+ cook2 = cook1 && JSON.parse(cook1);
1409
+ message = '密码输入错误';
1410
+
1411
+ if (!cook2) {
1412
+ _context5.next = 11;
1413
+ break;
1414
+ }
1415
+
1416
+ if (!cook2.hasOwnProperty(this.member.MeStorageCardId + "")) {
1417
+ _context5.next = 11;
1418
+ break;
1419
+ }
1420
+
1421
+ if (!(cook2[this.member.MeStorageCardId] > 3)) {
1422
+ _context5.next = 11;
1423
+ break;
1424
+ }
1425
+
1426
+ message = '今日密码错误已达上限,不可使用储值消费,请明日再试,如忘记请重置密码或修改密码。';
1427
+ return _context5.abrupt('return', _promise2.default.resolve(message));
1428
+
1429
+ case 11:
1430
+ _context5.next = 13;
1431
+ return (0, _tplusApi.ccApi)({ password: _tplusApi.User.pwdEncrypt(value.pwd) }, '/member/MeMemberWallet/checkPaymentPassword/' + value.id, false, false);
1432
+
1433
+ case 13:
1434
+ result = _context5.sent;
1435
+
1436
+ if (!result.data) {
1437
+ if (cook2) {
1438
+ if (cook2.hasOwnProperty(this.member.MeStorageCardId + "")) {
1439
+ count = cook2[this.member.MeStorageCardId];
1440
+
1441
+ cook2[this.member.MeStorageCardId] = count + 1;
1442
+ } else {
1443
+ cook2[this.member.MeStorageCardId] = 1;
1444
+ }
1445
+ } else {
1446
+ cook2 = {};
1447
+ cook2[this.member.MeStorageCardId] = 1;
1448
+ }
1449
+ this.setCookie('errorPwd', '', -1);
1450
+ this.setCookie('errorPwd', (0, _stringify2.default)(cook2));
1451
+ }
1452
+ return _context5.abrupt('return', _promise2.default.resolve(result.data ? "" : message));
1453
+
1454
+ case 18:
1455
+ _context5.next = 20;
1456
+ return (0, _tplusApi.tApi)({ "CheckoutParams": {
1457
+ "Idmember": value.id,
1458
+ "Password": value.pwd
1459
+ } }, 'AA.DR.newRetailMember.CheckoutMemberPassword', false, false);
1460
+
1461
+ case 20:
1462
+ _result = _context5.sent;
1463
+ return _context5.abrupt('return', _promise2.default.resolve(_result.Success ? "" : _result.Message));
1464
+
1465
+ case 22:
1466
+ _context5.next = 27;
1467
+ break;
1468
+
1469
+ case 24:
1470
+ _context5.prev = 24;
1471
+ _context5.t0 = _context5['catch'](1);
1472
+ return _context5.abrupt('return', "failed");
1473
+
1474
+ case 27:
1475
+ case 'end':
1476
+ return _context5.stop();
1477
+ }
1478
+ }
1479
+ }, _callee5, this, [[1, 24]]);
1480
+ }));
1481
+
1482
+ function validePwd(_x3) {
1483
+ return _ref18.apply(this, arguments);
1484
+ }
1485
+
1486
+ return validePwd;
1487
+ }()
1488
+ }]);
1489
+ return SettlementStore;
1490
+ }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'queryPwd', [_mobx.action], {
1491
+ enumerable: true,
1492
+ initializer: function initializer() {
1493
+ var _this13 = this;
1494
+
1495
+ return function (newPass, newPassConfirm) {
1496
+ if (!newPass || !newPassConfirm) {
1497
+ return _message2.default.warn('您还有未填写项');
1498
+ }
1499
+ if (newPass !== newPassConfirm) {
1500
+ return _message2.default.warn('您两次输入的密码不一致');
1501
+ }
1502
+ var idstore = (0, _tplusPoslogin.PosInitData)('storeID');
1503
+ return (0, _tplusApi.ccApi)({
1504
+ Idstore: idstore,
1505
+ meMemberId: _this13.member.ID,
1506
+ oldPassword: null,
1507
+ newPassword: _tplusApi.User.pwdEncrypt(newPassConfirm),
1508
+ dataSource: "POS"
1509
+ }, '/member/MeMemberWallet/setWalletPayPassword', false, false, { method: 'post', timeout_skip: true }).then(function (resp) {
1510
+ if (resp.successful) {
1511
+ return true;
1512
+ }
1513
+ });
1514
+ };
1515
+ }
1516
+ }), _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), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'updateMemberInfo', [_mobx.action], {
1517
+ enumerable: true,
1518
+ initializer: function initializer() {
1519
+ var _this14 = this;
1520
+
1521
+ return function () {
1522
+ var _ref20 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(_this) {
1523
+ var _getLoginInfo, IdStore, StoreCode, resp;
1524
+
1525
+ return _regenerator2.default.wrap(function _callee6$(_context6) {
1526
+ while (1) {
1527
+ switch (_context6.prev = _context6.next) {
1528
+ case 0:
1529
+ _getLoginInfo = _this14.getLoginInfo(), IdStore = _getLoginInfo.IdStore, StoreCode = _getLoginInfo.StoreCode;
1530
+ _context6.next = 3;
1531
+ return (0, _tplusApi.tApi)({ Idmember: _this14.member.ID, IdStore: IdStore, StoreCode: StoreCode }, 'chanjet.AA.DR.INewRetailMember.GetUmemberDTO', false, false);
1532
+
1533
+ case 3:
1534
+ resp = _context6.sent;
1535
+
1536
+ _this.member = resp;
1537
+ _this.paymode.currentMode.member.setStorageCardNo(resp.StorageCardNo);
1538
+ return _context6.abrupt('return', _promise2.default.resolve(resp));
1539
+
1540
+ case 7:
1541
+ case 'end':
1542
+ return _context6.stop();
1543
+ }
1544
+ }
1545
+ }, _callee6, _this14);
1546
+ }));
1547
+
1548
+ return function (_x4) {
1549
+ return _ref20.apply(this, arguments);
1550
+ };
1551
+ }();
1552
+ }
1553
+ }), _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);
1554
+ exports.default = SettlementStore;
1555
+ var PayMode = exports.PayMode = (_class3 = function () {
1556
+ function PayMode() {
1557
+ // this.amount=getFixedNumber(amount);
1558
+ // this.calcReserved();
1559
+
1560
+ (0, _classCallCheck3.default)(this, PayMode);
1561
+ this._counter = 0;
1562
+ this.amount = 0;
1563
+ this.onlineamount = 0;
1564
+ this.maxamount = 0;
1565
+
1566
+ _initDefineProp(this, 'currentFocus', _descriptor3, this);
1567
+
1568
+ _initDefineProp(this, 'received', _descriptor4, this);
1569
+
1570
+ _initDefineProp(this, 'receivable', _descriptor5, this);
1571
+
1572
+ _initDefineProp(this, 'paymodes', _descriptor6, this);
1573
+
1574
+ _initDefineProp(this, 'thePaymodes', _descriptor7, this);
1575
+
1576
+ this.currentMode = null;
1577
+ this.settle = {
1578
+ name: "复合结算",
1579
+ hotKey: "Ctrl+M"
1580
+ };
1581
+
1582
+ _initDefineProp(this, 'calcCheckList', _descriptor8, this);
1583
+
1584
+ _initDefineProp(this, 'setCouponNum', _descriptor9, this);
1585
+
1586
+ _initDefineProp(this, 'addDjqs', _descriptor10, this);
1587
+ } //应收
1588
+
1589
+
1590
+ (0, _createClass3.default)(PayMode, [{
1591
+ key: 'clean',
1592
+ value: function clean() {
1593
+ this.thePaymodes = [];
1594
+ this.calcReserved();
1595
+ }
1596
+ }, {
1597
+ key: 'clear',
1598
+ value: function clear() {
1599
+ this.thePaymodes = [];
1600
+ this.calcReserved();
1601
+ this.paymodes = [];
1602
+ }
1603
+ }, {
1604
+ key: 'setAmount',
1605
+ value: function setAmount(a, o) {
1606
+ this.amount = (0, _utils.getFixedNumber)((a || 0) - (o || 0));
1607
+ this.onlineamount = (0, _utils.getFixedNumber)(o || 0);
1608
+ this.calcReserved();
1609
+ return this.amount < 0;
1610
+ }
1611
+ }, {
1612
+ key: 'calcReserved',
1613
+ value: function calcReserved() {
1614
+ var sum = 0;
1615
+ (0, _each3.default)(this.thePaymodes, function (mode) {
1616
+ sum = Math.Add(sum, mode.value == "" ? 0 : mode.value);
1617
+ });
1618
+ this.received = (0, _utils.getFixedNumber)(sum);
1619
+ this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
1620
+ }
1621
+ }, {
1622
+ key: 'calcDjqCheckValue',
1623
+ value: function calcDjqCheckValue(q1, dto) {
1624
+ var _this15 = this;
1625
+
1626
+ var useLimitPerOrder = (0, _tplusPoslogin.PosInitData)('UseLimitPerOrder');
1627
+ var qList = (0, _filter3.default)(this.currentMode.djqs, function (djq) {
1628
+ return djq.checked;
1629
+ });
1630
+ if (qList.length === useLimitPerOrder && !q1.checked) {
1631
+ _message2.default.warn('本单最多可用' + useLimitPerOrder + '张');
1632
+ return;
1633
+ }
1634
+
1635
+ var _ref21 = _mutantsUtil.platform || {},
1636
+ isNewRetailBCPos = _ref21.isNewRetailBCPos;
1637
+
1638
+ var _enumController$getEn14 = _mutantsUtil.enumController.getEnumOj(),
1639
+ PayStyle = _enumController$getEn14.PayStyle,
1640
+ Differentiate = _enumController$getEn14.Differentiate;
1641
+
1642
+ if (q1) {
1643
+ if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
1644
+ _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
1645
+ return;
1646
+ }
1647
+ var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
1648
+ return djq.promoCouponCode == q1.promoCouponCode;
1649
+ });
1650
+ if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
1651
+ _message2.default.error("本单金额低于使用门槛,该券不可使用。");
1652
+ return;
1653
+ }
1654
+ //判断是否是选择优惠券 //CC优惠券只能使用一个
1655
+ // if (q1 && !q1.checked && isNewRetailBCPos) {
1656
+ // // 检查是否有已经选定优惠券 并且去除选定的优惠券
1657
+ // this.currentMode.djqs.forEach((djq, index) => {
1658
+ // if (djq.checked) this.currentMode.djqs[index].checked = false;
1659
+ // })
1660
+ // }
1661
+ q && (q.checked = !q.checked);
1662
+ }
1663
+ var sum = 0;
1664
+ // console.log(this.store, 'stores-------');
1665
+ if (!q1.checked) {
1666
+ this.checkList.forEach(function (ele, i) {
1667
+ if (ele.id === q1.id) {
1668
+ _this15.checkList.splice(i, 1);
1669
+ }
1670
+ });
1671
+ } else {
1672
+ if (q1.discountPct > 0) {
1673
+ q1.amount = 0;
1674
+ }
1675
+ this.checkList.push(q1);
1676
+ }
1677
+ this.checkList.forEach(function (ele, i) {
1678
+ if (ele.discountPct > 0) {
1679
+ if (ele.amount === 0) {
1680
+ ele.amount = (1 - ele.discountPct) * _this15.currentMode.receivable;
1681
+ }
1682
+ }
1683
+ sum = Math.Add(sum, ele.amount);
1684
+ });
1685
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1686
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1687
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1688
+ var promoVoucher = {};
1689
+ promoVoucher.boName = "Retail";
1690
+ // promoVoucher.promoLinks = _filter(this.currentMode.djqs,djq=>djq.checked);
1691
+ promoVoucher.meMemberId = this.currentMode.member.id;
1692
+ promoVoucher.storeFactorId = (0, _tplusPoslogin.PosInitData)('storeID');
1693
+ promoVoucher.voucherDetailList = [];
1694
+ dto.RetailDetails.forEach(function (item) {
1695
+ var detailDTO = {};
1696
+ detailDTO.uuid = item.Code;
1697
+ detailDTO.detailBoName = "RetailDetail";
1698
+ detailDTO.voucherDetailId = item.ID;
1699
+ detailDTO.productId = item.Idinventory;
1700
+ detailDTO.uomId = item.Idunit;
1701
+ detailDTO.productSpecId = item.ProductSpecId;
1702
+ detailDTO.isManualFreeGift = item.IsPresent;
1703
+ detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
1704
+ detailDTO.IsManualChangePrice = item.IsManualChangePrice;
1705
+ if (detailDTO.IsManualChangePrice) //如果是手工改价
1706
+ {
1707
+ detailDTO.listPrice = item.TaxPrice;
1708
+ detailDTO.netAmountWithTax = item.TaxAmount;
1709
+ } else {
1710
+ var bookingQuantity = 0;
1711
+ if (item.BookingQuantity) {
1712
+ bookingQuantity = item.BookingQuantity;
1713
+ }
1714
+ detailDTO.listPrice = item.MemberPrice;
1715
+ detailDTO.netAmountWithTax = Math.Multiply(item.MemberPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
1716
+ }
1717
+ detailDTO.taxRate = item.TaxRate;
1718
+ detailDTO.quantity = item.Quantity;
1719
+
1720
+ detailDTO.amountWithTax = item.RetailAmount;
1721
+ // 促销 start
1722
+ if (item.PromotionDetails && item.PromotionDetails.length != 0) {
1723
+ var promoLinks = [];
1724
+ item.PromotionDetails.forEach(function (promotion) {
1725
+ promoLinks.push({
1726
+ promoId: promotion.IdSalesPromotionDTO,
1727
+ promoRuleId: promotion.PromotionRuleId
1728
+ });
1729
+ });
1730
+ if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
1731
+ }
1732
+ // 促销 end
1733
+ promoVoucher.voucherDetailList.push(detailDTO);
1734
+ });
1735
+ promoVoucher.promoLinks = this.checkList;
1736
+ return (0, _tplusApi.ccApi)((0, _extends3.default)({}, promoVoucher), 'promotion/PromoCalculate/findUsefulCouponPromoList', false, false, { method: 'post', timeout_skip: true }).then(function (result) {
1737
+ if (result && result.length != 0) {
1738
+ result.forEach(function (element) {
1739
+ var djq1 = (0, _filter3.default)(_this15.currentMode.djqs, function (djq) {
1740
+ return djq.id === element.id;
1741
+ });
1742
+
1743
+ var _ref22 = element || {},
1744
+ couponCode = _ref22.couponCode,
1745
+ name = _ref22.name,
1746
+ tieredAmountResult = _ref22.tieredAmountResult,
1747
+ fromDate = _ref22.fromDate,
1748
+ dateMount = _ref22.dateMount,
1749
+ promoMethodEnum = _ref22.promoMethodEnum,
1750
+ discountPct = _ref22.discountPct,
1751
+ nominalAmount = _ref22.nominalAmount,
1752
+ promoId = _ref22.promoId,
1753
+ id = _ref22.id,
1754
+ doorsill = _ref22.doorsill;
1755
+
1756
+ var condValue = tieredAmountResult.condValue,
1757
+ promoDiscount = tieredAmountResult.promoDiscount,
1758
+ displayText = tieredAmountResult.displayText,
1759
+ promoRuleId = tieredAmountResult.promoRuleId,
1760
+ couponCategoryEnum = tieredAmountResult.couponCategoryEnum;
1761
+
1762
+ if (!djq1.length) {
1763
+ // this.currentMode.djqs.push({
1764
+ // promoCouponCode: element.CouponCode,
1765
+ // name: element.CouponTitle,
1766
+ // IsEnable: true,
1767
+ // amount: element.ReductionAmount,
1768
+ // doorsill: element.EnableAmount,
1769
+ // LastTS: element.LastTS,
1770
+ // checked: false,
1771
+ // IsRepelWithPoints: true,
1772
+ // UMemberID: dto.Idmember,
1773
+ // expired: null,
1774
+ // displayText,
1775
+ // promoMethodEnum,
1776
+ // discountPct,
1777
+ // promoId,
1778
+ // promoRuleId,
1779
+ // couponCategoryEnum: tieredAmountResult.couponCategoryEnum,
1780
+ // id
1781
+ // })
1782
+ _this15.addDjqs(couponCode, name, true, nominalAmount, doorsill, element.LastTS, false, true, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, tieredAmountResult.couponCategoryEnum, id);
1783
+ } else {
1784
+ _this15.setCouponNum(element.id, tieredAmountResult.couponCategoryEnum);
1785
+ // this.currentMode.djqs[0].couponCategoryEnum = 'couponCategoryEnum';
1786
+ // djq1.couponCategoryEnum = element.tieredAmountResult.couponCategoryEnum
1787
+ }
1788
+ });
1789
+ }
1790
+ });
1791
+ //this.receivable = getFixedNumber(this.receivable - sum);
1792
+ }
1793
+ }, {
1794
+ key: 'calcDjqValue',
1795
+ value: function calcDjqValue(q1) {
1796
+ var _this16 = this;
1797
+
1798
+ var _ref23 = _mutantsUtil.platform || {},
1799
+ isNewRetailBCPos = _ref23.isNewRetailBCPos;
1800
+
1801
+ var _enumController$getEn15 = _mutantsUtil.enumController.getEnumOj(),
1802
+ Differentiate = _enumController$getEn15.Differentiate;
1803
+
1804
+ if (q1) {
1805
+ if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
1806
+ _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
1807
+ return;
1808
+ }
1809
+ var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
1810
+ return djq.code == q1.code;
1811
+ });
1812
+ if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
1813
+ _message2.default.error("本单金额低于使用门槛,该券不可使用。");
1814
+ return;
1815
+ }
1816
+ //判断是否是选择优惠券 //CC优惠券只能使用一个
1817
+ if (q1 && !q1.checked && isNewRetailBCPos) {
1818
+ // 检查是否有已经选定优惠券 并且去除选定的优惠券
1819
+ this.currentMode.djqs.forEach(function (djq, index) {
1820
+ if (djq.checked) _this16.currentMode.djqs[index].checked = false;
1821
+ });
1822
+ }
1823
+ q && (q.checked = !q.checked);
1824
+ }
1825
+ var sum = 0;
1826
+ (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
1827
+ return djq.checked;
1828
+ }), function (q) {
1829
+ sum = Math.Add(sum, q.amount);
1830
+ });
1831
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1832
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1833
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1834
+ //this.receivable = getFixedNumber(this.receivable - sum);
1835
+ }
1836
+ }, {
1837
+ key: 'reCalculationDjqs',
1838
+ value: function reCalculationDjqs() {
1839
+ var sum = 0;
1840
+ (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
1841
+ return djq.checked;
1842
+ }), function (q) {
1843
+ sum = Math.Add(sum, q.amount);
1844
+ });
1845
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1846
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1847
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1848
+ this.currentMode.maxamount = this.currentMode.receivable || this.currentMode.receivable;
1849
+ }
1850
+ }, {
1851
+ key: 'clearDjqs',
1852
+ value: function clearDjqs() {
1853
+ this.currentMode.djqs = [];
1854
+ }
1855
+ }, {
1856
+ key: 'setCurrentModeValue',
1857
+ value: function setCurrentModeValue(v, max) {
1858
+ this.currentMode.value = parseFloat(v) || 0;
1859
+ this.currentMode.errinfo = '';
1860
+ var sum = this.amount;
1861
+
1862
+ var _enumController$getEn16 = _mutantsUtil.enumController.getEnumOj(),
1863
+ PayStyle = _enumController$getEn16.PayStyle;
1864
+
1865
+ this.paymodes.thePaymodes && this.paymodes.thePaymodes.forEach(function (mode) {
1866
+ if (mode.paymentType === PayStyle.hyczk) {
1867
+ sum -= mode.value;
1868
+ }
1869
+ });
1870
+
1871
+ if (this.amount > 0 && (v === '' || v === '0.00')) {
1872
+ this.currentMode.errinfo = "实收金额必须录入";
1873
+ } else if (Math.abs(parseFloat(v)) > Math.abs(sum)) {
1874
+ this.currentMode.errinfo = "实收不应大于应收";
1875
+ } else if (parseFloat(v) > 0 && parseFloat(v) > (max || 0)) {
1876
+ this.currentMode.errinfo = "余额不足";
1877
+ }
1878
+ }
1879
+ }, {
1880
+ key: 'calcMemberBalance',
1881
+ value: function calcMemberBalance() {
1882
+ this.currentMode.balance = this.currentMode.member.rawbalance - this.currentMode.value;
1883
+ }
1884
+ }, {
1885
+ key: 'setPaymodes',
1886
+ value: function () {
1887
+ var _ref24 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type, isIntegralExchange) {
1888
+ var _this17 = this;
1889
+
1890
+ var _enumController$getEn17, settleStyleType, PayStyle, memberStoreCode, settlementCode, param, modes;
1891
+
1892
+ return _regenerator2.default.wrap(function _callee7$(_context7) {
1893
+ while (1) {
1894
+ switch (_context7.prev = _context7.next) {
1895
+ case 0:
1896
+ _enumController$getEn17 = _mutantsUtil.enumController.getEnumOj(), settleStyleType = _enumController$getEn17.settleStyleType, PayStyle = _enumController$getEn17.PayStyle;
1897
+ memberStoreCode = settleStyleType.memberStoreCode, settlementCode = settleStyleType.settlementCode;
1898
+ param = { 'settleStyleType': type == 1 ? memberStoreCode : settlementCode, isIntegralExchange: isIntegralExchange };
1899
+ _context7.next = 5;
1900
+ return (0, _tplusApi.tApi)({ param: param }, 'chanjet.RE.NewPos.GetNewStoreSettleStyles', false, false);
1901
+
1902
+ case 5:
1903
+ modes = _context7.sent;
1904
+
1905
+ if (modes) {
1906
+ (0, _mobx.runInAction)(function () {
1907
+ var paymodes = [];
1908
+ (0, _each3.default)(modes.SettleStyles, function (mode, index) {
1909
+ //产品需求确认会员储值卡结算方式前端展示统一调整为“储值卡" tuzha by 2020-07-08
1910
+
1911
+ if (mode.Code == PayStyle.hyczk) {
1912
+ mode.Name = '储值余额';
1913
+ }
1914
+ paymodes.push({
1915
+ name: mode.Name,
1916
+ isDefault: mode.IsDefaultSettleStyle,
1917
+ isQuick: (0, _findIndex3.default)(modes.QuickSettleStyles, { 'Code': mode.Code }) >= 0,
1918
+ orderBy: 1,
1919
+ paymentType: mode.Code,
1920
+ idSettleStyle: mode.IdSettleStyle,
1921
+ idBankAccount: mode.IdBankAccount,
1922
+ exchangeRate: mode.Currency ? mode.Currency.ExchangeRate : 1,
1923
+ idCurrency: mode.Currency ? mode.Currency.ID : -1,
1924
+ calDirection: mode.Currency ? mode.Currency.CalDirection.Id : "88"
1925
+ });
1926
+ });
1927
+ _this17.paymodes = paymodes;
1928
+ //modes.QuickSettleStyles
1929
+ });
1930
+ }
1931
+
1932
+ case 7:
1933
+ case 'end':
1934
+ return _context7.stop();
1935
+ }
1936
+ }
1937
+ }, _callee7, this);
1938
+ }));
1939
+
1940
+ function setPaymodes(_x5, _x6) {
1941
+ return _ref24.apply(this, arguments);
1942
+ }
1943
+
1944
+ return setPaymodes;
1945
+ }()
1946
+ }, {
1947
+ key: 'charge',
1948
+ get: function get() {
1949
+ return Math.abs(this.receivable);
1950
+ }
1951
+ }, {
1952
+ key: 'counter',
1953
+ get: function get() {
1954
+ return ++this._counter;
1955
+ }
1956
+ }]);
1957
+ return PayMode;
1958
+ }(), (_descriptor3 = _applyDecoratedDescriptor(_class3.prototype, 'currentFocus', [_mobx.observable], {
1959
+ enumerable: true,
1960
+ initializer: function initializer() {
1961
+ return "";
1962
+ }
1963
+ }), _descriptor4 = _applyDecoratedDescriptor(_class3.prototype, 'received', [_mobx.observable], {
1964
+ enumerable: true,
1965
+ initializer: function initializer() {
1966
+ return 0;
1967
+ }
1968
+ }), _descriptor5 = _applyDecoratedDescriptor(_class3.prototype, 'receivable', [_mobx.observable], {
1969
+ enumerable: true,
1970
+ initializer: function initializer() {
1971
+ return 0;
1972
+ }
1973
+ }), _descriptor6 = _applyDecoratedDescriptor(_class3.prototype, 'paymodes', [_mobx.observable], {
1974
+ enumerable: true,
1975
+ initializer: function initializer() {
1976
+ return [];
1977
+ }
1978
+ }), _descriptor7 = _applyDecoratedDescriptor(_class3.prototype, 'thePaymodes', [_mobx.observable], {
1979
+ enumerable: true,
1980
+ initializer: function initializer() {
1981
+ return [];
1982
+ }
1983
+ }), _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), _descriptor8 = _applyDecoratedDescriptor(_class3.prototype, 'calcCheckList', [_mobx.action], {
1984
+ enumerable: true,
1985
+ initializer: function initializer() {
1986
+ var _this18 = this;
1987
+
1988
+ return function () {
1989
+ _this18.checkList = [];
1990
+ };
1991
+ }
1992
+ }), _applyDecoratedDescriptor(_class3.prototype, 'calcDjqCheckValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'calcDjqCheckValue'), _class3.prototype), _descriptor9 = _applyDecoratedDescriptor(_class3.prototype, 'setCouponNum', [_mobx.action], {
1993
+ enumerable: true,
1994
+ initializer: function initializer() {
1995
+ var _this19 = this;
1996
+
1997
+ return function (id, couponNum, code) {
1998
+ _this19.currentMode.djqs.forEach(function (ele) {
1999
+ if (ele.id === id) {
2000
+ ele.couponCategoryEnum = couponNum;
2001
+ var IsEnable = ele.couponCategoryEnum === 'RIGUP' || ele.couponCategoryEnum === 'UN_MATCH' || ele.couponCategoryEnum === "PREPARING" || ele.couponCategoryEnum === 'PROMO_LIMITED' || ele.couponCategoryEnum === 'COUPON_CONFLICT' ? false : true;
2002
+ ele.IsEnable = IsEnable;
2003
+ }
2004
+ });
2005
+ };
2006
+ }
2007
+ }), _descriptor10 = _applyDecoratedDescriptor(_class3.prototype, 'addDjqs', [_mobx.action], {
2008
+ enumerable: true,
2009
+ initializer: function initializer() {
2010
+ var _this20 = this;
2011
+
2012
+ return function (promoCouponCode, name, IsEnable, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id) {
2013
+ var djq = {
2014
+ promoCouponCode: promoCouponCode,
2015
+ name: name,
2016
+ IsEnable: IsEnable,
2017
+ amount: amount,
2018
+ doorsill: doorsill,
2019
+ LastTS: LastTS,
2020
+ checked: checked,
2021
+ IsRepelWithPoints: IsRepelWithPoints,
2022
+ UMemberID: UMemberID,
2023
+ expired: expired,
2024
+ displayText: displayText,
2025
+ promoMethodEnum: promoMethodEnum,
2026
+ discountPct: discountPct,
2027
+ promoId: promoId,
2028
+ promoRuleId: promoRuleId,
2029
+ couponCategoryEnum: couponCategoryEnum,
2030
+ id: id
2031
+ };
2032
+ _this20.currentMode.djqs.push(djq);
2033
+ };
2034
+ }
2035
+ }), _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);
2036
+ var Member = exports.Member = (_class5 = function () {
2037
+ function Member(m) {
2038
+ var _this21 = this;
2039
+
2040
+ (0, _classCallCheck3.default)(this, Member);
2041
+
2042
+ _initDefineProp(this, 'cardNo', _descriptor11, this);
2043
+
2044
+ _initDefineProp(this, 'balance', _descriptor12, this);
2045
+
2046
+ _initDefineProp(this, 'exchangable', _descriptor13, this);
2047
+
2048
+ _initDefineProp(this, 'MeStorageCardId', _descriptor14, this);
2049
+
2050
+ _initDefineProp(this, 'StorageCardNo', _descriptor15, this);
2051
+
2052
+ if (m) {
2053
+ this.id = m.ID;
2054
+ this.uid = m.Uid;
2055
+ this.type = m.MemberType ? m.MemberType.Name : "普通";
2056
+ this.rawbalance = m.BalanceStorage;
2057
+ var index = (0, _findIndex3.default)(m.DynamicPropertyKeys, function (key) {
2058
+ return key == 'canusedbalancestorage';
2059
+ });
2060
+
2061
+ var _ref25 = _mutantsUtil.platform || {},
2062
+ isNewRetailBCPos = _ref25.isNewRetailBCPos;
2063
+
2064
+ m.StorageCardNo && (this.StorageCardNo = m.StorageCardNo);
2065
+ m.MeStorageCardId && (this.MeStorageCardId = m.MeStorageCardId);
2066
+ (0, _mobx.runInAction)(function () {
2067
+ _this21.cardNo = m.CardCode;
2068
+ if (index >= 0) {
2069
+ _this21.balance = parseFloat(m.DynamicPropertyValues[index]);
2070
+ } else {
2071
+ _this21.balance = _this21.rawbalance;
2072
+ }
2073
+ });
2074
+ this.needPwd = m.MemberType ? m.MemberType.IsNeedPwd : false;
2075
+ this.NeedModifyPassword = m.NeedModifyPassword;
2076
+ this.bonusPoints = m.BalanceIntegral;
2077
+ }
2078
+ }
2079
+
2080
+ (0, _createClass3.default)(Member, [{
2081
+ key: 'setExchangable',
2082
+ value: function setExchangable(v) {
2083
+ this.exchangable = v;
2084
+ }
2085
+ }, {
2086
+ key: 'setCardNo',
2087
+ value: function setCardNo(v) {
2088
+ this.cardNo = v;
2089
+ this.id = null;
2090
+ }
2091
+ }, {
2092
+ key: 'setMeStorageCardId',
2093
+ value: function setMeStorageCardId(v) {
2094
+ this.MeStorageCardId = v;
2095
+ }
2096
+ }, {
2097
+ key: 'setStorageCardNo',
2098
+ value: function setStorageCardNo(v) {
2099
+ this.StorageCardNo = v;
2100
+ }
2101
+ }]);
2102
+ return Member;
2103
+ }(), (_descriptor11 = _applyDecoratedDescriptor(_class5.prototype, 'cardNo', [_mobx.observable], {
2104
+ enumerable: true,
2105
+ initializer: null
2106
+ }), _descriptor12 = _applyDecoratedDescriptor(_class5.prototype, 'balance', [_mobx.observable], {
2107
+ enumerable: true,
2108
+ initializer: null
2109
+ }), _descriptor13 = _applyDecoratedDescriptor(_class5.prototype, 'exchangable', [_mobx.observable], {
2110
+ enumerable: true,
2111
+ initializer: null
2112
+ }), _descriptor14 = _applyDecoratedDescriptor(_class5.prototype, 'MeStorageCardId', [_mobx.observable], {
2113
+ enumerable: true,
2114
+ initializer: null
2115
+ }), _descriptor15 = _applyDecoratedDescriptor(_class5.prototype, 'StorageCardNo', [_mobx.observable], {
2116
+ enumerable: true,
2117
+ initializer: null
2118
+ }), _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), _applyDecoratedDescriptor(_class5.prototype, 'setMeStorageCardId', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class5.prototype, 'setMeStorageCardId'), _class5.prototype), _applyDecoratedDescriptor(_class5.prototype, 'setStorageCardNo', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class5.prototype, 'setStorageCardNo'), _class5.prototype)), _class5);
2119
+ //# sourceMappingURL=settlementStore.js.map