tplus-components-touch 3.22.16 → 3.23.2

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