tplus-components-touch 3.41.3 → 3.41.6

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