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