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