tplus-components-touch 3.20.1 → 3.20.5

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 (50) hide show
  1. package/dist/components/settlement/settlement.js +4 -2
  2. package/dist/components/settlement/settlement.js.map +1 -1
  3. package/dist/components/settlement/settlement.less +4 -2
  4. package/package.json +1 -1
  5. package/dist/components/commonForm/addressPicker/index.js +0 -230
  6. package/dist/components/commonForm/addressPicker/index.js.map +0 -1
  7. package/dist/components/commonForm/autoComplete/index.js +0 -241
  8. package/dist/components/commonForm/autoComplete/index.js.map +0 -1
  9. package/dist/components/commonForm/datePicker/index.js +0 -89
  10. package/dist/components/commonForm/datePicker/index.js.map +0 -1
  11. package/dist/components/commonForm/formControl/index.js +0 -140
  12. package/dist/components/commonForm/formControl/index.js.map +0 -1
  13. package/dist/components/commonForm/inputNumber/index.js +0 -272
  14. package/dist/components/commonForm/inputNumber/index.js.map +0 -1
  15. package/dist/components/commonForm/radio/index.js +0 -132
  16. package/dist/components/commonForm/radio/index.js.map +0 -1
  17. package/dist/components/input/tplusInput/index.js +0 -81
  18. package/dist/components/input/tplusInput/index.js.map +0 -1
  19. package/dist/components/input/tplusInput/inputContent.js +0 -128
  20. package/dist/components/input/tplusInput/inputContent.js.map +0 -1
  21. package/dist/components/input/tplusInput/inputs.js +0 -151
  22. package/dist/components/input/tplusInput/inputs.js.map +0 -1
  23. package/dist/components/input/utils/index.js +0 -26
  24. package/dist/components/input/utils/index.js.map +0 -1
  25. package/dist/components/settlement/prototypeTable/index.js +0 -349
  26. package/dist/components/settlement/prototypeTable/index.js.map +0 -1
  27. package/dist/components/settlement/prototypeTable/utils.js +0 -14
  28. package/dist/components/settlement/prototypeTable/utils.js.map +0 -1
  29. package/dist/components/settlement/settlementStore.js +0 -1872
  30. package/dist/components/settlement/settlementStore.js.map +0 -1
  31. package/dist/components/settlement/utils.js +0 -249
  32. package/dist/components/settlement/utils.js.map +0 -1
  33. package/dist/components/spin/index.js +0 -95
  34. package/dist/components/spin/index.js.map +0 -1
  35. package/dist/components/test/index.js +0 -330
  36. package/dist/components/test/index.js.map +0 -1
  37. package/dist/components/ticon/iconfont/iconfont.js +0 -35
  38. package/dist/components/ticon/iconfont/iconfont.js.map +0 -1
  39. package/dist/components/ticon/index.js +0 -60
  40. package/dist/components/ticon/index.js.map +0 -1
  41. package/dist/components/touchScroll/index.js +0 -182
  42. package/dist/components/touchScroll/index.js.map +0 -1
  43. package/dist/components/touchTable/AuthProcess.js +0 -42
  44. package/dist/components/touchTable/AuthProcess.js.map +0 -1
  45. package/dist/components/touchTable/generateWater.js +0 -59
  46. package/dist/components/touchTable/generateWater.js.map +0 -1
  47. package/dist/components/touchTable/index.js +0 -1101
  48. package/dist/components/touchTable/index.js.map +0 -1
  49. package/dist/components/touchTable/utils.js +0 -14
  50. package/dist/components/touchTable/utils.js.map +0 -1
@@ -1,1872 +0,0 @@
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, _desc3, _value3, _class5, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12;
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
- (0, _remove3.default)(this.paymode.thePaymodes, function (mode) {
952
- return mode.paymethodId === index;
953
- });
954
- this.paymode.currentFocus = -1;
955
- this.paymode.calcReserved();
956
- }
957
- }, {
958
- key: 'commit',
959
- value: function () {
960
- var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(bTest) {
961
- return _regenerator2.default.wrap(function _callee2$(_context2) {
962
- while (1) {
963
- switch (_context2.prev = _context2.next) {
964
- case 0:
965
- console.log('settlementStore.commit开始,参数:' + bTest);
966
-
967
- if (!bTest) {
968
- _context2.next = 3;
969
- break;
970
- }
971
-
972
- return _context2.abrupt('return', _promise2.default.resolve(true));
973
-
974
- case 3:
975
- _context2.prev = 3;
976
-
977
- if (!(this.type == 1)) {
978
- _context2.next = 9;
979
- break;
980
- }
981
-
982
- _context2.next = 7;
983
- return this.saveMember();
984
-
985
- case 7:
986
- _context2.next = 11;
987
- break;
988
-
989
- case 9:
990
- _context2.next = 11;
991
- return this.save();
992
-
993
- case 11:
994
- return _context2.abrupt('return', _promise2.default.resolve(true));
995
-
996
- case 14:
997
- _context2.prev = 14;
998
- _context2.t0 = _context2['catch'](3);
999
-
1000
- console.error('settlementStore.commit失败,错误信息:' + _context2.t0);
1001
- return _context2.abrupt('return', _promise2.default.resolve(_context2.t0));
1002
-
1003
- case 18:
1004
- console.error('settlementStore.commit失败,错误信息:' + err);
1005
-
1006
- case 19:
1007
- case 'end':
1008
- return _context2.stop();
1009
- }
1010
- }
1011
- }, _callee2, this, [[3, 14]]);
1012
- }));
1013
-
1014
- function commit(_x2) {
1015
- return _ref10.apply(this, arguments);
1016
- }
1017
-
1018
- return commit;
1019
- }()
1020
- }, {
1021
- key: 'saveMember',
1022
- value: function saveMember() {
1023
- var _this10 = this;
1024
-
1025
- var _enumController$getEn12 = _mutantsUtil.enumController.getEnumOj(),
1026
- PayStyle = _enumController$getEn12.PayStyle;
1027
-
1028
- (0, _mobx.runInAction)(function () {
1029
- _this10.dto.StorageMutiSettleDetails = [];
1030
- var thePaymodes = _this10.newStyle ? (0, _filter3.default)(_this10.paymode.thePaymodes, function (mode) {
1031
- return parseFloat(mode.value) != 0;
1032
- }) : _this10.paymode.thePaymodes;
1033
- (0, _each3.default)(thePaymodes, function (mode) {
1034
- var themode = (0, _find3.default)(_this10.paymode.paymodes, { 'paymentType': mode.paymentType });
1035
-
1036
- var value = parseFloat(mode.value);
1037
- var giveChange = null;
1038
- if (mode.paymentType == PayStyle.xianjin && _this10.paymode.receivable < 0 && value > Math.abs(_this10.paymode.receivable)) {
1039
- value = Math.Add(value, _this10.paymode.receivable);
1040
- giveChange = Math.abs(_this10.paymode.receivable);
1041
- }
1042
- _this10.dto.StorageMutiSettleDetails.push({
1043
- Code: mode.paymethodId,
1044
- StorageAmount: value,
1045
- GiveChange: giveChange,
1046
- IdsettleStyle: themode.idSettleStyle,
1047
- IdbankAccount: themode.idBankAccount,
1048
- PaymentCode: mode.authCode,
1049
- DynamicPropertyKeys: [],
1050
- DynamicPropertyValues: [],
1051
- DataSource: { Id: _this10.dataSource }
1052
- });
1053
- });
1054
- });
1055
- // cc结算调用
1056
- var IPMSG = {};
1057
- if (!!window.localStorage.IPMSG) {
1058
- IPMSG = JSON.parse(window.localStorage.IPMSG);
1059
- }
1060
- return (0, _tplusApi.tApi)({ dto: this.dto }, 'chanjet.ME.INewRetailMemberStorage.Save', false, false).then(function (resp) {
1061
- var _ref11 = _mutantsUtil.platform || {},
1062
- isHorizontalPad = _ref11.isHorizontalPad,
1063
- isHorizontalSunMi = _ref11.isHorizontalSunMi;
1064
-
1065
- if (isHorizontalPad === true) {
1066
- // pad打印
1067
- //执行移动端云打印
1068
- if (_this10.cloudPrintArguments) {
1069
- var _ref12 = _this10.cloudPrintArguments || {},
1070
- Open = _ref12.Open,
1071
- Key = _ref12.Key,
1072
- Sign = _ref12.Sign,
1073
- Name = _ref12.Name,
1074
- Card = _ref12.Card;
1075
-
1076
- if (!Open) {
1077
- _message2.default.warn(t('云打印未启用,请设置。'));
1078
- return;
1079
- }
1080
- _this10.printUtil.doStoragePrint({ Key: Key, Sign: Sign, Name: Name, Card: Card }, resp.ID, function (s) {
1081
- var msg = s.msg,
1082
- ret = s.ret;
1083
-
1084
- if (ret === 0) {
1085
- _message2.default.success(t('打印储值小票成功。'));
1086
- } else if (ret === -1) {
1087
- _message2.default.error(t(msg));
1088
- } else {
1089
- _message2.default.error(t('打印储值小票失败。'));
1090
- }
1091
- });
1092
- } else {
1093
- _message2.default.warn(t('云打印未启用,请设置。'));
1094
- }
1095
- return;
1096
- } else if (isHorizontalSunMi === true) {
1097
- _this10.printUtil.doStoragePrint({}, resp.ID, function (s) {
1098
- var msg = s.msg,
1099
- ret = s.ret;
1100
-
1101
- if (ret === 0) {
1102
- _message2.default.success(t('打印储值小票成功。'));
1103
- } else if (ret === -1) {
1104
- _message2.default.error(t(msg));
1105
- } else {
1106
- _message2.default.error(t('打印储值小票失败。'));
1107
- }
1108
- });
1109
- return;
1110
- } else {
1111
- if (global.StoragePrintProcessBlock) {
1112
- var _ref13 = _mutantsUtil.platform || {},
1113
- isNewRetailBCPos = _ref13.isNewRetailBCPos;
1114
-
1115
- if (isNewRetailBCPos) {
1116
- global.StoragePrintProcessBlock.execute(resp);
1117
- } else {
1118
- global.StoragePrintProcessBlock.execute(resp.ID);
1119
- }
1120
- return;
1121
- } else {
1122
- _message2.default.warn(t('打印小票只能在客户端中执行'));
1123
- return;
1124
- }
1125
- }
1126
- });
1127
- }
1128
- }, {
1129
- key: 'save',
1130
- value: function () {
1131
- var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
1132
- var _this11 = this;
1133
-
1134
- var _enumController$getEn13, PayStyle, _ref16, isNewRetailBCPos, IPMSG, RetailTypeEnum;
1135
-
1136
- return _regenerator2.default.wrap(function _callee3$(_context3) {
1137
- while (1) {
1138
- switch (_context3.prev = _context3.next) {
1139
- case 0:
1140
- _enumController$getEn13 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn13.PayStyle;
1141
-
1142
- (0, _mobx.runInAction)(function () {
1143
- _this11.dto.RetailPaymentDetails = [];
1144
- _this11.dto.RetailStorageDetails = [];
1145
- _this11.dto.RetailCouponDetails = [];
1146
- var czkSum = 0;
1147
- var Idmember = _this11.dto.Idmember;
1148
- var count = 0;
1149
- var thePaymodes = _this11.newStyle ? (0, _filter3.default)(_this11.paymode.thePaymodes, function (mode) {
1150
- return parseFloat(mode.value) != 0;
1151
- }) : _this11.paymode.thePaymodes;
1152
- (0, _each3.default)(thePaymodes, function (mode, index) {
1153
- var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': mode.paymentType });
1154
- if (mode.paymentType == PayStyle.hyczk) {
1155
- if (!Idmember) {
1156
- Idmember = mode.member.id;
1157
- }
1158
- czkSum = Math.Add(czkSum, mode.value);
1159
- var MeStorageCardId = mode.MeStorageCardId ? mode.MeStorageCardId : _this11.member.MeStorageCardId;
1160
- _this11.dto.RetailStorageDetails.push({
1161
- Code: mode.paymethodId,
1162
- MeStorageCardId: MeStorageCardId,
1163
- StoragePaymentAmount: mode.value,
1164
- IsOrigReturn: false,
1165
- BalanceStorage: mode.balance,
1166
- Idmember: mode.member.id,
1167
- DynamicPropertyKeys: [],
1168
- DynamicPropertyValues: [],
1169
- DataSource: { Id: _this11.dataSource },
1170
- Password: mode.authCode
1171
- });
1172
- } else {
1173
- var value = parseFloat(mode.value);
1174
- var giveChange = null;
1175
- if (mode.paymentType == PayStyle.xianjin && _this11.paymode.receivable < 0 && value > Math.abs(_this11.paymode.receivable)) {
1176
- value = Math.Add(value, _this11.paymode.receivable);
1177
- giveChange = Math.abs(_this11.paymode.receivable);
1178
- }
1179
- _this11.dto.RetailPaymentDetails.push({
1180
- Code: mode.paymethodId,
1181
- OrigAmount: mode.exchangeRate != 1 ? mode.value2 : value,
1182
- Amount: value,
1183
- GiveChange: giveChange,
1184
- IdsettleStyle: themode.idSettleStyle,
1185
- IdbankAccount: themode.idBankAccount,
1186
- Idcurrency: themode.idCurrency,
1187
- ExchangeRate: themode.exchangeRate,
1188
- PaymentCode: mode.authCode,
1189
- SteadCashIntegral: mode.steadCashIntegral,
1190
- OverchargesAmount: mode.overchargesAmount,
1191
- DynamicPropertyKeys: [],
1192
- DynamicPropertyValues: [],
1193
- DataSource: { Id: _this11.dataSource }
1194
- });
1195
- if (mode.paymentType == PayStyle.djq) {
1196
- (0, _each3.default)(mode.djqs, function (djq) {
1197
- if (djq.checked) {
1198
- _this11.dto.RetailCouponDetails.push({
1199
- CouponCode: djq.code,
1200
- ReductionAmount: djq.amount,
1201
- EnableAmount: djq.doorsill,
1202
- CouponTitle: djq.name,
1203
- IdMember: djq.UMemberID ? mode.member.id : null,
1204
- LastTS: djq.LastTS,
1205
- PromotionId: djq.promoId,
1206
- PromotionRuleId: djq.promoRuleId,
1207
- PromoCouponAllocatedId: djq.id,
1208
- DataSource: { Id: _this11.dataSource }
1209
- });
1210
- }
1211
- });
1212
- }
1213
- }
1214
- });
1215
-
1216
- var _ref15 = _mutantsUtil.platform || {},
1217
- isNewRetailBCPos = _ref15.isNewRetailBCPos;
1218
-
1219
- if (_this11.dto.RetailStorageDetails.length > 0) {
1220
- var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': PayStyle.hyczk });
1221
- if (isNewRetailBCPos) {
1222
- // this.dto.RetailStorageDetails && this.dto.RetailStorageDetails.forEach((value, index) => {
1223
- // value.MeStorageCardId = (mode.MeStorageCardId ? mode.MeStorageCardId : this.member.MeStorageCardId);
1224
- // })
1225
- _this11.dto.RetailPaymentDetails.push({
1226
- Code: _this11.paymode.counter,
1227
- OrigAmount: czkSum,
1228
- Amount: czkSum,
1229
- IdsettleStyle: themode.idSettleStyle,
1230
- IdbankAccount: themode.idBankAccount,
1231
- DynamicPropertyKeys: [],
1232
- DynamicPropertyValues: [],
1233
- DataSource: { Id: _this11.dataSource },
1234
- RetailStorageDetails: _this11.dto.RetailStorageDetails
1235
- });
1236
- } else {
1237
- _this11.dto.RetailPaymentDetails.push({
1238
- Code: _this11.paymode.counter,
1239
- OrigAmount: czkSum,
1240
- Amount: czkSum,
1241
- IdsettleStyle: themode.idSettleStyle,
1242
- IdbankAccount: themode.idBankAccount,
1243
- DynamicPropertyKeys: [],
1244
- DynamicPropertyValues: [],
1245
- DataSource: { Id: _this11.dataSource }
1246
- });
1247
- }
1248
- _this11.dto.Idmember = Idmember;
1249
- }
1250
- });
1251
- _ref16 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref16.isNewRetailBCPos;
1252
-
1253
- console.log('bc_pos\u73AF\u5883:' + isNewRetailBCPos + ',\u7ED3\u7B97\u6570\u636E\uFF1A', this.dto);
1254
-
1255
- if (!isNewRetailBCPos) {
1256
- _context3.next = 20;
1257
- break;
1258
- }
1259
-
1260
- // cc结算调用
1261
- IPMSG = {};
1262
-
1263
- if (!!window.localStorage.IPMSG) {
1264
- IPMSG = JSON.parse(window.localStorage.IPMSG);
1265
- }
1266
- RetailTypeEnum = this.dto.IdbusiType == 36 ? "INTEGRAL_EXCHANGE" : "NORMAL";
1267
- _context3.t1 = this.dto.IdbusiType == 37;
1268
-
1269
- if (!_context3.t1) {
1270
- _context3.next = 13;
1271
- break;
1272
- }
1273
-
1274
- _context3.next = 12;
1275
- return this.checkIntegralExchangeReturn(this.dto.RetailDetails[0].ReturnSourceId);
1276
-
1277
- case 12:
1278
- _context3.t1 = _context3.sent;
1279
-
1280
- case 13:
1281
- _context3.t0 = _context3.t1;
1282
-
1283
- if (_context3.t0) {
1284
- _context3.next = 16;
1285
- break;
1286
- }
1287
-
1288
- _context3.t0 = this.dto.IdbusiType != 37;
1289
-
1290
- case 16:
1291
- if (!_context3.t0) {
1292
- _context3.next = 18;
1293
- break;
1294
- }
1295
-
1296
- 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) {
1297
- _this11.setDtoID(resp.ID);
1298
- _this11.billID = resp.ID;
1299
- }));
1300
-
1301
- case 18:
1302
- _context3.next = 21;
1303
- break;
1304
-
1305
- case 20:
1306
- return _context3.abrupt('return', (0, _tplusApi.tApi)({ dto: this.dto.cut() }, 'chanjet.RE.newRetail.Settle', false, false, { timeout_skip: true }).then(function (resp) {
1307
- _this11.setDtoID(resp.ID);
1308
- _this11.billID = resp.ID;
1309
- }));
1310
-
1311
- case 21:
1312
- case 'end':
1313
- return _context3.stop();
1314
- }
1315
- }
1316
- }, _callee3, this);
1317
- }));
1318
-
1319
- function save() {
1320
- return _ref14.apply(this, arguments);
1321
- }
1322
-
1323
- return save;
1324
- }()
1325
- }, {
1326
- key: 'setDtoID',
1327
- value: function setDtoID(id) {
1328
- this.context.viewModel.data.ID = id;
1329
- }
1330
- }, {
1331
- key: 'querySettleResult',
1332
- value: function () {
1333
- var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
1334
- return _regenerator2.default.wrap(function _callee4$(_context4) {
1335
- while (1) {
1336
- switch (_context4.prev = _context4.next) {
1337
- case 0:
1338
- _context4.prev = 0;
1339
- _context4.t0 = _promise2.default;
1340
- _context4.next = 4;
1341
- return (0, _tplusApi.tApi)({ RetailCode: this.dto.Code }, 'chanjet.RE.newRetail.QuerySettleResult', false, false, { timeout_skip: true });
1342
-
1343
- case 4:
1344
- _context4.t1 = _context4.sent;
1345
- return _context4.abrupt('return', _context4.t0.resolve.call(_context4.t0, _context4.t1));
1346
-
1347
- case 8:
1348
- _context4.prev = 8;
1349
- _context4.t2 = _context4['catch'](0);
1350
- return _context4.abrupt('return', _promise2.default.resolve({ Flag: "1" }));
1351
-
1352
- case 11:
1353
- case 'end':
1354
- return _context4.stop();
1355
- }
1356
- }
1357
- }, _callee4, this, [[0, 8]]);
1358
- }));
1359
-
1360
- function querySettleResult() {
1361
- return _ref17.apply(this, arguments);
1362
- }
1363
-
1364
- return querySettleResult;
1365
- }()
1366
- }, {
1367
- key: 'setCookie',
1368
- value: function setCookie(key, val) {
1369
- var exp = new Date();
1370
- exp.setTime((0, _moment2.default)().endOf('day').valueOf());
1371
- document.cookie = key + '=' + val + ';expires=' + exp.toGMTString();
1372
- }
1373
- }, {
1374
- key: 'getAllCookies',
1375
- value: function getAllCookies() {
1376
- var cookies = document.cookie.split(/;\s/g);
1377
- var cookieObj = {};
1378
- cookies.forEach(function (item) {
1379
- var key = item.split('=')[0];
1380
- cookieObj[key] = item.split('=')[1];
1381
- });
1382
- return cookieObj;
1383
- }
1384
- }, {
1385
- key: 'validePwd',
1386
- value: function () {
1387
- var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(value) {
1388
- var _ref19, isNewRetailBCPos, cook1, cook2, message, result, count, _result;
1389
-
1390
- return _regenerator2.default.wrap(function _callee5$(_context5) {
1391
- while (1) {
1392
- switch (_context5.prev = _context5.next) {
1393
- case 0:
1394
- _ref19 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref19.isNewRetailBCPos;
1395
- _context5.prev = 1;
1396
-
1397
- if (!isNewRetailBCPos) {
1398
- _context5.next = 18;
1399
- break;
1400
- }
1401
-
1402
- cook1 = this.getAllCookies()['errorPwd'];
1403
- cook2 = cook1 && JSON.parse(cook1);
1404
- message = '密码输入错误';
1405
-
1406
- if (!cook2) {
1407
- _context5.next = 11;
1408
- break;
1409
- }
1410
-
1411
- if (!cook2.hasOwnProperty(this.member.MeStorageCardId + "")) {
1412
- _context5.next = 11;
1413
- break;
1414
- }
1415
-
1416
- if (!(cook2[this.member.MeStorageCardId] > 3)) {
1417
- _context5.next = 11;
1418
- break;
1419
- }
1420
-
1421
- message = '今日密码错误已达上限,不可使用储值消费,请明日再试,如忘记请重置密码或修改密码。';
1422
- return _context5.abrupt('return', _promise2.default.resolve(message));
1423
-
1424
- case 11:
1425
- _context5.next = 13;
1426
- return (0, _tplusApi.ccApi)({ password: _tplusApi.User.pwdEncrypt(value.pwd) }, '/member/MeMemberWallet/checkPaymentPassword/' + value.id, false, false);
1427
-
1428
- case 13:
1429
- result = _context5.sent;
1430
-
1431
- if (!result.data) {
1432
- if (cook2) {
1433
- if (cook2.hasOwnProperty(this.member.MeStorageCardId + "")) {
1434
- count = cook2[this.member.MeStorageCardId];
1435
-
1436
- cook2[this.member.MeStorageCardId] = count + 1;
1437
- } else {
1438
- cook2[this.member.MeStorageCardId] = 1;
1439
- }
1440
- } else {
1441
- cook2 = {};
1442
- cook2[this.member.MeStorageCardId] = 1;
1443
- }
1444
- this.setCookie('errorPwd', '', -1);
1445
- this.setCookie('errorPwd', (0, _stringify2.default)(cook2));
1446
- }
1447
- return _context5.abrupt('return', _promise2.default.resolve(result.data ? "" : message));
1448
-
1449
- case 18:
1450
- _context5.next = 20;
1451
- return (0, _tplusApi.tApi)({ "CheckoutParams": {
1452
- "Idmember": value.id,
1453
- "Password": value.pwd
1454
- } }, 'AA.DR.newRetailMember.CheckoutMemberPassword', false, false);
1455
-
1456
- case 20:
1457
- _result = _context5.sent;
1458
- return _context5.abrupt('return', _promise2.default.resolve(_result.Success ? "" : _result.Message));
1459
-
1460
- case 22:
1461
- _context5.next = 27;
1462
- break;
1463
-
1464
- case 24:
1465
- _context5.prev = 24;
1466
- _context5.t0 = _context5['catch'](1);
1467
- return _context5.abrupt('return', "failed");
1468
-
1469
- case 27:
1470
- case 'end':
1471
- return _context5.stop();
1472
- }
1473
- }
1474
- }, _callee5, this, [[1, 24]]);
1475
- }));
1476
-
1477
- function validePwd(_x3) {
1478
- return _ref18.apply(this, arguments);
1479
- }
1480
-
1481
- return validePwd;
1482
- }()
1483
- }]);
1484
- return SettlementStore;
1485
- }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'queryPwd', [_mobx.action], {
1486
- enumerable: true,
1487
- initializer: function initializer() {
1488
- var _this12 = this;
1489
-
1490
- return function (newPass, newPassConfirm) {
1491
- if (!newPass || !newPassConfirm) {
1492
- return _message2.default.warn('您还有未填写项');
1493
- }
1494
- if (newPass !== newPassConfirm) {
1495
- return _message2.default.warn('您两次输入的密码不一致');
1496
- }
1497
- var idstore = (0, _tplusPoslogin.PosInitData)('storeID');
1498
- return (0, _tplusApi.ccApi)({
1499
- Idstore: idstore,
1500
- meMemberId: _this12.member.ID,
1501
- oldPassword: null,
1502
- newPassword: _tplusApi.User.pwdEncrypt(newPassConfirm),
1503
- dataSource: "POS"
1504
- }, '/member/MeMemberWallet/setWalletPayPassword', false, false, { method: 'post', timeout_skip: true }).then(function (resp) {
1505
- if (resp.successful) {
1506
- return true;
1507
- }
1508
- });
1509
- };
1510
- }
1511
- }), _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], {
1512
- enumerable: true,
1513
- initializer: function initializer() {
1514
- var _this13 = this;
1515
-
1516
- return function () {
1517
- var _ref20 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(_this) {
1518
- var _getLoginInfo, IdStore, StoreCode, resp;
1519
-
1520
- return _regenerator2.default.wrap(function _callee6$(_context6) {
1521
- while (1) {
1522
- switch (_context6.prev = _context6.next) {
1523
- case 0:
1524
- _getLoginInfo = _this13.getLoginInfo(), IdStore = _getLoginInfo.IdStore, StoreCode = _getLoginInfo.StoreCode;
1525
- _context6.next = 3;
1526
- return (0, _tplusApi.tApi)({ Idmember: _this13.member.ID, IdStore: IdStore, StoreCode: StoreCode }, 'chanjet.AA.DR.INewRetailMember.GetUmemberDTO', false, false);
1527
-
1528
- case 3:
1529
- resp = _context6.sent;
1530
-
1531
- _this.member = resp;
1532
- _this.paymode.currentMode.member.setStorageCardNo(resp.StorageCardNo);
1533
- return _context6.abrupt('return', _promise2.default.resolve(resp));
1534
-
1535
- case 7:
1536
- case 'end':
1537
- return _context6.stop();
1538
- }
1539
- }
1540
- }, _callee6, _this13);
1541
- }));
1542
-
1543
- return function (_x4) {
1544
- return _ref20.apply(this, arguments);
1545
- };
1546
- }();
1547
- }
1548
- }), _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);
1549
- exports.default = SettlementStore;
1550
- var PayMode = exports.PayMode = (_class3 = function () {
1551
- function PayMode() {
1552
- // this.amount=getFixedNumber(amount);
1553
- // this.calcReserved();
1554
-
1555
- (0, _classCallCheck3.default)(this, PayMode);
1556
- this._counter = 0;
1557
- this.amount = 0;
1558
- this.onlineamount = 0;
1559
- this.maxamount = 0;
1560
-
1561
- _initDefineProp(this, 'currentFocus', _descriptor3, this);
1562
-
1563
- _initDefineProp(this, 'received', _descriptor4, this);
1564
-
1565
- _initDefineProp(this, 'receivable', _descriptor5, this);
1566
-
1567
- _initDefineProp(this, 'paymodes', _descriptor6, this);
1568
-
1569
- _initDefineProp(this, 'thePaymodes', _descriptor7, this);
1570
-
1571
- this.currentMode = null;
1572
- this.settle = {
1573
- name: "复合结算",
1574
- hotKey: "Ctrl+M"
1575
- };
1576
- } //应收
1577
-
1578
-
1579
- (0, _createClass3.default)(PayMode, [{
1580
- key: 'clean',
1581
- value: function clean() {
1582
- this.thePaymodes = [];
1583
- this.calcReserved();
1584
- }
1585
- }, {
1586
- key: 'clear',
1587
- value: function clear() {
1588
- this.thePaymodes = [];
1589
- this.calcReserved();
1590
- this.paymodes = [];
1591
- }
1592
- }, {
1593
- key: 'setAmount',
1594
- value: function setAmount(a, o) {
1595
- this.amount = (0, _utils.getFixedNumber)((a || 0) - (o || 0));
1596
- this.onlineamount = (0, _utils.getFixedNumber)(o || 0);
1597
- this.calcReserved();
1598
- return this.amount < 0;
1599
- }
1600
- }, {
1601
- key: 'calcReserved',
1602
- value: function calcReserved() {
1603
- var sum = 0;
1604
- (0, _each3.default)(this.thePaymodes, function (mode) {
1605
- sum = Math.Add(sum, mode.value == "" ? 0 : mode.value);
1606
- });
1607
- this.received = (0, _utils.getFixedNumber)(sum);
1608
- this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
1609
- }
1610
- }, {
1611
- key: 'calcDjqValue',
1612
- value: function calcDjqValue(q1) {
1613
- var _this14 = this;
1614
-
1615
- var _ref21 = _mutantsUtil.platform || {},
1616
- isNewRetailBCPos = _ref21.isNewRetailBCPos;
1617
-
1618
- var _enumController$getEn14 = _mutantsUtil.enumController.getEnumOj(),
1619
- Differentiate = _enumController$getEn14.Differentiate;
1620
-
1621
- if (q1) {
1622
- if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
1623
- _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
1624
- return;
1625
- }
1626
- var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
1627
- return djq.code == q1.code;
1628
- });
1629
- if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
1630
- _message2.default.error("本单金额低于使用门槛,该券不可使用。");
1631
- return;
1632
- }
1633
- //判断是否是选择优惠券 //CC优惠券只能使用一个
1634
- if (q1 && !q1.checked && isNewRetailBCPos) {
1635
- // 检查是否有已经选定优惠券 并且去除选定的优惠券
1636
- this.currentMode.djqs.forEach(function (djq, index) {
1637
- if (djq.checked) _this14.currentMode.djqs[index].checked = false;
1638
- });
1639
- }
1640
- q && (q.checked = !q.checked);
1641
- }
1642
- var sum = 0;
1643
- (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
1644
- return djq.checked;
1645
- }), function (q) {
1646
- sum = Math.Add(sum, q.amount);
1647
- });
1648
- this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1649
- this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1650
- this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1651
- //this.receivable = getFixedNumber(this.receivable - sum);
1652
- }
1653
- }, {
1654
- key: 'reCalculationDjqs',
1655
- value: function reCalculationDjqs() {
1656
- var sum = 0;
1657
- (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
1658
- return djq.checked;
1659
- }), function (q) {
1660
- sum = Math.Add(sum, q.amount);
1661
- });
1662
- this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1663
- this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1664
- this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1665
- this.currentMode.maxamount = this.currentMode.receivable || this.currentMode.receivable;
1666
- }
1667
- }, {
1668
- key: 'clearDjqs',
1669
- value: function clearDjqs() {
1670
- this.currentMode.djqs = [];
1671
- }
1672
- }, {
1673
- key: 'setCurrentModeValue',
1674
- value: function setCurrentModeValue(v, max) {
1675
- this.currentMode.value = parseFloat(v) || 0;
1676
- this.currentMode.errinfo = '';
1677
- if (this.amount > 0 && (v === '' || v === '0.00')) {
1678
- this.currentMode.errinfo = "实收金额必须录入";
1679
- } else if (Math.abs(parseFloat(v)) > Math.abs(this.amount)) {
1680
- this.currentMode.errinfo = "实收不应大于应收";
1681
- } else if (parseFloat(v) > 0 && parseFloat(v) > (max || 0)) {
1682
- this.currentMode.errinfo = "余额不足";
1683
- }
1684
- }
1685
- }, {
1686
- key: 'calcMemberBalance',
1687
- value: function calcMemberBalance() {
1688
- this.currentMode.balance = this.currentMode.member.rawbalance - this.currentMode.value;
1689
- }
1690
- }, {
1691
- key: 'setPaymodes',
1692
- value: function () {
1693
- var _ref22 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type, isIntegralExchange) {
1694
- var _this15 = this;
1695
-
1696
- var _enumController$getEn15, settleStyleType, PayStyle, memberStoreCode, settlementCode, param, modes;
1697
-
1698
- return _regenerator2.default.wrap(function _callee7$(_context7) {
1699
- while (1) {
1700
- switch (_context7.prev = _context7.next) {
1701
- case 0:
1702
- _enumController$getEn15 = _mutantsUtil.enumController.getEnumOj(), settleStyleType = _enumController$getEn15.settleStyleType, PayStyle = _enumController$getEn15.PayStyle;
1703
- memberStoreCode = settleStyleType.memberStoreCode, settlementCode = settleStyleType.settlementCode;
1704
- param = { 'settleStyleType': type == 1 ? memberStoreCode : settlementCode, isIntegralExchange: isIntegralExchange };
1705
- _context7.next = 5;
1706
- return (0, _tplusApi.tApi)({ param: param }, 'chanjet.RE.NewPos.GetNewStoreSettleStyles', false, false);
1707
-
1708
- case 5:
1709
- modes = _context7.sent;
1710
-
1711
- if (modes) {
1712
- (0, _mobx.runInAction)(function () {
1713
- var paymodes = [];
1714
- (0, _each3.default)(modes.SettleStyles, function (mode, index) {
1715
- //产品需求确认会员储值卡结算方式前端展示统一调整为“储值卡" tuzha by 2020-07-08
1716
-
1717
- if (mode.Code == PayStyle.hyczk) {
1718
- mode.Name = '储值余额';
1719
- }
1720
- paymodes.push({
1721
- name: mode.Name,
1722
- isDefault: mode.IsDefaultSettleStyle,
1723
- isQuick: (0, _findIndex3.default)(modes.QuickSettleStyles, { 'Code': mode.Code }) >= 0,
1724
- orderBy: 1,
1725
- paymentType: mode.Code,
1726
- idSettleStyle: mode.IdSettleStyle,
1727
- idBankAccount: mode.IdBankAccount,
1728
- exchangeRate: mode.Currency ? mode.Currency.ExchangeRate : 1,
1729
- idCurrency: mode.Currency ? mode.Currency.ID : -1,
1730
- calDirection: mode.Currency ? mode.Currency.CalDirection.Id : "88"
1731
- });
1732
- });
1733
- _this15.paymodes = paymodes;
1734
- //modes.QuickSettleStyles
1735
- });
1736
- }
1737
-
1738
- case 7:
1739
- case 'end':
1740
- return _context7.stop();
1741
- }
1742
- }
1743
- }, _callee7, this);
1744
- }));
1745
-
1746
- function setPaymodes(_x5, _x6) {
1747
- return _ref22.apply(this, arguments);
1748
- }
1749
-
1750
- return setPaymodes;
1751
- }()
1752
- }, {
1753
- key: 'charge',
1754
- get: function get() {
1755
- return Math.abs(this.receivable);
1756
- }
1757
- }, {
1758
- key: 'counter',
1759
- get: function get() {
1760
- return ++this._counter;
1761
- }
1762
- }]);
1763
- return PayMode;
1764
- }(), (_descriptor3 = _applyDecoratedDescriptor(_class3.prototype, 'currentFocus', [_mobx.observable], {
1765
- enumerable: true,
1766
- initializer: function initializer() {
1767
- return "";
1768
- }
1769
- }), _descriptor4 = _applyDecoratedDescriptor(_class3.prototype, 'received', [_mobx.observable], {
1770
- enumerable: true,
1771
- initializer: function initializer() {
1772
- return 0;
1773
- }
1774
- }), _descriptor5 = _applyDecoratedDescriptor(_class3.prototype, 'receivable', [_mobx.observable], {
1775
- enumerable: true,
1776
- initializer: function initializer() {
1777
- return 0;
1778
- }
1779
- }), _descriptor6 = _applyDecoratedDescriptor(_class3.prototype, 'paymodes', [_mobx.observable], {
1780
- enumerable: true,
1781
- initializer: function initializer() {
1782
- return [];
1783
- }
1784
- }), _descriptor7 = _applyDecoratedDescriptor(_class3.prototype, 'thePaymodes', [_mobx.observable], {
1785
- enumerable: true,
1786
- initializer: function initializer() {
1787
- return [];
1788
- }
1789
- }), _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), _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);
1790
- var Member = exports.Member = (_class5 = function () {
1791
- function Member(m) {
1792
- var _this16 = this;
1793
-
1794
- (0, _classCallCheck3.default)(this, Member);
1795
-
1796
- _initDefineProp(this, 'cardNo', _descriptor8, this);
1797
-
1798
- _initDefineProp(this, 'balance', _descriptor9, this);
1799
-
1800
- _initDefineProp(this, 'exchangable', _descriptor10, this);
1801
-
1802
- _initDefineProp(this, 'meStorageCardId', _descriptor11, this);
1803
-
1804
- _initDefineProp(this, 'StorageCardNo', _descriptor12, this);
1805
-
1806
- if (m) {
1807
- this.id = m.ID;
1808
- this.uid = m.Uid;
1809
- this.type = m.MemberType ? m.MemberType.Name : "普通";
1810
- this.rawbalance = m.BalanceStorage;
1811
- var index = (0, _findIndex3.default)(m.DynamicPropertyKeys, function (key) {
1812
- return key == 'canusedbalancestorage';
1813
- });
1814
-
1815
- var _ref23 = _mutantsUtil.platform || {},
1816
- isNewRetailBCPos = _ref23.isNewRetailBCPos;
1817
-
1818
- m.StorageCardNo && (this.StorageCardNo = m.StorageCardNo);
1819
- (0, _mobx.runInAction)(function () {
1820
- _this16.cardNo = m.CardCode;
1821
- if (index >= 0) {
1822
- _this16.balance = parseFloat(m.DynamicPropertyValues[index]);
1823
- } else {
1824
- _this16.balance = _this16.rawbalance;
1825
- }
1826
- });
1827
- this.needPwd = m.MemberType ? m.MemberType.IsNeedPwd : false;
1828
- this.NeedModifyPassword = m.NeedModifyPassword;
1829
- this.bonusPoints = m.BalanceIntegral;
1830
- }
1831
- }
1832
-
1833
- (0, _createClass3.default)(Member, [{
1834
- key: 'setExchangable',
1835
- value: function setExchangable(v) {
1836
- this.exchangable = v;
1837
- }
1838
- }, {
1839
- key: 'setCardNo',
1840
- value: function setCardNo(v) {
1841
- this.cardNo = v;
1842
- this.id = null;
1843
- }
1844
- }, {
1845
- key: 'setMeStorageCardId',
1846
- value: function setMeStorageCardId(v) {
1847
- this.meStorageCardId = v;
1848
- }
1849
- }, {
1850
- key: 'setStorageCardNo',
1851
- value: function setStorageCardNo(v) {
1852
- this.StorageCardNo = v;
1853
- }
1854
- }]);
1855
- return Member;
1856
- }(), (_descriptor8 = _applyDecoratedDescriptor(_class5.prototype, 'cardNo', [_mobx.observable], {
1857
- enumerable: true,
1858
- initializer: null
1859
- }), _descriptor9 = _applyDecoratedDescriptor(_class5.prototype, 'balance', [_mobx.observable], {
1860
- enumerable: true,
1861
- initializer: null
1862
- }), _descriptor10 = _applyDecoratedDescriptor(_class5.prototype, 'exchangable', [_mobx.observable], {
1863
- enumerable: true,
1864
- initializer: null
1865
- }), _descriptor11 = _applyDecoratedDescriptor(_class5.prototype, 'meStorageCardId', [_mobx.observable], {
1866
- enumerable: true,
1867
- initializer: null
1868
- }), _descriptor12 = _applyDecoratedDescriptor(_class5.prototype, 'StorageCardNo', [_mobx.observable], {
1869
- enumerable: true,
1870
- initializer: null
1871
- }), _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);
1872
- //# sourceMappingURL=settlementStore.js.map