tplus-components-touch 3.22.16 → 3.22.20

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 (238) hide show
  1. package/README.md +16 -16
  2. package/dist/components/acCitySelect/CitySelect.js +541 -0
  3. package/dist/components/acCitySelect/CitySelect.js.map +1 -0
  4. package/dist/components/acCitySelect/CitySelect.less +10 -0
  5. package/dist/components/acCitySelect/citys.js +1270 -0
  6. package/dist/components/acCitySelect/citys.js.map +1 -0
  7. package/dist/components/acCitySelect/index.js +18 -0
  8. package/dist/components/acCitySelect/index.js.map +1 -0
  9. package/dist/components/acCitySelect/provinceData.js +40 -0
  10. package/dist/components/acCitySelect/provinceData.js.map +1 -0
  11. package/dist/components/addLog/AddLogProcessor.js +49 -0
  12. package/dist/components/addLog/AddLogProcessor.js.map +1 -0
  13. package/dist/components/addLog/OperationLogApi.js +125 -0
  14. package/dist/components/addLog/OperationLogApi.js.map +1 -0
  15. package/dist/components/autoComplete/index.js +245 -0
  16. package/dist/components/autoComplete/index.js.map +1 -0
  17. package/dist/components/autoComplete/index.less +89 -0
  18. package/dist/components/autoComplete/option.js +75 -0
  19. package/dist/components/autoComplete/option.js.map +1 -0
  20. package/dist/components/autoCompleteWithKeyboard/index.js +231 -0
  21. package/dist/components/autoCompleteWithKeyboard/index.js.map +1 -0
  22. package/dist/components/autoCompleteWithKeyboard/index.less +8 -0
  23. package/dist/components/billSearch/api.js +465 -0
  24. package/dist/components/billSearch/api.js.map +1 -0
  25. package/dist/components/billSearch/index.js +2063 -0
  26. package/dist/components/billSearch/index.js.map +1 -0
  27. package/dist/components/billSearch/index.less +373 -0
  28. package/dist/components/cloudPrint/BTPrintFormatUtil.js +568 -0
  29. package/dist/components/cloudPrint/BTPrintFormatUtil.js.map +1 -0
  30. package/dist/components/cloudPrint/api.js +349 -0
  31. package/dist/components/cloudPrint/api.js.map +1 -0
  32. package/dist/components/cloudPrint/index.js +674 -0
  33. package/dist/components/cloudPrint/index.js.map +1 -0
  34. package/dist/components/cloudPrint/printDispatch.js +223 -0
  35. package/dist/components/cloudPrint/printDispatch.js.map +1 -0
  36. package/dist/components/commonForm/addressPicker/index.js +232 -0
  37. package/dist/components/commonForm/addressPicker/index.js.map +1 -0
  38. package/dist/components/commonForm/addressPicker/style.less +11 -0
  39. package/dist/components/commonForm/autoComplete/index.js +241 -0
  40. package/dist/components/commonForm/autoComplete/index.js.map +1 -0
  41. package/dist/components/commonForm/autoComplete/style.less +3 -0
  42. package/dist/components/commonForm/datePicker/index.js +89 -0
  43. package/dist/components/commonForm/datePicker/index.js.map +1 -0
  44. package/dist/components/commonForm/datePicker/style.less +5 -0
  45. package/dist/components/commonForm/formControl/index.js +143 -0
  46. package/dist/components/commonForm/formControl/index.js.map +1 -0
  47. package/dist/components/commonForm/formControl/style.less +0 -0
  48. package/dist/components/commonForm/index.js +225 -0
  49. package/dist/components/commonForm/index.js.map +1 -0
  50. package/dist/components/commonForm/inputNumber/index.js +272 -0
  51. package/dist/components/commonForm/inputNumber/index.js.map +1 -0
  52. package/dist/components/commonForm/inputNumber/style.less +11 -0
  53. package/dist/components/commonForm/radio/index.js +132 -0
  54. package/dist/components/commonForm/radio/index.js.map +1 -0
  55. package/dist/components/commonForm/radio/style.less +0 -0
  56. package/dist/components/commonForm/style.less +2 -0
  57. package/dist/components/deliverySearch/api.js +355 -0
  58. package/dist/components/deliverySearch/api.js.map +1 -0
  59. package/dist/components/deliverySearch/index.js +1214 -0
  60. package/dist/components/deliverySearch/index.js.map +1 -0
  61. package/dist/components/deliverySearch/index.less +554 -0
  62. package/dist/components/form/index.js +310 -0
  63. package/dist/components/form/index.js.map +1 -0
  64. package/dist/components/hardwareAPI/index.js +181 -0
  65. package/dist/components/hardwareAPI/index.js.map +1 -0
  66. package/dist/components/hotKey/config.js +306 -0
  67. package/dist/components/hotKey/config.js.map +1 -0
  68. package/dist/components/hotKey/hotKeyModal.js +479 -0
  69. package/dist/components/hotKey/hotKeyModal.js.map +1 -0
  70. package/dist/components/hotKey/index.js +785 -0
  71. package/dist/components/hotKey/index.js.map +1 -0
  72. package/dist/components/hotKey/localConfig.js +1021 -0
  73. package/dist/components/hotKey/localConfig.js.map +1 -0
  74. package/dist/components/hotKey/style.less +96 -0
  75. package/dist/components/hotKey/utils.js +135 -0
  76. package/dist/components/hotKey/utils.js.map +1 -0
  77. package/dist/components/input/index.js +251 -0
  78. package/dist/components/input/index.js.map +1 -0
  79. package/dist/components/input/style.less +99 -0
  80. package/dist/components/input/tplusInput/index.js +81 -0
  81. package/dist/components/input/tplusInput/index.js.map +1 -0
  82. package/dist/components/input/tplusInput/inputContent.js +128 -0
  83. package/dist/components/input/tplusInput/inputContent.js.map +1 -0
  84. package/dist/components/input/tplusInput/inputs.js +151 -0
  85. package/dist/components/input/tplusInput/inputs.js.map +1 -0
  86. package/dist/components/input/tplusInput/style.less +132 -0
  87. package/dist/components/input/utils/index.js +26 -0
  88. package/dist/components/input/utils/index.js.map +1 -0
  89. package/dist/components/inventorySearch/api.js +214 -0
  90. package/dist/components/inventorySearch/api.js.map +1 -0
  91. package/dist/components/inventorySearch/index.js +303 -0
  92. package/dist/components/inventorySearch/index.js.map +1 -0
  93. package/dist/components/inventorySearch/index.less +120 -0
  94. package/dist/components/inventorySearch/store.js +344 -0
  95. package/dist/components/inventorySearch/store.js.map +1 -0
  96. package/dist/components/inventorySearch/tab.js +258 -0
  97. package/dist/components/inventorySearch/tab.js.map +1 -0
  98. package/dist/components/keyboard/index.js +255 -0
  99. package/dist/components/keyboard/index.js.map +1 -0
  100. package/dist/components/keyboard/index.less +470 -0
  101. package/dist/components/keyboard/letterKeyboard.js +210 -0
  102. package/dist/components/keyboard/letterKeyboard.js.map +1 -0
  103. package/dist/components/keyboard/numKeyboard.js +459 -0
  104. package/dist/components/keyboard/numKeyboard.js.map +1 -0
  105. package/dist/components/keyboard/numKeyboardScan.js +195 -0
  106. package/dist/components/keyboard/numKeyboardScan.js.map +1 -0
  107. package/dist/components/keyboard/numberButton_input.js +303 -0
  108. package/dist/components/keyboard/numberButton_input.js.map +1 -0
  109. package/dist/components/keyboard/numkeyboardPassword.js +460 -0
  110. package/dist/components/keyboard/numkeyboardPassword.js.map +1 -0
  111. package/dist/components/keyboard/onlyKeyboard.js +90 -0
  112. package/dist/components/keyboard/onlyKeyboard.js.map +1 -0
  113. package/dist/components/keyboard/onlyLetterButton.js +187 -0
  114. package/dist/components/keyboard/onlyLetterButton.js.map +1 -0
  115. package/dist/components/keyboard/onlyLetterButton2.js +235 -0
  116. package/dist/components/keyboard/onlyLetterButton2.js.map +1 -0
  117. package/dist/components/keyboard/onlyLetterButton2.less +162 -0
  118. package/dist/components/keyboard/onlyNumberButton.js +128 -0
  119. package/dist/components/keyboard/onlyNumberButton.js.map +1 -0
  120. package/dist/components/keyboard/onlyNumberButton2.js +115 -0
  121. package/dist/components/keyboard/onlyNumberButton2.js.map +1 -0
  122. package/dist/components/keyboard/textKeyboard.js +50 -0
  123. package/dist/components/keyboard/textKeyboard.js.map +1 -0
  124. package/dist/components/layout/hamburger.js +29 -0
  125. package/dist/components/layout/hamburger.js.map +1 -0
  126. package/dist/components/layout/index.js +31 -0
  127. package/dist/components/layout/index.js.map +1 -0
  128. package/dist/components/layout/layout.js +182 -0
  129. package/dist/components/layout/layout.js.map +1 -0
  130. package/dist/components/layout/sider.js +165 -0
  131. package/dist/components/layout/sider.js.map +1 -0
  132. package/dist/components/layout/style.less +82 -0
  133. package/dist/components/loading/index.js +198 -0
  134. package/dist/components/loading/index.js.map +1 -0
  135. package/dist/components/loading/loadingContent.js +176 -0
  136. package/dist/components/loading/loadingContent.js.map +1 -0
  137. package/dist/components/loading/style.less +61 -0
  138. package/dist/components/loading/utils.js +29 -0
  139. package/dist/components/loading/utils.js.map +1 -0
  140. package/dist/components/message/index.js +308 -0
  141. package/dist/components/message/index.js.map +1 -0
  142. package/dist/components/message/index.less +101 -0
  143. package/dist/components/modal/index.js +93 -0
  144. package/dist/components/modal/index.js.map +1 -0
  145. package/dist/components/modal/index.less +19 -0
  146. package/dist/components/modalVertical/index.js +325 -0
  147. package/dist/components/modalVertical/index.js.map +1 -0
  148. package/dist/components/modalVertical/style.less +60 -0
  149. package/dist/components/modalWraper/index.js +470 -0
  150. package/dist/components/modalWraper/index.js.map +1 -0
  151. package/dist/components/modalWraper/style.less +257 -0
  152. package/dist/components/modalWraper/utils.js +48 -0
  153. package/dist/components/modalWraper/utils.js.map +1 -0
  154. package/dist/components/notification/index.js +119 -0
  155. package/dist/components/notification/index.js.map +1 -0
  156. package/dist/components/notification/index.less +52 -0
  157. package/dist/components/overflowTip/index.js +269 -0
  158. package/dist/components/overflowTip/index.js.map +1 -0
  159. package/dist/components/overflowTip/style.less +66 -0
  160. package/dist/components/page/index.js +49 -0
  161. package/dist/components/page/index.js.map +1 -0
  162. package/dist/components/page/index.less +22 -0
  163. package/dist/components/product/detail.js +148 -0
  164. package/dist/components/product/detail.js.map +1 -0
  165. package/dist/components/product/getCard.js +145 -0
  166. package/dist/components/product/getCard.js.map +1 -0
  167. package/dist/components/product/index.less +128 -0
  168. package/dist/components/progressState/EmptyAndErrorView.js +143 -0
  169. package/dist/components/progressState/EmptyAndErrorView.js.map +1 -0
  170. package/dist/components/progressState/ProgressState.js +157 -0
  171. package/dist/components/progressState/ProgressState.js.map +1 -0
  172. package/dist/components/progressState/index.js +14 -0
  173. package/dist/components/progressState/index.js.map +1 -0
  174. package/dist/components/progressState/style.less +65 -0
  175. package/dist/components/scan/index.js +219 -0
  176. package/dist/components/scan/index.js.map +1 -0
  177. package/dist/components/scan/index.less +34 -0
  178. package/dist/components/select/index.js +28 -0
  179. package/dist/components/select/index.js.map +1 -0
  180. package/dist/components/select/index.less +12 -0
  181. package/dist/components/settlement/asyncModal.js +204 -0
  182. package/dist/components/settlement/asyncModal.js.map +1 -0
  183. package/dist/components/settlement/index.js +16 -0
  184. package/dist/components/settlement/index.js.map +1 -0
  185. package/dist/components/settlement/prototypeTable/index.js +349 -0
  186. package/dist/components/settlement/prototypeTable/index.js.map +1 -0
  187. package/dist/components/settlement/prototypeTable/style.less +59 -0
  188. package/dist/components/settlement/prototypeTable/utils.js +14 -0
  189. package/dist/components/settlement/prototypeTable/utils.js.map +1 -0
  190. package/dist/components/settlement/settlement.js +5471 -0
  191. package/dist/components/settlement/settlement.js.map +1 -0
  192. package/dist/components/settlement/settlement.less +1594 -0
  193. package/dist/components/settlement/settlementStore.js +2097 -0
  194. package/dist/components/settlement/settlementStore.js.map +1 -0
  195. package/dist/components/settlement/utils.js +249 -0
  196. package/dist/components/settlement/utils.js.map +1 -0
  197. package/dist/components/socket/index.js +220 -0
  198. package/dist/components/socket/index.js.map +1 -0
  199. package/dist/components/spin/index.js +95 -0
  200. package/dist/components/spin/index.js.map +1 -0
  201. package/dist/components/spin/spin-style.less +436 -0
  202. package/dist/components/test/index.js +330 -0
  203. package/dist/components/test/index.js.map +1 -0
  204. package/dist/components/ticon/iconfont/demo.css +539 -0
  205. package/dist/components/ticon/iconfont/demo_index.html +5202 -0
  206. package/dist/components/ticon/iconfont/iconfont.css +887 -0
  207. package/dist/components/ticon/iconfont/iconfont.eot +0 -0
  208. package/dist/components/ticon/iconfont/iconfont.js +35 -0
  209. package/dist/components/ticon/iconfont/iconfont.js.map +1 -0
  210. package/dist/components/ticon/iconfont/iconfont.json +1535 -0
  211. package/dist/components/ticon/iconfont/iconfont.svg +593 -0
  212. package/dist/components/ticon/iconfont/iconfont.ttf +0 -0
  213. package/dist/components/ticon/iconfont/iconfont.woff +0 -0
  214. package/dist/components/ticon/iconfont/iconfont.woff2 +0 -0
  215. package/dist/components/ticon/index.js +60 -0
  216. package/dist/components/ticon/index.js.map +1 -0
  217. package/dist/components/touchScroll/index.js +182 -0
  218. package/dist/components/touchScroll/index.js.map +1 -0
  219. package/dist/components/touchTable/AuthProcess.js +42 -0
  220. package/dist/components/touchTable/AuthProcess.js.map +1 -0
  221. package/dist/components/touchTable/generateWater.js +59 -0
  222. package/dist/components/touchTable/generateWater.js.map +1 -0
  223. package/dist/components/touchTable/index.js +1109 -0
  224. package/dist/components/touchTable/index.js.map +1 -0
  225. package/dist/components/touchTable/index.less +370 -0
  226. package/dist/components/touchTable/utils.js +14 -0
  227. package/dist/components/touchTable/utils.js.map +1 -0
  228. package/dist/demo/PopOverDemo.js +126 -0
  229. package/dist/demo/PopOverDemo.js.map +1 -0
  230. package/dist/index.js +249 -0
  231. package/dist/index.js.map +1 -0
  232. package/dist/util/tools.js +202 -0
  233. package/dist/util/tools.js.map +1 -0
  234. package/locales/zh/tplus-components-touch.json +1 -1
  235. package/locales/zh-CN/tplus-components-touch.json +1 -1
  236. package/mocks/memberInfo.json +79 -79
  237. package/package.json +35 -35
  238. package/tsconfig.json +26 -26
@@ -0,0 +1,2097 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Member = exports.PayMode = exports.default = undefined;
7
+
8
+ var _defineProperty = require('babel-runtime/core-js/object/define-property');
9
+
10
+ var _defineProperty2 = _interopRequireDefault(_defineProperty);
11
+
12
+ var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor');
13
+
14
+ var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
15
+
16
+ var _stringify = require('babel-runtime/core-js/json/stringify');
17
+
18
+ var _stringify2 = _interopRequireDefault(_stringify);
19
+
20
+ var _promise = require('babel-runtime/core-js/promise');
21
+
22
+ var _promise2 = _interopRequireDefault(_promise);
23
+
24
+ var _regenerator = require('babel-runtime/regenerator');
25
+
26
+ var _regenerator2 = _interopRequireDefault(_regenerator);
27
+
28
+ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
29
+
30
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
31
+
32
+ var _extends2 = require('babel-runtime/helpers/extends');
33
+
34
+ var _extends3 = _interopRequireDefault(_extends2);
35
+
36
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
37
+
38
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
39
+
40
+ var _createClass2 = require('babel-runtime/helpers/createClass');
41
+
42
+ var _createClass3 = _interopRequireDefault(_createClass2);
43
+
44
+ var _desc, _value, _class, _descriptor, _descriptor2, _desc2, _value2, _class3, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _desc3, _value3, _class5, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15;
45
+
46
+ var _mobx = require('mobx');
47
+
48
+ var _mutantsMicrofx = require('mutants-microfx');
49
+
50
+ var _find2 = require('lodash/find');
51
+
52
+ var _find3 = _interopRequireDefault(_find2);
53
+
54
+ var _remove2 = require('lodash/remove');
55
+
56
+ var _remove3 = _interopRequireDefault(_remove2);
57
+
58
+ var _each2 = require('lodash/each');
59
+
60
+ var _each3 = _interopRequireDefault(_each2);
61
+
62
+ var _map2 = require('lodash/map');
63
+
64
+ var _map3 = _interopRequireDefault(_map2);
65
+
66
+ var _join2 = require('lodash/join');
67
+
68
+ var _join3 = _interopRequireDefault(_join2);
69
+
70
+ var _trim2 = require('lodash/trim');
71
+
72
+ var _trim3 = _interopRequireDefault(_trim2);
73
+
74
+ var _filter2 = require('lodash/filter');
75
+
76
+ var _filter3 = _interopRequireDefault(_filter2);
77
+
78
+ var _findIndex2 = require('lodash/findIndex');
79
+
80
+ var _findIndex3 = _interopRequireDefault(_findIndex2);
81
+
82
+ var _findLastIndex2 = require('lodash/findLastIndex');
83
+
84
+ var _findLastIndex3 = _interopRequireDefault(_findLastIndex2);
85
+
86
+ var _findKey2 = require('lodash/findKey');
87
+
88
+ var _findKey3 = _interopRequireDefault(_findKey2);
89
+
90
+ var _tplusPoslogin = require('tplus-poslogin');
91
+
92
+ var _utils = require('./utils');
93
+
94
+ var _tplusApi = require('tplus-api');
95
+
96
+ var _cloneDeep = require('lodash/cloneDeep');
97
+
98
+ var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
99
+
100
+ var _message = require('../message');
101
+
102
+ var _message2 = _interopRequireDefault(_message);
103
+
104
+ var _mutantsUtil = require('mutants-util');
105
+
106
+ var _tplusComponentsTouch = require('tplus-components-touch');
107
+
108
+ var _moment = require('moment');
109
+
110
+ var _moment2 = _interopRequireDefault(_moment);
111
+
112
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
113
+
114
+ function _initDefineProp(target, property, descriptor, context) {
115
+ if (!descriptor) return;
116
+ (0, _defineProperty2.default)(target, property, {
117
+ enumerable: descriptor.enumerable,
118
+ configurable: descriptor.configurable,
119
+ writable: descriptor.writable,
120
+ value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
121
+ });
122
+ }
123
+
124
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
125
+ var desc = {};
126
+ Object['ke' + 'ys'](descriptor).forEach(function (key) {
127
+ desc[key] = descriptor[key];
128
+ });
129
+ desc.enumerable = !!desc.enumerable;
130
+ desc.configurable = !!desc.configurable;
131
+
132
+ if ('value' in desc || desc.initializer) {
133
+ desc.writable = true;
134
+ }
135
+
136
+ desc = decorators.slice().reverse().reduce(function (desc, decorator) {
137
+ return decorator(target, property, desc) || desc;
138
+ }, desc);
139
+
140
+ if (context && desc.initializer !== void 0) {
141
+ desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
142
+ desc.initializer = undefined;
143
+ }
144
+
145
+ if (desc.initializer === void 0) {
146
+ Object['define' + 'Property'](target, property, desc);
147
+ desc = null;
148
+ }
149
+
150
+ return desc;
151
+ }
152
+
153
+ function _initializerWarningHelper(descriptor, context) {
154
+ throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
155
+ }
156
+
157
+ var t = _mutantsMicrofx.i18n.getFixedT(null, 'newretail');
158
+
159
+ var SettlementStore = (_class = function () {
160
+ //type==2
161
+ function SettlementStore() {
162
+ var _this2 = this;
163
+
164
+ (0, _classCallCheck3.default)(this, SettlementStore);
165
+ this.paymode = null;
166
+ this.dto = null;
167
+ this.member = null;
168
+ this.brefund = false;
169
+ this.bquick = false;
170
+ this.boriginReturn = false;
171
+ this.newStyle = true;
172
+
173
+ _initDefineProp(this, 'queryPwd', _descriptor, this);
174
+
175
+ _initDefineProp(this, 'updateMemberInfo', _descriptor2, this);
176
+
177
+ this.getCouponList = function (coupon_code) {
178
+ var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
179
+ PayStyle = _enumController$getEn.PayStyle,
180
+ Differentiate = _enumController$getEn.Differentiate;
181
+
182
+ var couponApplyRule = (0, _tplusPoslogin.PosInitData)('CouponApplyRule');
183
+
184
+ var _enumController$getEn2 = _mutantsUtil.enumController.getEnumOj(),
185
+ CouponApplyRule = _enumController$getEn2.CouponApplyRule;
186
+
187
+ if (couponApplyRule == CouponApplyRule.SHOWN_BY_CUSTOMER && !!coupon_code || couponApplyRule != CouponApplyRule.SHOWN_BY_CUSTOMER) {
188
+ var dto = _this2.dto;
189
+ var promoVoucher = {};
190
+ _this2.paymode.clearDjqs();
191
+ _this2.paymode.reCalculationDjqs();
192
+ // promoVoucher.bizDate = dto.VoucherDate;
193
+ // promoVoucher.bizDate = new Date().getTime();
194
+ promoVoucher.coupon_code = coupon_code || "";
195
+ promoVoucher.boName = "Retail";
196
+ promoVoucher.voucherId = dto.ID;
197
+ var onlinePaymentAmount = 0;
198
+ if (dto.OnlinePaymentAmount) {
199
+ onlinePaymentAmount = dto.OnlinePaymentAmount;
200
+ }
201
+ promoVoucher.promoLinks = (0, _filter3.default)(_this2.paymode.currentMode.djqs, function (djq) {
202
+ return djq.checked;
203
+ });
204
+ promoVoucher.totalAmountWithTax = Math.Minus(dto.TotalTaxAmount, onlinePaymentAmount);
205
+ promoVoucher.redBlueFlagEnum = "BLUE";
206
+ promoVoucher.meMemberId = dto.Idmember;
207
+ promoVoucher.storeFactorId = dto.Idstore;
208
+ promoVoucher.voucherDetailList = [];
209
+ dto.RetailDetails.forEach(function (item) {
210
+ var detailDTO = {};
211
+ detailDTO.uuid = item.Code;
212
+ detailDTO.detailBoName = "RetailDetail";
213
+ detailDTO.voucherDetailId = item.ID;
214
+ detailDTO.productId = item.Idinventory;
215
+ detailDTO.uomId = item.Idunit;
216
+ detailDTO.productSpecId = item.ProductSpecId;
217
+ detailDTO.isManualFreeGift = item.IsPresent;
218
+ detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
219
+ detailDTO.IsManualChangePrice = item.IsManualChangePrice;
220
+ // if(detailDTO.IsManualChangePrice)//如果是手工改价
221
+ // {
222
+ // detailDTO.listPrice = item.TaxPrice;
223
+ // detailDTO.netAmountWithTax = item.TaxAmount;
224
+ // }
225
+ // else
226
+ // {
227
+ var bookingQuantity = 0;
228
+ if (item.BookingQuantity) {
229
+ bookingQuantity = item.BookingQuantity;
230
+ }
231
+ detailDTO.listPrice = JSON.getCellValue(item, "listPrice");
232
+ detailDTO.netAmountWithTax = Math.Multiply(detailDTO.listPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
233
+ //}
234
+ detailDTO.taxRate = item.TaxRate;
235
+ detailDTO.quantity = item.Quantity;
236
+
237
+ detailDTO.amountWithTax = item.RetailAmount;
238
+ // 促销 start
239
+ if (item.PromotionDetails && item.PromotionDetails.length != 0) {
240
+ var promoLinks = [];
241
+ item.PromotionDetails.forEach(function (promotion) {
242
+ promoLinks.push({
243
+ promoId: promotion.IdSalesPromotionDTO,
244
+ promoRuleId: promotion.PromotionRuleId
245
+ });
246
+ });
247
+ if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
248
+ }
249
+ // 促销 end
250
+ promoVoucher.voucherDetailList.push(detailDTO);
251
+ });
252
+
253
+ return (0, _tplusApi.ccApi)((0, _extends3.default)({}, promoVoucher), 'promotion/PromoCalculate/findUsefulCouponPromoList', false, false, { method: 'post', timeout_skip: true }).then(function (result) {
254
+ if (result && result.length != 0) {
255
+ result.forEach(function (element) {
256
+ var _ref = element || {},
257
+ couponCode = _ref.couponCode,
258
+ name = _ref.name,
259
+ tieredAmountResult = _ref.tieredAmountResult,
260
+ fromDate = _ref.fromDate,
261
+ dateMount = _ref.dateMount,
262
+ promoMethodEnum = _ref.promoMethodEnum,
263
+ discountPct = _ref.discountPct,
264
+ nominalAmount = _ref.nominalAmount,
265
+ promoId = _ref.promoId,
266
+ id = _ref.id;
267
+
268
+ var condValue = tieredAmountResult.condValue,
269
+ promoDiscount = tieredAmountResult.promoDiscount,
270
+ displayText = tieredAmountResult.displayText,
271
+ promoRuleId = tieredAmountResult.promoRuleId,
272
+ couponCategoryEnum = tieredAmountResult.couponCategoryEnum;
273
+
274
+ if (result.IsRepelWithPoints && (0, _find3.default)(_this2.paymode.thePaymodes, function (themode) {
275
+ return themode.paymentType == PayStyle.jfdx;
276
+ })) {
277
+ _message2.default.error(Differentiate.COUPON + '\uFF08' + result.SN + '\uFF09\u4E0D\u53EF\u4E0E\u79EF\u5206\u4E00\u8D77\u4F7F\u7528');
278
+ } else {
279
+ var IsEnable = couponCategoryEnum === 'RIGUP' || couponCategoryEnum === 'UN_MATCH' || couponCategoryEnum === "PREPARING" || couponCategoryEnum === 'PROMO_LIMITED' || couponCategoryEnum === 'COUPON_CONFLICT' ? false : true;
280
+
281
+ var _ref2 = _mutantsUtil.platform || {},
282
+ isNewRetailBCPos = _ref2.isNewRetailBCPos;
283
+
284
+ _this2.addDjq(couponCode, name, IsEnable, promoMethodEnum == "CASH_COUPON" ? nominalAmount : promoDiscount, condValue, null, false, !result.IsRepelWithPoints, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id, true, 1);
285
+ }
286
+ });
287
+ if (promoVoucher.coupon_code) {
288
+ _this2.paymode.calcDjqCheckValue(_this2.paymode.currentMode.djqs[0], _this2.dto, 'single');
289
+ }
290
+ } else {
291
+ if (promoVoucher.coupon_code) {
292
+ _message2.default.info(Differentiate.COUPON + '\u53F7\u4E0D\u5B58\u5728\uFF01');
293
+ _this2.getCouponList();
294
+ } else {
295
+ _message2.default.info('\u6CA1\u6709\u627E\u5230\u53EF\u4F7F\u7528\u7684' + Differentiate.COUPON + '\uFF01');
296
+ }
297
+ }
298
+ });
299
+ }
300
+ };
301
+
302
+ this.getSettleGift = function () {
303
+ return (0, _tplusApi.ccApi)({}, '/marketingtool/paygift/executeRightsForPos/' + _this2.billID, false, false, { method: 'get', timeout_skip: true });
304
+ };
305
+
306
+ this.checkCoupon = function () {
307
+ var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(sn) {
308
+ var _ref4, isNewRetailBCPos, _enumController$getEn3, PayStyle, Differentiate;
309
+
310
+ return _regenerator2.default.wrap(function _callee$(_context) {
311
+ while (1) {
312
+ switch (_context.prev = _context.next) {
313
+ case 0:
314
+ _ref4 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref4.isNewRetailBCPos;
315
+
316
+ if (!isNewRetailBCPos) {
317
+ _context.next = 7;
318
+ break;
319
+ }
320
+
321
+ _context.next = 4;
322
+ return _this2.getCouponList(sn, 'sinlge');
323
+
324
+ case 4:
325
+ return _context.abrupt('return', _context.sent);
326
+
327
+ case 7:
328
+ _enumController$getEn3 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn3.PayStyle, Differentiate = _enumController$getEn3.Differentiate;
329
+ return _context.abrupt('return', (0, _tplusApi.tApi)({ request: {
330
+ Uid: _this2.paymode.currentMode.member.uid || '',
331
+ SN: sn,
332
+ StoreCode: _this2.dto.Idstore,
333
+ Inventories: (0, _map3.default)((0, _filter3.default)(_this2.dto.RetailDetails, function (d) {
334
+ return d.Quantity > 0 && !d.IsPresent;
335
+ }), function (detail) {
336
+ return {
337
+ IdInventory: detail.Inventory.ID,
338
+ IdUnit: detail.Idunit,
339
+ Code: detail.Inventory.Code,
340
+ FreeItem0: JSON.getCellValue(detail, "freeitem0"),
341
+ FreeItem1: JSON.getCellValue(detail, "freeitem1"),
342
+ FreeItem2: JSON.getCellValue(detail, "freeitem2"),
343
+ FreeItem3: JSON.getCellValue(detail, "freeitem3"),
344
+ FreeItem4: JSON.getCellValue(detail, "freeitem4"),
345
+ FreeItem5: JSON.getCellValue(detail, "freeitem5"),
346
+ FreeItem6: JSON.getCellValue(detail, "freeitem6"),
347
+ FreeItem7: JSON.getCellValue(detail, "freeitem7"),
348
+ FreeItem8: JSON.getCellValue(detail, "freeitem8"),
349
+ FreeItem9: JSON.getCellValue(detail, "freeitem9")
350
+ };
351
+ }),
352
+ // inventoryCodes:_join(_map(this.dto.RetailDetails,(detail)=>{return detail.Inventory.Code;}),','),
353
+ InventoryClassCodes: (0, _join3.default)((0, _map3.default)((0, _filter3.default)(_this2.dto.RetailDetails, function (d) {
354
+ return d.Quantity > 0;
355
+ }), function (detail) {
356
+ return (detail.Inventory.InventoryClass || { Code: '' }).Code;
357
+ }), ','),
358
+ Amount: _this2.paymode.amount
359
+ } }, 'chanjet.AA.DR.coupon.CheckCoupon', false, false).then(function (result) {
360
+ if ((0, _find3.default)(_this2.paymode.currentMode.djqs, function (djq) {
361
+ return djq.code == result.SN;
362
+ })) {
363
+ _message2.default.info(Differentiate.COUPON + '\u5DF2\u6DFB\u52A0');
364
+ } else if (result.IsRepelWithPoints && (0, _find3.default)(_this2.paymode.thePaymodes, function (themode) {
365
+ return themode.paymentType == PayStyle.jfdx;
366
+ })) {
367
+ _message2.default.error(Differentiate.COUPON + '\uFF08' + result.SN + '\uFF09\u4E0D\u53EF\u4E0E\u79EF\u5206\u4E00\u8D77\u4F7F\u7528');
368
+ } else {
369
+ _this2.addDjq(result.SN, result.Title, result.ReduceAmount, result.StartAmount, result.LastTS, false, !result.IsRepelWithPoints, result.UMemberID);
370
+ }
371
+ }));
372
+
373
+ case 9:
374
+ case 'end':
375
+ return _context.stop();
376
+ }
377
+ }
378
+ }, _callee, _this2);
379
+ }));
380
+
381
+ return function (_x) {
382
+ return _ref3.apply(this, arguments);
383
+ };
384
+ }();
385
+
386
+ this.checkIntegralExchangeReturn = function (id) {
387
+ return new _promise2.default(function (resolve, reject) {
388
+ (0, _tplusApi.tApi)({ param: { refVoucherId: id } }, 'chanjet.RE.NewPos.GetNewIntegralExchange', false, false, { timeout_skip: true }).then(function (resp) {
389
+ if (resp && resp.expireIntegral > 0) {
390
+ _tplusComponentsTouch.ModalWraper.confirm({
391
+ className: 'tplus-confirm-modal',
392
+ title: "温馨提示",
393
+ 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',
394
+ cancelable: false,
395
+ onOk: function onOk() {
396
+ resolve(true);
397
+ },
398
+ onCancel: function onCancel() {
399
+ reject(false);
400
+ }
401
+ });
402
+ } else {
403
+ resolve(true);
404
+ }
405
+ });
406
+ });
407
+ };
408
+
409
+ this.paymode = new PayMode();
410
+ var params = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('cloudPrintArguments');
411
+ if (params) this.cloudPrintArguments = params;
412
+ this.newStyle = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') == 'voucher';
413
+ }
414
+
415
+ (0, _createClass3.default)(SettlementStore, [{
416
+ key: 'initPaymodes',
417
+ value: function initPaymodes(event, type, isIntegralExchange) {
418
+ this.isIntegralExchange = isIntegralExchange;
419
+ this.paymode.setPaymodes(type, isIntegralExchange);
420
+ this.updateEvent = event;
421
+ }
422
+ }, {
423
+ key: 'init',
424
+ value: function init(context, amounthandler, datasource, storeinfo, bquick, amount, type, data) {
425
+ var _this3 = this;
426
+
427
+ this.newStyle = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('voucherDefaultPosMode') == 'voucher';
428
+ this.type = type;
429
+ if (context) {
430
+ this.context = context;
431
+ this.amountHandler = amounthandler;
432
+ this.dataSource = datasource;
433
+ this.storeInfo = storeinfo;
434
+ this.dto = context.viewModel.data;
435
+ (0, _mobx.runInAction)(function () {
436
+ // 单品金额抹零
437
+ if (global.DealSingleRowAmountSettingProcessorBlock) {
438
+ global.DealSingleRowAmountSettingProcessorBlock.execute(_this3.dto);
439
+ }
440
+ // 成交金额抹零
441
+ if (global.DealAmountSettingProcessorBlock) {
442
+ global.DealAmountSettingProcessorBlock.execute(_this3.dto);
443
+ }
444
+ });
445
+ // this.member=context.stores && context.stores.memberStore && context.stores.memberStore.member;
446
+ this.member = this.dto.Member; //stores.selectMemberStore.selectMemberInfo;
447
+ this.brefund = this.paymode.setAmount(this.dto.TotalTaxAmount, this.dto.OnlinePaymentAmount);
448
+ } else {
449
+ this.brefund = this.paymode.setAmount(amount, 0);
450
+ this.dto = data;
451
+ }
452
+ this.paymode.clean();
453
+
454
+ //this.dto.TotalTaxAmount<0;
455
+ this.bquick = !!bquick;
456
+ this.boriginReturn = JSON.getCellValue(this.dto, "IsOriginalReturn");
457
+ if (this.boriginReturn) {
458
+ this.initByOriginReturn();
459
+ }
460
+ if (this.newStyle) {
461
+ this.setModes();
462
+ }
463
+ }
464
+ }, {
465
+ key: 'setModes',
466
+ value: function setModes() {
467
+ var _this4 = this;
468
+
469
+ (0, _each3.default)(this.paymode.paymodes, function (p) {
470
+ if ((0, _findIndex3.default)(_this4.paymode.thePaymodes, function (mode) {
471
+ return p.paymentType == mode.paymentType;
472
+ }) == -1) {
473
+ _this4.addPay(p.paymentType);
474
+ }
475
+ });
476
+ if (!this.boriginReturn && this.paymode.thePaymodes.length > 0) {
477
+ this.changeValue(this.paymode.thePaymodes[0].paymethodId, 0, true);
478
+ }
479
+ }
480
+ }, {
481
+ key: 'amountChanged',
482
+ value: function amountChanged(amount) {
483
+ if (this.type == 1) {
484
+ this.brefund = this.paymode.setAmount(amount, 0);
485
+ }
486
+ }
487
+ }, {
488
+ key: 'initByOriginReturn',
489
+ value: function initByOriginReturn() {
490
+ var _this5 = this;
491
+
492
+ var _enumController$getEn4 = _mutantsUtil.enumController.getEnumOj(),
493
+ PayStyle = _enumController$getEn4.PayStyle;
494
+
495
+ var _ref5 = _mutantsUtil.platform || {},
496
+ isNewRetailBCPos = _ref5.isNewRetailBCPos;
497
+
498
+ console.log(this.dto, 'dto==========');
499
+ this.paymode.checkList = [];
500
+ (0, _each3.default)(this.dto.RetailPaymentDetails, function (detail) {
501
+ var themode = (0, _find3.default)(_this5.paymode.paymodes, { 'idSettleStyle': detail.IdsettleStyle });
502
+ if (detail.SettleStyle.Code === PayStyle.hyczk && !themode) {
503
+ _tplusComponentsTouch.ModalWraper.info({
504
+ title: '温馨提示',
505
+ content: '没有储值结算方式,请在后台添加储值余额结算方式。',
506
+ okText: '确定',
507
+ okType: 'primary'
508
+ });
509
+ }
510
+ if (themode && themode.paymentType && themode.paymentType != PayStyle.hyczk) {
511
+ var newmode = (0, _extends3.default)({}, _this5.genNewMode(themode.paymentType, false, detail.Amount), {
512
+ authCode: detail.PaymentCode,
513
+ steadCashIntegral: detail.SteadCashIntegral,
514
+ overchargesAmount: detail.OverchargesAmount,
515
+ boriginReturn: true
516
+ });
517
+ _this5.paymode.currentMode = newmode;
518
+ if (themode.paymentType == PayStyle.djq) {
519
+ (0, _each3.default)(_this5.dto.RetailCouponDetails, function (djq) {
520
+ if (isNewRetailBCPos) {
521
+ var _ref6 = djq || {},
522
+ displayText = _ref6.displayText,
523
+ promoRuleId = _ref6.promoRuleId,
524
+ dateMount = _ref6.dateMount,
525
+ promoMethodEnum = _ref6.promoMethodEnum,
526
+ discountPct = _ref6.discountPct,
527
+ promoId = _ref6.promoId,
528
+ id = _ref6.id;
529
+
530
+ _this5.addDjq(djq.CouponCode, djq.CouponTitle, true, djq.ReductionAmount, djq.EnableAmount, djq.LastTS, true, false, _this5.dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, null, id, true);
531
+ return;
532
+ }
533
+ _this5.addDjq(djq.CouponCode, djq.CouponTitle, true, djq.ReductionAmount, djq.EnableAmount, djq.LastTS, true, false);
534
+ });
535
+ }
536
+ _this5.paymode.thePaymodes.push(newmode);
537
+ }
538
+ });
539
+ (0, _each3.default)(this.dto.RetailStorageDetails, function (detail) {
540
+ var balanceAmount = detail.Member.BalanceStorage;
541
+ balanceAmount = balanceAmount - detail.StoragePaymentAmount;
542
+ var newmode = (0, _extends3.default)({}, _this5.genNewMode(PayStyle.hyczk, false, detail.StoragePaymentAmount), {
543
+ member: new Member(detail.Member),
544
+ authCode: detail.Password,
545
+ balance: balanceAmount,
546
+ boriginReturn: true
547
+ });
548
+ _this5.paymode.thePaymodes.push(newmode);
549
+ });
550
+ this.paymode.calcReserved();
551
+ }
552
+ }, {
553
+ key: 'clean',
554
+ value: function clean() {
555
+ this.bquick = false;
556
+ this.paymode.clean();
557
+ }
558
+ }, {
559
+ key: 'quickSettle',
560
+ value: function quickSettle(key) {
561
+ this.addPay(key);
562
+ }
563
+
564
+ //outer call
565
+ //(type===PayStyle.hyczk || type===PayStyle.jfczk || type===PayStyle.jfdx || type===PayStyle.djq)
566
+
567
+ }, {
568
+ key: 'changeFocusAndAddPay',
569
+ value: function changeFocusAndAddPay(type) {
570
+ var _this6 = this;
571
+
572
+ var _enumController$getEn5 = _mutantsUtil.enumController.getEnumOj(),
573
+ PayStyle = _enumController$getEn5.PayStyle;
574
+
575
+ this.paymode.currentFocus = type;
576
+ if (this.paymode.currentMode) {
577
+ if (type == PayStyle.jfdx) {
578
+ if (this.newStyle) {
579
+ var index = (0, _findIndex3.default)(this.paymode.thePaymodes, function (m) {
580
+ return m.paymentType == PayStyle.jfdx;
581
+ });
582
+ this.paymode.thePaymodes.splice(index, 1, this.paymode.currentMode);
583
+ this.paymode.calcReserved();
584
+ } else {
585
+ this.addPayDirectly(this.paymode.currentMode);
586
+ }
587
+
588
+ //抵现积分
589
+ (0, _tplusApi.tApi)({ IntegralSteadCashParams: {
590
+ Idmember: this.paymode.currentMode.member.id,
591
+ TotalTaxAmount: this.paymode.amount,
592
+ BalanceTaxAmount: this.paymode.currentMode.value
593
+ } }, 'AA.DR.newRetailMember.CalculdateIntegralSteadCash', false, false).then(function (result) {
594
+ _this6.paymode.currentMode.steadCashIntegral = result.Integral;
595
+ _this6.paymode.currentMode.overchargesAmount = result.Amount - _this6.paymode.currentMode.value;
596
+ });
597
+ } else {
598
+ this.addPayDirectly(this.paymode.currentMode);
599
+ }
600
+ } else {
601
+ this.addPay(type);
602
+ }
603
+ }
604
+
605
+ // 设置密码后更新会员信息
606
+
607
+ }, {
608
+ key: 'getLoginInfo',
609
+ value: function getLoginInfo() {
610
+ var _ref7 = _mutantsMicrofx.localStore.get('user') || {},
611
+ _ref7$loginInfo = _ref7.loginInfo,
612
+ loginInfo = _ref7$loginInfo === undefined ? {} : _ref7$loginInfo;
613
+
614
+ return loginInfo;
615
+ }
616
+ }, {
617
+ key: 'loadCzk',
618
+ value: function loadCzk(v) {
619
+ var _this7 = this;
620
+
621
+ if ((0, _trim3.default)(v) === "") {
622
+ (0, _mobx.runInAction)(function () {
623
+ _this7.paymode.currentMode.member = new Member(null);
624
+ _this7.paymode.currentMode.errinfo = "请输入储值卡";
625
+ });
626
+ return;
627
+ }
628
+ var IdStore = this.storeInfo.storeID;
629
+ var StoreCode = this.storeInfo.storeCode; //_find(this.storeInfo.storeInfos,(store)=>{return store.ID==IdStore;}).Code;
630
+
631
+ var _ref8 = _mutantsUtil.platform || {},
632
+ isNewRetailBCPos = _ref8.isNewRetailBCPos;
633
+
634
+ var address = '';
635
+ if (isNewRetailBCPos) {
636
+ // address = '/member/memberProfile/FindByStorageCode/'+v;
637
+ address = '/member/MeMemberWallet/FindByStorageCode';
638
+ return (0, _tplusApi.ccApi)({ code: v }, address, false, false, { method: 'get', timeout_skip: true }).then(function (result) {
639
+ var data = result.data;
640
+ var m = data;
641
+
642
+ var _ref9 = _mutantsUtil.platform || {},
643
+ isNewRetailBCPos = _ref9.isNewRetailBCPos;
644
+
645
+ if (isNewRetailBCPos) {
646
+ _this7.paymode && _this7.paymode.currentMode.member.setMeStorageCardId(m.MeStorageCardId);
647
+ _this7.paymode && _this7.paymode.currentMode.member.setStorageCardNo(m.StorageCardNo);
648
+ _this7.paymode && (_this7.paymode.currentMode.MeStorageCardId = m.MeStorageCardId);
649
+ _this7.paymode && (_this7.paymode.currentMode.StorageCardNo = m.StorageCardNo);
650
+ }
651
+ if (!m || !m.ID) {
652
+ (0, _mobx.runInAction)(function () {
653
+ _this7.paymode.currentMode.errinfo = "无效的会员卡号";
654
+ });
655
+ } else {
656
+ (0, _mobx.runInAction)(function () {
657
+ _this7.paymode.currentMode.errinfo = "";
658
+ _this7.paymode.currentMode.member = new Member(m);
659
+ _this7.paymode.currentMode.value = (0, _utils.getFixedNumber)(_this7.brefund ? _this7.paymode.receivable : Math.max(_this7.paymode.receivable, 0));
660
+ _this7.updateEvent();
661
+ var message = '';
662
+ if (global.CheckMemberStorageProcessorBlock) {
663
+ message = CheckMemberStorageProcessorBlock.execute(m);
664
+ }
665
+ if (!String.isNullOrEmpty(message)) {
666
+ _this7.paymode.currentMode.errinfo = message;
667
+ } else if (_this7.checkReceived(_this7.paymode.currentMode, "balance")) {
668
+ _this7.paymode.currentMode.errinfo = "余额不足";
669
+ } else if (_this7.paymode.amount > 0 && _this7.paymode.currentMode.value == 0) {
670
+ _this7.paymode.currentMode.errinfo = "实收金额必须录入";
671
+ } else {
672
+ // 查询成功后将焦点移入下一个输入框
673
+ var nextInput = document.querySelector('.czk .received .input');
674
+ nextInput && nextInput.select();
675
+ }
676
+ });
677
+ }
678
+ });
679
+ } else {
680
+ address = 'AA.DR.newRetailMember.SearchMember';
681
+ return (0, _tplusApi.tApi)({ SearchParams: { Key: v, IsSingleMember: true, IdStore: IdStore, StoreCode: StoreCode } }, address, false, false).then(function (result) {
682
+ var data = JSON.parse(result.Data);
683
+ var m = data && data.length > 0 && data[0];
684
+
685
+ var _ref10 = _mutantsUtil.platform || {},
686
+ isNewRetailBCPos = _ref10.isNewRetailBCPos;
687
+
688
+ if (isNewRetailBCPos) {
689
+ _this7.paymode && _this7.paymode.currentMode.member.setMeStorageCardId(m.MeStorageCardId);
690
+ _this7.paymode && _this7.paymode.currentMode.member.setStorageCardNo(m.StorageCardNo);
691
+ _this7.paymode && (_this7.paymode.currentMode.MeStorageCardId = m.MeStorageCardId);
692
+ _this7.paymode && (_this7.paymode.currentMode.StorageCardNo = m.StorageCardNo);
693
+ }
694
+ if (!m || !m.ID) {
695
+ (0, _mobx.runInAction)(function () {
696
+ _this7.paymode.currentMode.errinfo = "无效的会员卡号";
697
+ });
698
+ } else {
699
+ (0, _mobx.runInAction)(function () {
700
+ _this7.paymode.currentMode.errinfo = "";
701
+ _this7.paymode.currentMode.member = new Member(m);
702
+ _this7.paymode.currentMode.value = (0, _utils.getFixedNumber)(_this7.brefund ? _this7.paymode.receivable : Math.max(_this7.paymode.receivable, 0));
703
+ _this7.updateEvent();
704
+ var message = '';
705
+ if (global.CheckMemberStorageProcessorBlock) {
706
+ message = CheckMemberStorageProcessorBlock.execute(data[0]);
707
+ }
708
+ if (!String.isNullOrEmpty(message)) {
709
+ _this7.paymode.currentMode.errinfo = message;
710
+ } else if (_this7.checkReceived(_this7.paymode.currentMode, "balance")) {
711
+ _this7.paymode.currentMode.errinfo = "余额不足";
712
+ } else if (_this7.paymode.amount > 0 && _this7.paymode.currentMode.value == 0) {
713
+ _this7.paymode.currentMode.errinfo = "实收金额必须录入";
714
+ } else {
715
+ // 查询成功后将焦点移入下一个输入框
716
+ var nextInput = document.querySelector('.czk .received .input');
717
+ nextInput && nextInput.focus();
718
+ }
719
+ });
720
+ }
721
+ });
722
+ }
723
+ }
724
+ }, {
725
+ key: 'addDjq',
726
+ value: function addDjq(promoCouponCode, name, IsEnable, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id, unCheck, count) {
727
+ var djq = {
728
+ code: promoCouponCode,
729
+ promoCouponCode: promoCouponCode,
730
+ name: name,
731
+ IsEnable: IsEnable,
732
+ amount: amount,
733
+ doorsill: doorsill, //:"无门槛"
734
+ LastTS: LastTS,
735
+ checked: checked,
736
+ IsRepelWithPoints: IsRepelWithPoints,
737
+ UMemberID: UMemberID,
738
+ expired: expired, //还剩多少过期
739
+ displayText: displayText,
740
+ promoMethodEnum: promoMethodEnum,
741
+ discountPct: discountPct,
742
+ promoId: promoId,
743
+ promoRuleId: promoRuleId,
744
+ couponCategoryEnum: couponCategoryEnum,
745
+ id: id,
746
+ count: count === 1 && (couponCategoryEnum === 'RIGUP' || couponCategoryEnum === 'UN_MATCH' || couponCategoryEnum === "PREPARING" || couponCategoryEnum === 'PROMO_LIMITED' || couponCategoryEnum === 'COUPON_CONFLICT') ? 1 : null
747
+ };
748
+ this.paymode.currentMode.djqs.push(djq);
749
+ // let copyData = _clonedeep(this.data[targetIndex]);
750
+ !unCheck && !this.boriginReturn && this.paymode.calcDjqValue(djq);
751
+ }
752
+ }, {
753
+ key: 'setCurrentMode',
754
+ value: function setCurrentMode(id, type, append) {
755
+ var _enumController$getEn6 = _mutantsUtil.enumController.getEnumOj(),
756
+ PayStyle = _enumController$getEn6.PayStyle;
757
+
758
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { paymethodId: id });
759
+ if (mode) {
760
+ this.paymode.currentMode = mode;
761
+ if (this.newStyle) {
762
+ this.afterSetCurrentMode(type);
763
+ }
764
+ } else {
765
+ this.paymode.currentMode = this.genNewMode(type, append);
766
+ this.afterSetCurrentMode(type);
767
+ }
768
+ }
769
+ }, {
770
+ key: 'afterSetCurrentMode',
771
+ value: function afterSetCurrentMode(type) {
772
+ var _this8 = this;
773
+
774
+ var _enumController$getEn7 = _mutantsUtil.enumController.getEnumOj(),
775
+ PayStyle = _enumController$getEn7.PayStyle;
776
+
777
+ if (type == PayStyle.djq) {
778
+ this.paymode.calcDjqValue();
779
+ } else if (type == PayStyle.jfdx) {
780
+ //获取可兑换的金额
781
+ if (this.newStyle) {
782
+ var themode = (0, _find3.default)(this.paymode.thePaymodes, { paymentType: PayStyle.jfdx });
783
+ if (themode && parseFloat(themode.value || 0) != 0) {
784
+ this.paymode.currentMode.value = themode.value;
785
+ }
786
+ }
787
+
788
+ (0, _tplusApi.tApi)({ IntegralSteadCashParams: {
789
+ Idmember: this.paymode.currentMode.member.id,
790
+ TotalTaxAmount: this.paymode.amount,
791
+ BalanceTaxAmount: this.paymode.amount
792
+ } }, 'AA.DR.newRetailMember.CalculdateIntegralSteadCash', false, false).then(function (result) {
793
+ _this8.paymode.currentMode.member.setExchangable(result.MaxAmount);
794
+ _this8.updateEvent();
795
+ if (_this8.checkReceived(_this8.paymode.currentMode, "exchangable")) {
796
+ (0, _mobx.runInAction)(function () {
797
+ _this8.paymode.currentMode.errinfo = '余额不足';
798
+ });
799
+ }
800
+ });
801
+ }
802
+ }
803
+ }, {
804
+ key: 'checkReceived',
805
+ value: function checkReceived(mode, name) {
806
+ return !this.brefund && parseFloat(mode.value) > parseFloat(mode.maxamount || mode.member[name] || 0);
807
+ }
808
+ }, {
809
+ key: 'genNewMode',
810
+ value: function genNewMode(type, notwithm, v) {
811
+ var _enumController$getEn8 = _mutantsUtil.enumController.getEnumOj(),
812
+ PayStyle = _enumController$getEn8.PayStyle;
813
+
814
+ var value = (0, _utils.getFixedNumber)(v || (this.brefund ? this.paymode.receivable : Math.max(this.paymode.receivable, 0)));
815
+ var themode = (0, _find3.default)(this.paymode.paymodes, { 'paymentType': type });
816
+ var mode = (0, _mobx.observable)({
817
+ paymethodId: this.paymode.counter,
818
+ name: themode.name,
819
+ exchangeRate: themode.exchangeRate,
820
+ calDirection: themode.calDirection,
821
+ value: value,
822
+ value2: (0, _utils.getFixedNumber)(themode.calDirection == "88" ? value / themode.exchangeRate : value * themode.exchangeRate),
823
+ value3: value,
824
+ order: this.paymode.thePaymodes.length + 1,
825
+ paymentType: type,
826
+ djqs: [],
827
+ member: new Member(!notwithm ? this.member : null),
828
+ authCode: '',
829
+ steadCashIntegral: null,
830
+ errinfo: '',
831
+ maxamount: this.paymode.amount
832
+ });
833
+ if (type == PayStyle.hyczk) {
834
+ if (!mode.member.id || !mode.member.StorageCardNo) {
835
+ (0, _mobx.runInAction)(function () {
836
+ mode.errinfo = '未录入储值卡';
837
+ });
838
+ } else if (this.checkReceived(mode, "balance")) {
839
+ (0, _mobx.runInAction)(function () {
840
+ mode.errinfo = '余额不足';
841
+ });
842
+ }
843
+ }
844
+ if (type == PayStyle.hyczk || type == PayStyle.jfdx || type == PayStyle.djq) {
845
+ this.setMaxAmount(type, mode);
846
+ }
847
+ console.log(mode);
848
+ return mode;
849
+ }
850
+ }, {
851
+ key: 'setMaxAmount',
852
+ value: function setMaxAmount(type, mode) {
853
+ var _this9 = this;
854
+
855
+ var _enumController$getEn9 = _mutantsUtil.enumController.getEnumOj(),
856
+ PayStyle = _enumController$getEn9.PayStyle;
857
+
858
+ var sum = 0;
859
+ if (type == PayStyle.hyczk) {
860
+ (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
861
+ return m.paymentType == type;
862
+ }), function (q) {
863
+ sum = Math.Add(sum, q.value);
864
+ });
865
+ } else if (type == PayStyle.djq || type == PayStyle.jfdx) {
866
+ (0, _each3.default)((0, _filter3.default)(this.paymode.thePaymodes, function (m) {
867
+ return m.paymentType == PayStyle.djq || m.paymentType == PayStyle.jfdx;
868
+ }), function (q) {
869
+ sum = Math.Add(sum, q.value);
870
+ });
871
+ }
872
+
873
+ this.amountHandler && this.amountHandler(type).then(function () {
874
+ (0, _mobx.runInAction)(function () {
875
+ mode.maxamount = (0, _utils.getFixedNumber)(Math.Minus(_this9.context.viewModel.getViewItem('Voucher').availableAmount, sum));
876
+ _this9.updateEvent();
877
+ });
878
+ });
879
+ }
880
+ }, {
881
+ key: 'changeFocusOnly',
882
+ value: function changeFocusOnly(type) {
883
+ this.paymode.currentFocus = type;
884
+ // 获取焦点时带入剩余的值
885
+ // let mode=_find(this.paymode.thePaymodes,{'paymentType':type});
886
+ // if(mode && this.isIntegralExchange){
887
+ // const shouldSetValue =getFixedNumber(parseFloat(this.paymode.receivable) + parseFloat(mode.value));
888
+ // mode.value = shouldSetValue;
889
+ // mode.value2 = getFixedNumber(mode.calDirection=="88"?shouldSetValue / mode.exchangeRate:(shouldSetValue * mode.exchangeRate));
890
+ // mode.value3 = shouldSetValue;
891
+ // this.paymode.calcReserved();
892
+ // }
893
+ }
894
+ }, {
895
+ key: 'changeClickFocusOnly',
896
+ value: function changeClickFocusOnly(type) {
897
+ this.paymode.currentFocus = type;
898
+ // 获取焦点时带入剩余的值
899
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymentType': type });
900
+ if (mode) {
901
+ var shouldSetValue = (0, _utils.getFixedNumber)(parseFloat(this.paymode.receivable) + parseFloat(mode.value));
902
+ mode.value = shouldSetValue;
903
+ mode.value2 = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? shouldSetValue / mode.exchangeRate : shouldSetValue * mode.exchangeRate);
904
+ mode.value3 = shouldSetValue;
905
+ this.paymode.calcReserved();
906
+ }
907
+ }
908
+ }, {
909
+ key: 'changeValue',
910
+ value: function changeValue(index, value, blur) {
911
+ var mode = (0, _find3.default)(this.paymode.thePaymodes, { 'paymethodId': index });
912
+ var v = blur ? (0, _utils.getFixedNumber)(value) : isNaN(value) && value != '-' ? 0.00 : value;
913
+ if (mode) {
914
+ if (mode.exchangeRate != 1) {
915
+ if ((0, _utils.getFixedNumber)(mode.calDirection == "88" ? mode.value3 / mode.exchangeRate : mode.value3 * mode.exchangeRate) != v) {
916
+ mode.value = (0, _utils.getFixedNumber)(mode.calDirection == "88" ? v * mode.exchangeRate : v / mode.exchangeRate);
917
+ } else {
918
+ mode.value = mode.value3;
919
+ }
920
+ mode.value2 = v;
921
+ } else {
922
+ mode.value = v;
923
+ mode.value2 = v;
924
+ }
925
+
926
+ this.paymode.calcReserved();
927
+ }
928
+ }
929
+ }, {
930
+ key: 'addPayDirectly',
931
+ value: function addPayDirectly(pay) {
932
+ var _enumController$getEn10 = _mutantsUtil.enumController.getEnumOj(),
933
+ PayStyle = _enumController$getEn10.PayStyle;
934
+
935
+ if (!(0, _find3.default)(this.paymode.thePaymodes, { paymethodId: pay.paymethodId })) {
936
+ var pos = this.paymode.thePaymodes.length;
937
+ if (pay.paymentType == PayStyle.hyczk) {
938
+ var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
939
+ return m.paymethodId != pay.paymethodId && m.paymentType == PayStyle.hyczk;
940
+ });
941
+ pos = index == -1 ? pos : index + 1;
942
+ }
943
+ // this.paymode.thePaymodes.push(pay);
944
+ this.paymode.thePaymodes.splice(pos, 0, pay);
945
+ }
946
+ this.paymode.calcReserved();
947
+ }
948
+ }, {
949
+ key: 'addPay',
950
+ value: function addPay(type) {
951
+ var _enumController$getEn11 = _mutantsUtil.enumController.getEnumOj(),
952
+ PayStyle = _enumController$getEn11.PayStyle;
953
+
954
+ var pos = this.paymode.thePaymodes.length;
955
+ if (type == PayStyle.hyczk) {
956
+ var index = (0, _findLastIndex3.default)(this.paymode.thePaymodes, function (m) {
957
+ return m.paymentType == PayStyle.hyczk;
958
+ });
959
+ pos = index == -1 ? pos : index + 1;
960
+ }
961
+ // this.paymode.thePaymodes.push(this.genNewMode(type) );
962
+ this.paymode.thePaymodes.splice(pos, 0, this.genNewMode(type, this.newStyle && type == PayStyle.hyczk));
963
+ this.paymode.calcReserved();
964
+ }
965
+ }, {
966
+ key: 'delPay',
967
+ value: function delPay(index) {
968
+ var _enumController$getEn12 = _mutantsUtil.enumController.getEnumOj(),
969
+ PayStyle = _enumController$getEn12.PayStyle;
970
+
971
+ (0, _remove3.default)(this.paymode.thePaymodes, function (mode) {
972
+ return mode.paymethodId === index;
973
+ });
974
+ this.paymode.currentFocus = -1;
975
+ this.paymode.calcReserved();
976
+ }
977
+ }, {
978
+ key: 'commit',
979
+ value: function () {
980
+ var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(bTest) {
981
+ var _ref12, isNewRetailBCPos;
982
+
983
+ return _regenerator2.default.wrap(function _callee2$(_context2) {
984
+ while (1) {
985
+ switch (_context2.prev = _context2.next) {
986
+ case 0:
987
+ console.log('settlementStore.commit开始,参数:' + bTest);
988
+
989
+ if (!bTest) {
990
+ _context2.next = 3;
991
+ break;
992
+ }
993
+
994
+ return _context2.abrupt('return', _promise2.default.resolve(true));
995
+
996
+ case 3:
997
+ _ref12 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref12.isNewRetailBCPos;
998
+ _context2.prev = 4;
999
+
1000
+ if (!(this.type == 1)) {
1001
+ _context2.next = 10;
1002
+ break;
1003
+ }
1004
+
1005
+ _context2.next = 8;
1006
+ return this.saveMember();
1007
+
1008
+ case 8:
1009
+ _context2.next = 18;
1010
+ break;
1011
+
1012
+ case 10:
1013
+ if (!isNewRetailBCPos) {
1014
+ _context2.next = 13;
1015
+ break;
1016
+ }
1017
+
1018
+ _context2.next = 13;
1019
+ return _mutantsMicrofx.stores.offlineSys.generatorCode(this.dto);
1020
+
1021
+ case 13:
1022
+ _context2.next = 15;
1023
+ return this.save();
1024
+
1025
+ case 15:
1026
+ if (!isNewRetailBCPos) {
1027
+ _context2.next = 18;
1028
+ break;
1029
+ }
1030
+
1031
+ _context2.next = 18;
1032
+ return _mutantsMicrofx.stores.offlineSys.retailSequenceUpload();
1033
+
1034
+ case 18:
1035
+ return _context2.abrupt('return', _promise2.default.resolve(true));
1036
+
1037
+ case 21:
1038
+ _context2.prev = 21;
1039
+ _context2.t0 = _context2['catch'](4);
1040
+
1041
+ console.error('settlementStore.commit失败,错误信息:' + _context2.t0);
1042
+ return _context2.abrupt('return', _promise2.default.resolve(_context2.t0));
1043
+
1044
+ case 25:
1045
+ case 'end':
1046
+ return _context2.stop();
1047
+ }
1048
+ }
1049
+ }, _callee2, this, [[4, 21]]);
1050
+ }));
1051
+
1052
+ function commit(_x2) {
1053
+ return _ref11.apply(this, arguments);
1054
+ }
1055
+
1056
+ return commit;
1057
+ }()
1058
+ }, {
1059
+ key: 'handlePrint',
1060
+ value: function handlePrint(resp) {
1061
+ // 储值打印
1062
+ return (0, _tplusComponentsTouch.printDispatch)(_tplusComponentsTouch.DoNameList.DO_STORAGE_PRINT, resp, {});
1063
+ }
1064
+ }, {
1065
+ key: 'saveMember',
1066
+ value: function saveMember() {
1067
+ var _this10 = this;
1068
+
1069
+ var _enumController$getEn13 = _mutantsUtil.enumController.getEnumOj(),
1070
+ PayStyle = _enumController$getEn13.PayStyle;
1071
+
1072
+ (0, _mobx.runInAction)(function () {
1073
+ _this10.dto.StorageMutiSettleDetails = [];
1074
+ var thePaymodes = _this10.newStyle ? (0, _filter3.default)(_this10.paymode.thePaymodes, function (mode) {
1075
+ return parseFloat(mode.value) != 0;
1076
+ }) : _this10.paymode.thePaymodes;
1077
+ (0, _each3.default)(thePaymodes, function (mode) {
1078
+ var themode = (0, _find3.default)(_this10.paymode.paymodes, { 'paymentType': mode.paymentType });
1079
+
1080
+ var value = parseFloat(mode.value);
1081
+ var giveChange = null;
1082
+ if (mode.paymentType == PayStyle.xianjin && _this10.paymode.receivable < 0 && value > Math.abs(_this10.paymode.receivable)) {
1083
+ value = Math.Add(value, _this10.paymode.receivable);
1084
+ giveChange = Math.abs(_this10.paymode.receivable);
1085
+ }
1086
+ _this10.dto.StorageMutiSettleDetails.push({
1087
+ Code: mode.paymethodId,
1088
+ StorageAmount: value,
1089
+ GiveChange: giveChange,
1090
+ IdsettleStyle: themode.idSettleStyle,
1091
+ IdbankAccount: themode.idBankAccount,
1092
+ PaymentCode: mode.authCode,
1093
+ DynamicPropertyKeys: [],
1094
+ DynamicPropertyValues: [],
1095
+ DataSource: { Id: _this10.dataSource }
1096
+ });
1097
+ });
1098
+ });
1099
+ // cc结算调用
1100
+ var IPMSG = {};
1101
+ if (!!window.localStorage.IPMSG) {
1102
+ IPMSG = JSON.parse(window.localStorage.IPMSG);
1103
+ }
1104
+ return (0, _tplusApi.tApi)({ dto: this.dto }, 'chanjet.ME.INewRetailMemberStorage.Save', false, false).then(function (resp) {
1105
+ _this10.handlePrint(resp);
1106
+ });
1107
+ }
1108
+ }, {
1109
+ key: 'save',
1110
+ value: function () {
1111
+ var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
1112
+ var _this11 = this;
1113
+
1114
+ var _enumController$getEn14, PayStyle, _ref15, isNewRetailBCPos, IPMSG, RetailTypeEnum;
1115
+
1116
+ return _regenerator2.default.wrap(function _callee3$(_context3) {
1117
+ while (1) {
1118
+ switch (_context3.prev = _context3.next) {
1119
+ case 0:
1120
+ _enumController$getEn14 = _mutantsUtil.enumController.getEnumOj(), PayStyle = _enumController$getEn14.PayStyle;
1121
+
1122
+ (0, _mobx.runInAction)(function () {
1123
+ _this11.dto.RetailPaymentDetails = [];
1124
+ _this11.dto.RetailStorageDetails = [];
1125
+ _this11.dto.RetailCouponDetails = [];
1126
+ var czkSum = 0;
1127
+ var Idmember = _this11.dto.Idmember;
1128
+ var count = 0;
1129
+ var thePaymodes = _this11.newStyle ? (0, _filter3.default)(_this11.paymode.thePaymodes, function (mode) {
1130
+ return parseFloat(mode.value) != 0;
1131
+ }) : _this11.paymode.thePaymodes;
1132
+ (0, _each3.default)(thePaymodes, function (mode, index) {
1133
+ var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': mode.paymentType });
1134
+ if (mode.paymentType == PayStyle.hyczk) {
1135
+ if (!Idmember) {
1136
+ Idmember = mode.member.id;
1137
+ }
1138
+ czkSum = Math.Add(czkSum, mode.value);
1139
+ var MeStorageCardId = mode.member.MeStorageCardId ? mode.member.MeStorageCardId : _this11.member.MeStorageCardId;
1140
+ _this11.dto.RetailStorageDetails.push({
1141
+ Code: mode.paymethodId,
1142
+ MeStorageCardId: MeStorageCardId,
1143
+ StoragePaymentAmount: mode.value,
1144
+ IsOrigReturn: false,
1145
+ BalanceStorage: mode.balance,
1146
+ Idmember: mode.member.id,
1147
+ DynamicPropertyKeys: [],
1148
+ DynamicPropertyValues: [],
1149
+ DataSource: { Id: _this11.dataSource },
1150
+ Password: mode.authCode
1151
+ });
1152
+ } else {
1153
+ var value = parseFloat(mode.value);
1154
+ var giveChange = null;
1155
+ if (mode.paymentType == PayStyle.xianjin && _this11.paymode.receivable < 0 && value > Math.abs(_this11.paymode.receivable)) {
1156
+ value = Math.Add(value, _this11.paymode.receivable);
1157
+ giveChange = Math.abs(_this11.paymode.receivable);
1158
+ }
1159
+ _this11.dto.RetailPaymentDetails.push({
1160
+ Code: mode.paymethodId,
1161
+ OrigAmount: mode.exchangeRate != 1 ? mode.value2 : value,
1162
+ Amount: value,
1163
+ GiveChange: giveChange,
1164
+ IdsettleStyle: themode.idSettleStyle,
1165
+ IdbankAccount: themode.idBankAccount,
1166
+ Idcurrency: themode.idCurrency,
1167
+ ExchangeRate: themode.exchangeRate,
1168
+ PaymentCode: mode.authCode,
1169
+ SteadCashIntegral: mode.steadCashIntegral,
1170
+ OverchargesAmount: mode.overchargesAmount,
1171
+ DynamicPropertyKeys: [],
1172
+ DynamicPropertyValues: [],
1173
+ DataSource: { Id: _this11.dataSource }
1174
+ });
1175
+ if (mode.paymentType == PayStyle.djq) {
1176
+ (0, _each3.default)(_this11.paymode.checkList && _this11.paymode.checkList.length ? _this11.paymode.checkList : mode.djqs, function (djq) {
1177
+ _this11.dto.RetailCouponDetails.push({
1178
+ CouponCode: djq.promoCouponCode,
1179
+ ReductionAmount: djq.amount,
1180
+ EnableAmount: djq.doorsill,
1181
+ CouponTitle: djq.name,
1182
+ IdMember: djq.UMemberID ? mode.member.id : null,
1183
+ LastTS: djq.LastTS,
1184
+ PromotionId: djq.promoId,
1185
+ PromotionRuleId: djq.promoRuleId,
1186
+ PromoCouponAllocatedId: djq.id,
1187
+ DataSource: { Id: _this11.dataSource }
1188
+ });
1189
+ });
1190
+ }
1191
+ }
1192
+ });
1193
+
1194
+ var _ref14 = _mutantsUtil.platform || {},
1195
+ isNewRetailBCPos = _ref14.isNewRetailBCPos;
1196
+
1197
+ if (_this11.dto.RetailStorageDetails.length > 0) {
1198
+ var themode = (0, _find3.default)(_this11.paymode.paymodes, { 'paymentType': PayStyle.hyczk });
1199
+ if (isNewRetailBCPos) {
1200
+ // this.dto.RetailStorageDetails && this.dto.RetailStorageDetails.forEach((value, index) => {
1201
+ // value.MeStorageCardId = (mode.MeStorageCardId ? mode.MeStorageCardId : this.member.MeStorageCardId);
1202
+ // })
1203
+ _this11.dto.RetailPaymentDetails.push({
1204
+ Code: _this11.paymode.counter,
1205
+ OrigAmount: czkSum,
1206
+ Amount: czkSum,
1207
+ IdsettleStyle: themode.idSettleStyle,
1208
+ IdbankAccount: themode.idBankAccount,
1209
+ DynamicPropertyKeys: [],
1210
+ DynamicPropertyValues: [],
1211
+ DataSource: { Id: _this11.dataSource },
1212
+ RetailStorageDetails: _this11.dto.RetailStorageDetails
1213
+ });
1214
+ } else {
1215
+ _this11.dto.RetailPaymentDetails.push({
1216
+ Code: _this11.paymode.counter,
1217
+ OrigAmount: czkSum,
1218
+ Amount: czkSum,
1219
+ IdsettleStyle: themode.idSettleStyle,
1220
+ IdbankAccount: themode.idBankAccount,
1221
+ DynamicPropertyKeys: [],
1222
+ DynamicPropertyValues: [],
1223
+ DataSource: { Id: _this11.dataSource }
1224
+ });
1225
+ }
1226
+ _this11.dto.Idmember = Idmember;
1227
+ }
1228
+ });
1229
+ _ref15 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref15.isNewRetailBCPos;
1230
+
1231
+ console.log('bc_pos\u73AF\u5883:' + isNewRetailBCPos + ',\u7ED3\u7B97\u6570\u636E\uFF1A', this.dto);
1232
+
1233
+ if (!isNewRetailBCPos) {
1234
+ _context3.next = 20;
1235
+ break;
1236
+ }
1237
+
1238
+ // cc结算调用
1239
+ IPMSG = {};
1240
+
1241
+ if (!!window.localStorage.IPMSG) {
1242
+ IPMSG = JSON.parse(window.localStorage.IPMSG);
1243
+ }
1244
+ RetailTypeEnum = this.dto.IdbusiType == 36 ? "INTEGRAL_EXCHANGE" : "NORMAL";
1245
+ _context3.t1 = this.dto.IdbusiType == 37;
1246
+
1247
+ if (!_context3.t1) {
1248
+ _context3.next = 13;
1249
+ break;
1250
+ }
1251
+
1252
+ _context3.next = 12;
1253
+ return this.checkIntegralExchangeReturn(this.dto.RetailDetails[0].ReturnSourceId);
1254
+
1255
+ case 12:
1256
+ _context3.t1 = _context3.sent;
1257
+
1258
+ case 13:
1259
+ _context3.t0 = _context3.t1;
1260
+
1261
+ if (_context3.t0) {
1262
+ _context3.next = 16;
1263
+ break;
1264
+ }
1265
+
1266
+ _context3.t0 = this.dto.IdbusiType != 37;
1267
+
1268
+ case 16:
1269
+ if (!_context3.t0) {
1270
+ _context3.next = 18;
1271
+ break;
1272
+ }
1273
+
1274
+ return _context3.abrupt('return', (0, _tplusApi.ccApi)({ dto: (0, _extends3.default)({}, this.dto.cut(), { RetailOms: { RetailTypeEnum: RetailTypeEnum } }), cip: IPMSG.query || "" }, '/retail/RetailPos/settle', false, false, { method: 'post', timeout_skip: true }).then(function (resp) {
1275
+ _this11.setDtoID(resp.ID);
1276
+ _this11.paymode.checkList = [];
1277
+ _this11.billID = resp.ID;
1278
+ }));
1279
+
1280
+ case 18:
1281
+ _context3.next = 21;
1282
+ break;
1283
+
1284
+ case 20:
1285
+ return _context3.abrupt('return', (0, _tplusApi.tApi)({ dto: this.dto.cut() }, 'chanjet.RE.newRetail.Settle', false, false, { timeout_skip: true }).then(function (resp) {
1286
+ _this11.setDtoID(resp.ID);
1287
+ _this11.billID = resp.ID;
1288
+ }));
1289
+
1290
+ case 21:
1291
+ case 'end':
1292
+ return _context3.stop();
1293
+ }
1294
+ }
1295
+ }, _callee3, this);
1296
+ }));
1297
+
1298
+ function save() {
1299
+ return _ref13.apply(this, arguments);
1300
+ }
1301
+
1302
+ return save;
1303
+ }()
1304
+ }, {
1305
+ key: 'setDtoID',
1306
+ value: function setDtoID(id) {
1307
+ this.context.viewModel.data.ID = id;
1308
+ }
1309
+ }, {
1310
+ key: 'querySettleResult',
1311
+ value: function () {
1312
+ var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
1313
+ return _regenerator2.default.wrap(function _callee4$(_context4) {
1314
+ while (1) {
1315
+ switch (_context4.prev = _context4.next) {
1316
+ case 0:
1317
+ _context4.prev = 0;
1318
+ _context4.t0 = _promise2.default;
1319
+ _context4.next = 4;
1320
+ return (0, _tplusApi.tApi)({ RetailCode: this.dto.Code }, 'chanjet.RE.newRetail.QuerySettleResult', false, false, { timeout_skip: true });
1321
+
1322
+ case 4:
1323
+ _context4.t1 = _context4.sent;
1324
+ return _context4.abrupt('return', _context4.t0.resolve.call(_context4.t0, _context4.t1));
1325
+
1326
+ case 8:
1327
+ _context4.prev = 8;
1328
+ _context4.t2 = _context4['catch'](0);
1329
+ return _context4.abrupt('return', _promise2.default.resolve({ Flag: "1" }));
1330
+
1331
+ case 11:
1332
+ case 'end':
1333
+ return _context4.stop();
1334
+ }
1335
+ }
1336
+ }, _callee4, this, [[0, 8]]);
1337
+ }));
1338
+
1339
+ function querySettleResult() {
1340
+ return _ref16.apply(this, arguments);
1341
+ }
1342
+
1343
+ return querySettleResult;
1344
+ }()
1345
+ }, {
1346
+ key: 'setCookie',
1347
+ value: function setCookie(key, val) {
1348
+ var exp = new Date();
1349
+ exp.setTime((0, _moment2.default)().endOf('day').valueOf());
1350
+ document.cookie = key + '=' + val + ';expires=' + exp.toGMTString();
1351
+ }
1352
+ }, {
1353
+ key: 'getAllCookies',
1354
+ value: function getAllCookies() {
1355
+ var cookies = document.cookie.split(/;\s/g);
1356
+ var cookieObj = {};
1357
+ cookies.forEach(function (item) {
1358
+ var key = item.split('=')[0];
1359
+ cookieObj[key] = item.split('=')[1];
1360
+ });
1361
+ return cookieObj;
1362
+ }
1363
+ }, {
1364
+ key: 'validePwd',
1365
+ value: function () {
1366
+ var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(value) {
1367
+ var _ref18, isNewRetailBCPos, cook1, cook2, message, result, count, _result;
1368
+
1369
+ return _regenerator2.default.wrap(function _callee5$(_context5) {
1370
+ while (1) {
1371
+ switch (_context5.prev = _context5.next) {
1372
+ case 0:
1373
+ _ref18 = _mutantsUtil.platform || {}, isNewRetailBCPos = _ref18.isNewRetailBCPos;
1374
+ _context5.prev = 1;
1375
+
1376
+ if (!isNewRetailBCPos) {
1377
+ _context5.next = 18;
1378
+ break;
1379
+ }
1380
+
1381
+ cook1 = this.getAllCookies()['errorPwd'];
1382
+ cook2 = cook1 && JSON.parse(cook1);
1383
+ message = '密码输入错误';
1384
+
1385
+ if (!cook2) {
1386
+ _context5.next = 11;
1387
+ break;
1388
+ }
1389
+
1390
+ if (!cook2.hasOwnProperty(this.member.MeStorageCardId + "")) {
1391
+ _context5.next = 11;
1392
+ break;
1393
+ }
1394
+
1395
+ if (!(cook2[this.member.MeStorageCardId] > 3)) {
1396
+ _context5.next = 11;
1397
+ break;
1398
+ }
1399
+
1400
+ message = '今日密码错误已达上限,不可使用储值消费,请明日再试,如忘记请重置密码或修改密码。';
1401
+ return _context5.abrupt('return', _promise2.default.resolve(message));
1402
+
1403
+ case 11:
1404
+ _context5.next = 13;
1405
+ return (0, _tplusApi.ccApi)({ password: _tplusApi.User.pwdEncrypt(value.pwd) }, '/member/MeMemberWallet/checkPaymentPassword/' + value.id, false, false);
1406
+
1407
+ case 13:
1408
+ result = _context5.sent;
1409
+
1410
+ if (!result.data) {
1411
+ if (cook2) {
1412
+ if (cook2.hasOwnProperty(this.member.MeStorageCardId + "")) {
1413
+ count = cook2[this.member.MeStorageCardId];
1414
+
1415
+ cook2[this.member.MeStorageCardId] = count + 1;
1416
+ } else {
1417
+ cook2[this.member.MeStorageCardId] = 1;
1418
+ }
1419
+ } else {
1420
+ cook2 = {};
1421
+ cook2[this.member.MeStorageCardId] = 1;
1422
+ }
1423
+ this.setCookie('errorPwd', '', -1);
1424
+ this.setCookie('errorPwd', (0, _stringify2.default)(cook2));
1425
+ }
1426
+ return _context5.abrupt('return', _promise2.default.resolve(result.data ? "" : message));
1427
+
1428
+ case 18:
1429
+ _context5.next = 20;
1430
+ return (0, _tplusApi.tApi)({ "CheckoutParams": {
1431
+ "Idmember": value.id,
1432
+ "Password": value.pwd
1433
+ } }, 'AA.DR.newRetailMember.CheckoutMemberPassword', false, false);
1434
+
1435
+ case 20:
1436
+ _result = _context5.sent;
1437
+ return _context5.abrupt('return', _promise2.default.resolve(_result.Success ? "" : _result.Message));
1438
+
1439
+ case 22:
1440
+ _context5.next = 27;
1441
+ break;
1442
+
1443
+ case 24:
1444
+ _context5.prev = 24;
1445
+ _context5.t0 = _context5['catch'](1);
1446
+ return _context5.abrupt('return', "failed");
1447
+
1448
+ case 27:
1449
+ case 'end':
1450
+ return _context5.stop();
1451
+ }
1452
+ }
1453
+ }, _callee5, this, [[1, 24]]);
1454
+ }));
1455
+
1456
+ function validePwd(_x3) {
1457
+ return _ref17.apply(this, arguments);
1458
+ }
1459
+
1460
+ return validePwd;
1461
+ }()
1462
+ }]);
1463
+ return SettlementStore;
1464
+ }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'queryPwd', [_mobx.action], {
1465
+ enumerable: true,
1466
+ initializer: function initializer() {
1467
+ var _this12 = this;
1468
+
1469
+ return function (newPass, newPassConfirm) {
1470
+ if (!newPass || !newPassConfirm) {
1471
+ return _message2.default.warn('您还有未填写项');
1472
+ }
1473
+ if (newPass !== newPassConfirm) {
1474
+ return _message2.default.warn('您两次输入的密码不一致');
1475
+ }
1476
+ var idstore = (0, _tplusPoslogin.PosInitData)('storeID');
1477
+ return (0, _tplusApi.ccApi)({
1478
+ Idstore: idstore,
1479
+ meMemberId: _this12.member.ID,
1480
+ oldPassword: null,
1481
+ newPassword: _tplusApi.User.pwdEncrypt(newPassConfirm),
1482
+ dataSource: "POS"
1483
+ }, '/member/MeMemberWallet/setWalletPayPassword', false, false, { method: 'post', timeout_skip: true }).then(function (resp) {
1484
+ if (resp.successful) {
1485
+ return true;
1486
+ }
1487
+ });
1488
+ };
1489
+ }
1490
+ }), _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), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'updateMemberInfo', [_mobx.action], {
1491
+ enumerable: true,
1492
+ initializer: function initializer() {
1493
+ var _this13 = this;
1494
+
1495
+ return function () {
1496
+ var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(_this) {
1497
+ var _getLoginInfo, IdStore, StoreCode, resp;
1498
+
1499
+ return _regenerator2.default.wrap(function _callee6$(_context6) {
1500
+ while (1) {
1501
+ switch (_context6.prev = _context6.next) {
1502
+ case 0:
1503
+ _getLoginInfo = _this13.getLoginInfo(), IdStore = _getLoginInfo.IdStore, StoreCode = _getLoginInfo.StoreCode;
1504
+ _context6.next = 3;
1505
+ return (0, _tplusApi.tApi)({ Idmember: _this13.member.ID, IdStore: IdStore, StoreCode: StoreCode }, 'chanjet.AA.DR.INewRetailMember.GetUmemberDTO', false, false);
1506
+
1507
+ case 3:
1508
+ resp = _context6.sent;
1509
+
1510
+ _this.member = resp;
1511
+ _this.paymode.currentMode.member.setStorageCardNo(resp.StorageCardNo);
1512
+ return _context6.abrupt('return', _promise2.default.resolve(resp));
1513
+
1514
+ case 7:
1515
+ case 'end':
1516
+ return _context6.stop();
1517
+ }
1518
+ }
1519
+ }, _callee6, _this13);
1520
+ }));
1521
+
1522
+ return function (_x4) {
1523
+ return _ref19.apply(this, arguments);
1524
+ };
1525
+ }();
1526
+ }
1527
+ }), _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);
1528
+ exports.default = SettlementStore;
1529
+ var PayMode = exports.PayMode = (_class3 = function () {
1530
+ //应收
1531
+ function PayMode() {
1532
+ // this.amount=getFixedNumber(amount);
1533
+ // this.calcReserved();
1534
+
1535
+ (0, _classCallCheck3.default)(this, PayMode);
1536
+ this._counter = 0;
1537
+ this.amount = 0;
1538
+ this.onlineamount = 0;
1539
+ this.maxamount = 0;
1540
+
1541
+ _initDefineProp(this, 'currentFocus', _descriptor3, this);
1542
+
1543
+ _initDefineProp(this, 'received', _descriptor4, this);
1544
+
1545
+ _initDefineProp(this, 'receivable', _descriptor5, this);
1546
+
1547
+ _initDefineProp(this, 'paymodes', _descriptor6, this);
1548
+
1549
+ _initDefineProp(this, 'thePaymodes', _descriptor7, this);
1550
+
1551
+ this.currentMode = null;
1552
+ this.checkList = [];
1553
+ this.settle = {
1554
+ name: "复合结算",
1555
+ hotKey: "Ctrl+M"
1556
+ };
1557
+
1558
+ _initDefineProp(this, 'calcCheckList', _descriptor8, this);
1559
+
1560
+ _initDefineProp(this, 'setCouponNum', _descriptor9, this);
1561
+
1562
+ _initDefineProp(this, 'addDjqs', _descriptor10, this);
1563
+ }
1564
+ // @observable store = null;
1565
+
1566
+
1567
+ (0, _createClass3.default)(PayMode, [{
1568
+ key: 'clean',
1569
+ value: function clean() {
1570
+ this.thePaymodes = [];
1571
+ this.calcReserved();
1572
+ }
1573
+ }, {
1574
+ key: 'clear',
1575
+ value: function clear() {
1576
+ this.thePaymodes = [];
1577
+ this.calcReserved();
1578
+ this.paymodes = [];
1579
+ }
1580
+ }, {
1581
+ key: 'setAmount',
1582
+ value: function setAmount(a, o) {
1583
+ this.amount = (0, _utils.getFixedNumber)((a || 0) - (o || 0));
1584
+ this.onlineamount = (0, _utils.getFixedNumber)(o || 0);
1585
+ this.calcReserved();
1586
+ return this.amount < 0;
1587
+ }
1588
+ }, {
1589
+ key: 'calcReserved',
1590
+ value: function calcReserved() {
1591
+ var sum = 0;
1592
+ (0, _each3.default)(this.thePaymodes, function (mode) {
1593
+ sum = Math.Add(sum, mode.value == "" ? 0 : mode.value);
1594
+ });
1595
+ this.received = (0, _utils.getFixedNumber)(sum);
1596
+ this.receivable = (0, _utils.getFixedNumber)(this.amount - sum);
1597
+ }
1598
+ }, {
1599
+ key: 'calcDjqCheckValue',
1600
+ value: function calcDjqCheckValue(q1, dto, params) {
1601
+ var _this14 = this;
1602
+
1603
+ var useLimitPerOrder = (0, _tplusPoslogin.PosInitData)('UseLimitPerOrder');
1604
+ var qList = (0, _filter3.default)(this.currentMode.djqs, function (djq) {
1605
+ return djq.checked;
1606
+ });
1607
+ if (qList.length === useLimitPerOrder && !q1.checked) {
1608
+ _message2.default.warn('本单最多可用' + useLimitPerOrder + '张');
1609
+ return;
1610
+ }
1611
+ if (params === 'single') {
1612
+ this.checkList = [];
1613
+ }
1614
+
1615
+ var _ref20 = _mutantsUtil.platform || {},
1616
+ isNewRetailBCPos = _ref20.isNewRetailBCPos;
1617
+
1618
+ var _enumController$getEn15 = _mutantsUtil.enumController.getEnumOj(),
1619
+ PayStyle = _enumController$getEn15.PayStyle,
1620
+ Differentiate = _enumController$getEn15.Differentiate;
1621
+
1622
+ if (q1) {
1623
+ if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
1624
+ _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
1625
+ return;
1626
+ }
1627
+ var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
1628
+ return djq.promoCouponCode == q1.promoCouponCode;
1629
+ });
1630
+ if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
1631
+ _message2.default.error("本单金额低于使用门槛,该券不可使用。");
1632
+ return;
1633
+ }
1634
+ //判断是否是选择优惠券 //CC优惠券只能使用一个
1635
+ // if (q1 && !q1.checked && isNewRetailBCPos) {
1636
+ // // 检查是否有已经选定优惠券 并且去除选定的优惠券
1637
+ // this.currentMode.djqs.forEach((djq, index) => {
1638
+ // if (djq.checked) this.currentMode.djqs[index].checked = false;
1639
+ // })
1640
+ // }
1641
+ q && (q.checked = !q.checked);
1642
+ }
1643
+ var sum = 0;
1644
+ // console.log(this.store, 'stores-------');
1645
+ if (!q1.checked) {
1646
+ this.checkList.forEach(function (ele, i) {
1647
+ if (ele.id === q1.id) {
1648
+ _this14.checkList.splice(i, 1);
1649
+ }
1650
+ });
1651
+ } else {
1652
+ this.checkList.push(q1);
1653
+ }
1654
+
1655
+ this.checkList.forEach(function (ele) {
1656
+ sum = Math.Add(sum, ele.amount);
1657
+ });
1658
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1659
+ console.log(this.receivable, sum, Math.min(this.receivable, sum, this.currentMode.maxamount), 'sum---------');
1660
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - Math.min(this.receivable, sum, this.currentMode.maxamount));
1661
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1662
+ if (params === 'single') {
1663
+ return;
1664
+ }
1665
+ var promoVoucher = {};
1666
+ promoVoucher.boName = "Retail";
1667
+ // promoVoucher.promoLinks = _filter(this.currentMode.djqs,djq=>djq.checked);
1668
+ promoVoucher.meMemberId = this.currentMode.member.id;
1669
+ promoVoucher.storeFactorId = (0, _tplusPoslogin.PosInitData)('storeID');
1670
+ promoVoucher.voucherDetailList = [];
1671
+ dto.RetailDetails.forEach(function (item) {
1672
+ var detailDTO = {};
1673
+ detailDTO.uuid = item.Code;
1674
+ detailDTO.detailBoName = "RetailDetail";
1675
+ detailDTO.voucherDetailId = item.ID;
1676
+ detailDTO.productId = item.Idinventory;
1677
+ detailDTO.uomId = item.Idunit;
1678
+ detailDTO.productSpecId = item.ProductSpecId;
1679
+ detailDTO.isManualFreeGift = item.IsPresent;
1680
+ detailDTO.isListPriceIncludingTax = item.TaxFlag || true;
1681
+ detailDTO.IsManualChangePrice = item.IsManualChangePrice;
1682
+ var bookingQuantity = 0;
1683
+ if (item.BookingQuantity) {
1684
+ bookingQuantity = item.BookingQuantity;
1685
+ }
1686
+ detailDTO.listPrice = JSON.getCellValue(item, "listPrice");
1687
+ detailDTO.netAmountWithTax = Math.Multiply(detailDTO.listPrice, Math.Minus(item.Quantity, bookingQuantity)); //item.TaxAmount;
1688
+ detailDTO.taxRate = item.TaxRate;
1689
+ detailDTO.quantity = item.Quantity;
1690
+
1691
+ detailDTO.amountWithTax = item.RetailAmount;
1692
+ // 促销 start
1693
+ if (item.PromotionDetails && item.PromotionDetails.length != 0) {
1694
+ var promoLinks = [];
1695
+ item.PromotionDetails.forEach(function (promotion) {
1696
+ promoLinks.push({
1697
+ promoId: promotion.IdSalesPromotionDTO,
1698
+ promoRuleId: promotion.PromotionRuleId
1699
+ });
1700
+ });
1701
+ if (promoLinks.length != 0) detailDTO.promoLinks = promoLinks;
1702
+ }
1703
+ // 促销 end
1704
+ promoVoucher.voucherDetailList.push(detailDTO);
1705
+ });
1706
+ promoVoucher.promoLinks = this.checkList;
1707
+ return (0, _tplusApi.ccApi)((0, _extends3.default)({}, promoVoucher), 'promotion/PromoCalculate/findUsefulCouponPromoList', false, false, { method: 'post', timeout_skip: true }).then(function (result) {
1708
+ if (result && result.length != 0) {
1709
+ result.forEach(function (element, index) {
1710
+ var djq1 = false;
1711
+ _this14.currentMode.djqs.forEach(function (djq) {
1712
+ if (element.id === djq.id) {
1713
+ djq1 = true;
1714
+ }
1715
+ });
1716
+
1717
+ var _ref21 = element || {},
1718
+ couponCode = _ref21.couponCode,
1719
+ name = _ref21.name,
1720
+ tieredAmountResult = _ref21.tieredAmountResult,
1721
+ fromDate = _ref21.fromDate,
1722
+ dateMount = _ref21.dateMount,
1723
+ promoMethodEnum = _ref21.promoMethodEnum,
1724
+ discountPct = _ref21.discountPct,
1725
+ nominalAmount = _ref21.nominalAmount,
1726
+ promoId = _ref21.promoId,
1727
+ id = _ref21.id,
1728
+ doorsill = _ref21.doorsill;
1729
+
1730
+ var condValue = tieredAmountResult.condValue,
1731
+ promoDiscount = tieredAmountResult.promoDiscount,
1732
+ displayText = tieredAmountResult.displayText,
1733
+ promoRuleId = tieredAmountResult.promoRuleId,
1734
+ couponCategoryEnum = tieredAmountResult.couponCategoryEnum;
1735
+
1736
+ if (!djq1) {
1737
+ // this.currentMode.djqs.push({
1738
+ // promoCouponCode: element.CouponCode,
1739
+ // name: element.CouponTitle,
1740
+ // IsEnable: true,
1741
+ // amount: element.ReductionAmount,
1742
+ // doorsill: element.EnableAmount,
1743
+ // LastTS: element.LastTS,
1744
+ // checked: false,
1745
+ // IsRepelWithPoints: true,
1746
+ // UMemberID: dto.Idmember,
1747
+ // expired: null,
1748
+ // displayText,
1749
+ // promoMethodEnum,
1750
+ // discountPct,
1751
+ // promoId,
1752
+ // promoRuleId,
1753
+ // couponCategoryEnum: tieredAmountResult.couponCategoryEnum,
1754
+ // id
1755
+ // })
1756
+ _this14.addDjqs(couponCode, name, true, nominalAmount, doorsill, element.LastTS, false, true, dto.Idmember, dateMount, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, tieredAmountResult.couponCategoryEnum, id);
1757
+ djq1 = false;
1758
+ } else {
1759
+ _this14.setCouponNum(element.id, tieredAmountResult.couponCategoryEnum, promoMethodEnum, nominalAmount, promoDiscount);
1760
+ // this.currentMode.djqs[0].couponCategoryEnum = 'couponCategoryEnum';
1761
+ // djq1.couponCategoryEnum = element.tieredAmountResult.couponCategoryEnum
1762
+ }
1763
+ });
1764
+ }
1765
+ // 优惠券【6052098985043】与【6120822326451】不可叠加使用
1766
+ });
1767
+ //this.receivable = getFixedNumber(this.receivable - sum);
1768
+ }
1769
+ }, {
1770
+ key: 'calcDjqValue',
1771
+ value: function calcDjqValue(q1) {
1772
+ var _ref22 = _mutantsUtil.platform || {},
1773
+ isNewRetailBCPos = _ref22.isNewRetailBCPos;
1774
+
1775
+ var _enumController$getEn16 = _mutantsUtil.enumController.getEnumOj(),
1776
+ Differentiate = _enumController$getEn16.Differentiate;
1777
+
1778
+ if (q1) {
1779
+ if (!this.currentMode.boriginReturn && parseFloat(this.currentMode.maxamount) <= 0) {
1780
+ _message2.default.error('\u672C\u5355\u6CA1\u6709' + Differentiate.COUPON + '\u53EF\u7528\u91D1\u989D\uFF0C\u8BE5\u5238\u4E0D\u53EF\u4F7F\u7528\u3002');
1781
+ return;
1782
+ }
1783
+ var q = (0, _find3.default)(this.currentMode.djqs, function (djq) {
1784
+ return djq.code == q1.code;
1785
+ });
1786
+ if (q && !q.checked && parseFloat(this.amount) < parseFloat(q.doorsill)) {
1787
+ _message2.default.error("本单金额低于使用门槛,该券不可使用。");
1788
+ return;
1789
+ }
1790
+ //判断是否是选择优惠券 //CC优惠券只能使用一个
1791
+ // if (q1 && !q1.checked && isNewRetailBCPos) {
1792
+ // // 检查是否有已经选定优惠券 并且去除选定的优惠券
1793
+ // this.currentMode.djqs.forEach((djq, index) => {
1794
+ // if (djq.checked) this.currentMode.djqs[index].checked = false;
1795
+ // })
1796
+ // }
1797
+ q && (q.checked = !q.checked);
1798
+ }
1799
+ var sum = 0;
1800
+ // console.log(this.store, 'stores-------');
1801
+ (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
1802
+ return djq.checked;
1803
+ }), function (q) {
1804
+ sum = Math.Add(sum, q.amount);
1805
+ });
1806
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1807
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1808
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1809
+
1810
+ //this.receivable = getFixedNumber(this.receivable - sum);
1811
+ }
1812
+ }, {
1813
+ key: 'reCalculationDjqs',
1814
+ value: function reCalculationDjqs() {
1815
+ var sum = 0;
1816
+ (0, _each3.default)((0, _filter3.default)(this.currentMode.djqs, function (djq) {
1817
+ return djq.checked;
1818
+ }), function (q) {
1819
+ sum = Math.Add(sum, q.amount);
1820
+ });
1821
+ this.currentMode.value = (0, _utils.getFixedNumber)(Math.min(this.receivable, sum, this.currentMode.maxamount));
1822
+ this.currentMode.receivable = (0, _utils.getFixedNumber)(this.receivable - this.currentMode.value);
1823
+ this.currentMode.overchargesAmount = (0, _utils.getFixedNumber)(sum - this.currentMode.value);
1824
+ this.currentMode.maxamount = this.currentMode.receivable || this.currentMode.receivable;
1825
+ }
1826
+ }, {
1827
+ key: 'clearDjqs',
1828
+ value: function clearDjqs() {
1829
+ this.currentMode.djqs = [];
1830
+ }
1831
+ }, {
1832
+ key: 'setCurrentModeValue',
1833
+ value: function setCurrentModeValue(v, max) {
1834
+ this.currentMode.value = parseFloat(v) || 0;
1835
+ this.currentMode.errinfo = '';
1836
+ var sum = this.amount;
1837
+
1838
+ var _enumController$getEn17 = _mutantsUtil.enumController.getEnumOj(),
1839
+ PayStyle = _enumController$getEn17.PayStyle;
1840
+
1841
+ this.paymodes.thePaymodes && this.paymodes.thePaymodes.forEach(function (mode) {
1842
+ if (mode.paymentType === PayStyle.hyczk) {
1843
+ sum -= mode.value;
1844
+ }
1845
+ });
1846
+
1847
+ if (this.amount > 0 && (v === '' || v === '0.00')) {
1848
+ this.currentMode.errinfo = "实收金额必须录入";
1849
+ } else if (Math.abs(parseFloat(v)) > Math.abs(sum)) {
1850
+ this.currentMode.errinfo = "实收不应大于应收";
1851
+ } else if (parseFloat(v) > 0 && parseFloat(v) > (max || 0)) {
1852
+ this.currentMode.errinfo = "余额不足";
1853
+ }
1854
+ }
1855
+ }, {
1856
+ key: 'calcMemberBalance',
1857
+ value: function calcMemberBalance() {
1858
+ this.currentMode.balance = this.currentMode.member.rawbalance - this.currentMode.value;
1859
+ }
1860
+ }, {
1861
+ key: 'setPaymodes',
1862
+ value: function () {
1863
+ var _ref23 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type, isIntegralExchange) {
1864
+ var _this15 = this;
1865
+
1866
+ var _enumController$getEn18, settleStyleType, PayStyle, memberStoreCode, settlementCode, param, modes;
1867
+
1868
+ return _regenerator2.default.wrap(function _callee7$(_context7) {
1869
+ while (1) {
1870
+ switch (_context7.prev = _context7.next) {
1871
+ case 0:
1872
+ _enumController$getEn18 = _mutantsUtil.enumController.getEnumOj(), settleStyleType = _enumController$getEn18.settleStyleType, PayStyle = _enumController$getEn18.PayStyle;
1873
+ memberStoreCode = settleStyleType.memberStoreCode, settlementCode = settleStyleType.settlementCode;
1874
+ param = { 'settleStyleType': type == 1 ? memberStoreCode : settlementCode, isIntegralExchange: isIntegralExchange };
1875
+ _context7.next = 5;
1876
+ return (0, _tplusApi.tApi)({ param: param }, 'chanjet.RE.NewPos.GetNewStoreSettleStyles', false, false);
1877
+
1878
+ case 5:
1879
+ modes = _context7.sent;
1880
+
1881
+ if (modes) {
1882
+ (0, _mobx.runInAction)(function () {
1883
+ var paymodes = [];
1884
+ (0, _each3.default)(modes.SettleStyles, function (mode, index) {
1885
+ //产品需求确认会员储值卡结算方式前端展示统一调整为“储值卡" tuzha by 2020-07-08
1886
+
1887
+ if (mode.Code == PayStyle.hyczk) {
1888
+ mode.Name = '储值余额';
1889
+ }
1890
+ paymodes.push({
1891
+ name: mode.Name,
1892
+ isDefault: mode.IsDefaultSettleStyle,
1893
+ isQuick: (0, _findIndex3.default)(modes.QuickSettleStyles, { 'Code': mode.Code }) >= 0,
1894
+ orderBy: 1,
1895
+ paymentType: mode.Code,
1896
+ offlineDisable: mode.offlineDisable,
1897
+ idSettleStyle: mode.IdSettleStyle,
1898
+ idBankAccount: mode.IdBankAccount,
1899
+ exchangeRate: mode.Currency ? mode.Currency.ExchangeRate : 1,
1900
+ idCurrency: mode.Currency ? mode.Currency.ID : -1,
1901
+ calDirection: mode.Currency ? mode.Currency.CalDirection.Id : "88"
1902
+ });
1903
+ });
1904
+ _this15.paymodes = paymodes;
1905
+ //modes.QuickSettleStyles
1906
+ });
1907
+ }
1908
+
1909
+ case 7:
1910
+ case 'end':
1911
+ return _context7.stop();
1912
+ }
1913
+ }
1914
+ }, _callee7, this);
1915
+ }));
1916
+
1917
+ function setPaymodes(_x5, _x6) {
1918
+ return _ref23.apply(this, arguments);
1919
+ }
1920
+
1921
+ return setPaymodes;
1922
+ }()
1923
+ }, {
1924
+ key: 'charge',
1925
+ get: function get() {
1926
+ return Math.abs(this.receivable);
1927
+ }
1928
+ }, {
1929
+ key: 'counter',
1930
+ get: function get() {
1931
+ return ++this._counter;
1932
+ }
1933
+ }]);
1934
+ return PayMode;
1935
+ }(), (_descriptor3 = _applyDecoratedDescriptor(_class3.prototype, 'currentFocus', [_mobx.observable], {
1936
+ enumerable: true,
1937
+ initializer: function initializer() {
1938
+ return "";
1939
+ }
1940
+ }), _descriptor4 = _applyDecoratedDescriptor(_class3.prototype, 'received', [_mobx.observable], {
1941
+ enumerable: true,
1942
+ initializer: function initializer() {
1943
+ return 0;
1944
+ }
1945
+ }), _descriptor5 = _applyDecoratedDescriptor(_class3.prototype, 'receivable', [_mobx.observable], {
1946
+ enumerable: true,
1947
+ initializer: function initializer() {
1948
+ return 0;
1949
+ }
1950
+ }), _descriptor6 = _applyDecoratedDescriptor(_class3.prototype, 'paymodes', [_mobx.observable], {
1951
+ enumerable: true,
1952
+ initializer: function initializer() {
1953
+ return [];
1954
+ }
1955
+ }), _descriptor7 = _applyDecoratedDescriptor(_class3.prototype, 'thePaymodes', [_mobx.observable], {
1956
+ enumerable: true,
1957
+ initializer: function initializer() {
1958
+ return [];
1959
+ }
1960
+ }), _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), _descriptor8 = _applyDecoratedDescriptor(_class3.prototype, 'calcCheckList', [_mobx.action], {
1961
+ enumerable: true,
1962
+ initializer: function initializer() {
1963
+ var _this16 = this;
1964
+
1965
+ return function () {
1966
+ _this16.checkList = [];
1967
+ };
1968
+ }
1969
+ }), _applyDecoratedDescriptor(_class3.prototype, 'calcDjqCheckValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class3.prototype, 'calcDjqCheckValue'), _class3.prototype), _descriptor9 = _applyDecoratedDescriptor(_class3.prototype, 'setCouponNum', [_mobx.action], {
1970
+ enumerable: true,
1971
+ initializer: function initializer() {
1972
+ var _this17 = this;
1973
+
1974
+ return function (id, couponNum, promoMethodEnum, nominalAmount, promoDiscount) {
1975
+ _this17.currentMode.djqs.forEach(function (ele) {
1976
+ if (ele.id === id) {
1977
+ promoMethodEnum == "CASH_COUPON" ? ele.amount = nominalAmount : ele.amount = promoDiscount;
1978
+ ele.couponCategoryEnum = couponNum;
1979
+ var IsEnable = ele.couponCategoryEnum === 'RIGUP' || ele.couponCategoryEnum === 'UN_MATCH' || ele.couponCategoryEnum === "PREPARING" || ele.couponCategoryEnum === 'PROMO_LIMITED' || ele.couponCategoryEnum === 'COUPON_CONFLICT' ? false : true;
1980
+ ele.IsEnable = IsEnable;
1981
+ }
1982
+ });
1983
+ };
1984
+ }
1985
+ }), _descriptor10 = _applyDecoratedDescriptor(_class3.prototype, 'addDjqs', [_mobx.action], {
1986
+ enumerable: true,
1987
+ initializer: function initializer() {
1988
+ var _this18 = this;
1989
+
1990
+ return function (promoCouponCode, name, IsEnable, amount, doorsill, LastTS, checked, IsRepelWithPoints, UMemberID, expired, displayText, promoMethodEnum, discountPct, promoId, promoRuleId, couponCategoryEnum, id) {
1991
+ var djq = {
1992
+ promoCouponCode: promoCouponCode,
1993
+ name: name,
1994
+ IsEnable: IsEnable,
1995
+ amount: amount,
1996
+ doorsill: doorsill,
1997
+ LastTS: LastTS,
1998
+ checked: checked,
1999
+ IsRepelWithPoints: IsRepelWithPoints,
2000
+ UMemberID: UMemberID,
2001
+ expired: expired,
2002
+ displayText: displayText,
2003
+ promoMethodEnum: promoMethodEnum,
2004
+ discountPct: discountPct,
2005
+ promoId: promoId,
2006
+ promoRuleId: promoRuleId,
2007
+ couponCategoryEnum: couponCategoryEnum,
2008
+ id: id
2009
+ };
2010
+ _this18.currentMode.djqs.push(djq);
2011
+ };
2012
+ }
2013
+ }), _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);
2014
+ var Member = exports.Member = (_class5 = function () {
2015
+ function Member(m) {
2016
+ var _this19 = this;
2017
+
2018
+ (0, _classCallCheck3.default)(this, Member);
2019
+
2020
+ _initDefineProp(this, 'cardNo', _descriptor11, this);
2021
+
2022
+ _initDefineProp(this, 'balance', _descriptor12, this);
2023
+
2024
+ _initDefineProp(this, 'exchangable', _descriptor13, this);
2025
+
2026
+ _initDefineProp(this, 'MeStorageCardId', _descriptor14, this);
2027
+
2028
+ _initDefineProp(this, 'StorageCardNo', _descriptor15, this);
2029
+
2030
+ if (m) {
2031
+ this.id = m.ID;
2032
+ this.uid = m.Uid;
2033
+ this.type = m.MemberType ? m.MemberType.Name : "普通";
2034
+ this.rawbalance = m.BalanceStorage;
2035
+ var index = (0, _findIndex3.default)(m.DynamicPropertyKeys, function (key) {
2036
+ return key == 'canusedbalancestorage';
2037
+ });
2038
+
2039
+ var _ref24 = _mutantsUtil.platform || {},
2040
+ isNewRetailBCPos = _ref24.isNewRetailBCPos;
2041
+
2042
+ m.StorageCardNo && (this.StorageCardNo = m.StorageCardNo);
2043
+ m.MeStorageCardId && (this.MeStorageCardId = m.MeStorageCardId);
2044
+ (0, _mobx.runInAction)(function () {
2045
+ _this19.cardNo = m.CardCode;
2046
+ if (index >= 0) {
2047
+ _this19.balance = parseFloat(m.DynamicPropertyValues[index]);
2048
+ } else {
2049
+ _this19.balance = _this19.rawbalance;
2050
+ }
2051
+ });
2052
+ this.needPwd = m.MemberType ? m.MemberType.IsNeedPwd : false;
2053
+ this.NeedModifyPassword = m.NeedModifyPassword;
2054
+ this.bonusPoints = m.BalanceIntegral;
2055
+ }
2056
+ }
2057
+
2058
+ (0, _createClass3.default)(Member, [{
2059
+ key: 'setExchangable',
2060
+ value: function setExchangable(v) {
2061
+ this.exchangable = v;
2062
+ }
2063
+ }, {
2064
+ key: 'setCardNo',
2065
+ value: function setCardNo(v) {
2066
+ this.cardNo = v;
2067
+ this.id = null;
2068
+ }
2069
+ }, {
2070
+ key: 'setMeStorageCardId',
2071
+ value: function setMeStorageCardId(v) {
2072
+ this.MeStorageCardId = v;
2073
+ }
2074
+ }, {
2075
+ key: 'setStorageCardNo',
2076
+ value: function setStorageCardNo(v) {
2077
+ this.StorageCardNo = v;
2078
+ }
2079
+ }]);
2080
+ return Member;
2081
+ }(), (_descriptor11 = _applyDecoratedDescriptor(_class5.prototype, 'cardNo', [_mobx.observable], {
2082
+ enumerable: true,
2083
+ initializer: null
2084
+ }), _descriptor12 = _applyDecoratedDescriptor(_class5.prototype, 'balance', [_mobx.observable], {
2085
+ enumerable: true,
2086
+ initializer: null
2087
+ }), _descriptor13 = _applyDecoratedDescriptor(_class5.prototype, 'exchangable', [_mobx.observable], {
2088
+ enumerable: true,
2089
+ initializer: null
2090
+ }), _descriptor14 = _applyDecoratedDescriptor(_class5.prototype, 'MeStorageCardId', [_mobx.observable], {
2091
+ enumerable: true,
2092
+ initializer: null
2093
+ }), _descriptor15 = _applyDecoratedDescriptor(_class5.prototype, 'StorageCardNo', [_mobx.observable], {
2094
+ enumerable: true,
2095
+ initializer: null
2096
+ }), _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), _applyDecoratedDescriptor(_class5.prototype, 'setMeStorageCardId', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class5.prototype, 'setMeStorageCardId'), _class5.prototype), _applyDecoratedDescriptor(_class5.prototype, 'setStorageCardNo', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class5.prototype, 'setStorageCardNo'), _class5.prototype)), _class5);
2097
+ //# sourceMappingURL=settlementStore.js.map