tplus-components-touch 3.45.1 → 3.46.1

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