tplus-components-touch 3.54.1 → 3.54.2

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