tplus-components-touch 3.43.1 → 3.45.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 (80) hide show
  1. package/dist/components/billSearch/index.js +17 -40
  2. package/dist/components/billSearch/index.js.map +1 -1
  3. package/dist/components/deliverySearch/index.js +5 -1
  4. package/dist/components/deliverySearch/index.js.map +1 -1
  5. package/dist/components/hotKey/localConfig.js +13 -0
  6. package/dist/components/hotKey/localConfig.js.map +1 -1
  7. package/dist/components/inventorySearch/tab.js +6 -1
  8. package/dist/components/inventorySearch/tab.js.map +1 -1
  9. package/dist/components/loading/loadingContent.js +5 -2
  10. package/dist/components/loading/loadingContent.js.map +1 -1
  11. package/dist/components/message/index.js +4 -6
  12. package/dist/components/message/index.js.map +1 -1
  13. package/dist/components/modalWraper/index.js +16 -1
  14. package/dist/components/modalWraper/index.js.map +1 -1
  15. package/dist/components/modalWraper/style.less +6 -0
  16. package/dist/components/notification/index.js +11 -12
  17. package/dist/components/notification/index.js.map +1 -1
  18. package/dist/components/progressState/EmptyAndErrorView.js +5 -7
  19. package/dist/components/progressState/EmptyAndErrorView.js.map +1 -1
  20. package/dist/components/settlement/asyncModal.js +4 -1
  21. package/dist/components/settlement/asyncModal.js.map +1 -1
  22. package/dist/components/settlement/settlement.js +352 -291
  23. package/dist/components/settlement/settlement.js.map +1 -1
  24. package/dist/components/settlement/settlement.less +4 -1
  25. package/dist/components/settlement/settlementApi.js +512 -0
  26. package/dist/components/settlement/settlementApi.js.map +1 -0
  27. package/dist/components/ticon/iconfont/demo.css +539 -539
  28. package/dist/index.js +8 -3
  29. package/dist/index.js.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/components/commonForm/addressPicker/index.js +0 -241
  32. package/dist/components/commonForm/addressPicker/index.js.map +0 -1
  33. package/dist/components/commonForm/autoComplete/index.js +0 -260
  34. package/dist/components/commonForm/autoComplete/index.js.map +0 -1
  35. package/dist/components/commonForm/datePicker/index.js +0 -92
  36. package/dist/components/commonForm/datePicker/index.js.map +0 -1
  37. package/dist/components/commonForm/formControl/index.js +0 -144
  38. package/dist/components/commonForm/formControl/index.js.map +0 -1
  39. package/dist/components/commonForm/inputNumber/index.js +0 -272
  40. package/dist/components/commonForm/inputNumber/index.js.map +0 -1
  41. package/dist/components/commonForm/radio/index.js +0 -132
  42. package/dist/components/commonForm/radio/index.js.map +0 -1
  43. package/dist/components/input/tplusInput/index.js +0 -81
  44. package/dist/components/input/tplusInput/index.js.map +0 -1
  45. package/dist/components/input/tplusInput/inputContent.js +0 -128
  46. package/dist/components/input/tplusInput/inputContent.js.map +0 -1
  47. package/dist/components/input/tplusInput/inputs.js +0 -151
  48. package/dist/components/input/tplusInput/inputs.js.map +0 -1
  49. package/dist/components/input/utils/index.js +0 -26
  50. package/dist/components/input/utils/index.js.map +0 -1
  51. package/dist/components/settlement/moreCzkTable/index.js +0 -156
  52. package/dist/components/settlement/moreCzkTable/index.js.map +0 -1
  53. package/dist/components/settlement/prototypeTable/index.js +0 -353
  54. package/dist/components/settlement/prototypeTable/index.js.map +0 -1
  55. package/dist/components/settlement/prototypeTable/utils.js +0 -14
  56. package/dist/components/settlement/prototypeTable/utils.js.map +0 -1
  57. package/dist/components/settlement/settlementStore.js +0 -2869
  58. package/dist/components/settlement/settlementStore.js.map +0 -1
  59. package/dist/components/settlement/utils.js +0 -249
  60. package/dist/components/settlement/utils.js.map +0 -1
  61. package/dist/components/socket/index.js +0 -221
  62. package/dist/components/socket/index.js.map +0 -1
  63. package/dist/components/spin/index.js +0 -95
  64. package/dist/components/spin/index.js.map +0 -1
  65. package/dist/components/test/index.js +0 -330
  66. package/dist/components/test/index.js.map +0 -1
  67. package/dist/components/ticon/iconfont/iconfont.js +0 -35
  68. package/dist/components/ticon/iconfont/iconfont.js.map +0 -1
  69. package/dist/components/ticon/index.js +0 -60
  70. package/dist/components/ticon/index.js.map +0 -1
  71. package/dist/components/touchScroll/index.js +0 -186
  72. package/dist/components/touchScroll/index.js.map +0 -1
  73. package/dist/components/touchTable/AuthProcess.js +0 -42
  74. package/dist/components/touchTable/AuthProcess.js.map +0 -1
  75. package/dist/components/touchTable/generateWater.js +0 -59
  76. package/dist/components/touchTable/generateWater.js.map +0 -1
  77. package/dist/components/touchTable/index.js +0 -1133
  78. package/dist/components/touchTable/index.js.map +0 -1
  79. package/dist/components/touchTable/utils.js +0 -14
  80. package/dist/components/touchTable/utils.js.map +0 -1
@@ -1,2869 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Member = exports.PayMode = exports.default = undefined;
7
-
8
- var _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.integralCashOverOrderAmount;
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
- key: 'getLoginInfo',
766
- value: function getLoginInfo() {
767
- return _mutantsMicrofx.stores.user.options.get('loginInfo');
768
- }
769
- }, {
770
- key: 'loadCzk',
771
- value: function loadCzk(v) {
772
- var _this7 = this;
773
-
774
- if ((0, _trim3.default)(v) === "") {
775
- (0, _mobx.runInAction)(function () {
776
- _this7.paymode.currentMode.errinfo = "请输入储值卡";
777
- });
778
- return;
779
- }
780
- var IdStore = this.storeInfo.storeID;
781
- var StoreCode = this.storeInfo.storeCode; //_find(this.storeInfo.storeInfos,(store)=>{return store.ID==IdStore;}).Code;
782
-
783
- var _ref8 = _mutantsUtil.platform || {},
784
- isNewRetailBCPos = _ref8.isNewRetailBCPos;
785
-
786
- var address = '';
787
- if (isNewRetailBCPos) {
788
- // address = '/member/memberProfile/FindByStorageCode/'+v;
789
- address = '/marketingtool/MeStorageCard/getCardInfoByCardNo/' + v + '/' + true;
790
- return (0, _tplusApi.ccApi)({ code: v }, address, false, false, { method: 'get', timeout_skip: true }).then(function () {
791
- var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(result) {
792
- var data, m;
793
- return _regenerator2.default.wrap(function _callee3$(_context3) {
794
- while (1) {
795
- switch (_context3.prev = _context3.next) {
796
- case 0:
797
- data = result.data;
798
- m = data && data.length && data[0];
799
-
800
- if (!(result && result.data.length)) {
801
- _context3.next = 25;
802
- break;
803
- }
804
-
805
- if (!(result.data.length === 1)) {
806
- _context3.next = 14;
807
- break;
808
- }
809
-
810
- if (!(m.CardTypeEnum === 'BALANCE_CARD')) {
811
- _context3.next = 10;
812
- break;
813
- }
814
-
815
- _this7.paymode.updateCardInfo(m);
816
- _this7.handleCzkData(m);
817
- return _context3.abrupt('return', result.data);
818
-
819
- case 10:
820
- _context3.next = 12;
821
- return (0, _tplusApi.ccApi)({ dto: _this7.dto, meStorageCardId: m.MeStorageCardId }, '/retail/RetailPos/validateRetailStorageCard', false, false).then(function (result1) {
822
- var data1 = result1.data ? JSON.parse(result1.data)[0] : {};
823
- if (data1.enable) {
824
- _this7.paymode.updateCardInfo(m);
825
- _this7.handleCzkData(m);
826
- return result1.data;
827
- } else {
828
- _message2.default.warn(data1.disableReason);
829
- }
830
- });
831
-
832
- case 12:
833
- _context3.next = 25;
834
- break;
835
-
836
- case 14:
837
- if (!(result.data && result.data.length === 1)) {
838
- _context3.next = 19;
839
- break;
840
- }
841
-
842
- _this7.paymode.updateCardInfo(result.data[0]);
843
- return _context3.abrupt('return', result.data);
844
-
845
- case 19:
846
- if (!(result.data && result.data.length > 1)) {
847
- _context3.next = 23;
848
- break;
849
- }
850
-
851
- return _context3.abrupt('return', result.data);
852
-
853
- case 23:
854
- _message2.default.warn('没有可用储值卡!');
855
- return _context3.abrupt('return', false);
856
-
857
- case 25:
858
- case 'end':
859
- return _context3.stop();
860
- }
861
- }
862
- }, _callee3, _this7);
863
- }));
864
-
865
- return function (_x2) {
866
- return _ref9.apply(this, arguments);
867
- };
868
- }()
869
- // result.data.forEach((m) => {
870
- // if (m.CardTypeEnum === 'BALANCE_CARD') {
871
- // // 会员概念改为卡,把这些字段都放开
872
- // this.paymode.updateCardInfo(m);
873
- // }
874
- // })
875
- );
876
- } else {
877
- address = 'AA.DR.newRetailMember.SearchMember';
878
- return (0, _tplusApi.tApi)({ SearchParams: { Key: v, IsSingleMember: true, IdStore: IdStore, StoreCode: StoreCode } }, address, false, false).then(function (result) {
879
- var data = JSON.parse(result.Data);
880
- var m = data && data.length > 0 && data[0];
881
- if (!m || !m.ID) {
882
- (0, _mobx.runInAction)(function () {
883
- _this7.paymode.currentMode.errinfo = "无效的会员卡号";
884
- });
885
- } else {
886
- (0, _mobx.runInAction)(function () {
887
- _this7.paymode.currentMode.errinfo = "";
888
- _this7.paymode.currentMode.member = new Member(m);
889
- _this7.paymode.currentMode.value = (0, _utils.getFixedNumber)(_this7.brefund ? _this7.paymode.receivable : Math.max(_this7.paymode.receivable, 0));
890
- _this7.updateEvent();
891
- var message = '';
892
- if (global.CheckMemberStorageProcessorBlock) {
893
- message = CheckMemberStorageProcessorBlock.execute(data[0]);
894
- }
895
- if (!String.isNullOrEmpty(message)) {
896
- _this7.paymode.currentMode.errinfo = message;
897
- } else if (_this7.checkReceived(_this7.paymode.currentMode, "balance")) {
898
- _this7.paymode.currentMode.errinfo = "余额不足";
899
- } else if (_this7.paymode.amount > 0 && _this7.paymode.currentMode.value == 0) {
900
- _this7.paymode.currentMode.errinfo = "实收金额必须录入";
901
- } else {
902
- // 查询成功后将焦点移入下一个输入框
903
- var nextInput = document.querySelector('.czk .received .input');
904
- nextInput && nextInput.focus();
905
- }
906
- });
907
- }
908
- });
909
- }
910
- }
911
- }, {
912
- key: 'addDjq',
913
- value: function addDjq(promoCouponCode, name, IsEnable, nominalAmount, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id, unCheck, count) {
914
- var djq = {
915
- code: promoCouponCode,
916
- promoCouponCode: promoCouponCode,
917
- name: name,
918
- IsEnable: IsEnable,
919
- nominalAmount: nominalAmount,
920
- amount: amount,
921
- doorsill: doorsill, //:"无门槛"
922
- LastTS: LastTS,
923
- checked: checked,
924
- IsRepelWithPoints: IsRepelWithPoints,
925
- UMemberID: UMemberID,
926
- expired: expired, //还剩多少过期
927
- displayText: displayText,
928
- promoMethodEnum: promoMethodEnum,
929
- discountPct: discountPct,
930
- promoId: promoId,
931
- promoRuleId: promoRuleId,
932
- couponCategoryEnum: couponCategoryEnum,
933
- id: id,
934
- count: count === 1 && (couponCategoryEnum === 'RIGUP' || couponCategoryEnum === 'UN_MATCH' || couponCategoryEnum === "PREPARING" || couponCategoryEnum === 'PROMO_LIMITED' || couponCategoryEnum === 'COUPON_CONFLICT') ? 1 : null
935
- };
936
- this.paymode.currentMode.djqs.push(djq);
937
- // let copyData = _clonedeep(this.data[targetIndex]);
938
- !unCheck && !this.boriginReturn && this.paymode.calcDjqValue(djq);
939
- }
940
- }, {
941
- key: 'setCurrentMode',
942
- value: function setCurrentMode(id, type, append) {
943
- var _enumController$getEn7 = _mutantsUtil.enumController.getEnumOj(),
944
- PayStyle = _enumController$getEn7.PayStyle;
945
-
946
- var mode = (0, _find3.default)(this.paymode.thePaymodes, { paymethodId: id });
947
- if (mode) {
948
- this.paymode.currentMode = mode;
949
- if (this.newStyle) {
950
- this.afterSetCurrentMode(type);
951
- }
952
- } else {
953
- this.paymode.currentMode = this.genNewMode(type, append);
954
- this.afterSetCurrentMode(type);
955
- }
956
- }
957
- }, {
958
- key: 'afterSetCurrentMode',
959
- value: function afterSetCurrentMode(type) {
960
- var _this8 = this;
961
-
962
- var _enumController$getEn8 = _mutantsUtil.enumController.getEnumOj(),
963
- PayStyle = _enumController$getEn8.PayStyle;
964
-
965
- if (type == PayStyle.djq) {
966
- this.paymode.calcDjqValue();
967
- } else if (type == PayStyle.jfdx) {
968
- //获取可兑换的金额
969
- if (this.newStyle) {
970
- var themode = (0, _find3.default)(this.paymode.thePaymodes, { paymentType: PayStyle.jfdx });
971
- if (themode && parseFloat(themode.value || 0) != 0) {
972
- this.paymode.currentMode.value = themode.value;
973
- }
974
- }
975
-
976
- //积分抵现不包含运费
977
- var BuyerPayFreight = this.dto.BuyerPayFreight;
978
- var DistributionMode = this.dto.DistributionMode;
979
- var IdbusiType = this.dto.IdbusiType;
980
-
981
- var _getLoginInfo2 = this.getLoginInfo(),
982
- PreSellOrBook = _getLoginInfo2.PreSellOrBook,
983
- PercentageWhenBook = _getLoginInfo2.PercentageWhenBook;
984
-
985
- var value = 0;
986
- if ((DistributionMode.Id == 'ELECTRONIC' || DistributionMode.Id == 'CITY_DISTRIBUTE') && BuyerPayFreight && BuyerPayFreight > 0) {
987
- value = (0, _utils.getFixedNumber)(Math.Minus(this.paymode.amount, BuyerPayFreight));
988
- } else if (IdbusiType == 38 && PreSellOrBook == 'BOOK' && PercentageWhenBook < 100 && (!DistributionMode.Id || DistributionMode.Id == 'ON_SITE_PICKUP')) {
989
- //预订场景下:现场提货,且订金比例非100%时,积分抵现按全款计算(因为只有全款才能使用积分抵现)
990
- value = this.paymode.bookMaxValue;
991
- } else {
992
- value = this.paymode.amount;
993
- }
994
-
995
- (0, _tplusApi.tApi)({ IntegralSteadCashParams: {
996
- Idmember: this.paymode.currentMode.memberId,
997
- TotalTaxAmount: value,
998
- BalanceTaxAmount: value
999
- } }, 'AA.DR.newRetailMember.CalculdateIntegralSteadCash', false, false).then(function (result) {
1000
- _this8.paymode.currentMode.member.setExchangable(result.MaxAmount);
1001
- _this8.paymode.currentMode.perIntegral = result.perIntegral;
1002
- _this8.paymode.currentMode.cashAmount = result.cashAmount;
1003
- _this8.paymode.currentMode.integralCashOverOrderAmount = result.integralCashOverOrderAmount;
1004
- _this8.updateEvent();
1005
- if (_this8.checkReceived(_this8.paymode.currentMode, "exchangable")) {
1006
- (0, _mobx.runInAction)(function () {
1007
- _this8.paymode.currentMode.errinfo = '余额不足';
1008
- });
1009
- }
1010
- });
1011
- }
1012
- }
1013
- }, {
1014
- key: 'checkReceived',
1015
- value: function checkReceived(mode, name) {
1016
- return !this.brefund && parseFloat(mode.value) > parseFloat(mode.maxamount || mode.member[name] || 0);
1017
- }
1018
- }, {
1019
- key: 'genNewMode',
1020
- value: function genNewMode(type, notwithm, v, isQuick) {
1021
- var _enumController$getEn9 = _mutantsUtil.enumController.getEnumOj(),
1022
- PayStyle = _enumController$getEn9.PayStyle;
1023
-
1024
- var value = (0, _utils.getFixedNumber)(v || (this.brefund ? this.paymode.receivable : Math.max(this.paymode.receivable, 0)));
1025
- var themode = (0, _find3.default)(this.paymode.paymodes, { 'paymentType': type });
1026
- var memberId = this.member && this.member.ID ? this.member.ID : null;
1027
- var mode = (0, _mobx.observable)({
1028
- paymethodId: this.paymode.counter,
1029
- name: themode.name,
1030
- exchangeRate: themode.exchangeRate,
1031
- calDirection: themode.calDirection,
1032
- thridPayment: themode.thridPayment,
1033
- value: value,
1034
- value2: (0, _utils.getFixedNumber)(themode.calDirection == "88" ? value / themode.exchangeRate : value * themode.exchangeRate),
1035
- value3: value,
1036
- order: this.paymode.thePaymodes.length + 1,
1037
- paymentType: type,
1038
- djqs: [],
1039
- card: null,
1040
- memberId: !notwithm ? memberId : null,
1041
- member: new Member(!notwithm ? this.member : null),
1042
- authCode: '',
1043
- steadCashIntegral: null,
1044
- errinfo: '',
1045
- maxamount: this.paymode.amount,
1046
- virtualPay: themode.virtualPay
1047
- });
1048
- if (type == PayStyle.hyczk) {
1049
- if (!mode.storageCardNo) {
1050
- (0, _mobx.runInAction)(function () {
1051
- mode.errinfo = '未录入手机号或储值卡号';
1052
- });
1053
- } else if (this.checkReceived(mode, "balance")) {
1054
- (0, _mobx.runInAction)(function () {
1055
- mode.errinfo = '余额不足';
1056
- });
1057
- }
1058
- }
1059
- if (type == PayStyle.hyczk || type == PayStyle.jfdx || type == PayStyle.djq) {
1060
- this.setMaxAmount(type, mode);
1061
- }
1062
- console.log('\u5F53\u524D\u64CD\u4F5C\u7ED3\u7B97\u65B9\u5F0F\u4FE1\u606F:' + mode);
1063
- return mode;
1064
- }
1065
- }, {
1066
- key: 'setMaxAmount',
1067
- value: function setMaxAmount(type, mode) {
1068
- var _this9 = this;
1069
-
1070
- var _enumController$getEn10 = _mutantsUtil.enumController.getEnumOj(),
1071
- PayStyle = _enumController$getEn10.PayStyle;
1072
-
1073
- var sum = 0;
1074
- if (type == PayStyle.hyczk) {
1075
- (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
1076
- return m.paymentType == type;
1077
- }), function (q) {
1078
- sum = Math.Add(sum, q.value);
1079
- });
1080
- } else if (type == PayStyle.djq || type == PayStyle.jfdx) {
1081
- (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
1082
- return m.paymentType == PayStyle.djq || m.paymentType == PayStyle.jfdx;
1083
- }), function (q) {
1084
- sum = Math.Add(sum, q.value);
1085
- });
1086
- }
1087
-
1088
- this.amountHandler && this.amountHandler(type).then(function () {
1089
- (0, _mobx.runInAction)(function () {
1090
-
1091
- //预售储值结算应包含运费
1092
- var BuyerPayFreight = _this9.dto.BuyerPayFreight;
1093
- var DistributionMode = _this9.dto.DistributionMode;
1094
- var value = 0;
1095
- if ((DistributionMode.Id == 'ELECTRONIC' || DistributionMode.Id == 'CITY_DISTRIBUTE') && BuyerPayFreight && BuyerPayFreight > 0 && type == PayStyle.hyczk) {
1096
- value = (0, _utils.getFixedNumber)(parseFloat(_this9.context.viewModel.getViewItem('Voucher').availableAmount) + parseFloat(BuyerPayFreight));
1097
- } else {
1098
- value = _this9.context.viewModel.getViewItem('Voucher').availableAmount;
1099
- }
1100
- mode.maxamount = (0, _utils.getFixedNumber)(Math.Minus(value, sum));
1101
- _this9.updateEvent();
1102
- });
1103
- });
1104
- }
1105
- }, {
1106
- key: 'changeFocusOnly',
1107
- value: function changeFocusOnly(type) {
1108
- this.paymode.currentFocus = type;
1109
- }
1110
- }, {
1111
- key: 'changeClickFocusOnly',
1112
- value: function changeClickFocusOnly(type) {
1113
- this.paymode.currentFocus = type;
1114
- // 获取焦点时带入剩余的值
1115
- var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymentType': type });
1116
- if (mode) {
1117
- var shouldSetValue = (0, _utils.getFixedNumber)(parseFloat(this.paymode.receivable) + parseFloat(mode.value));
1118
- mode.value = shouldSetValue;
1119
- mode.value2 = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? shouldSetValue / mode.exchangeRate : shouldSetValue * mode.exchangeRate);
1120
- mode.value3 = shouldSetValue;
1121
- this.paymode.calcReserved('bookPay'); //参数multiPay代表复合结算
1122
- }
1123
- }
1124
- }, {
1125
- key: 'changeValue',
1126
- value: function changeValue(index, value, blur, type) {
1127
- var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymethodId': index });
1128
- var v = blur ? (0, _utils.getFixedNumber)(value) : isNaN(value) && value != '-' ? 0.00 : value;
1129
- if (mode) {
1130
- if (mode.exchangeRate != 1) {
1131
- if ((0, _utils.getFixedNumber)(mode.calDirection == "88" ? mode.value3 / mode.exchangeRate : mode.value3 * mode.exchangeRate) != v) {
1132
- mode.value = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? v * mode.exchangeRate : v / mode.exchangeRate);
1133
- } else {
1134
- mode.value = mode.value3;
1135
- }
1136
- mode.value2 = v;
1137
- } else {
1138
- mode.value = v;
1139
- mode.value2 = v;
1140
- }
1141
-
1142
- this.paymode.calcReserved(type);
1143
- }
1144
- }
1145
- }, {
1146
- key: 'addPayDirectly',
1147
- value: function addPayDirectly(pay) {
1148
- var _enumController$getEn11 = _mutantsUtil.enumController.getEnumOj(),
1149
- PayStyle = _enumController$getEn11.PayStyle;
1150
-
1151
- if (!(0, _find3.default)(this.paymode.thePaymodes, { paymethodId: pay.paymethodId })) {
1152
- var pos = this.paymode.thePaymodes.length;
1153
- if (pay.paymentType == PayStyle.hyczk) {
1154
- var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
1155
- return m.paymethodId != pay.paymethodId && m.paymentType == PayStyle.hyczk;
1156
- });
1157
- pos = index == -1 ? pos : index + 1;
1158
- }
1159
- // this.paymode.thePaymodes.push(pay);
1160
- this.paymode.thePaymodes.splice(pos, 0, pay);
1161
- }
1162
- this.paymode.calcReserved();
1163
- }
1164
- }, {
1165
- key: 'addPay',
1166
- value: function addPay(type, bookType, isQuick) {
1167
- var _enumController$getEn12 = _mutantsUtil.enumController.getEnumOj(),
1168
- PayStyle = _enumController$getEn12.PayStyle;
1169
-
1170
- var pos = this.paymode.thePaymodes.length;
1171
- if (type == PayStyle.hyczk) {
1172
- var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
1173
- return m.paymentType == PayStyle.hyczk;
1174
- });
1175
- pos = index == -1 ? pos : index + 1;
1176
- }
1177
- this.paymode.thePaymodes.splice(pos, 0, this.genNewMode(type, this.newStyle && type == PayStyle.hyczk, undefined, isQuick));
1178
- this.paymode.calcReserved(bookType);
1179
- }
1180
- }, {
1181
- key: 'delPay',
1182
- value: function delPay(index, bookType) {
1183
- var _enumController$getEn13 = _mutantsUtil.enumController.getEnumOj(),
1184
- PayStyle = _enumController$getEn13.PayStyle;
1185
-
1186
- (0, _remove3.default)(this.paymode.thePaymodes, function (mode) {
1187
- return mode.paymethodId === index;
1188
- });
1189
- this.paymode.currentFocus = -1;
1190
- this.paymode.calcReserved(bookType);
1191
- }
1192
-
1193
- // 获取储值是否重复, 在commit方法中使用
1194
-
1195
- }, {
1196
- key: 'findStorageBillValidate',
1197
- value: function findStorageBillValidate() {
1198
- var _this10 = this;
1199
-
1200
- var _enumController$getEn14 = _mutantsUtil.enumController.getEnumOj(),
1201
- PayStyle = _enumController$getEn14.PayStyle;
1202
-
1203
- (0, _mobx.runInAction)(function () {
1204
- _this10.dto.StorageMutiSettleDetails = [];
1205
- var thePaymodes = _this10.newStyle ? (0, _filter3.default)(_this10.paymode.thePaymodes, function (mode) {
1206
- return parseFloat(mode.value) != 0;
1207
- }) : _this10.paymode.thePaymodes;
1208
- (0, _each3.default)(thePaymodes, function (mode) {
1209
- var themode = (0, _find3.default)(_this10.paymode.paymodes, { 'paymentType': mode.paymentType });
1210
-
1211
- var value = parseFloat(mode.value);
1212
- var giveChange = null;
1213
- if (mode.paymentType == PayStyle.xianjin && _this10.paymode.receivable < 0 && value > Math.abs(_this10.paymode.receivable)) {
1214
- value = Math.Add(value, _this10.paymode.receivable);
1215
- giveChange = Math.abs(_this10.paymode.receivable);
1216
- }
1217
- _this10.dto.StorageMutiSettleDetails.push({
1218
- Code: mode.paymethodId,
1219
- StorageAmount: value,
1220
- GiveChange: giveChange,
1221
- IdsettleStyle: themode.idSettleStyle,
1222
- IdbankAccount: themode.idBankAccount,
1223
- PaymentCode: mode.authCode,
1224
- DynamicPropertyKeys: [],
1225
- DynamicPropertyValues: [],
1226
- DataSource: { Id: _this10.dataSource }
1227
- });
1228
- });
1229
- });
1230
- return (0, _tplusApi.ccApi)((0, _extends3.default)({}, this.dto), '/marketingtool/Storage/findStorageBillValidate', false, false);
1231
- }
1232
-
1233
- //判断是否重复弹框
1234
-
1235
- }, {
1236
- key: 'commit',
1237
- value: function () {
1238
- var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(bTest) {
1239
- var status, paylist, ret, _ref11, _ref11$data, code, returnMsg, state, ret1, ret2;
1240
-
1241
- return _regenerator2.default.wrap(function _callee4$(_context4) {
1242
- while (1) {
1243
- switch (_context4.prev = _context4.next) {
1244
- case 0:
1245
- console.log('settlementStore.commit开始,参数:' + bTest);
1246
-
1247
- if (!bTest) {
1248
- _context4.next = 3;
1249
- break;
1250
- }
1251
-
1252
- return _context4.abrupt('return', _promise2.default.resolve(true));
1253
-
1254
- case 3:
1255
- status = this.type;
1256
- _context4.prev = 4;
1257
- paylist = this.paymode.thePaymodes.filter(function (v) {
1258
- return !!v.thridPayment && Math.abs(v.value) > 0;
1259
- }) || [];
1260
-
1261
- if (!(paylist && paylist.length > 1)) {
1262
- _context4.next = 9;
1263
- break;
1264
- }
1265
-
1266
- _message2.default.warn('二开支付目前仅支持单一结算方式。');
1267
- return _context4.abrupt('return', _promise2.default.resolve(false));
1268
-
1269
- case 9:
1270
- if (!(status == 1)) {
1271
- _context4.next = 30;
1272
- break;
1273
- }
1274
-
1275
- _context4.next = 12;
1276
- return this.findStorageBillValidate();
1277
-
1278
- case 12:
1279
- ret = _context4.sent;
1280
- _ref11 = ret || {}, _ref11$data = _ref11.data;
1281
- _ref11$data = _ref11$data === undefined ? {} : _ref11$data;
1282
- code = _ref11$data.code, returnMsg = _ref11$data.returnMsg;
1283
-
1284
- if (!(code && code == 10001)) {
1285
- _context4.next = 24;
1286
- break;
1287
- }
1288
-
1289
- _context4.next = 19;
1290
- return this.repeatStorageModal(returnMsg);
1291
-
1292
- case 19:
1293
- state = _context4.sent;
1294
-
1295
- if (!(state === false)) {
1296
- _context4.next = 22;
1297
- break;
1298
- }
1299
-
1300
- return _context4.abrupt('return', _promise2.default.resolve(false));
1301
-
1302
- case 22:
1303
- _context4.next = 28;
1304
- break;
1305
-
1306
- case 24:
1307
- _context4.next = 26;
1308
- return this.saveMember();
1309
-
1310
- case 26:
1311
- ret1 = _context4.sent;
1312
-
1313
- if (ret1 === false) {
1314
- _promise2.default.resolve(false);
1315
- }
1316
-
1317
- case 28:
1318
- _context4.next = 39;
1319
- break;
1320
-
1321
- case 30:
1322
- _context4.next = 32;
1323
- return _mutantsMicrofx.stores.offlineSys.generatorCode(this.dto);
1324
-
1325
- case 32:
1326
- _context4.next = 34;
1327
- return this.save();
1328
-
1329
- case 34:
1330
- ret2 = _context4.sent;
1331
-
1332
- if (!(ret2 === false)) {
1333
- _context4.next = 37;
1334
- break;
1335
- }
1336
-
1337
- return _context4.abrupt('return', _promise2.default.resolve(false));
1338
-
1339
- case 37:
1340
- _context4.next = 39;
1341
- return _mutantsMicrofx.stores.offlineSys.retailSequenceUpload();
1342
-
1343
- case 39:
1344
- return _context4.abrupt('return', _promise2.default.resolve(true));
1345
-
1346
- case 42:
1347
- _context4.prev = 42;
1348
- _context4.t0 = _context4['catch'](4);
1349
-
1350
- console.error('settlementStore.commit失败,错误信息:' + _context4.t0);
1351
- //其他支付失败时,处理二开支付情况。
1352
- this.thirdPayRefund(status == 1 ? 2 : 1);
1353
- return _context4.abrupt('return', _promise2.default.resolve(_context4.t0));
1354
-
1355
- case 47:
1356
- case 'end':
1357
- return _context4.stop();
1358
- }
1359
- }
1360
- }, _callee4, this, [[4, 42]]);
1361
- }));
1362
-
1363
- function commit(_x3) {
1364
- return _ref10.apply(this, arguments);
1365
- }
1366
-
1367
- return commit;
1368
- }()
1369
- }, {
1370
- key: 'handlePrint',
1371
- value: function handlePrint(resp) {
1372
- // 储值打印
1373
- return (0, _tplusComponentsTouch.printDispatch)(_tplusComponentsTouch.DoNameList.DO_STORAGE_PRINT, resp, {});
1374
- }
1375
- }, {
1376
- key: 'saveMember',
1377
- value: function () {
1378
- var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5() {
1379
- var _this11 = this;
1380
-
1381
- var _enumController$getEn15, PayStyle, TradeType, IPMSG, dtoParams, payList, payment, tradeType, ret, _ref13, type, data, msg, code;
1382
-
1383
- return _regenerator2.default.wrap(function _callee5$(_context5) {
1384
- while (1) {
1385
- switch (_context5.prev = _context5.next) {
1386
- case 0:
1387
- _enumController$getEn15 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn15.PayStyle, TradeType = _enumController$getEn15.TradeType;
1388
-
1389
- (0, _mobx.runInAction)(function () {
1390
- _this11.dto.StorageMutiSettleDetails = [];
1391
- var thePaymodes = _this11.newStyle ? (0, _filter3.default)(_this11.paymode.thePaymodes, function (mode) {
1392
- return parseFloat(mode.value) != 0;
1393
- }) : _this11.paymode.thePaymodes;
1394
- (0, _each3.default)(thePaymodes, function (mode) {
1395
- var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': mode.paymentType });
1396
-
1397
- var value = parseFloat(mode.value);
1398
- var giveChange = null;
1399
- if (mode.paymentType == PayStyle.xianjin && _this11.paymode.receivable < 0 && value > Math.abs(_this11.paymode.receivable)) {
1400
- value = Math.Add(value, _this11.paymode.receivable);
1401
- giveChange = Math.abs(_this11.paymode.receivable);
1402
- }
1403
- _this11.dto.StorageMutiSettleDetails.push({
1404
- Code: mode.paymethodId,
1405
- StorageAmount: value,
1406
- GiveChange: giveChange,
1407
- IdsettleStyle: themode.idSettleStyle,
1408
- IdbankAccount: themode.idBankAccount,
1409
- PaymentCode: mode.authCode,
1410
- DynamicPropertyKeys: [],
1411
- DynamicPropertyValues: [],
1412
- DataSource: { Id: _this11.dataSource },
1413
- ThirdPaymentInfo: themode.thridPayment || null,
1414
- ThirdPaymentReturnInfo: mode.thirdPaymentReturnInfo || null
1415
- });
1416
- });
1417
- });
1418
- // cc结算调用
1419
- IPMSG = {};
1420
-
1421
- if (!!window.localStorage.IPMSG) {
1422
- IPMSG = JSON.parse(window.localStorage.IPMSG);
1423
- }
1424
- dtoParams = this.dto;
1425
- //处理存在二开支付情况
1426
-
1427
- payList = dtoParams.StorageMutiSettleDetails.filter(function (v) {
1428
- return v.ThirdPaymentInfo;
1429
- });
1430
-
1431
- if (!(payList && payList.length > 0)) {
1432
- _context5.next = 19;
1433
- break;
1434
- }
1435
-
1436
- payment = payList[0];
1437
- tradeType = payment && payment.StorageAmount > 0 ? TradeType.PAY : TradeType.REFUND;
1438
- _context5.next = 11;
1439
- return this.thirdPay(2, payment, tradeType, dtoParams);
1440
-
1441
- case 11:
1442
- ret = _context5.sent;
1443
- _ref13 = ret || {}, type = _ref13.type, data = _ref13.data, msg = _ref13.msg, code = _ref13.code;
1444
-
1445
- if (!(type === true)) {
1446
- _context5.next = 17;
1447
- break;
1448
- }
1449
-
1450
- dtoParams = data;
1451
- _context5.next = 19;
1452
- break;
1453
-
1454
- case 17:
1455
- _message2.default.warn('\u5237\u5361\u652F\u4ED8\u5931\u8D25,\u9519\u8BEF\u7801:' + code);
1456
- return _context5.abrupt('return', false);
1457
-
1458
- case 19:
1459
- this.dtoParams = dtoParams;
1460
- console.log('储值结算信息:', dtoParams);
1461
- return _context5.abrupt('return', (0, _tplusApi.tApi)({ dto: dtoParams }, 'chanjet.ME.INewRetailMemberStorage.Save', false, false).then(function (resp) {
1462
- _this11.handlePrint(resp);
1463
- }));
1464
-
1465
- case 22:
1466
- case 'end':
1467
- return _context5.stop();
1468
- }
1469
- }
1470
- }, _callee5, this);
1471
- }));
1472
-
1473
- function saveMember() {
1474
- return _ref12.apply(this, arguments);
1475
- }
1476
-
1477
- return saveMember;
1478
- }()
1479
- }, {
1480
- key: 'save',
1481
- value: function () {
1482
- var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6() {
1483
- var _this12 = this;
1484
-
1485
- var _enumController$getEn16, PayStyle, TradeType, IPMSG, RetailTypeEnum, _getLoginInfo3, PreSellOrBook, PercentageWhenBook, _ref15, IdbusiType, DistributionMode, prepaidAmount, fullPayment, dtoParams, payList, payment, tradeType, ret, _ref16, type, data, msg, code;
1486
-
1487
- return _regenerator2.default.wrap(function _callee6$(_context6) {
1488
- while (1) {
1489
- switch (_context6.prev = _context6.next) {
1490
- case 0:
1491
- _enumController$getEn16 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn16.PayStyle, TradeType = _enumController$getEn16.TradeType;
1492
-
1493
- (0, _mobx.runInAction)(function () {
1494
- _this12.dto.RetailPaymentDetails = [];
1495
- _this12.dto.RetailStorageDetails = [];
1496
- _this12.dto.RetailCouponDetails = [];
1497
- var czkSum = 0;
1498
- var count = 0;
1499
- var thePaymodes = _this12.newStyle ? (0, _filter3.default)(_this12.paymode.thePaymodes, function (mode) {
1500
- return parseFloat(mode.value) != 0;
1501
- }) : _this12.paymode.thePaymodes;
1502
- (0, _each3.default)(thePaymodes, function (mode, index) {
1503
- var themode = (0, _find3.default)(_this12.paymode.paymodes, { 'paymentType': mode.paymentType });
1504
- if (mode.paymentType == PayStyle.hyczk) {
1505
- czkSum = Math.Add(czkSum, mode.value);
1506
- _this12.dto.RetailStorageDetails.push({
1507
- Code: mode.paymethodId,
1508
- MeStorageCardId: mode.meStorageCardId,
1509
- StoragePaymentAmount: mode.value,
1510
- IsOrigReturn: false,
1511
- BalanceStorage: mode.balance,
1512
- Idmember: mode.memberId,
1513
- DynamicPropertyKeys: [],
1514
- DynamicPropertyValues: [],
1515
- DataSource: { Id: _this12.dataSource },
1516
- Password: mode.authCode
1517
- });
1518
- } else {
1519
- var value = parseFloat(mode.value);
1520
- var giveChange = null;
1521
- if (mode.paymentType == PayStyle.xianjin && _this12.paymode.receivable < 0 && value > Math.abs(_this12.paymode.receivable)) {
1522
- value = Math.Add(value, _this12.paymode.receivable);
1523
- giveChange = Math.abs(_this12.paymode.receivable);
1524
- }
1525
- _this12.dto.RetailPaymentDetails.push({
1526
- Code: mode.paymethodId,
1527
- OrigAmount: mode.exchangeRate != 1 ? mode.value2 : value,
1528
- Amount: value,
1529
- GiveChange: giveChange,
1530
- IdsettleStyle: themode.idSettleStyle,
1531
- IdbankAccount: themode.idBankAccount,
1532
- Idcurrency: themode.idCurrency,
1533
- ExchangeRate: themode.exchangeRate,
1534
- PaymentCode: mode.authCode,
1535
- SteadCashIntegral: mode.steadCashIntegral,
1536
- OverchargesAmount: mode.overchargesAmount,
1537
- DynamicPropertyKeys: [],
1538
- DynamicPropertyValues: [],
1539
- DataSource: { Id: _this12.dataSource },
1540
- ThirdPaymentInfo: themode.thridPayment || null,
1541
- ThirdPaymentReturnInfo: mode.thirdPaymentReturnInfo || null
1542
- });
1543
- if (mode.paymentType == PayStyle.djq) {
1544
- (0, _each3.default)(_this12.paymode.checkList && _this12.paymode.checkList.length ? _this12.paymode.checkList : mode.djqs, function (djq) {
1545
- _this12.dto.RetailCouponDetails.push({
1546
- CouponCode: djq.promoCouponCode,
1547
- ReductionAmount: djq.amount,
1548
- EnableAmount: djq.doorsill,
1549
- CouponTitle: djq.name,
1550
- IdMember: djq.UMemberID ? mode.memberId : null,
1551
- LastTS: djq.LastTS,
1552
- PromotionId: djq.promoId,
1553
- PromotionRuleId: djq.promoRuleId,
1554
- PromoCouponAllocatedId: djq.id,
1555
- DataSource: { Id: _this12.dataSource }
1556
- });
1557
- });
1558
- }
1559
- }
1560
- });
1561
- if (_this12.dto.RetailStorageDetails.length > 0) {
1562
- var themode = (0, _find3.default)(_this12.paymode.paymodes, { 'paymentType': PayStyle.hyczk });
1563
- _this12.dto.RetailPaymentDetails.push({
1564
- Code: _this12.paymode.counter,
1565
- OrigAmount: czkSum,
1566
- Amount: czkSum,
1567
- IdsettleStyle: themode.idSettleStyle,
1568
- IdbankAccount: themode.idBankAccount,
1569
- DynamicPropertyKeys: [],
1570
- DynamicPropertyValues: [],
1571
- DataSource: { Id: _this12.dataSource },
1572
- RetailStorageDetails: _this12.dto.RetailStorageDetails
1573
- });
1574
- }
1575
- });
1576
- console.log('\u7ED3\u7B97\u6570\u636E\uFF1A', this.dto);
1577
- // cc结算调用
1578
- IPMSG = {};
1579
-
1580
- if (!!window.localStorage.IPMSG) {
1581
- IPMSG = JSON.parse(window.localStorage.IPMSG);
1582
- }
1583
- RetailTypeEnum = this.dto.IdbusiType == 36 ? "INTEGRAL_EXCHANGE" : "NORMAL";
1584
- _getLoginInfo3 = this.getLoginInfo(), PreSellOrBook = _getLoginInfo3.PreSellOrBook, PercentageWhenBook = _getLoginInfo3.PercentageWhenBook;
1585
- _ref15 = this.dto || {}, IdbusiType = _ref15.IdbusiType, DistributionMode = _ref15.DistributionMode;
1586
-
1587
- if (IdbusiType == 38 && PreSellOrBook == 'BOOK' && PercentageWhenBook < 100 && (!DistributionMode.Id || DistributionMode.Id == 'ON_SITE_PICKUP')) {
1588
- prepaidAmount = (0, _utils.getFixedNumber)(this.dto.RetailPaymentDetails.reduce(function (c, item) {
1589
- return c + (item.Amount || 0);
1590
- }, 0));
1591
- fullPayment = (0, _utils.getFixedNumber)(this.dto.RetailDetails.reduce(function (c, item) {
1592
- return c + (item.TaxAmount || 0);
1593
- }, 0));
1594
-
1595
- this.isFull = fullPayment == prepaidAmount; // 是否全款
1596
- (0, _mobx.runInAction)(function () {
1597
- _this12.dto.PrepaidAmount = prepaidAmount;
1598
- });
1599
- }
1600
- _context6.t1 = this.dto.IdbusiType == 37;
1601
-
1602
- if (!_context6.t1) {
1603
- _context6.next = 14;
1604
- break;
1605
- }
1606
-
1607
- _context6.next = 13;
1608
- return this.checkIntegralExchangeReturn(this.dto.RetailDetails[0].ReturnSourceId);
1609
-
1610
- case 13:
1611
- _context6.t1 = _context6.sent;
1612
-
1613
- case 14:
1614
- _context6.t0 = _context6.t1;
1615
-
1616
- if (_context6.t0) {
1617
- _context6.next = 17;
1618
- break;
1619
- }
1620
-
1621
- _context6.t0 = this.dto.IdbusiType != 37;
1622
-
1623
- case 17:
1624
- if (!_context6.t0) {
1625
- _context6.next = 36;
1626
- break;
1627
- }
1628
-
1629
- dtoParams = (0, _extends3.default)({}, this.dto.cut(), { RetailOms: { RetailTypeEnum: RetailTypeEnum } });
1630
- //处理存在二开支付情况
1631
-
1632
- payList = dtoParams.RetailPaymentDetails.filter(function (v) {
1633
- return v.ThirdPaymentInfo;
1634
- });
1635
-
1636
- if (!(payList && payList.length > 0)) {
1637
- _context6.next = 33;
1638
- break;
1639
- }
1640
-
1641
- payment = payList[0];
1642
- tradeType = payment && payment.Amount > 0 ? TradeType.PAY : TradeType.REFUND;
1643
- _context6.next = 25;
1644
- return this.thirdPay(1, payment, tradeType, dtoParams);
1645
-
1646
- case 25:
1647
- ret = _context6.sent;
1648
- _ref16 = ret || {}, type = _ref16.type, data = _ref16.data, msg = _ref16.msg, code = _ref16.code;
1649
-
1650
- if (!(type === true)) {
1651
- _context6.next = 31;
1652
- break;
1653
- }
1654
-
1655
- dtoParams = data;
1656
- _context6.next = 33;
1657
- break;
1658
-
1659
- case 31:
1660
- _message2.default.warn('\u5237\u5361\u652F\u4ED8\u5931\u8D25,\u9519\u8BEF\u7801:' + code);
1661
- return _context6.abrupt('return', false);
1662
-
1663
- case 33:
1664
- this.dtoParams = dtoParams;
1665
- console.log('结算信息:', dtoParams);
1666
- 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) {
1667
- var _ref17 = resp || {},
1668
- ID = _ref17.ID;
1669
-
1670
- _this12.setDtoID(ID);
1671
- _this12.billID = ID;
1672
- _this12.paymode.checkList = [];
1673
- }));
1674
-
1675
- case 36:
1676
- case 'end':
1677
- return _context6.stop();
1678
- }
1679
- }
1680
- }, _callee6, this);
1681
- }));
1682
-
1683
- function save() {
1684
- return _ref14.apply(this, arguments);
1685
- }
1686
-
1687
- return save;
1688
- }()
1689
-
1690
- //裁剪二开支付数据
1691
-
1692
- }, {
1693
- key: 'removeThirdPayDto',
1694
- value: function removeThirdPayDto(dto) {
1695
- var data = (0, _extends3.default)({}, dto);
1696
- delete data['DynamicPropertyKeys'];
1697
- delete data['DynamicPropertyValues'];
1698
- return data;
1699
- }
1700
-
1701
- /**
1702
- * 二开支付
1703
- * vType:1零售单、2储值单
1704
- * payment:结算方式
1705
- * trade:00表示结算、02表示退款
1706
- * dto:结算数据集合
1707
- */
1708
-
1709
- }, {
1710
- key: 'thirdPay',
1711
- value: function () {
1712
- var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(vType, payment, trade, dto) {
1713
- var cto, params, ret, _ref19, Code, _Message, Result, _ref20, ThirdPaymentReturnInfo;
1714
-
1715
- return _regenerator2.default.wrap(function _callee7$(_context7) {
1716
- while (1) {
1717
- switch (_context7.prev = _context7.next) {
1718
- case 0:
1719
- _context7.prev = 0;
1720
- cto = this.removeThirdPayDto(dto);
1721
- params = { VoucherType: vType, Payment: payment, TradeType: trade, dto: cto };
1722
-
1723
- console.log('刷卡信息:', (0, _stringify2.default)(params));
1724
- _context7.next = 6;
1725
- return new _promise2.default(function (resolve, reject) {
1726
- _mutantsMicrofx.nativeMs.setIpcRendererMethod('ThirdPayment', (0, _extends3.default)({}, params), function (res) {
1727
- return resolve(res);
1728
- });
1729
- });
1730
-
1731
- case 6:
1732
- ret = _context7.sent;
1733
-
1734
- console.log('刷卡返回信息:', ret);
1735
- ret = JSON.parse(ret);
1736
- _ref19 = ret || {}, Code = _ref19.Code, _Message = _ref19.Message, Result = _ref19.Result;
1737
-
1738
- if (!(Code > 0)) {
1739
- _context7.next = 14;
1740
- break;
1741
- }
1742
-
1743
- return _context7.abrupt('return', { type: false, data: null, msg: _Message, code: Code });
1744
-
1745
- case 14:
1746
- if (!(trade == '00')) {
1747
- _context7.next = 20;
1748
- break;
1749
- }
1750
-
1751
- _ref20 = Result || {}, ThirdPaymentReturnInfo = _ref20.ThirdPaymentReturnInfo;
1752
-
1753
- if (vType == 1) {
1754
- dto.RetailPaymentDetails.forEach(function (v) {
1755
- if (v.ThirdPaymentInfo != null && Math.abs(v.Amount) > 0) {
1756
- v.ThirdPaymentReturnInfo = ThirdPaymentReturnInfo;
1757
- }
1758
- });
1759
- } else if (vType == 2) {
1760
- dto.StorageMutiSettleDetails.forEach(function (v) {
1761
- if (v.ThirdPaymentInfo != null && Math.abs(v.StorageAmount) > 0) {
1762
- v.ThirdPaymentReturnInfo = ThirdPaymentReturnInfo;
1763
- }
1764
- });
1765
- }
1766
- return _context7.abrupt('return', { type: true, data: dto, msg: _Message, code: Code });
1767
-
1768
- case 20:
1769
- if (!(trade == '02')) {
1770
- _context7.next = 22;
1771
- break;
1772
- }
1773
-
1774
- return _context7.abrupt('return', { type: true, data: dto, msg: _Message, code: Code });
1775
-
1776
- case 22:
1777
- _context7.next = 27;
1778
- break;
1779
-
1780
- case 24:
1781
- _context7.prev = 24;
1782
- _context7.t0 = _context7['catch'](0);
1783
- return _context7.abrupt('return', { type: false, data: null, msg: _context7.t0, code: '9999' });
1784
-
1785
- case 27:
1786
- case 'end':
1787
- return _context7.stop();
1788
- }
1789
- }
1790
- }, _callee7, this, [[0, 24]]);
1791
- }));
1792
-
1793
- function thirdPay(_x4, _x5, _x6, _x7) {
1794
- return _ref18.apply(this, arguments);
1795
- }
1796
-
1797
- return thirdPay;
1798
- }()
1799
-
1800
- //二开支付强制退款情况
1801
-
1802
- }, {
1803
- key: 'thirdPayRefund',
1804
- value: function () {
1805
- var _ref21 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(type) {
1806
- var _this13 = this;
1807
-
1808
- var dto, pay, payment, _enumController$getEn17, TradeType;
1809
-
1810
- return _regenerator2.default.wrap(function _callee9$(_context9) {
1811
- while (1) {
1812
- switch (_context9.prev = _context9.next) {
1813
- case 0:
1814
- dto = type == 1 ? this.dtoParams.RetailPaymentDetails : this.dtoParams.StorageMutiSettleDetails;
1815
- pay = dto && dto.filter(function (v) {
1816
- return v.ThirdPaymentInfo;
1817
- });
1818
-
1819
- if (pay && pay.length > 0) {
1820
- setTimeout(function () {
1821
- _message2.default.warn("支付出现异常,将发起刷卡退款。", { duration: 4.5 });
1822
- }, 1000);
1823
- payment = pay[0];
1824
- _enumController$getEn17 = _mutantsUtil.enumController.getEnumOj(), TradeType = _enumController$getEn17.TradeType;
1825
-
1826
- setTimeout((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8() {
1827
- var ret, _ref23, msg;
1828
-
1829
- return _regenerator2.default.wrap(function _callee8$(_context8) {
1830
- while (1) {
1831
- switch (_context8.prev = _context8.next) {
1832
- case 0:
1833
- _context8.next = 2;
1834
- return _this13.thirdPay(type, payment, TradeType.REFUND, dto);
1835
-
1836
- case 2:
1837
- ret = _context8.sent;
1838
- _ref23 = ret || {}, msg = _ref23.msg;
1839
-
1840
- console.log('\u5237\u5361\u652F\u4ED8\u9000\u6B3E:' + msg);
1841
-
1842
- case 5:
1843
- case 'end':
1844
- return _context8.stop();
1845
- }
1846
- }
1847
- }, _callee8, _this13);
1848
- })), 4500);
1849
- }
1850
-
1851
- case 3:
1852
- case 'end':
1853
- return _context9.stop();
1854
- }
1855
- }
1856
- }, _callee9, this);
1857
- }));
1858
-
1859
- function thirdPayRefund(_x8) {
1860
- return _ref21.apply(this, arguments);
1861
- }
1862
-
1863
- return thirdPayRefund;
1864
- }()
1865
- }, {
1866
- key: 'setDtoID',
1867
- value: function setDtoID(id) {
1868
- this.context.viewModel.data.ID = id;
1869
- }
1870
- }, {
1871
- key: 'querySettleResult',
1872
- value: function () {
1873
- var _ref24 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10() {
1874
- return _regenerator2.default.wrap(function _callee10$(_context10) {
1875
- while (1) {
1876
- switch (_context10.prev = _context10.next) {
1877
- case 0:
1878
- _context10.prev = 0;
1879
- _context10.t0 = _promise2.default;
1880
- _context10.next = 4;
1881
- return (0, _tplusApi.tApi)({ RetailCode: this.dto.Code }, 'chanjet.RE.newRetail.QuerySettleResult', false, false, { timeout_skip: true });
1882
-
1883
- case 4:
1884
- _context10.t1 = _context10.sent;
1885
- return _context10.abrupt('return', _context10.t0.resolve.call(_context10.t0, _context10.t1));
1886
-
1887
- case 8:
1888
- _context10.prev = 8;
1889
- _context10.t2 = _context10['catch'](0);
1890
- return _context10.abrupt('return', _promise2.default.resolve({ Flag: "1" }));
1891
-
1892
- case 11:
1893
- case 'end':
1894
- return _context10.stop();
1895
- }
1896
- }
1897
- }, _callee10, this, [[0, 8]]);
1898
- }));
1899
-
1900
- function querySettleResult() {
1901
- return _ref24.apply(this, arguments);
1902
- }
1903
-
1904
- return querySettleResult;
1905
- }()
1906
- }, {
1907
- key: 'setCookie',
1908
- value: function setCookie(key, val) {
1909
- var exp = new Date();
1910
- exp.setTime((0, _moment2.default)().endOf('day').valueOf());
1911
- document.cookie = key + '=' + val + ';expires=' + exp.toGMTString();
1912
- }
1913
- }, {
1914
- key: 'getAllCookies',
1915
- value: function getAllCookies() {
1916
- var cookies = document.cookie.split(/;\s/g);
1917
- var cookieObj = {};
1918
- cookies.forEach(function (item) {
1919
- var key = item.split('=')[0];
1920
- cookieObj[key] = item.split('=')[1];
1921
- });
1922
- return cookieObj;
1923
- }
1924
- }, {
1925
- key: 'validePwd',
1926
- value: function () {
1927
- var _ref25 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(value) {
1928
- var _ref26, isNewRetailBCPos, cook1, cook2, message, memberStorageId, _paymode$currentMode, cardTypeEnum, memberId, meStorageCardId, cardStatusEnum, result, count, _result;
1929
-
1930
- return _regenerator2.default.wrap(function _callee11$(_context11) {
1931
- while (1) {
1932
- switch (_context11.prev = _context11.next) {
1933
- case 0:
1934
- _ref26 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref26.isNewRetailBCPos;
1935
- _context11.prev = 1;
1936
-
1937
- if (!isNewRetailBCPos) {
1938
- _context11.next = 33;
1939
- break;
1940
- }
1941
-
1942
- cook1 = this.getAllCookies()['errorPwd'];
1943
- cook2 = cook1 && JSON.parse(cook1);
1944
- message = '密码输入错误';
1945
- memberStorageId = this.paymode.currentMode.meStorageCardId;
1946
-
1947
- if (!cook2) {
1948
- _context11.next = 12;
1949
- break;
1950
- }
1951
-
1952
- if (!cook2.hasOwnProperty(memberStorageId + "")) {
1953
- _context11.next = 12;
1954
- break;
1955
- }
1956
-
1957
- if (!(cook2[memberStorageId] > 3)) {
1958
- _context11.next = 12;
1959
- break;
1960
- }
1961
-
1962
- message = '今日密码错误已达上限,不可使用储值消费,请明日再试,如忘记请重置密码或修改密码。';
1963
- return _context11.abrupt('return', _promise2.default.resolve(message));
1964
-
1965
- case 12:
1966
- _paymode$currentMode = this.paymode.currentMode, cardTypeEnum = _paymode$currentMode.cardTypeEnum, memberId = _paymode$currentMode.memberId, meStorageCardId = _paymode$currentMode.meStorageCardId, cardStatusEnum = _paymode$currentMode.cardStatusEnum;
1967
- result = null;
1968
-
1969
- if (!(cardTypeEnum === 'BALANCE_CARD')) {
1970
- _context11.next = 20;
1971
- break;
1972
- }
1973
-
1974
- _context11.next = 17;
1975
- return (0, _tplusApi.ccApi)({ md5Password: _tplusApi.User.pwdEncrypt(value.pwd), cardType: cardTypeEnum }, '/member/MeMemberWallet/checkPaymentPassword/' + memberId, false, false);
1976
-
1977
- case 17:
1978
- result = _context11.sent;
1979
- _context11.next = 29;
1980
- break;
1981
-
1982
- case 20:
1983
- if (!(cardStatusEnum === 'BINDING' && this.member && this.member.ID === memberId)) {
1984
- _context11.next = 26;
1985
- break;
1986
- }
1987
-
1988
- _context11.next = 23;
1989
- return (0, _tplusApi.ccApi)({ md5Password: _tplusApi.User.pwdEncrypt(value.pwd), password: value.pwd, cardType: cardTypeEnum }, '/member/MeMemberWallet/checkPaymentPassword/' + meStorageCardId, false, false);
1990
-
1991
- case 23:
1992
- result = _context11.sent;
1993
- _context11.next = 29;
1994
- break;
1995
-
1996
- case 26:
1997
- _context11.next = 28;
1998
- return (0, _tplusApi.ccApi)({ password: value.pwd, cardType: cardTypeEnum }, '/member/MeMemberWallet/checkPaymentPassword/' + meStorageCardId, false, false);
1999
-
2000
- case 28:
2001
- result = _context11.sent;
2002
-
2003
- case 29:
2004
- if (!result.data) {
2005
- if (cook2) {
2006
- if (cook2.hasOwnProperty(memberStorageId + "")) {
2007
- count = cook2[memberStorageId];
2008
-
2009
- cook2[memberStorageId] = count + 1;
2010
- } else {
2011
- cook2[memberStorageId] = 1;
2012
- }
2013
- } else {
2014
- cook2 = {};
2015
- cook2[memberStorageId] = 1;
2016
- }
2017
- this.setCookie('errorPwd', '', -1);
2018
- this.setCookie('errorPwd', (0, _stringify2.default)(cook2));
2019
- }
2020
- return _context11.abrupt('return', _promise2.default.resolve(result.data ? "" : message));
2021
-
2022
- case 33:
2023
- _context11.next = 35;
2024
- return (0, _tplusApi.tApi)({ "CheckoutParams": {
2025
- "Idmember": value.id,
2026
- "Password": value.pwd
2027
- } }, 'AA.DR.newRetailMember.CheckoutMemberPassword', false, false);
2028
-
2029
- case 35:
2030
- _result = _context11.sent;
2031
- return _context11.abrupt('return', _promise2.default.resolve(_result.Success ? "" : _result.Message));
2032
-
2033
- case 37:
2034
- _context11.next = 42;
2035
- break;
2036
-
2037
- case 39:
2038
- _context11.prev = 39;
2039
- _context11.t0 = _context11['catch'](1);
2040
- return _context11.abrupt('return', "failed");
2041
-
2042
- case 42:
2043
- case 'end':
2044
- return _context11.stop();
2045
- }
2046
- }
2047
- }, _callee11, this, [[1, 39]]);
2048
- }));
2049
-
2050
- function validePwd(_x9) {
2051
- return _ref25.apply(this, arguments);
2052
- }
2053
-
2054
- return validePwd;
2055
- }()
2056
- }]);
2057
- return SettlementStore;
2058
- }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'newStyle', [_mobx.observable], {
2059
- enumerable: true,
2060
- initializer: function initializer() {
2061
- return true;
2062
- }
2063
- }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'setNewStyle', [_mobx.action], {
2064
- enumerable: true,
2065
- initializer: function initializer() {
2066
- var _this14 = this;
2067
-
2068
- return function () {
2069
- _this14.newStyle = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') == 'voucher';
2070
- };
2071
- }
2072
- }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, 'queryPwd', [_mobx.action], {
2073
- enumerable: true,
2074
- initializer: function initializer() {
2075
- var _this15 = this;
2076
-
2077
- return function (newPass, newPassConfirm) {
2078
- if (!newPass || !newPassConfirm) {
2079
- return _message2.default.warn('您还有未填写项');
2080
- }
2081
- if (newPass !== newPassConfirm) {
2082
- return _message2.default.warn('您两次输入的密码不一致');
2083
- }
2084
- var idstore = (0, _tplusPoslogin.PosInitData)('storeID');
2085
- return (0, _tplusApi.ccApi)({
2086
- Idstore: idstore,
2087
- meMemberId: _this15.paymode.currentMode.memberId,
2088
- oldPassword: null,
2089
- newPassword: _tplusApi.User.pwdEncrypt(newPassConfirm),
2090
- dataSource: "POS"
2091
- }, '/member/MeMemberWallet/setWalletPayPassword', false, false, { method: 'post', timeout_skip: true }).then(function (resp) {
2092
- if (resp.successful) {
2093
- return true;
2094
- }
2095
- });
2096
- };
2097
- }
2098
- }), _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], {
2099
- enumerable: true,
2100
- initializer: function initializer() {
2101
- var _this16 = this;
2102
-
2103
- return function () {
2104
- var _ref27 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(_this) {
2105
- var _getLoginInfo4, IdStore, StoreCode, resp;
2106
-
2107
- return _regenerator2.default.wrap(function _callee12$(_context12) {
2108
- while (1) {
2109
- switch (_context12.prev = _context12.next) {
2110
- case 0:
2111
- _getLoginInfo4 = _this16.getLoginInfo(), IdStore = _getLoginInfo4.IdStore, StoreCode = _getLoginInfo4.StoreCode;
2112
- _context12.next = 3;
2113
- return (0, _tplusApi.tApi)({ Idmember: _this16.member.ID, IdStore: IdStore, StoreCode: StoreCode }, 'chanjet.AA.DR.INewRetailMember.GetUmemberDTO', false, false);
2114
-
2115
- case 3:
2116
- resp = _context12.sent;
2117
-
2118
- _this.member = resp;
2119
- _this.paymode.updateMemberStorageCardNo(resp.StorageCardNo, resp.WalletEnabled);
2120
- return _context12.abrupt('return', _promise2.default.resolve(resp));
2121
-
2122
- case 7:
2123
- case 'end':
2124
- return _context12.stop();
2125
- }
2126
- }
2127
- }, _callee12, _this16);
2128
- }));
2129
-
2130
- return function (_x10) {
2131
- return _ref27.apply(this, arguments);
2132
- };
2133
- }();
2134
- }
2135
- }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, 'updateCurrentMode', [_mobx.action], {
2136
- enumerable: true,
2137
- initializer: function initializer() {
2138
- var _this17 = this;
2139
-
2140
- return function () {
2141
- var _ref28 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(memberId) {
2142
- var result;
2143
- return _regenerator2.default.wrap(function _callee13$(_context13) {
2144
- while (1) {
2145
- switch (_context13.prev = _context13.next) {
2146
- case 0:
2147
- _context13.next = 2;
2148
- return (0, _tplusApi.ccApi)({}, '/marketingtool/MeStorageCard/getCardInfoByMemberId/' + memberId + '/' + true, false, false, { method: 'get' });
2149
-
2150
- case 2:
2151
- result = _context13.sent;
2152
-
2153
- if (!(result && result.data.length)) {
2154
- _context13.next = 20;
2155
- break;
2156
- }
2157
-
2158
- if (!(result.data.length === 1)) {
2159
- _context13.next = 9;
2160
- break;
2161
- }
2162
-
2163
- _this17.paymode.updateCardInfo(result.data[0]);
2164
- return _context13.abrupt('return', result.data);
2165
-
2166
- case 9:
2167
- if (!(result.data && result.data.length === 1)) {
2168
- _context13.next = 14;
2169
- break;
2170
- }
2171
-
2172
- _this17.paymode.updateCardInfo(result.data[0]);
2173
- return _context13.abrupt('return', result.data);
2174
-
2175
- case 14:
2176
- if (!(result.data && result.data.length > 1)) {
2177
- _context13.next = 18;
2178
- break;
2179
- }
2180
-
2181
- return _context13.abrupt('return', result.data);
2182
-
2183
- case 18:
2184
- _message2.default.warn('没有可用储值卡!');
2185
- return _context13.abrupt('return', false);
2186
-
2187
- case 20:
2188
- case 'end':
2189
- return _context13.stop();
2190
- }
2191
- }
2192
- }, _callee13, _this17);
2193
- }));
2194
-
2195
- return function (_x11) {
2196
- return _ref28.apply(this, arguments);
2197
- };
2198
- }();
2199
- }
2200
- }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, 'updateCardInfo', [_mobx.action], {
2201
- enumerable: true,
2202
- initializer: function initializer() {
2203
- var _this18 = this;
2204
-
2205
- return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14() {
2206
- var address, result;
2207
- return _regenerator2.default.wrap(function _callee14$(_context14) {
2208
- while (1) {
2209
- switch (_context14.prev = _context14.next) {
2210
- case 0:
2211
- address = '/marketingtool/MeStorageCard/getCardInfoByCardNo/' + _this18.paymode.currentMode.storageCardNo;
2212
- _context14.next = 3;
2213
- return (0, _tplusApi.ccApi)({}, address, false, false, { method: 'get', timeout_skip: true });
2214
-
2215
- case 3:
2216
- result = _context14.sent;
2217
-
2218
- _this18.paymode.updateCardInfo(result.data);
2219
-
2220
- case 5:
2221
- case 'end':
2222
- return _context14.stop();
2223
- }
2224
- }
2225
- }, _callee14, _this18);
2226
- }));
2227
- }
2228
- }), _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);
2229
- exports.default = SettlementStore;
2230
- var PayMode = exports.PayMode = (_class3 = function () {
2231
- //预订场景下,现场提货,且选项设置订金比例非100% or 取货最大补款数大于0时 为 true
2232
- function PayMode() {
2233
- // this.amount=getFixedNumber(amount);
2234
- // this.calcReserved();
2235
-
2236
- (0, _classCallCheck3.default)(this, PayMode);
2237
- this._counter = 0;
2238
- this.amount = 0;
2239
- this.onlineamount = 0;
2240
- this.maxamount = 0;
2241
-
2242
- _initDefineProp(this, 'currentFocus', _descriptor7, this);
2243
-
2244
- _initDefineProp(this, 'received', _descriptor8, this);
2245
-
2246
- _initDefineProp(this, 'receivable', _descriptor9, this);
2247
-
2248
- _initDefineProp(this, 'paymodes', _descriptor10, this);
2249
-
2250
- _initDefineProp(this, 'thePaymodes', _descriptor11, this);
2251
-
2252
- this.bookMaxValue = 0;
2253
- this.isNotFullBook = false;
2254
- this.isNotFullOnlyBook = false;
2255
-
2256
- _initDefineProp(this, 'storageCardNo', _descriptor12, this);
2257
-
2258
- _initDefineProp(this, 'balance', _descriptor13, this);
2259
-
2260
- this.currentMode = null;
2261
- this.checkList = [];
2262
- this.settle = {
2263
- name: "复合结算",
2264
- hotKey: "Ctrl+M"
2265
- };
2266
-
2267
- _initDefineProp(this, 'calcCheckList', _descriptor14, this);
2268
-
2269
- _initDefineProp(this, 'setCouponNum', _descriptor15, this);
2270
-
2271
- _initDefineProp(this, 'addDjqs', _descriptor16, this);
2272
- }
2273
- // @observable store = null;
2274
- //只是预订场景下,现场提货,且选项设置订金比例非100%时 为 true
2275
- //应收
2276
-
2277
-
2278
- (0, _createClass3.default)(PayMode, [{
2279
- key: 'clean',
2280
- value: function clean() {
2281
- this.thePaymodes = [];
2282
- this.calcReserved();
2283
- }
2284
- }, {
2285
- key: 'clear',
2286
- value: function clear() {
2287
- this.thePaymodes = [];
2288
- this.calcReserved();
2289
- this.paymodes = [];
2290
- }
2291
- }, {
2292
- key: 'setAmount',
2293
- value: function setAmount(a, o) {
2294
- this.amount = (0, _utils.getFixedNumber)((a || 0) - (o || 0));
2295
- this.onlineamount = (0, _utils.getFixedNumber)(o || 0);
2296
- this.calcReserved();
2297
- return this.amount < 0;
2298
- }
2299
- }, {
2300
- key: 'calcReserved',
2301
- value: function calcReserved(type) {
2302
- var sum = 0;
2303
- (0, _each3.default)(this.thePaymodes, function (mode) {
2304
- sum = Math.Add(sum, mode.value == "" ? 0 : mode.value);
2305
- });
2306
- this.received = (0, _utils.getFixedNumber)(sum);
2307
- if (type === 'bookPay' && this.isNotFullBook) {
2308
- if (this.amount <= sum && sum <= this.bookMaxValue) {
2309
- this.receivable = (0, _utils.getFixedNumber)(0);
2310
- }
2311
- if (sum < this.amount) {
2312
- this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
2313
- }
2314
- if (sum > this.bookMaxValue) {
2315
- this.receivable = (0, _utils.getFixedNumber)(this.bookMaxValue - sum);
2316
- }
2317
- } else {
2318
- this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
2319
- }
2320
- }
2321
- }, {
2322
- key: 'updateMemberStorageCardNo',
2323
- value: function updateMemberStorageCardNo(storageCardNo, walletEnabled) {
2324
- this.currentMode.storageCardNo = storageCardNo;
2325
- this.currentMode.walletEnabled = walletEnabled;
2326
- }
2327
- }, {
2328
- key: 'updateCardInfo',
2329
- value: function updateCardInfo(m) {
2330
- this.currentMode.cardStatusEnum = m.CardStatusEnum;
2331
- this.currentMode.isNeedPassword = m.IsNeedPassword;
2332
- this.currentMode.meStorageCardId = m.MeStorageCardId;
2333
- this.currentMode.storageCardNo = m.StorageCardNo;
2334
- this.currentMode.balance = m.BalanceStorage;
2335
- this.currentMode.rawbalance = m.BalanceStorage;
2336
- this.currentMode.cardTypeEnum = m.CardTypeEnum;
2337
- this.currentMode.walletEnabled = m.WalletEnabled;
2338
- this.currentMode.memberId = m.ID;
2339
- this.currentMode.freePaymentPasswordStore = m.FreePaymentPasswordStore;
2340
- }
2341
- }, {
2342
- key: 'calcDjqCheckValue',
2343
- value: function calcDjqCheckValue(q1, dto, params) {
2344
- var _this19 = this;
2345
-
2346
- var useLimitPerOrder = (0, _tplusPoslogin.PosInitData)('UseLimitPerOrder');
2347
- var qList = (0, _filter3.default)(this.currentMode.djqs, function (djq) {
2348
- return djq.checked;
2349
- });
2350
- if (qList.length === useLimitPerOrder && !q1.checked) {
2351
- _message2.default.warn('本单最多可用' + useLimitPerOrder + '张');
2352
- return;
2353
- }
2354
- if (params === 'single') {
2355
- this.checkList = [];
2356
- }
2357
-
2358
- var _ref30 = _mutantsUtil.platform || {},
2359
- isNewRetailBCPos = _ref30.isNewRetailBCPos;
2360
-
2361
- var _enumController$getEn18 = _mutantsUtil.enumController.getEnumOj(),
2362
- PayStyle = _enumController$getEn18.PayStyle,
2363
- Differentiate = _enumController$getEn18.Differentiate;
2364
-
2365
- if (q1) {
2366
- if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
2367
- _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
2368
- return;
2369
- }
2370
- var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
2371
- return djq.promoCouponCode == q1.promoCouponCode;
2372
- });
2373
- if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
2374
- _message2.default.error("本单金额低于使用门槛,该券不可使用。");
2375
- return;
2376
- }
2377
- //判断是否是选择优惠券 //CC优惠券只能使用一个
2378
- // if (q1 && !q1.checked && isNewRetailBCPos) {
2379
- // // 检查是否有已经选定优惠券 并且去除选定的优惠券
2380
- // this.currentMode.djqs.forEach((djq, index) => {
2381
- // if (djq.checked) this.currentMode.djqs[index].checked = false;
2382
- // })
2383
- // }
2384
- q && (q.checked = !q.checked);
2385
- }
2386
- var sum = 0;
2387
- // console.log(this.store, 'stores-------');
2388
- if (!q1.checked) {
2389
- this.checkList.forEach(function (ele, i) {
2390
- if (ele.id === q1.id) {
2391
- _this19.checkList.splice(i, 1);
2392
- }
2393
- });
2394
- } else {
2395
- this.checkList.push(q1);
2396
- }
2397
-
2398
- this.checkList.forEach(function (ele) {
2399
- sum = Math.Add(sum, ele.amount);
2400
- });
2401
- this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
2402
- console.log(this.receivable, sum, Math.min(this.receivable, sum, this.currentMode.maxamount), 'sum---------');
2403
- this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - Math.min(this.receivable, sum, this.currentMode.maxamount));
2404
- this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
2405
- if (params === 'single') {
2406
- return;
2407
- }
2408
- var promoVoucher = {};
2409
- promoVoucher.boName = "Retail";
2410
- // promoVoucher.promoLinks = _filter(this.currentMode.djqs,djq=>djq.checked);
2411
- promoVoucher.meMemberId = this.currentMode.member.id;
2412
- promoVoucher.storeFactorId = (0, _tplusPoslogin.PosInitData)('storeID');
2413
- promoVoucher.voucherDetailList = [];
2414
- dto.RetailDetails.forEach(function (item) {
2415
- var detailDTO = {};
2416
- detailDTO.uuid = item.Code;
2417
- detailDTO.detailBoName = "RetailDetail";
2418
- detailDTO.voucherDetailId = item.ID;
2419
- detailDTO.productId = item.Idinventory;
2420
- detailDTO.uomId = item.Idunit;
2421
- detailDTO.productSpecId = item.ProductSpecId;
2422
- detailDTO.isManualFreeGift = item.IsPresent;
2423
- detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
2424
- detailDTO.IsManualChangePrice = item.IsManualChangePrice;
2425
-
2426
- // if(detailDTO.IsManualChangePrice)//如果是手工改价
2427
- // {
2428
- // detailDTO.listPrice = item.TaxPrice;
2429
- // detailDTO.netAmountWithTax = item.TaxAmount;
2430
- // }
2431
- // else
2432
- // {
2433
-
2434
- var bookingQuantity = 0;
2435
- if (item.BookingQuantity) {
2436
- bookingQuantity = item.BookingQuantity;
2437
- }
2438
- detailDTO.listPrice = JSON.getCellValue(item, "listPrice");
2439
- detailDTO.netAmountWithTax = Math.Multiply(detailDTO.listPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
2440
- detailDTO.taxRate = item.TaxRate;
2441
- detailDTO.quantity = item.Quantity;
2442
-
2443
- detailDTO.amountWithTax = item.RetailAmount;
2444
- // 促销 start
2445
- if (item.PromotionDetails && item.PromotionDetails.length != 0) {
2446
- var promoLinks = [];
2447
- item.PromotionDetails.forEach(function (promotion) {
2448
- promoLinks.push({
2449
- promoId: promotion.IdSalesPromotionDTO,
2450
- promoRuleId: promotion.PromotionRuleId
2451
- });
2452
- });
2453
- if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
2454
- }
2455
- // 促销 end
2456
- promoVoucher.voucherDetailList.push(detailDTO);
2457
- });
2458
- promoVoucher.promoLinks = this.checkList;
2459
- return (0, _tplusApi.ccApi)((0, _extends3.default)({}, promoVoucher), 'promotion/PromoCalculate/findUsefulCouponPromoList', false, false, { method: 'post', timeout_skip: true }).then(function (result) {
2460
- if (result && result.length != 0) {
2461
- result.forEach(function (element, index) {
2462
- var djq1 = false;
2463
- _this19.currentMode.djqs.forEach(function (djq) {
2464
- if (element.id === djq.id) {
2465
- djq1 = true;
2466
- }
2467
- });
2468
-
2469
- var _ref31 = element || {},
2470
- couponCode = _ref31.couponCode,
2471
- name = _ref31.name,
2472
- tieredAmountResult = _ref31.tieredAmountResult,
2473
- fromDate = _ref31.fromDate,
2474
- dateMount = _ref31.dateMount,
2475
- promoMethodEnum = _ref31.promoMethodEnum,
2476
- discountPct = _ref31.discountPct,
2477
- nominalAmount = _ref31.nominalAmount,
2478
- promoId = _ref31.promoId,
2479
- id = _ref31.id,
2480
- doorsill = _ref31.doorsill;
2481
-
2482
- var condValue = tieredAmountResult.condValue,
2483
- promoDiscount = tieredAmountResult.promoDiscount,
2484
- displayText = tieredAmountResult.displayText,
2485
- promoRuleId = tieredAmountResult.promoRuleId,
2486
- couponCategoryEnum = tieredAmountResult.couponCategoryEnum;
2487
-
2488
- if (!djq1) {
2489
- // this.currentMode.djqs.push({
2490
- // promoCouponCode: element.CouponCode,
2491
- // name: element.CouponTitle,
2492
- // IsEnable: true,
2493
- // amount: element.ReductionAmount,
2494
- // doorsill: element.EnableAmount,
2495
- // LastTS: element.LastTS,
2496
- // checked: false,
2497
- // IsRepelWithPoints: true,
2498
- // UMemberID: dto.Idmember,
2499
- // expired: null,
2500
- // displayText,
2501
- // promoMethodEnum,
2502
- // discountPct,
2503
- // promoId,
2504
- // promoRuleId,
2505
- // couponCategoryEnum: tieredAmountResult.couponCategoryEnum,
2506
- // id
2507
- // })
2508
- _this19.addDjqs(couponCode, name, true, nominalAmount, promoDiscount, doorsill, element.LastTS, false, true, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, tieredAmountResult.couponCategoryEnum, id);
2509
- djq1 = false;
2510
- } else {
2511
- _this19.setCouponNum(element.id, couponCategoryEnum, promoMethodEnum, nominalAmount, promoDiscount);
2512
- // this.currentMode.djqs[0].couponCategoryEnum = 'couponCategoryEnum';
2513
- // djq1.couponCategoryEnum = element.tieredAmountResult.couponCategoryEnum
2514
- }
2515
- });
2516
- }
2517
- // 优惠券【6052098985043】与【6120822326451】不可叠加使用
2518
- });
2519
- //this.receivable = getFixedNumber(this.receivable - sum);
2520
- }
2521
- }, {
2522
- key: 'calcDjqValue',
2523
- value: function calcDjqValue(q1) {
2524
- var _ref32 = _mutantsUtil.platform || {},
2525
- isNewRetailBCPos = _ref32.isNewRetailBCPos;
2526
-
2527
- var _enumController$getEn19 = _mutantsUtil.enumController.getEnumOj(),
2528
- Differentiate = _enumController$getEn19.Differentiate;
2529
-
2530
- if (q1) {
2531
- if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
2532
- _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
2533
- return;
2534
- }
2535
- var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
2536
- return djq.code == q1.code;
2537
- });
2538
- if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
2539
- _message2.default.error("本单金额低于使用门槛,该券不可使用。");
2540
- return;
2541
- }
2542
- //判断是否是选择优惠券 //CC优惠券只能使用一个
2543
- // if (q1 && !q1.checked && isNewRetailBCPos) {
2544
- // // 检查是否有已经选定优惠券 并且去除选定的优惠券
2545
- // this.currentMode.djqs.forEach((djq, index) => {
2546
- // if (djq.checked) this.currentMode.djqs[index].checked = false;
2547
- // })
2548
- // }
2549
- q && (q.checked = !q.checked);
2550
- }
2551
- var sum = 0;
2552
- // console.log(this.store, 'stores-------');
2553
- (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
2554
- return djq.checked;
2555
- }), function (q) {
2556
- sum = Math.Add(sum, q.amount);
2557
- });
2558
- this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
2559
- this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
2560
- this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
2561
-
2562
- //this.receivable = getFixedNumber(this.receivable - sum);
2563
- }
2564
- }, {
2565
- key: 'reCalculationDjqs',
2566
- value: function reCalculationDjqs() {
2567
- var sum = 0;
2568
- (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
2569
- return djq.checked;
2570
- }), function (q) {
2571
- sum = Math.Add(sum, q.amount);
2572
- });
2573
- this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
2574
- this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
2575
- this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
2576
- this.currentMode.maxamount = this.currentMode.receivable || this.currentMode.receivable;
2577
- }
2578
- }, {
2579
- key: 'clearDjqs',
2580
- value: function clearDjqs() {
2581
- this.currentMode.djqs = [];
2582
- }
2583
- }, {
2584
- key: 'setCurrentModeValue',
2585
- value: function setCurrentModeValue(v, max) {
2586
- this.currentMode.value = parseFloat(v) || 0;
2587
- this.currentMode.errinfo = '';
2588
- var sum = this.amount;
2589
-
2590
- var _enumController$getEn20 = _mutantsUtil.enumController.getEnumOj(),
2591
- PayStyle = _enumController$getEn20.PayStyle;
2592
-
2593
- this.thePaymodes && this.thePaymodes.forEach(function (mode) {
2594
- if (mode.paymentType === PayStyle.hyczk) {
2595
- sum -= mode.value;
2596
- }
2597
- });
2598
-
2599
- if (this.amount > 0 && (v === '' || v === '0.00') && sum !== 0) {
2600
- this.currentMode.errinfo = "实收金额必须录入";
2601
- } else if (Math.abs(parseFloat(v)) > Math.abs((0, _utils.getFixedNumber)(sum))) {
2602
- this.currentMode.errinfo = "实收不应大于应收";
2603
- } else if (parseFloat(v) > 0 && parseFloat(v) > (max || 0)) {
2604
- this.currentMode.errinfo = "余额不足";
2605
- }
2606
- // 如果是积分抵现的一些判断
2607
- if (this.currentMode.paymentType === PayStyle.jfdx) {
2608
- if (this.currentMode.integralCashOverOrderAmount === true) {
2609
- this.currentMode.steadCashIntegral = Math.ceil(this.currentMode.value / this.currentMode.cashAmount) * this.currentMode.perIntegral;
2610
- } else if (this.currentMode.integralCashOverOrderAmount === false) {
2611
- var v1 = this.currentMode.value / this.currentMode.cashAmount;
2612
- if ((0, _isInteger2.default)(v1)) {
2613
- this.currentMode.steadCashIntegral = Math.floor(this.currentMode.value / this.currentMode.cashAmount) * this.currentMode.perIntegral;
2614
- } else {
2615
- 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';
2616
- }
2617
- }
2618
- }
2619
- }
2620
- }, {
2621
- key: 'calcMemberBalance',
2622
- value: function calcMemberBalance() {
2623
- this.currentMode.balance = this.currentMode.rawbalance - this.currentMode.value;
2624
- }
2625
- }, {
2626
- key: 'setPaymodes',
2627
- value: function () {
2628
- var _ref33 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15(type, isIntegralExchange) {
2629
- var _this20 = this;
2630
-
2631
- var _ref34, isHorizontalPad, isHorizontalSunMi, isMobileEnvironment, _enumController$getEn21, settleStyleType, PayStyle, memberStoreCode, settlementCode, param, modes;
2632
-
2633
- return _regenerator2.default.wrap(function _callee15$(_context15) {
2634
- while (1) {
2635
- switch (_context15.prev = _context15.next) {
2636
- case 0:
2637
- // 是否移动端判断
2638
- _ref34 = _mutantsUtil.platform || {}, isHorizontalPad = _ref34.isHorizontalPad, isHorizontalSunMi = _ref34.isHorizontalSunMi;
2639
- isMobileEnvironment = !!isHorizontalPad || !!isHorizontalSunMi;
2640
- _enumController$getEn21 = _mutantsUtil.enumController.getEnumOj(), settleStyleType = _enumController$getEn21.settleStyleType, PayStyle = _enumController$getEn21.PayStyle;
2641
- memberStoreCode = settleStyleType.memberStoreCode, settlementCode = settleStyleType.settlementCode;
2642
- param = { 'settleStyleType': type == 1 ? memberStoreCode : settlementCode, isIntegralExchange: isIntegralExchange };
2643
- _context15.next = 7;
2644
- return (0, _tplusApi.tApi)({ param: param }, 'chanjet.RE.NewPos.GetNewStoreSettleStyles', false, false);
2645
-
2646
- case 7:
2647
- modes = _context15.sent;
2648
-
2649
- if (modes) {
2650
- (0, _mobx.runInAction)(function () {
2651
- var paymodes = [];
2652
- var settleLists = modes.SettleStyles;
2653
- settleLists = isMobileEnvironment ? settleLists.filter(function (v) {
2654
- return !v.ThirdPaymentInfo;
2655
- }) : settleLists;
2656
- (0, _each3.default)(settleLists, function (mode, index) {
2657
- //产品需求确认会员储值卡结算方式前端展示统一调整为“储值卡" tuzha by 2020-07-08
2658
- if (mode.Code == PayStyle.hyczk) {
2659
- mode.Name = '储值卡';
2660
- }
2661
- paymodes.push({
2662
- name: mode.Name,
2663
- isDefault: mode.IsDefaultSettleStyle,
2664
- isQuick: (0, _findIndex3.default)(modes.QuickSettleStyles, { 'Code': mode.Code }) >= 0,
2665
- orderBy: 1,
2666
- paymentType: mode.Code,
2667
- offlineDisable: mode.offlineDisable,
2668
- idSettleStyle: mode.IdSettleStyle,
2669
- idBankAccount: mode.IdBankAccount,
2670
- exchangeRate: mode.Currency ? mode.Currency.ExchangeRate : 1,
2671
- idCurrency: mode.Currency ? mode.Currency.ID : -1,
2672
- calDirection: mode.Currency ? mode.Currency.CalDirection.Id : "88",
2673
- virtualPay: mode.VirtualPay,
2674
- thridPayment: mode.ThirdPaymentInfo
2675
- });
2676
- });
2677
- _this20.paymodes = paymodes;
2678
- });
2679
- }
2680
-
2681
- case 9:
2682
- case 'end':
2683
- return _context15.stop();
2684
- }
2685
- }
2686
- }, _callee15, this);
2687
- }));
2688
-
2689
- function setPaymodes(_x12, _x13) {
2690
- return _ref33.apply(this, arguments);
2691
- }
2692
-
2693
- return setPaymodes;
2694
- }()
2695
- }, {
2696
- key: 'charge',
2697
- get: function get() {
2698
- return Math.abs(this.receivable);
2699
- }
2700
- }, {
2701
- key: 'counter',
2702
- get: function get() {
2703
- return ++this._counter;
2704
- }
2705
- }]);
2706
- return PayMode;
2707
- }(), (_descriptor7 = _applyDecoratedDescriptor(_class3.prototype, 'currentFocus', [_mobx.observable], {
2708
- enumerable: true,
2709
- initializer: function initializer() {
2710
- return "";
2711
- }
2712
- }), _descriptor8 = _applyDecoratedDescriptor(_class3.prototype, 'received', [_mobx.observable], {
2713
- enumerable: true,
2714
- initializer: function initializer() {
2715
- return 0;
2716
- }
2717
- }), _descriptor9 = _applyDecoratedDescriptor(_class3.prototype, 'receivable', [_mobx.observable], {
2718
- enumerable: true,
2719
- initializer: function initializer() {
2720
- return 0;
2721
- }
2722
- }), _descriptor10 = _applyDecoratedDescriptor(_class3.prototype, 'paymodes', [_mobx.observable], {
2723
- enumerable: true,
2724
- initializer: function initializer() {
2725
- return [];
2726
- }
2727
- }), _descriptor11 = _applyDecoratedDescriptor(_class3.prototype, 'thePaymodes', [_mobx.observable], {
2728
- enumerable: true,
2729
- initializer: function initializer() {
2730
- return [];
2731
- }
2732
- }), _descriptor12 = _applyDecoratedDescriptor(_class3.prototype, 'storageCardNo', [_mobx.observable], {
2733
- enumerable: true,
2734
- initializer: function initializer() {
2735
- return null;
2736
- }
2737
- }), _descriptor13 = _applyDecoratedDescriptor(_class3.prototype, 'balance', [_mobx.observable], {
2738
- enumerable: true,
2739
- initializer: function initializer() {
2740
- return null;
2741
- }
2742
- }), _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], {
2743
- enumerable: true,
2744
- initializer: function initializer() {
2745
- var _this21 = this;
2746
-
2747
- return function () {
2748
- _this21.checkList = [];
2749
- };
2750
- }
2751
- }), _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], {
2752
- enumerable: true,
2753
- initializer: function initializer() {
2754
- var _this22 = this;
2755
-
2756
- return function (id, couponNum, promoMethodEnum, nominalAmount, promoDiscount) {
2757
- _this22.currentMode.djqs.forEach(function (ele) {
2758
- if (ele.id === id) {
2759
- ele.amount = promoDiscount;
2760
- promoMethodEnum == "CASH_COUPON" && (ele.nominalAmount = nominalAmount);
2761
- ele.couponCategoryEnum = couponNum;
2762
- var IsEnable = ele.couponCategoryEnum === 'RIGUP' || ele.couponCategoryEnum === 'UN_MATCH' || ele.couponCategoryEnum === "PREPARING" || ele.couponCategoryEnum === 'PROMO_LIMITED' || ele.couponCategoryEnum === 'COUPON_CONFLICT' ? false : true;
2763
- ele.IsEnable = IsEnable;
2764
- }
2765
- });
2766
- };
2767
- }
2768
- }), _descriptor16 = _applyDecoratedDescriptor(_class3.prototype, 'addDjqs', [_mobx.action], {
2769
- enumerable: true,
2770
- initializer: function initializer() {
2771
- var _this23 = this;
2772
-
2773
- return function (promoCouponCode, name, IsEnable, nominalAmount, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id) {
2774
- var djq = {
2775
- promoCouponCode: promoCouponCode,
2776
- name: name,
2777
- IsEnable: IsEnable,
2778
- nominalAmount: nominalAmount,
2779
- amount: amount,
2780
- doorsill: doorsill,
2781
- LastTS: LastTS,
2782
- checked: checked,
2783
- IsRepelWithPoints: IsRepelWithPoints,
2784
- UMemberID: UMemberID,
2785
- expired: expired,
2786
- displayText: displayText,
2787
- promoMethodEnum: promoMethodEnum,
2788
- discountPct: discountPct,
2789
- promoId: promoId,
2790
- promoRuleId: promoRuleId,
2791
- couponCategoryEnum: couponCategoryEnum,
2792
- id: id
2793
- };
2794
- _this23.currentMode.djqs.push(djq);
2795
- };
2796
- }
2797
- }), _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);
2798
- var Member = exports.Member = (_class5 = function () {
2799
- function Member(m) {
2800
- var _this24 = this;
2801
-
2802
- (0, _classCallCheck3.default)(this, Member);
2803
-
2804
- _initDefineProp(this, 'cardNo', _descriptor17, this);
2805
-
2806
- _initDefineProp(this, 'balance', _descriptor18, this);
2807
-
2808
- _initDefineProp(this, 'exchangable', _descriptor19, this);
2809
-
2810
- _initDefineProp(this, 'meStorageCardId', _descriptor20, this);
2811
-
2812
- _initDefineProp(this, 'storageCardNo', _descriptor21, this);
2813
-
2814
- if (m) {
2815
- this.id = m.ID;
2816
- this.uid = m.Uid;
2817
- this.type = m.MemberType ? m.MemberType.Name : "普通";
2818
- this.rawbalance = m.BalanceStorage;
2819
- var index = (0, _findIndex3.default)(m.DynamicPropertyKeys, function (key) {
2820
- return key == 'canusedbalancestorage';
2821
- });
2822
-
2823
- var _ref35 = _mutantsUtil.platform || {},
2824
- isNewRetailBCPos = _ref35.isNewRetailBCPos;
2825
-
2826
- (0, _mobx.runInAction)(function () {
2827
- _this24.cardNo = m.CardCode;
2828
- if (index >= 0) {
2829
- _this24.balance = parseFloat(m.DynamicPropertyValues[index]);
2830
- } else {
2831
- _this24.balance = _this24.rawbalance;
2832
- }
2833
- });
2834
- this.needPwd = m.MemberType ? m.MemberType.IsNeedPwd : false;
2835
- this.NeedModifyPassword = m.NeedModifyPassword;
2836
- this.bonusPoints = m.BalanceIntegral;
2837
- }
2838
- }
2839
-
2840
- (0, _createClass3.default)(Member, [{
2841
- key: 'setExchangable',
2842
- value: function setExchangable(v) {
2843
- this.exchangable = v;
2844
- }
2845
- }, {
2846
- key: 'setCardNo',
2847
- value: function setCardNo(v) {
2848
- this.cardNo = v;
2849
- this.id = null;
2850
- }
2851
- }]);
2852
- return Member;
2853
- }(), (_descriptor17 = _applyDecoratedDescriptor(_class5.prototype, 'cardNo', [_mobx.observable], {
2854
- enumerable: true,
2855
- initializer: null
2856
- }), _descriptor18 = _applyDecoratedDescriptor(_class5.prototype, 'balance', [_mobx.observable], {
2857
- enumerable: true,
2858
- initializer: null
2859
- }), _descriptor19 = _applyDecoratedDescriptor(_class5.prototype, 'exchangable', [_mobx.observable], {
2860
- enumerable: true,
2861
- initializer: null
2862
- }), _descriptor20 = _applyDecoratedDescriptor(_class5.prototype, 'meStorageCardId', [_mobx.observable], {
2863
- enumerable: true,
2864
- initializer: null
2865
- }), _descriptor21 = _applyDecoratedDescriptor(_class5.prototype, 'storageCardNo', [_mobx.observable], {
2866
- enumerable: true,
2867
- initializer: null
2868
- }), _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);
2869
- //# sourceMappingURL=settlementStore.js.map