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