tplus-components-touch 3.45.1 → 3.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/components/billSearch/index.js +2 -2
  2. package/dist/components/billSearch/index.js.map +1 -1
  3. package/dist/components/cloudPrint/BTPrintFormatUtil.js +2 -2
  4. package/dist/components/cloudPrint/BTPrintFormatUtil.js.map +1 -1
  5. package/dist/components/cloudPrint/index.js +893 -608
  6. package/dist/components/cloudPrint/index.js.map +1 -1
  7. package/dist/components/cloudPrint/printDispatch.js +184 -48
  8. package/dist/components/cloudPrint/printDispatch.js.map +1 -1
  9. package/dist/components/cloudPrint/printTemplate/dialy_one.json +239 -0
  10. package/dist/components/cloudPrint/printTemplate/duty_one.json +239 -0
  11. package/dist/components/cloudPrint/printTemplate/retail_one.json +204 -0
  12. package/dist/components/cloudPrint/printTemplate/retail_two.json +220 -0
  13. package/dist/components/cloudPrint/printTemplate/storage_one.json +129 -0
  14. package/dist/components/cloudPrint/printTemplate/template.js +52 -0
  15. package/dist/components/cloudPrint/printTemplate/template.js.map +1 -0
  16. package/dist/components/commonForm/addressPicker/index.js +241 -0
  17. package/dist/components/commonForm/addressPicker/index.js.map +1 -0
  18. package/dist/components/commonForm/autoComplete/index.js +260 -0
  19. package/dist/components/commonForm/autoComplete/index.js.map +1 -0
  20. package/dist/components/commonForm/datePicker/index.js +92 -0
  21. package/dist/components/commonForm/datePicker/index.js.map +1 -0
  22. package/dist/components/commonForm/formControl/index.js +144 -0
  23. package/dist/components/commonForm/formControl/index.js.map +1 -0
  24. package/dist/components/commonForm/inputNumber/index.js +272 -0
  25. package/dist/components/commonForm/inputNumber/index.js.map +1 -0
  26. package/dist/components/commonForm/radio/index.js +132 -0
  27. package/dist/components/commonForm/radio/index.js.map +1 -0
  28. package/dist/components/hardwareAPI/index.js +46 -12
  29. package/dist/components/hardwareAPI/index.js.map +1 -1
  30. package/dist/components/input/tplusInput/index.js +81 -0
  31. package/dist/components/input/tplusInput/index.js.map +1 -0
  32. package/dist/components/input/tplusInput/inputContent.js +128 -0
  33. package/dist/components/input/tplusInput/inputContent.js.map +1 -0
  34. package/dist/components/input/tplusInput/inputs.js +151 -0
  35. package/dist/components/input/tplusInput/inputs.js.map +1 -0
  36. package/dist/components/input/utils/index.js +26 -0
  37. package/dist/components/input/utils/index.js.map +1 -0
  38. package/dist/components/message/index.js +4 -3
  39. package/dist/components/message/index.js.map +1 -1
  40. package/dist/components/modalWraper/index.js +1 -16
  41. package/dist/components/modalWraper/index.js.map +1 -1
  42. package/dist/components/modalWraper/style.less +0 -6
  43. package/dist/components/settlement/asyncModal.js +1 -4
  44. package/dist/components/settlement/asyncModal.js.map +1 -1
  45. package/dist/components/settlement/moreCzkTable/index.js +156 -0
  46. package/dist/components/settlement/moreCzkTable/index.js.map +1 -0
  47. package/dist/components/settlement/prototypeTable/index.js +353 -0
  48. package/dist/components/settlement/prototypeTable/index.js.map +1 -0
  49. package/dist/components/settlement/prototypeTable/utils.js +14 -0
  50. package/dist/components/settlement/prototypeTable/utils.js.map +1 -0
  51. package/dist/components/settlement/settlement.js +225 -292
  52. package/dist/components/settlement/settlement.js.map +1 -1
  53. package/dist/components/settlement/settlement.less +0 -3
  54. package/dist/components/settlement/settlementStore.js +2820 -0
  55. package/dist/components/settlement/settlementStore.js.map +1 -0
  56. package/dist/components/settlement/utils.js +249 -0
  57. package/dist/components/settlement/utils.js.map +1 -0
  58. package/dist/components/socket/index.js +221 -0
  59. package/dist/components/socket/index.js.map +1 -0
  60. package/dist/components/spin/index.js +95 -0
  61. package/dist/components/spin/index.js.map +1 -0
  62. package/dist/components/test/index.js +330 -0
  63. package/dist/components/test/index.js.map +1 -0
  64. package/dist/components/ticon/iconfont/iconfont.js +35 -0
  65. package/dist/components/ticon/iconfont/iconfont.js.map +1 -0
  66. package/dist/components/ticon/index.js +60 -0
  67. package/dist/components/ticon/index.js.map +1 -0
  68. package/dist/components/touchScroll/index.js +186 -0
  69. package/dist/components/touchScroll/index.js.map +1 -0
  70. package/dist/components/touchTable/AuthProcess.js +42 -0
  71. package/dist/components/touchTable/AuthProcess.js.map +1 -0
  72. package/dist/components/touchTable/generateWater.js +59 -0
  73. package/dist/components/touchTable/generateWater.js.map +1 -0
  74. package/dist/components/touchTable/index.js +1135 -0
  75. package/dist/components/touchTable/index.js.map +1 -0
  76. package/dist/components/touchTable/utils.js +14 -0
  77. package/dist/components/touchTable/utils.js.map +1 -0
  78. package/dist/index.js +3 -8
  79. package/dist/index.js.map +1 -1
  80. package/package.json +2 -2
  81. package/dist/components/settlement/settlementApi.js +0 -512
  82. package/dist/components/settlement/settlementApi.js.map +0 -1
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _map = require('babel-runtime/core-js/map');
8
+
9
+ var _map2 = _interopRequireDefault(_map);
10
+
7
11
  var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
8
12
 
9
13
  var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
10
14
 
11
- var _map = require('babel-runtime/core-js/map');
15
+ var _extends2 = require('babel-runtime/helpers/extends');
12
16
 
13
- var _map2 = _interopRequireDefault(_map);
17
+ var _extends3 = _interopRequireDefault(_extends2);
14
18
 
15
19
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
16
20
 
@@ -20,8 +24,6 @@ var _createClass2 = require('babel-runtime/helpers/createClass');
20
24
 
21
25
  var _createClass3 = _interopRequireDefault(_createClass2);
22
26
 
23
- var _class, _temp, _initialiseProps;
24
-
25
27
  var _BTPrintFormatUtil = require('./BTPrintFormatUtil');
26
28
 
27
29
  var _BTPrintFormatUtil2 = _interopRequireDefault(_BTPrintFormatUtil);
@@ -38,13 +40,638 @@ var _tools = require('../../util/tools');
38
40
 
39
41
  var _tools2 = _interopRequireDefault(_tools);
40
42
 
43
+ var _retail_one = require('./printTemplate/retail_one.json');
44
+
45
+ var _retail_one2 = _interopRequireDefault(_retail_one);
46
+
41
47
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
48
 
43
- var PrintUtil = (_temp = _class = function () {
49
+ var PrintUtil = function () {
44
50
  function PrintUtil() {
51
+ var _this2 = this;
52
+
45
53
  (0, _classCallCheck3.default)(this, PrintUtil);
46
54
 
47
- _initialiseProps.call(this);
55
+ this.doTestPrint = function (printParams, callback) {
56
+ _this2.cloudAddList(printParams, function (result) {
57
+ var ret = result.ret;
58
+
59
+ if (ret === 0) {
60
+ _this2.cloudPrint('\n\n' + '飞蛾打印机测试打印成功。' + '\n\n', printParams, callback);
61
+ } else {
62
+ if (typeof callback == 'function') callback(result);
63
+ }
64
+ });
65
+ };
66
+
67
+ this.doPrint = function (printParams, Id, callback) {
68
+ if (!printParams || !Id) return;
69
+ var _this = _this2;
70
+ _api2.default.getPrintDataInfo(Id).then(function (ret) {
71
+ var _ref = ret || {},
72
+ Store = _ref.Store,
73
+ UserName = _ref.UserName,
74
+ Code = _ref.Code,
75
+ CreatedTime = _ref.CreatedTime,
76
+ TotalCount = _ref.TotalCount,
77
+ TotalTaxAmount = _ref.TotalTaxAmount,
78
+ WipeChange = _ref.WipeChange,
79
+ RetailDetails = _ref.RetailDetails,
80
+ Member = _ref.Member,
81
+ BalanceIntegral = _ref.BalanceIntegral,
82
+ Integral = _ref.Integral,
83
+ BalanceStorage = _ref.BalanceStorage,
84
+ RetailPaymentDetails = _ref.RetailPaymentDetails,
85
+ TotalDiscountAmount = _ref.TotalDiscountAmount;
86
+
87
+ var details = [];
88
+
89
+ Member = _tools2.default.changePrivateInfo(Member, 'print');
90
+
91
+ if (RetailDetails && RetailDetails.length > 0) {
92
+ RetailDetails.map(function (item) {
93
+ var inventoryCode = item.Inventory.Code;
94
+ item.Inventory.NameAndCode = item.Inventory.Name + ('(' + inventoryCode + ')');
95
+ var quantity = _this2.toDecimal2NoZero(item.Quantity);
96
+ quantity += item.Unit.Name || '';
97
+ item.quantityAndUnit = quantity;
98
+
99
+ // 零售价
100
+ // let Price = this.toDecimal2NoZero (item.Price);
101
+
102
+ // // 商品编码
103
+ // let inventoryCode = item.Inventory.Code;
104
+
105
+ // let taxPrice = this.toDecimal2NoZero (item.TaxPrice);
106
+ // // item.TaxPrice,
107
+ // // this.Precision.Price
108
+
109
+ // // 金额
110
+ // let taxAmount = tool.formatPrecision (
111
+ // item.TaxAmount,
112
+ // this.Precision.TaxAmount
113
+ // );
114
+ // details.push ([item.Inventory.Name + `(${inventoryCode})`, quantity,taxPrice, Price, taxAmount]);
115
+ });
116
+ // 总优惠金额
117
+ // let totalDiscount = this.toDecimal2NoZero(item.TotalDiscount);
118
+ }
119
+ var constr = _this.loadBTPrintDataByTemplate(printParams, {
120
+ Store: Store,
121
+ UserName: UserName,
122
+ Code: Code,
123
+ CreatedTime: CreatedTime,
124
+ details: RetailDetails,
125
+ TotalCount: TotalCount,
126
+ TotalTaxAmount: TotalTaxAmount,
127
+ WipeChange: WipeChange,
128
+ Member: Member,
129
+ BalanceIntegral: BalanceIntegral,
130
+ Integral: Integral,
131
+ BalanceStorage: BalanceStorage,
132
+ RetailPaymentDetails: RetailPaymentDetails,
133
+ TotalDiscountAmount: TotalDiscountAmount
134
+ });
135
+
136
+ // let constr = _this.loadBTPrintData ({
137
+ // Store,
138
+ // UserName,
139
+ // Code,
140
+ // CreatedTime,
141
+ // details,
142
+ // TotalCount,
143
+ // TotalTaxAmount,
144
+ // WipeChange,
145
+ // Member,
146
+ // BalanceIntegral,
147
+ // Integral,
148
+ // BalanceStorage,
149
+ // RetailPaymentDetails
150
+ // });
151
+ _this.cloudPrint(constr, printParams, callback);
152
+ });
153
+ };
154
+
155
+ this.doDialyPrint = function (printParams, Id, callback) {
156
+ if (!Id) return;
157
+ var _this = _this2;
158
+ _api2.default.getDialyPrintDataInfo(Id).then(function (ret) {
159
+ var constr = _this.loadBTDutyAndDialyPrintData(printParams, ret || {}, 'Dialy');
160
+ _this.cloudPrint(constr, printParams, callback);
161
+ });
162
+ };
163
+
164
+ this.doDutyPrint = function (printParams, Id, callback) {
165
+ if (!Id) return;
166
+ var _this = _this2;
167
+ _api2.default.getDutyPrintDataInfo(Id).then(function (ret) {
168
+ var constr = _this.loadBTDutyAndDialyPrintData(printParams, ret, 'Duty');
169
+ _this.cloudPrint(constr, printParams, callback);
170
+ });
171
+ };
172
+
173
+ this.doStoragePrint = function (printParams, Id, callback) {
174
+ if (!Id) return;
175
+ var _this = _this2;
176
+ _api2.default.getStoragePrintDataInfo(Id).then(function (ret) {
177
+ var constr = _this.loadBTStoragePrintData(printParams, ret || {});
178
+ _this.cloudPrint(constr, printParams, callback);
179
+ });
180
+ };
181
+
182
+ this.loadBTStoragePrintData = function (printParams, printEntity) {
183
+ var _ref2 = printEntity || {},
184
+ _ref2$Member = _ref2.Member,
185
+ Member = _ref2$Member === undefined ? {} : _ref2$Member,
186
+ _ref2$StorageDetails = _ref2.StorageDetails,
187
+ StorageDetails = _ref2$StorageDetails === undefined ? [] : _ref2$StorageDetails,
188
+ Person = _ref2.Person,
189
+ StorageMutiSettleDetails = _ref2.StorageMutiSettleDetails;
190
+
191
+ var Mobilephone = Member.Mobilephone,
192
+ MemberName = Member.Name;
193
+
194
+ var _ref3 = Person || {},
195
+ StorageName = _ref3.Name;
196
+
197
+ printEntity.StorageName = StorageName;
198
+ printEntity.MemberName = MemberName;
199
+
200
+ var template = printParams.template;
201
+
202
+ return _this2.dutyPrintStringByTemplate(template, printEntity);
203
+ };
204
+
205
+ this.loadBTDutyAndDialyPrintData = function (printParams, printEntity, type) {
206
+ var WorkingDate = printEntity.WorkingDate,
207
+ WorkingTime = printEntity.WorkingTime,
208
+ DailyDate = printEntity.DailyDate,
209
+ DailyTime = printEntity.DailyTime,
210
+ RetailAmount = printEntity.RetailAmount,
211
+ ReturnAmount = printEntity.ReturnAmount,
212
+ InitialAmount = printEntity.InitialAmount,
213
+ ImprestAmount = printEntity.ImprestAmount,
214
+ ShiftDate = printEntity.ShiftDate,
215
+ ShiftTime = printEntity.ShiftTime,
216
+ ShiftVoucherDetails = printEntity.ShiftVoucherDetails;
217
+
218
+ printEntity.WorkingDateAndTime = WorkingDate + ' ' + WorkingTime;
219
+ printEntity.DailyDateAndTime = DailyDate + ' ' + DailyTime;
220
+ printEntity.DutyDateAndTime = ShiftDate + ' ' + ShiftTime;
221
+ printEntity.NetAmount = RetailAmount + ReturnAmount;
222
+ printEntity.ImprestBalance = InitialAmount + ImprestAmount;
223
+ printEntity.ShiftVoucherDetails = ShiftVoucherDetails.map(function (item) {
224
+ var _item$SettleStyle = item.SettleStyle;
225
+ _item$SettleStyle = _item$SettleStyle === undefined ? {} : _item$SettleStyle;
226
+ var Name = _item$SettleStyle.Name;
227
+
228
+ return (0, _extends3.default)({
229
+ Name: Name
230
+ }, item);
231
+ });
232
+ var template = printParams.template;
233
+
234
+ return _this2.dutyPrintStringByTemplate(template, printEntity);
235
+ };
236
+
237
+ this.loadBTPrintDataByTemplate = function (printParams, printEntity) {
238
+ //支付方式--明细
239
+ var pBodyValueList = [];
240
+ printEntity.RetailPaymentDetails && printEntity.RetailPaymentDetails.forEach(function (items) {
241
+ var _items$Amount = items.Amount,
242
+ Amount = _items$Amount === undefined ? '0.00' : _items$Amount,
243
+ _items$SettleStyle$Na = items.SettleStyle.Name,
244
+ Name = _items$SettleStyle$Na === undefined ? "其他方式" : _items$SettleStyle$Na;
245
+ // bodyValue.push(tool.format (Amount));
246
+
247
+ pBodyValueList.push({
248
+ NameAndCode: Name,
249
+ TotalAmount: _mutantsUtil.tools.format(Amount)
250
+ });
251
+ });
252
+ printEntity.RetailPaymentDetails = pBodyValueList;
253
+ var template = printParams.template;
254
+
255
+ return _this2.dutyPrintStringByTemplate(template, printEntity);
256
+ };
257
+
258
+ this.dutyPrintStringByTemplate = function (template, data) {
259
+ var width = template.width,
260
+ templateBody = template.body;
261
+
262
+ var templateContent = "";
263
+ _BTPrintFormatUtil2.default.setLineByteSize(Math.floor(width / 58 * _this2.lineSize));
264
+ for (var index = 0; index < templateBody.length; index++) {
265
+ var printTemplateItem = templateBody[index];
266
+ switch (printTemplateItem.type) {
267
+ case 'lineFeed':
268
+ {
269
+ if (printTemplateItem.height) {
270
+ var height = printTemplateItem.height;
271
+ do {
272
+ templateContent += '\n';
273
+ height--;
274
+ } while (height > 0);
275
+ }
276
+ break;
277
+ }
278
+ case 'separateLine':
279
+ {
280
+ if (printTemplateItem.height) {
281
+ var value = printTemplateItem.value;
282
+
283
+ var _height = printTemplateItem.height;
284
+ do {
285
+ templateContent += _BTPrintFormatUtil2.default.drawSeparateLine(value);
286
+ _height--;
287
+ } while (_height > 0);
288
+ }
289
+ break;
290
+ }
291
+ case 'printTitle':
292
+ {
293
+ templateContent += _BTPrintFormatUtil2.default.printTitle(printTemplateItem.value || JSON.getCellValue(data, printTemplateItem.attribute) || "");
294
+ break;
295
+ }
296
+ case 'printStarTitle':
297
+ {
298
+ templateContent += _BTPrintFormatUtil2.default.printStarTitle(printTemplateItem.value);
299
+ break;
300
+ }
301
+ case 'spaceCenterPrintMsg':
302
+ {
303
+ templateContent += _BTPrintFormatUtil2.default.spaceCenterPrintMsg.apply(_BTPrintFormatUtil2.default, (0, _toConsumableArray3.default)(printTemplateItem.value));
304
+ break;
305
+ }
306
+ case 'leftPrintMsg':
307
+ {
308
+ var _ret = function () {
309
+ var body = printTemplateItem.body;
310
+
311
+ var valueMap = new _map2.default();
312
+ body.forEach(function (attr) {
313
+ var name = attr.name,
314
+ attribute = attr.attribute,
315
+ type = attr.type;
316
+
317
+ var value = '';
318
+ if (attribute && attribute.length) {
319
+ var symbolList = [];
320
+ var attributeList = attribute && attribute.replace(/\+{1}|\-{1}/g, function (symbol) {
321
+ symbolList.push(symbol);
322
+ return "**_**";
323
+ }).split("**_**");
324
+ var totalValue = JSON.getCellValue(data, attributeList[0]);
325
+ if (symbolList.length > 0) {
326
+ for (var _index = 0; _index < symbolList.length; _index++) {
327
+ switch (symbolList[_index]) {
328
+ case "+":
329
+ {
330
+ totalValue += JSON.getCellValue(data, attributeList[_index + 1]);
331
+ break;
332
+ }
333
+ case "-":
334
+ {
335
+ totalValue -= JSON.getCellValue(data, attributeList[_index + 1]);
336
+ break;
337
+ }
338
+ }
339
+ }
340
+ }
341
+ value = _this2.formatValue(type, totalValue);
342
+ }
343
+ valueMap.set(name, value);
344
+ });
345
+ templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(valueMap);
346
+ return 'break';
347
+ }();
348
+
349
+ if (_ret === 'break') break;
350
+ }
351
+ case 'printMenuMSG':
352
+ {
353
+ var _ret2 = function () {
354
+ var headerList = printTemplateItem.headerList,
355
+ bodyList = printTemplateItem.bodyList;
356
+
357
+ var bodyListArray = [];
358
+ var listArray = JSON.getCellValue(data, bodyList.attribute);
359
+
360
+ bodyList.list.forEach(function (list, index) {
361
+ var type = list.type,
362
+ attribute = list.attribute;
363
+ // bodyListArray.push(this.formatValue(type,listArray[attribute]))
364
+
365
+ listArray.map(function (item, i) {
366
+ var arr = bodyListArray[i] || [];
367
+ var listArr = arr[index] || [];
368
+ arr[index] = _this2.formatValue(type, JSON.getCellValue(item, attribute));
369
+ bodyListArray[i] = arr;
370
+ });
371
+ });
372
+ templateContent += _BTPrintFormatUtil2.default.printMenuMSG(bodyListArray, headerList, true);
373
+ return 'break';
374
+ }();
375
+
376
+ if (_ret2 === 'break') break;
377
+ }
378
+ case 'text':
379
+ {
380
+ templateContent += printTemplateItem.value;
381
+ break;
382
+ }
383
+ }
384
+ }
385
+ return templateContent;
386
+ };
387
+
388
+ this.formatValue = function (type, value) {
389
+ switch (type) {
390
+ case "string":
391
+ return value || "";
392
+ case "number":
393
+ return value || '0';
394
+ case "price":
395
+ return _mutantsUtil.tools.format(value) || '0.00';
396
+ default:
397
+ return value || "";
398
+ }
399
+ };
400
+
401
+ this.loadBTPrintData = function (params) {
402
+ var _printEntity$paymentT, _printEntity$detailCo;
403
+
404
+ var templateContent = '';
405
+ var printEntity = {};
406
+
407
+ var _ref4 = params || {},
408
+ Store = _ref4.Store,
409
+ UserName = _ref4.UserName,
410
+ Code = _ref4.Code,
411
+ CreatedTime = _ref4.CreatedTime,
412
+ details = _ref4.details,
413
+ TotalCount = _ref4.TotalCount,
414
+ TotalTaxAmount = _ref4.TotalTaxAmount,
415
+ WipeChange = _ref4.WipeChange,
416
+ Member = _ref4.Member,
417
+ BalanceIntegral = _ref4.BalanceIntegral,
418
+ Integral = _ref4.Integral,
419
+ BalanceStorage = _ref4.BalanceStorage,
420
+ RetailPaymentDetails = _ref4.RetailPaymentDetails;
421
+
422
+ printEntity.headerMap = new _map2.default();
423
+ printEntity.detailTopList = [];
424
+ printEntity.paymentTypeTopList = [];
425
+ printEntity.paymentTypeDetailList = [];
426
+ printEntity.detailContentList = [];
427
+ printEntity.footerMap1 = new _map2.default();
428
+ printEntity.footerMap2 = new _map2.default();
429
+ printEntity.headerMap.set('门店名称', Store.Name || '');
430
+ printEntity.headerMap.set('门店电话', Store.Telephone || '');
431
+ printEntity.headerMap.set('收银员', UserName || '');
432
+ printEntity.headerMap.set('单号', Code);
433
+ printEntity.headerMap.set('日期', CreatedTime || '');
434
+ printEntity.detailTopList.push({
435
+ Caption: '商品名称',
436
+ IsTitle: true,
437
+ IsFoot: false
438
+ });
439
+ printEntity.detailTopList.push({
440
+ Caption: '数量',
441
+ IsTitle: false,
442
+ IsFoot: false
443
+ });
444
+ printEntity.detailTopList.push({
445
+ Caption: '单价',
446
+ IsTitle: false,
447
+ IsFoot: false
448
+ });
449
+ printEntity.detailTopList.push({
450
+ Caption: '金额',
451
+ IsTitle: false,
452
+ IsFoot: false
453
+ });
454
+
455
+ //支付方式
456
+ printEntity.paymentTypeTopList.push({
457
+ Caption: '支付方式',
458
+ IsTitle: false,
459
+ IsFoot: false
460
+ });
461
+ printEntity.paymentTypeTopList.push({
462
+ Caption: '金额',
463
+ IsTitle: false,
464
+ IsFoot: false
465
+ });
466
+ (_printEntity$paymentT = printEntity.paymentTypeDetailList).push.apply(_printEntity$paymentT, (0, _toConsumableArray3.default)(RetailPaymentDetails));
467
+
468
+ (_printEntity$detailCo = printEntity.detailContentList).push.apply(_printEntity$detailCo, (0, _toConsumableArray3.default)(details));
469
+ printEntity.footerMap1.set('数量', TotalCount);
470
+ printEntity.footerMap1.set('金额', TotalTaxAmount);
471
+ printEntity.footerMap1.set('抹零', WipeChange || '0.00');
472
+
473
+ printEntity.footerMap2.set('会员卡号', Member && Member.CardCode || '');
474
+ printEntity.footerMap2.set('会员手机', Member && Member.Mobilephone || '');
475
+ printEntity.footerMap2.set('积分余额', BalanceIntegral || '0');
476
+ printEntity.footerMap2.set('本次积分', Integral || '0');
477
+ printEntity.footerMap2.set('储值余额', BalanceStorage || '0.00');
478
+ // 设定打印尺寸
479
+ _BTPrintFormatUtil2.default.setLineByteSize(_this2.lineSize);
480
+
481
+ //单据头部
482
+ templateContent += '\n';
483
+ if (printEntity.headerMap && printEntity.headerMap.size > 0) {
484
+ templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.headerMap);
485
+ }
486
+
487
+ templateContent += '\n';
488
+
489
+ //单据内容--头部
490
+ var mhList = [];
491
+ if (printEntity.detailTopList && printEntity.detailTopList.length > 0) {
492
+ printEntity.detailTopList.forEach(function (item) {
493
+ var mh = {
494
+ headerText: item.Caption,
495
+ headerWeight: 1,
496
+ isTitle: item.IsTitle,
497
+ isFoot: item.IsFoot
498
+ };
499
+ mhList.push(mh);
500
+ });
501
+ }
502
+ //单据内容--明细
503
+ var bodyValueList = [];
504
+ printEntity.detailContentList.forEach(function (items) {
505
+ var bodyValue = [];
506
+ items.forEach(function (item) {
507
+ bodyValue.push(item);
508
+ });
509
+ bodyValueList.push(bodyValue);
510
+ });
511
+ templateContent += _BTPrintFormatUtil2.default.printMenuMSG(bodyValueList, mhList, true);
512
+
513
+ //单据底部1
514
+ if (printEntity.footerMap1 && printEntity.footerMap1.size > 0) {
515
+ templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.footerMap1);
516
+ }
517
+ templateContent += _BTPrintFormatUtil2.default.drawSeparateLine();
518
+ templateContent += '\n';
519
+
520
+ //支付方式--头部
521
+ var phList = [];
522
+ if (printEntity.paymentTypeTopList && printEntity.paymentTypeTopList.length > 0) {
523
+ printEntity.paymentTypeTopList.forEach(function (item, index) {
524
+ var mh = {
525
+ headerText: item.Caption,
526
+ headerWeight: index == 0 ? 3 : 1,
527
+ isTitle: item.IsTitle,
528
+ isFoot: item.IsFoot
529
+ };
530
+ phList.push(mh);
531
+ });
532
+ }
533
+ //支付方式--明细
534
+ var pBodyValueList = [];
535
+ printEntity.paymentTypeDetailList.forEach(function (items) {
536
+ var bodyValue = [];
537
+ var _items$Amount2 = items.Amount,
538
+ Amount = _items$Amount2 === undefined ? '0.00' : _items$Amount2,
539
+ _items$SettleStyle$Na2 = items.SettleStyle.Name,
540
+ Name = _items$SettleStyle$Na2 === undefined ? "其他方式" : _items$SettleStyle$Na2;
541
+
542
+ bodyValue.push(Name);
543
+ bodyValue.push(_mutantsUtil.tools.format(Amount));
544
+ pBodyValueList.push(bodyValue);
545
+ });
546
+ templateContent += _BTPrintFormatUtil2.default.printMenuMSG(pBodyValueList, phList, true);
547
+
548
+ //单据底部2
549
+ if (printEntity.footerMap2 && printEntity.footerMap2.size > 0) {
550
+ templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.footerMap2);
551
+ }
552
+ templateContent += '\n';
553
+ templateContent += _BTPrintFormatUtil2.default.drawSeparateLine2();
554
+ templateContent += '\n';
555
+ templateContent += '\t谢谢惠顾,欢迎再次光临';
556
+ templateContent += '\n\n\n';
557
+ return templateContent;
558
+ };
559
+
560
+ this.cloudPrint = function (cloudContents, printParams, callback) {
561
+ var _ref5 = printParams || {},
562
+ Open = _ref5.Open,
563
+ Key = _ref5.Key,
564
+ Sign = _ref5.Sign,
565
+ Name = _ref5.Name,
566
+ Card = _ref5.Card,
567
+ isLocalSunMi = _ref5.isLocalSunMi;
568
+ // 商米没有配置则调用本地打印接口
569
+
570
+
571
+ if (_this2.isHorizontalSunMi && isLocalSunMi) {
572
+ _this2.sunMiLocalPrint(cloudContents, Name, callback);
573
+ } else if (_this2.isHorizontalSunMi && !Open) {
574
+ console.log(cloudContents);
575
+ _this2.sunmiPrint(cloudContents, callback);
576
+ } else if (Open) {
577
+ var _ref6 = printParams || {},
578
+ _Key = _ref6.Key,
579
+ _Sign = _ref6.Sign,
580
+ _Name = _ref6.Name,
581
+ _Card = _ref6.Card;
582
+
583
+ var arr = [];
584
+ arr.push(_Sign, _Key);
585
+ if (_Name) arr.push(_Name);
586
+ if (_Card) arr.push(_Card);
587
+ var printerContent = arr.join('#');
588
+ var PrintCount = _this2.PrintCount; //打印次数
589
+ _api2.default.openPrintMsg({
590
+ content: cloudContents,
591
+ printerContent: printerContent,
592
+ apiname: 'Open_printMsg',
593
+ deviceCode: _Sign,
594
+ times: PrintCount
595
+ }).then(function (s) {
596
+ if (typeof callback == 'function' && s && s.data) callback(s.data);
597
+ });
598
+ }
599
+ };
600
+
601
+ this.sunmiPrint = function (cloudContents, callback) {
602
+ window.sunMi_OperatingCashier && window.sunMi_OperatingCashier
603
+ // 检测打印机状态
604
+ .updatePrinterState().then(function (status) {
605
+ var _ref7 = status || {},
606
+ state = _ref7.state,
607
+ message = _ref7.message;
608
+
609
+ if (state == 1) {
610
+ window.sunMi_OperatingCashier && window.sunMi_OperatingCashier.PrintSmallTicketter(cloudContents + '\n\n', _this2.PrintCount).then(function (ret) {
611
+ if (ret && ret.state && ret.state == 200) {
612
+ callback && callback({
613
+ ret: 0,
614
+ msg: "打印成功"
615
+ });
616
+ } else {
617
+ callback && callback({
618
+ ret: -1,
619
+ msg: ret.message ? ret.message : "打印失败"
620
+ });
621
+ }
622
+ });
623
+ } else {
624
+ callback && callback({
625
+ ret: -1,
626
+ msg: message ? message : "打印失败"
627
+ });
628
+ }
629
+ });
630
+ };
631
+
632
+ this.sunMiLocalPrint = function (cloudContents, deviceName, callback) {
633
+ window.LocalPrintPlugin.printByDeviceName({ deviceName: deviceName, printContent: cloudContents, PrintCount: _this2.PrintCount }).then(function (res) {
634
+ console.log("商米本地打印成功", res);
635
+ callback && callback({
636
+ ret: 0,
637
+ msg: "打印成功"
638
+ });
639
+ }).catch(function (error) {
640
+ console.log("商米本地打印失败", error);
641
+
642
+ var _ref8 = error || {},
643
+ message = _ref8.message;
644
+
645
+ callback && callback({
646
+ ret: -1,
647
+ msg: message || "打印失败"
648
+ });
649
+ });
650
+ };
651
+
652
+ this.cloudAddList = function (printParams, callback) {
653
+ var _ref9 = printParams || {},
654
+ Key = _ref9.Key,
655
+ Sign = _ref9.Sign,
656
+ Name = _ref9.Name,
657
+ Card = _ref9.Card;
658
+
659
+ var arr = [];
660
+ arr.push(Sign, Key);
661
+ if (Name) arr.push(Name);
662
+ if (Card) arr.push(Card);
663
+ var printerContent = arr.join('#');
664
+ var PrintCount = _this2.PrintCount; //按照添加一次的
665
+ _api2.default.openPrinterAddlist({
666
+ content: '',
667
+ printerContent: printerContent,
668
+ apiname: 'Open_printerAddlist',
669
+ deviceCode: Sign,
670
+ times: PrintCount
671
+ }).then(function (s) {
672
+ if (typeof callback == 'function' && s && s.data) callback(s.data);
673
+ });
674
+ };
48
675
 
49
676
  this.BTPrintEntity = {};
50
677
  this.BTPrintContent = '';
@@ -56,8 +683,8 @@ var PrintUtil = (_temp = _class = function () {
56
683
  TaxAmount: (0, _tplusPoslogin.PosInitData)('AmountPrecision')
57
684
  };
58
685
 
59
- var _ref = _mutantsUtil.platform || {},
60
- isHorizontalSunMi = _ref.isHorizontalSunMi;
686
+ var _ref10 = _mutantsUtil.platform || {},
687
+ isHorizontalSunMi = _ref10.isHorizontalSunMi;
61
688
 
62
689
  this.isHorizontalSunMi = !!isHorizontalSunMi;
63
690
 
@@ -101,9 +728,266 @@ var PrintUtil = (_temp = _class = function () {
101
728
  //储值打印
102
729
 
103
730
 
731
+ //储值打印
732
+ // loadBTStoragePrintData = (printParams, params) => {
733
+ // let templateContent = '';
734
+ // let printEntity = {};
735
+ // const {
736
+ // Store,
737
+ // StorageDetails,
738
+ // CreatedTime,
739
+ // Member,
740
+ // CardCode,
741
+ // StorageMutiSettleDetails,
742
+ // Person,
743
+ // } = params || {};
744
+ // const { Mobilephone, Name : MemberName } = Member || {};
745
+ // const { Name : StorageName} = Person || {};
746
+ // const {
747
+ // ThisStorageAmount,
748
+ // ThisPresentAmount,
749
+ // AfterBalanceStorage,
750
+ // } = StorageDetails[0] || {};
751
+ // printEntity.headerMap = new Map ();
752
+ // printEntity.footerMap1 = new Map ();
753
+ // printEntity.footerMap2 = new Map ();
754
+ // printEntity.headerMap.set ('日期', CreatedTime || '');
755
+ // printEntity.headerMap.set ('储值业务员', StorageName || '');
756
+ // printEntity.headerMap.set ('会员卡号', CardCode || '');
757
+ // printEntity.headerMap.set ('手机号', Mobilephone || '');
758
+ // printEntity.headerMap.set ('会员姓名', MemberName || '');
759
+ // printEntity.headerMap.set ('本次储存金额', tool.format (ThisStorageAmount) || '');
760
+ // printEntity.headerMap.set ('本次赠送金额', tool.format (ThisPresentAmount) || '');
761
+ // printEntity.headerMap.set (
762
+ // '本次储值后金额',
763
+ // tool.format (AfterBalanceStorage) || ''
764
+ // );
765
+ // if (StorageMutiSettleDetails && StorageMutiSettleDetails.length != 0) {
766
+ // StorageMutiSettleDetails.forEach (details => {
767
+ // const {StorageAmount,SettleStyle} = details || {};
768
+ // const { Name } = SettleStyle || {}
769
+ // printEntity.headerMap.set (
770
+ // Name,
771
+ // StorageAmount || '0.00'
772
+ // );
773
+ // });
774
+ // }
775
+ // printEntity.headerMap.set ('顾客签字', '');
776
+
777
+ // // 设定打印尺寸
778
+ // BTPrintFormatUtil.setLineByteSize (this.lineSize);
779
+
780
+ // //单据头部
781
+ // templateContent += '\n';
782
+ // templateContent += BTPrintFormatUtil.printTitle (Store.Name || '');
783
+ // if (printEntity.headerMap && printEntity.headerMap.size > 0) {
784
+ // templateContent += BTPrintFormatUtil.leftPrintMsg (printEntity.headerMap);
785
+ // }
786
+ // templateContent += '\n\n\n\n';
787
+ // return templateContent;
788
+ // };
789
+
104
790
  // 交班日结打印 type: Duty 交班 Dialy 日结
105
791
 
106
792
 
793
+ // 交班日结打印 type: Duty 交班 Dialy 日结
794
+ // loadBTDutyAndDialyPrintData = (printParams, params, type) => {
795
+ // let templateContent = '';
796
+ // let printEntity = {};
797
+ // const {
798
+ // Code,
799
+ // Store,
800
+ // UserName,
801
+ // POSCode,
802
+ // POS,
803
+ // POSName,
804
+ // WorkingDate,
805
+ // StartDate,
806
+ // ShiftDate,
807
+ // DailyDate,
808
+ // RetailAmount,
809
+ // ReturnAmount,
810
+ // SalesStorageTotalAmount,
811
+ // CashOutAmount,
812
+ // CouponsDeduct,
813
+ // CouponsAmount,
814
+ // OnlineAmount,
815
+ // TotalCount,
816
+ // TotalCustom,
817
+ // Price,
818
+ // InitialAmount,
819
+ // ImprestAmount,
820
+ // ImprestBalanceAmount,
821
+ // ShiftVoucherDetails,
822
+ // DailyDetails,
823
+ // WorkingTime,
824
+ // ShiftTime,
825
+ // StartTime,
826
+ // DailyTime,
827
+ // Memo
828
+ // } = params || {};
829
+ // printEntity.headerMap = new Map ();
830
+ // printEntity.footerMap1 = new Map ();
831
+ // printEntity.footerMap2 = new Map ();
832
+ // printEntity.detailTopList = [];
833
+ // printEntity.detailContentList = [];
834
+ // printEntity.headerMap.set ('单号', Code);
835
+ // printEntity.headerMap.set ('门店', Store.Name || '');
836
+ // printEntity.headerMap.set ('POS编码', POSCode || '');
837
+ // printEntity.headerMap.set ('POS名称', POSName || '');
838
+ // printEntity.headerMap.set ('收 银 员', UserName || '');
839
+ // printEntity.headerMap.set (
840
+ // '上班日期',
841
+ // WorkingDate + " " +WorkingTime
842
+ // );
843
+ // printEntity.headerMap.set (
844
+ // type == 'Duty' ? '交班日期' : '日结日期',
845
+ // type == 'Duty' ? ShiftDate + " " + ShiftTime : DailyDate + " " + DailyTime
846
+ // );
847
+
848
+ // printEntity.footerMap1.set ('销售金额', tool.format (RetailAmount) || '0.00');
849
+ // printEntity.footerMap1.set ('退货金额', tool.format (ReturnAmount) || '0.00');
850
+ // printEntity.footerMap1.set (
851
+ // '净销售金额',
852
+ // tool.format (RetailAmount + ReturnAmount) || '0.00'
853
+ // );
854
+ // printEntity.footerMap1.set (
855
+ // '储值销售金额',
856
+ // tool.format (SalesStorageTotalAmount) || '0.00'
857
+ // );
858
+ // printEntity.footerMap1.set (
859
+ // '抵现销售金额',
860
+ // tool.format (CashOutAmount) || '0.00'
861
+ // );
862
+ // printEntity.footerMap1.set (
863
+ // '券抵扣(负劳务行)',
864
+ // tool.format (CouponsDeduct) || '0.00'
865
+ // );
866
+ // const { Differentiate } = enumController.getEnumOj();
867
+ // printEntity.footerMap1.set (`${Differentiate.COUPON}抵扣`, tool.format (CouponsAmount) || '0.00');
868
+ // printEntity.footerMap1.set ('线上收款金额', tool.format (OnlineAmount) || '0.00');
869
+ // printEntity.footerMap1.set ('水单总数', TotalCount || '0');
870
+ // printEntity.footerMap1.set ('来客数量', TotalCustom || '0');
871
+ // printEntity.footerMap1.set ('客单价', tool.format (Price) || '0.00');
872
+
873
+ // printEntity.detailTopList.push ({
874
+ // Caption: '结算方式',
875
+ // IsTitle: false,
876
+ // IsFoot: false,
877
+ // });
878
+ // printEntity.detailTopList.push ({
879
+ // Caption: '零售收款金额',
880
+ // IsTitle: false,
881
+ // IsFoot: false,
882
+ // });
883
+ // printEntity.detailTopList.push ({
884
+ // Caption: '储值金额',
885
+ // IsTitle: false,
886
+ // IsFoot: false,
887
+ // });
888
+
889
+ // let details = [];
890
+ // let DailyDetailsCommon = [];
891
+ // if (type == 'Duty') {
892
+ // DailyDetailsCommon = ShiftVoucherDetails;
893
+ // } else {
894
+ // DailyDetailsCommon = DailyDetails;
895
+ // }
896
+ // if (DailyDetailsCommon && DailyDetailsCommon.length != 0) {
897
+ // DailyDetailsCommon.forEach (detailsOb => {
898
+ // const { OrigAmount, MemberDepositAmount,SettleStyle} = detailsOb;
899
+ // const { Name } = SettleStyle || {}
900
+ // details.push ([
901
+ // Name,
902
+ // tool.format (OrigAmount) || '0.00',
903
+ // tool.format (MemberDepositAmount) || '0.00',
904
+ // ]);
905
+ // });
906
+ // }
907
+ // printEntity.detailContentList.push (...details);
908
+
909
+ // templateContent += '\n';
910
+ // // printEntity.footerMap2.set('现金', BalanceIntegral || '');
911
+ // printEntity.footerMap2.set (
912
+ // '备用金初始金额',
913
+ // tool.format (InitialAmount) || '0.00'
914
+ // );
915
+ // printEntity.footerMap2.set ('增减备用金', tool.format (ImprestAmount) || '0.00');
916
+ // printEntity.footerMap2.set (
917
+ // '备用金余额',
918
+ // tool.format (InitialAmount+ImprestAmount) || '0.00'
919
+ // );
920
+ // // 设定打印尺寸
921
+ // BTPrintFormatUtil.setLineByteSize (this.lineSize);
922
+
923
+ // //单据头部
924
+ // templateContent += '\n';
925
+ // templateContent += BTPrintFormatUtil.printTitle (
926
+ // type == 'Duty' ? '交班' : '日结'
927
+ // );
928
+ // templateContent += BTPrintFormatUtil.drawSeparateLine ();
929
+ // if (printEntity.headerMap && printEntity.headerMap.size > 0) {
930
+ // templateContent += BTPrintFormatUtil.leftPrintMsg (printEntity.headerMap);
931
+ // }
932
+ // templateContent += '\n';
933
+ // templateContent += BTPrintFormatUtil.printStarTitle ('销售看板');
934
+ // templateContent += BTPrintFormatUtil.drawSeparateLine ();
935
+ // //单据底部1
936
+ // if (printEntity.footerMap1 && printEntity.footerMap1.size > 0) {
937
+ // templateContent += BTPrintFormatUtil.leftPrintMsg (
938
+ // printEntity.footerMap1
939
+ // );
940
+ // }
941
+ // templateContent += '\n';
942
+ // templateContent += BTPrintFormatUtil.printStarTitle ('收银统计');
943
+ // templateContent += BTPrintFormatUtil.drawSeparateLine ();
944
+
945
+ // //单据内容--头部
946
+ // let mhList = [];
947
+ // if (printEntity.detailTopList && printEntity.detailTopList.length > 0) {
948
+ // printEntity.detailTopList.forEach (item => {
949
+ // let mh = {
950
+ // headerText: item.Caption,
951
+ // headerWeight: 1,
952
+ // isTitle: item.IsTitle,
953
+ // isFoot: item.IsFoot,
954
+ // };
955
+ // mhList.push (mh);
956
+ // });
957
+ // }
958
+ // //单据内容--明细
959
+ // let bodyValueList = [];
960
+ // printEntity.detailContentList.forEach (items => {
961
+ // let bodyValue = [];
962
+ // items.forEach (item => {
963
+ // bodyValue.push (item);
964
+ // });
965
+ // bodyValueList.push (bodyValue);
966
+ // });
967
+ // templateContent += BTPrintFormatUtil.printMenuMSG (
968
+ // bodyValueList,
969
+ // mhList,
970
+ // true
971
+ // );
972
+
973
+ // //单据底部2
974
+ // if (printEntity.footerMap2 && printEntity.footerMap2.size > 0) {
975
+ // templateContent += BTPrintFormatUtil.leftPrintMsg (
976
+ // printEntity.footerMap2
977
+ // );
978
+ // }
979
+ // templateContent += BTPrintFormatUtil.drawSeparateLine2 ();
980
+ // templateContent += '备注:'+ (Memo || '');
981
+ // templateContent += '\n'; //备注
982
+ // templateContent += '\n';
983
+ // templateContent += BTPrintFormatUtil.spaceCenterPrintMsg (
984
+ // '收银员签字:',
985
+ // '收银主管签字:'
986
+ // );
987
+ // templateContent += '\n\n\n\n';
988
+ // return templateContent;
989
+ // };
990
+
107
991
  //正常打印机(58mm)数据 小票打印
108
992
 
109
993
 
@@ -122,606 +1006,7 @@ var PrintUtil = (_temp = _class = function () {
122
1006
  }
123
1007
  }]);
124
1008
  return PrintUtil;
125
- }(), _initialiseProps = function _initialiseProps() {
126
- var _this2 = this;
127
-
128
- this.doTestPrint = function (printParams, callback) {
129
- _this2.cloudAddList(printParams, function (result) {
130
- var ret = result.ret;
131
-
132
- if (ret === 0) {
133
- _this2.cloudPrint('\n\n' + '飞蛾打印机测试打印成功。' + '\n\n', printParams, callback);
134
- } else {
135
- if (typeof callback == 'function') callback(result);
136
- }
137
- });
138
- };
139
-
140
- this.doPrint = function (printParams, Id, callback) {
141
- if (!printParams || !Id) return;
142
- var _this = _this2;
143
- _api2.default.getPrintDataInfo(Id).then(function (ret) {
144
- var _ref2 = ret || {},
145
- Store = _ref2.Store,
146
- UserName = _ref2.UserName,
147
- Code = _ref2.Code,
148
- CreatedTime = _ref2.CreatedTime,
149
- TotalCount = _ref2.TotalCount,
150
- TotalTaxAmount = _ref2.TotalTaxAmount,
151
- WipeChange = _ref2.WipeChange,
152
- RetailDetails = _ref2.RetailDetails,
153
- Member = _ref2.Member,
154
- BalanceIntegral = _ref2.BalanceIntegral,
155
- Integral = _ref2.Integral,
156
- BalanceStorage = _ref2.BalanceStorage,
157
- RetailPaymentDetails = _ref2.RetailPaymentDetails;
158
-
159
- var details = [];
160
-
161
- Member = _tools2.default.changePrivateInfo(Member, 'print');
162
-
163
- if (RetailDetails && RetailDetails.length > 0) {
164
- RetailDetails.map(function (item) {
165
- var quantity = _this2.toDecimal2NoZero(item.Quantity);
166
- // tool.formatPrecision (
167
- // item.Quantity,
168
- // this.Precision.Quantity
169
- // );
170
- quantity += item.Unit.Name;
171
- var taxPrice = _this2.toDecimal2NoZero(item.TaxPrice);
172
- // item.TaxPrice,
173
- // this.Precision.Price
174
- var taxAmount = _mutantsUtil.tools.formatPrecision(item.TaxAmount, _this2.Precision.TaxAmount);
175
- details.push([item.Inventory.Name, quantity, taxPrice, taxAmount]);
176
- });
177
- }
178
- var constr = _this.loadBTPrintData({
179
- Store: Store,
180
- UserName: UserName,
181
- Code: Code,
182
- CreatedTime: CreatedTime,
183
- details: details,
184
- TotalCount: TotalCount,
185
- TotalTaxAmount: TotalTaxAmount,
186
- WipeChange: WipeChange,
187
- Member: Member,
188
- BalanceIntegral: BalanceIntegral,
189
- Integral: Integral,
190
- BalanceStorage: BalanceStorage,
191
- RetailPaymentDetails: RetailPaymentDetails
192
- });
193
- _this.cloudPrint(constr, printParams, callback);
194
- });
195
- };
196
-
197
- this.doDialyPrint = function (printParams, Id, callback) {
198
- if (!Id) return;
199
- var _this = _this2;
200
- _api2.default.getDialyPrintDataInfo(Id).then(function (ret) {
201
- var constr = _this.loadBTDutyAndDialyPrintData(ret, 'Dialy');
202
- _this.cloudPrint(constr, printParams, callback);
203
- });
204
- };
205
-
206
- this.doDutyPrint = function (printParams, Id, callback) {
207
- if (!Id) return;
208
- var _this = _this2;
209
- _api2.default.getDutyPrintDataInfo(Id).then(function (ret) {
210
- var constr = _this.loadBTDutyAndDialyPrintData(ret, 'Duty');
211
- _this.cloudPrint(constr, printParams, callback);
212
- });
213
- };
214
-
215
- this.doStoragePrint = function (printParams, Id, callback) {
216
- if (!Id) return;
217
- var _this = _this2;
218
- _api2.default.getStoragePrintDataInfo(Id).then(function (ret) {
219
- var _ref3 = ret || {},
220
- Store = _ref3.Store,
221
- StorageDetails = _ref3.StorageDetails,
222
- MadeDate = _ref3.MadeDate,
223
- Member = _ref3.Member,
224
- CardCode = _ref3.CardCode,
225
- StorageMutiSettleDetails = _ref3.StorageMutiSettleDetails,
226
- CreatedTime = _ref3.CreatedTime,
227
- Person = _ref3.Person;
228
-
229
- Member = _tools2.default.changePrivateInfo(Member, 'print');
230
- var constr = _this.loadBTStoragePrintData({
231
- Store: Store,
232
- StorageDetails: StorageDetails,
233
- MadeDate: MadeDate,
234
- Member: Member,
235
- CardCode: CardCode,
236
- StorageMutiSettleDetails: StorageMutiSettleDetails,
237
- CreatedTime: CreatedTime,
238
- Person: Person
239
- });
240
- _this.cloudPrint(constr, printParams, callback);
241
- });
242
- };
243
-
244
- this.loadBTStoragePrintData = function (params) {
245
- var templateContent = '';
246
- var printEntity = {};
247
-
248
- var _ref4 = params || {},
249
- Store = _ref4.Store,
250
- StorageDetails = _ref4.StorageDetails,
251
- CreatedTime = _ref4.CreatedTime,
252
- Member = _ref4.Member,
253
- CardCode = _ref4.CardCode,
254
- StorageMutiSettleDetails = _ref4.StorageMutiSettleDetails,
255
- Person = _ref4.Person;
256
-
257
- var _ref5 = Member || {},
258
- Mobilephone = _ref5.Mobilephone,
259
- MemberName = _ref5.Name;
260
-
261
- var _ref6 = Person || {},
262
- StorageName = _ref6.Name;
263
-
264
- var _ref7 = StorageDetails[0] || {},
265
- ThisStorageAmount = _ref7.ThisStorageAmount,
266
- ThisPresentAmount = _ref7.ThisPresentAmount,
267
- AfterBalanceStorage = _ref7.AfterBalanceStorage;
268
-
269
- printEntity.headerMap = new _map2.default();
270
- printEntity.footerMap1 = new _map2.default();
271
- printEntity.footerMap2 = new _map2.default();
272
- printEntity.headerMap.set('日期', CreatedTime || '');
273
- printEntity.headerMap.set('储值业务员', StorageName || '');
274
- printEntity.headerMap.set('会员卡号', CardCode || '');
275
- printEntity.headerMap.set('手机号', Mobilephone || '');
276
- printEntity.headerMap.set('会员姓名', MemberName || '');
277
- printEntity.headerMap.set('本次储存金额', _mutantsUtil.tools.format(ThisStorageAmount) || '');
278
- printEntity.headerMap.set('本次赠送金额', _mutantsUtil.tools.format(ThisPresentAmount) || '');
279
- printEntity.headerMap.set('本次储值后金额', _mutantsUtil.tools.format(AfterBalanceStorage) || '');
280
- if (StorageMutiSettleDetails && StorageMutiSettleDetails.length != 0) {
281
- StorageMutiSettleDetails.forEach(function (details) {
282
- var _ref8 = details || {},
283
- StorageAmount = _ref8.StorageAmount,
284
- SettleStyle = _ref8.SettleStyle;
285
-
286
- var _ref9 = SettleStyle || {},
287
- Name = _ref9.Name;
288
-
289
- printEntity.headerMap.set(Name, StorageAmount || '0.00');
290
- });
291
- }
292
- printEntity.headerMap.set('顾客签字', '');
293
-
294
- // 设定打印尺寸
295
- _BTPrintFormatUtil2.default.setLineByteSize(_this2.lineSize);
1009
+ }();
296
1010
 
297
- //单据头部
298
- templateContent += '\n';
299
- templateContent += _BTPrintFormatUtil2.default.printTitle(Store.Name || '');
300
- if (printEntity.headerMap && printEntity.headerMap.size > 0) {
301
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.headerMap);
302
- }
303
- templateContent += '\n\n\n\n';
304
- return templateContent;
305
- };
306
-
307
- this.loadBTDutyAndDialyPrintData = function (params, type) {
308
- var _printEntity$detailCo;
309
-
310
- var templateContent = '';
311
- var printEntity = {};
312
-
313
- var _ref10 = params || {},
314
- Code = _ref10.Code,
315
- Store = _ref10.Store,
316
- UserName = _ref10.UserName,
317
- POSCode = _ref10.POSCode,
318
- POS = _ref10.POS,
319
- POSName = _ref10.POSName,
320
- WorkingDate = _ref10.WorkingDate,
321
- StartDate = _ref10.StartDate,
322
- ShiftDate = _ref10.ShiftDate,
323
- DailyDate = _ref10.DailyDate,
324
- RetailAmount = _ref10.RetailAmount,
325
- ReturnAmount = _ref10.ReturnAmount,
326
- SalesStorageTotalAmount = _ref10.SalesStorageTotalAmount,
327
- CashOutAmount = _ref10.CashOutAmount,
328
- CouponsDeduct = _ref10.CouponsDeduct,
329
- CouponsAmount = _ref10.CouponsAmount,
330
- OnlineAmount = _ref10.OnlineAmount,
331
- TotalCount = _ref10.TotalCount,
332
- TotalCustom = _ref10.TotalCustom,
333
- Price = _ref10.Price,
334
- InitialAmount = _ref10.InitialAmount,
335
- ImprestAmount = _ref10.ImprestAmount,
336
- ImprestBalanceAmount = _ref10.ImprestBalanceAmount,
337
- ShiftVoucherDetails = _ref10.ShiftVoucherDetails,
338
- DailyDetails = _ref10.DailyDetails,
339
- WorkingTime = _ref10.WorkingTime,
340
- ShiftTime = _ref10.ShiftTime,
341
- StartTime = _ref10.StartTime,
342
- DailyTime = _ref10.DailyTime,
343
- Memo = _ref10.Memo;
344
-
345
- printEntity.headerMap = new _map2.default();
346
- printEntity.footerMap1 = new _map2.default();
347
- printEntity.footerMap2 = new _map2.default();
348
- printEntity.detailTopList = [];
349
- printEntity.detailContentList = [];
350
- printEntity.headerMap.set('单号', Code);
351
- printEntity.headerMap.set('门店', Store.Name || '');
352
- printEntity.headerMap.set('POS编码', POSCode || '');
353
- printEntity.headerMap.set('POS名称', POSName || '');
354
- printEntity.headerMap.set('收 银 员', UserName || '');
355
- printEntity.headerMap.set('上班日期', WorkingDate + " " + WorkingTime);
356
- printEntity.headerMap.set(type == 'Duty' ? '交班日期' : '日结日期', type == 'Duty' ? ShiftDate + " " + ShiftTime : DailyDate + " " + DailyTime);
357
-
358
- printEntity.footerMap1.set('销售金额', _mutantsUtil.tools.format(RetailAmount) || '0.00');
359
- printEntity.footerMap1.set('退货金额', _mutantsUtil.tools.format(ReturnAmount) || '0.00');
360
- printEntity.footerMap1.set('净销售金额', _mutantsUtil.tools.format(RetailAmount + ReturnAmount) || '0.00');
361
- printEntity.footerMap1.set('储值销售金额', _mutantsUtil.tools.format(SalesStorageTotalAmount) || '0.00');
362
- printEntity.footerMap1.set('抵现销售金额', _mutantsUtil.tools.format(CashOutAmount) || '0.00');
363
- printEntity.footerMap1.set('券抵扣(负劳务行)', _mutantsUtil.tools.format(CouponsDeduct) || '0.00');
364
-
365
- var _enumController$getEn2 = _mutantsUtil.enumController.getEnumOj(),
366
- Differentiate = _enumController$getEn2.Differentiate;
367
-
368
- printEntity.footerMap1.set(Differentiate.COUPON + '\u62B5\u6263', _mutantsUtil.tools.format(CouponsAmount) || '0.00');
369
- printEntity.footerMap1.set('线上收款金额', _mutantsUtil.tools.format(OnlineAmount) || '0.00');
370
- printEntity.footerMap1.set('水单总数', TotalCount || '0');
371
- printEntity.footerMap1.set('来客数量', TotalCustom || '0');
372
- printEntity.footerMap1.set('客单价', _mutantsUtil.tools.format(Price) || '0.00');
373
-
374
- printEntity.detailTopList.push({
375
- Caption: '结算方式',
376
- IsTitle: false,
377
- IsFoot: false
378
- });
379
- printEntity.detailTopList.push({
380
- Caption: '零售收款金额',
381
- IsTitle: false,
382
- IsFoot: false
383
- });
384
- printEntity.detailTopList.push({
385
- Caption: '储值金额',
386
- IsTitle: false,
387
- IsFoot: false
388
- });
389
-
390
- var details = [];
391
- var DailyDetailsCommon = [];
392
- if (type == 'Duty') {
393
- DailyDetailsCommon = ShiftVoucherDetails;
394
- } else {
395
- DailyDetailsCommon = DailyDetails;
396
- }
397
- if (DailyDetailsCommon && DailyDetailsCommon.length != 0) {
398
- DailyDetailsCommon.forEach(function (detailsOb) {
399
- var OrigAmount = detailsOb.OrigAmount,
400
- MemberDepositAmount = detailsOb.MemberDepositAmount,
401
- SettleStyle = detailsOb.SettleStyle;
402
-
403
- var _ref11 = SettleStyle || {},
404
- Name = _ref11.Name;
405
-
406
- details.push([Name, _mutantsUtil.tools.format(OrigAmount) || '0.00', _mutantsUtil.tools.format(MemberDepositAmount) || '0.00']);
407
- });
408
- }
409
- (_printEntity$detailCo = printEntity.detailContentList).push.apply(_printEntity$detailCo, details);
410
-
411
- templateContent += '\n';
412
- // printEntity.footerMap2.set('现金', BalanceIntegral || '');
413
- printEntity.footerMap2.set('备用金初始金额', _mutantsUtil.tools.format(InitialAmount) || '0.00');
414
- printEntity.footerMap2.set('增减备用金', _mutantsUtil.tools.format(ImprestAmount) || '0.00');
415
- printEntity.footerMap2.set('备用金余额', _mutantsUtil.tools.format(InitialAmount + ImprestAmount) || '0.00');
416
- // 设定打印尺寸
417
- _BTPrintFormatUtil2.default.setLineByteSize(_this2.lineSize);
418
-
419
- //单据头部
420
- templateContent += '\n';
421
- templateContent += _BTPrintFormatUtil2.default.printTitle(type == 'Duty' ? '交班' : '日结');
422
- templateContent += _BTPrintFormatUtil2.default.drawSeparateLine();
423
- if (printEntity.headerMap && printEntity.headerMap.size > 0) {
424
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.headerMap);
425
- }
426
- templateContent += '\n';
427
- templateContent += _BTPrintFormatUtil2.default.printStarTitle('销售看板');
428
- templateContent += _BTPrintFormatUtil2.default.drawSeparateLine();
429
- //单据底部1
430
- if (printEntity.footerMap1 && printEntity.footerMap1.size > 0) {
431
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.footerMap1);
432
- }
433
- templateContent += '\n';
434
- templateContent += _BTPrintFormatUtil2.default.printStarTitle('收银统计');
435
- templateContent += _BTPrintFormatUtil2.default.drawSeparateLine();
436
-
437
- //单据内容--头部
438
- var mhList = [];
439
- if (printEntity.detailTopList && printEntity.detailTopList.length > 0) {
440
- printEntity.detailTopList.forEach(function (item) {
441
- var mh = {
442
- headerText: item.Caption,
443
- headerWeight: 1,
444
- isTitle: item.IsTitle,
445
- isFoot: item.IsFoot
446
- };
447
- mhList.push(mh);
448
- });
449
- }
450
- //单据内容--明细
451
- var bodyValueList = [];
452
- printEntity.detailContentList.forEach(function (items) {
453
- var bodyValue = [];
454
- items.forEach(function (item) {
455
- bodyValue.push(item);
456
- });
457
- bodyValueList.push(bodyValue);
458
- });
459
- templateContent += _BTPrintFormatUtil2.default.printMenuMSG(bodyValueList, mhList, true);
460
-
461
- //单据底部2
462
- if (printEntity.footerMap2 && printEntity.footerMap2.size > 0) {
463
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.footerMap2);
464
- }
465
- templateContent += _BTPrintFormatUtil2.default.drawSeparateLine2();
466
- templateContent += '备注:' + (Memo || '');
467
- templateContent += '\n'; //备注
468
- templateContent += '\n';
469
- templateContent += _BTPrintFormatUtil2.default.spaceCenterPrintMsg('收银员签字:', '收银主管签字:');
470
- templateContent += '\n\n\n\n';
471
- return templateContent;
472
- };
473
-
474
- this.loadBTPrintData = function (params) {
475
- var _printEntity$paymentT, _printEntity$detailCo2;
476
-
477
- var templateContent = '';
478
- var printEntity = {};
479
-
480
- var _ref12 = params || {},
481
- Store = _ref12.Store,
482
- UserName = _ref12.UserName,
483
- Code = _ref12.Code,
484
- CreatedTime = _ref12.CreatedTime,
485
- details = _ref12.details,
486
- TotalCount = _ref12.TotalCount,
487
- TotalTaxAmount = _ref12.TotalTaxAmount,
488
- WipeChange = _ref12.WipeChange,
489
- Member = _ref12.Member,
490
- BalanceIntegral = _ref12.BalanceIntegral,
491
- Integral = _ref12.Integral,
492
- BalanceStorage = _ref12.BalanceStorage,
493
- RetailPaymentDetails = _ref12.RetailPaymentDetails;
494
-
495
- printEntity.headerMap = new _map2.default();
496
- printEntity.detailTopList = [];
497
- printEntity.paymentTypeTopList = [];
498
- printEntity.paymentTypeDetailList = [];
499
- printEntity.detailContentList = [];
500
- printEntity.footerMap1 = new _map2.default();
501
- printEntity.footerMap2 = new _map2.default();
502
- printEntity.headerMap.set('门店名称', Store.Name || '');
503
- printEntity.headerMap.set('门店电话', Store.Telephone || '');
504
- printEntity.headerMap.set('收银员', UserName || '');
505
- printEntity.headerMap.set('单号', Code);
506
- printEntity.headerMap.set('日期', CreatedTime || '');
507
- printEntity.detailTopList.push({
508
- Caption: '商品名称',
509
- IsTitle: true,
510
- IsFoot: false
511
- });
512
- printEntity.detailTopList.push({
513
- Caption: '数量',
514
- IsTitle: false,
515
- IsFoot: false
516
- });
517
- printEntity.detailTopList.push({
518
- Caption: '单价',
519
- IsTitle: false,
520
- IsFoot: false
521
- });
522
- printEntity.detailTopList.push({
523
- Caption: '金额',
524
- IsTitle: false,
525
- IsFoot: false
526
- });
527
-
528
- //支付方式
529
- printEntity.paymentTypeTopList.push({
530
- Caption: '支付方式',
531
- IsTitle: false,
532
- IsFoot: false
533
- });
534
- printEntity.paymentTypeTopList.push({
535
- Caption: '金额',
536
- IsTitle: false,
537
- IsFoot: false
538
- });
539
- (_printEntity$paymentT = printEntity.paymentTypeDetailList).push.apply(_printEntity$paymentT, (0, _toConsumableArray3.default)(RetailPaymentDetails));
540
-
541
- (_printEntity$detailCo2 = printEntity.detailContentList).push.apply(_printEntity$detailCo2, (0, _toConsumableArray3.default)(details));
542
- printEntity.footerMap1.set('数量', TotalCount);
543
- printEntity.footerMap1.set('金额', TotalTaxAmount);
544
- printEntity.footerMap1.set('抹零', WipeChange || '0.00');
545
-
546
- printEntity.footerMap2.set('会员卡号', Member && Member.CardCode || '');
547
- printEntity.footerMap2.set('会员手机', Member && Member.Mobilephone || '');
548
- printEntity.footerMap2.set('积分余额', BalanceIntegral || '0');
549
- printEntity.footerMap2.set('本次积分', Integral || '0');
550
- printEntity.footerMap2.set('储值余额', BalanceStorage || '0.00');
551
- // 设定打印尺寸
552
- _BTPrintFormatUtil2.default.setLineByteSize(_this2.lineSize);
553
-
554
- //单据头部
555
- templateContent += '\n';
556
- if (printEntity.headerMap && printEntity.headerMap.size > 0) {
557
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.headerMap);
558
- }
559
-
560
- templateContent += '\n';
561
-
562
- //单据内容--头部
563
- var mhList = [];
564
- if (printEntity.detailTopList && printEntity.detailTopList.length > 0) {
565
- printEntity.detailTopList.forEach(function (item) {
566
- var mh = {
567
- headerText: item.Caption,
568
- headerWeight: 1,
569
- isTitle: item.IsTitle,
570
- isFoot: item.IsFoot
571
- };
572
- mhList.push(mh);
573
- });
574
- }
575
- //单据内容--明细
576
- var bodyValueList = [];
577
- printEntity.detailContentList.forEach(function (items) {
578
- var bodyValue = [];
579
- items.forEach(function (item) {
580
- bodyValue.push(item);
581
- });
582
- bodyValueList.push(bodyValue);
583
- });
584
- templateContent += _BTPrintFormatUtil2.default.printMenuMSG(bodyValueList, mhList, true);
585
-
586
- //单据底部1
587
- if (printEntity.footerMap1 && printEntity.footerMap1.size > 0) {
588
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.footerMap1);
589
- }
590
- templateContent += _BTPrintFormatUtil2.default.drawSeparateLine();
591
- templateContent += '\n';
592
-
593
- //支付方式--头部
594
- var phList = [];
595
- if (printEntity.paymentTypeTopList && printEntity.paymentTypeTopList.length > 0) {
596
- printEntity.paymentTypeTopList.forEach(function (item, index) {
597
- var mh = {
598
- headerText: item.Caption,
599
- headerWeight: index == 0 ? 3 : 1,
600
- isTitle: item.IsTitle,
601
- isFoot: item.IsFoot
602
- };
603
- phList.push(mh);
604
- });
605
- }
606
- //支付方式--明细
607
- var pBodyValueList = [];
608
- printEntity.paymentTypeDetailList.forEach(function (items) {
609
- var bodyValue = [];
610
- var _items$Amount = items.Amount,
611
- Amount = _items$Amount === undefined ? '0.00' : _items$Amount,
612
- _items$SettleStyle$Na = items.SettleStyle.Name,
613
- Name = _items$SettleStyle$Na === undefined ? "其他方式" : _items$SettleStyle$Na;
614
-
615
- bodyValue.push(Name);
616
- bodyValue.push(_mutantsUtil.tools.format(Amount));
617
- pBodyValueList.push(bodyValue);
618
- });
619
- templateContent += _BTPrintFormatUtil2.default.printMenuMSG(pBodyValueList, phList, true);
620
-
621
- //单据底部2
622
- if (printEntity.footerMap2 && printEntity.footerMap2.size > 0) {
623
- templateContent += _BTPrintFormatUtil2.default.leftPrintMsg(printEntity.footerMap2);
624
- }
625
- templateContent += '\n';
626
- templateContent += _BTPrintFormatUtil2.default.drawSeparateLine2();
627
- templateContent += '\n';
628
- templateContent += '\t谢谢惠顾,欢迎再次光临';
629
- templateContent += '\n\n\n';
630
- return templateContent;
631
- };
632
-
633
- this.cloudPrint = function (cloudContents, printParams, callback) {
634
- var _ref13 = printParams || {},
635
- Open = _ref13.Open,
636
- Key = _ref13.Key,
637
- Sign = _ref13.Sign,
638
- Name = _ref13.Name,
639
- Card = _ref13.Card;
640
- // 商米没有配置则调用本地打印接口
641
-
642
-
643
- if (_this2.isHorizontalSunMi && !Open) {
644
- console.log(cloudContents);
645
- _this2.sunmiPrint(cloudContents, callback);
646
- } else if (Open) {
647
- var _ref14 = printParams || {},
648
- _Key = _ref14.Key,
649
- _Sign = _ref14.Sign,
650
- _Name = _ref14.Name,
651
- _Card = _ref14.Card;
652
-
653
- var arr = [];
654
- arr.push(_Sign, _Key);
655
- if (_Name) arr.push(_Name);
656
- if (_Card) arr.push(_Card);
657
- var printerContent = arr.join('#');
658
- var PrintCount = _this2.PrintCount; //打印次数
659
- _api2.default.openPrintMsg({
660
- content: cloudContents,
661
- printerContent: printerContent,
662
- apiname: 'Open_printMsg',
663
- deviceCode: _Sign,
664
- times: PrintCount
665
- }).then(function (s) {
666
- if (typeof callback == 'function' && s && s.data) callback(s.data);
667
- });
668
- }
669
- };
670
-
671
- this.sunmiPrint = function (cloudContents, callback) {
672
- window.sunMi_OperatingCashier && window.sunMi_OperatingCashier
673
- // 检测打印机状态
674
- .updatePrinterState().then(function (status) {
675
- var _ref15 = status || {},
676
- state = _ref15.state,
677
- message = _ref15.message;
678
-
679
- if (state == 1) {
680
- window.sunMi_OperatingCashier && window.sunMi_OperatingCashier.PrintSmallTicketter(cloudContents + '\n\n').then(function (ret) {
681
- if (ret && ret.state && ret.state == 200) {
682
- callback && callback({
683
- ret: 0,
684
- msg: "打印成功"
685
- });
686
- } else {
687
- callback && callback({
688
- ret: -1,
689
- msg: ret.message ? ret.message : "打印失败"
690
- });
691
- }
692
- });
693
- } else {
694
- callback && callback({
695
- ret: -1,
696
- msg: message ? message : "打印失败"
697
- });
698
- }
699
- });
700
- };
701
-
702
- this.cloudAddList = function (printParams, callback) {
703
- var _ref16 = printParams || {},
704
- Key = _ref16.Key,
705
- Sign = _ref16.Sign,
706
- Name = _ref16.Name,
707
- Card = _ref16.Card;
708
-
709
- var arr = [];
710
- arr.push(Sign, Key);
711
- if (Name) arr.push(Name);
712
- if (Card) arr.push(Card);
713
- var printerContent = arr.join('#');
714
- var PrintCount = _this2.PrintCount; //按照添加一次的
715
- _api2.default.openPrinterAddlist({
716
- content: '',
717
- printerContent: printerContent,
718
- apiname: 'Open_printerAddlist',
719
- deviceCode: Sign,
720
- times: PrintCount
721
- }).then(function (s) {
722
- if (typeof callback == 'function' && s && s.data) callback(s.data);
723
- });
724
- };
725
- }, _temp);
726
1011
  exports.default = PrintUtil;
727
1012
  //# sourceMappingURL=index.js.map