ts-glitter 19.0.4 → 19.0.5

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 (31) hide show
  1. package/lowcode/Entry.js +3 -3
  2. package/lowcode/Entry.ts +3 -3
  3. package/lowcode/cms-plugin/POS-setting.js +1 -1
  4. package/lowcode/cms-plugin/POS-setting.ts +1 -1
  5. package/lowcode/cms-plugin/pos-pages/imin-module.js +39 -30
  6. package/lowcode/cms-plugin/pos-pages/imin-module.ts +44 -39
  7. package/lowcode/cms-plugin/pos-pages/payment-page.js +9 -6
  8. package/lowcode/cms-plugin/pos-pages/payment-page.ts +9 -6
  9. package/lowcode/cms-plugin/pos-pages/pos-function.js +1 -1
  10. package/lowcode/cms-plugin/pos-pages/pos-function.ts +1 -1
  11. package/lowcode/cms-plugin/pos-pages/products-page.js +6 -4
  12. package/lowcode/cms-plugin/pos-pages/products-page.ts +6 -4
  13. package/lowcode/cms-plugin/shopping-invoice-manager.js +67 -44
  14. package/lowcode/cms-plugin/shopping-invoice-manager.ts +81 -54
  15. package/lowcode/cms-plugin/shopping-product-setting.js +13 -3
  16. package/lowcode/cms-plugin/shopping-product-setting.ts +31 -9
  17. package/lowcode/glitter-base/route/shopping.js +16 -0
  18. package/lowcode/glitter-base/route/shopping.ts +20 -0
  19. package/lowcode/jslib/qrcode-d.js +609 -0
  20. package/package.json +1 -1
  21. package/src/api-public/controllers/invoice.js +18 -0
  22. package/src/api-public/controllers/invoice.js.map +1 -1
  23. package/src/api-public/controllers/invoice.ts +17 -0
  24. package/src/api-public/services/invoice.js.map +1 -1
  25. package/src/api-public/services/invoice.ts +1 -0
  26. package/src/api-public/services/public-table-check.js +5 -3
  27. package/src/api-public/services/public-table-check.js.map +1 -1
  28. package/src/api-public/services/public-table-check.ts +5 -3
  29. package/src/api-public/services/shopping.js +17 -17
  30. package/src/api-public/services/shopping.js.map +1 -1
  31. package/src/api-public/services/shopping.ts +27 -27
package/lowcode/Entry.js CHANGED
@@ -132,7 +132,7 @@ export class Entry {
132
132
  }
133
133
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
134
134
  console.log(`Entry-time:`, window.renderClock.stop());
135
- glitter.share.editerVersion = 'V_19.0.4';
135
+ glitter.share.editerVersion = 'V_19.0.5';
136
136
  glitter.share.start = new Date();
137
137
  const vm = { appConfig: [] };
138
138
  window.saasConfig = {
@@ -597,7 +597,7 @@ export class Entry {
597
597
  glitter.addMtScript([
598
598
  'https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js',
599
599
  'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js',
600
- glitter.root_path + 'jslib/qrcode.min.js',
600
+ glitter.root_path + 'jslib/qrcode-d.js',
601
601
  ], () => {
602
602
  }, () => {
603
603
  });
@@ -609,7 +609,7 @@ export class Entry {
609
609
  if (res.deviceType === 'SUNMI') {
610
610
  glitter.addMtScript([
611
611
  'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js',
612
- glitter.root_path + 'jslib/qrcode.min.js',
612
+ glitter.root_path + 'jslib/qrcode-d.js',
613
613
  ], () => {
614
614
  }, () => {
615
615
  });
package/lowcode/Entry.ts CHANGED
@@ -132,7 +132,7 @@ export class Entry {
132
132
  }
133
133
  (window as any).renderClock = (window as any).renderClock ?? createClock();
134
134
  console.log(`Entry-time:`, (window as any).renderClock.stop());
135
- glitter.share.editerVersion = 'V_19.0.4';
135
+ glitter.share.editerVersion = 'V_19.0.5';
136
136
  glitter.share.start = new Date();
137
137
  const vm = { appConfig: [] };
138
138
  (window as any).saasConfig = {
@@ -664,7 +664,7 @@ export class Entry {
664
664
  [
665
665
  'https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js',
666
666
  'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js',
667
- glitter.root_path + 'jslib/qrcode.min.js',
667
+ glitter.root_path + 'jslib/qrcode-d.js',
668
668
  ],
669
669
  () => {
670
670
  },
@@ -682,7 +682,7 @@ export class Entry {
682
682
  glitter.addMtScript(
683
683
  [
684
684
  'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js',
685
- glitter.root_path + 'jslib/qrcode.min.js',
685
+ glitter.root_path + 'jslib/qrcode-d.js',
686
686
  ],
687
687
  () => {
688
688
  },
@@ -645,7 +645,7 @@ cursor: pointer;
645
645
  else {
646
646
  return {
647
647
  class: `d-flex nav-left flex-column`,
648
- style: `height: 100%;gap:24px;padding-top:114px;position:fixed;left:0px;top:0px;background: #FFF;box-shadow: 1px 0px 10px 0px rgba(0, 0, 0, 0.05);z-index:10;`,
648
+ style: `height: 100%;gap:24px;padding-top:114px;position:fixed;left:0px;top:0px;background: #FFF;box-shadow: 1px 0px 10px 0px rgba(0, 0, 0, 0.05);z-index:15;`,
649
649
  };
650
650
  }
651
651
  },
@@ -763,7 +763,7 @@ cursor: pointer;
763
763
  } else {
764
764
  return {
765
765
  class: `d-flex nav-left flex-column`,
766
- style: `height: 100%;gap:24px;padding-top:114px;position:fixed;left:0px;top:0px;background: #FFF;box-shadow: 1px 0px 10px 0px rgba(0, 0, 0, 0.05);z-index:10;`,
766
+ style: `height: 100%;gap:24px;padding-top:114px;position:fixed;left:0px;top:0px;background: #FFF;box-shadow: 1px 0px 10px 0px rgba(0, 0, 0, 0.05);z-index:15;`,
767
767
  };
768
768
  }
769
769
  },
@@ -161,25 +161,26 @@ ${tempDiv.querySelector('.invoice-detail-sum').children[2].textContent.replace(/
161
161
  }
162
162
  function generateQRCode(text, size) {
163
163
  return new Promise((resolve) => {
164
- const div = document.createElement('div');
165
- let qr = new QRCode(div, {
166
- text: text,
167
- width: size,
168
- height: size,
169
- correctLevel: 1,
170
- version: 40
171
- });
172
- setTimeout(() => {
173
- resolve(div.querySelector('canvas').toDataURL('image/png'));
174
- }, 200);
164
+ try {
165
+ const div = document.createElement('div');
166
+ var qrcode_R = new QRCode(div, {
167
+ text: text,
168
+ width: 50,
169
+ height: 50,
170
+ colorDark: "#000000",
171
+ colorLight: "#ffffff",
172
+ correctLevel: QRCode.CorrectLevel.M
173
+ });
174
+ setTimeout(() => {
175
+ resolve(div.querySelector('canvas').toDataURL('image/png'));
176
+ }, 200);
177
+ }
178
+ catch (e) {
179
+ console.log('qr生成失敗');
180
+ console.log('qr生成失敗', e);
181
+ }
175
182
  });
176
183
  }
177
- const ba = (new Blob([invoice.qrcode_0]).size - (new Blob([invoice.qrcode_1]).size)) * 1.1;
178
- console.log(`ba=>`, invoice.qrcode_0);
179
- console.log(`ba=>`, invoice.qrcode_1);
180
- for (let a = 0; a <= ba; a++) {
181
- invoice.qrcode_1 += '*';
182
- }
183
184
  mergeQRCodes([invoice.qrcode_0, invoice.qrcode_1]).then((res) => {
184
185
  console.log(`two-qrcode=>`, res);
185
186
  glitter.runJsInterFace('start-print', {
@@ -474,29 +475,37 @@ ${tempDiv.querySelector('.invoice-detail-sum').children[2].textContent.replace(/
474
475
  glitter.addMtScript([
475
476
  'https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js',
476
477
  'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js',
477
- glitter.root_path + 'jslib/qrcode.min.js',
478
+ glitter.root_path + 'jslib/qrcode-d.js',
478
479
  ], () => {
479
480
  function generateQRCode(text, size) {
480
481
  return new Promise((resolve) => {
481
- const div = document.createElement('div');
482
- let qr = new QRCode(div, {
483
- text: text,
484
- width: size,
485
- height: size,
486
- correctLevel: 1,
487
- version: 40,
488
- });
489
- setTimeout(() => {
490
- resolve(div.querySelector('canvas').toDataURL('image/png').split('base64,')[1]);
491
- }, 200);
482
+ try {
483
+ const div = document.createElement('div');
484
+ var qrcode_R = new QRCode(div, {
485
+ text: text,
486
+ width: 100,
487
+ height: 100,
488
+ colorDark: "#000000",
489
+ colorLight: "#ffffff",
490
+ correctLevel: QRCode.CorrectLevel.M
491
+ });
492
+ setTimeout(() => {
493
+ resolve(div.querySelector('canvas').toDataURL('image/png'));
494
+ }, 200);
495
+ }
496
+ catch (e) {
497
+ console.log('qr生成失敗');
498
+ console.log('qr生成失敗', e);
499
+ }
492
500
  });
493
501
  }
494
502
  generateQRCode(code, 185).then((res) => {
503
+ console.log(`two-qrcode=>`, res);
495
504
  glitter.runJsInterFace('start-print', {
496
505
  'command-list': [
497
506
  {
498
507
  key: 'print-bitmap', data: {
499
- base64: res,
508
+ base64: res.split('base64,')[1],
500
509
  height: 185,
501
510
  width: 185,
502
511
  },
@@ -5,7 +5,6 @@ import { PaymentPage } from './payment-page.js';
5
5
  export class IminModule {
6
6
  //列印發票
7
7
  public static async printInvoice(invoice: any, orderID: string, staff_title: string) {
8
-
9
8
  if (PayConfig.posType === 'SUNMI') {
10
9
  IminModule.printInvoiceSunMi(invoice, orderID, staff_title);
11
10
  return;
@@ -184,30 +183,28 @@ ${tempDiv.querySelector('.invoice-detail-sum')!!.children[2].textContent!.replac
184
183
 
185
184
  function generateQRCode(text: string, size: number) {
186
185
  return new Promise((resolve) => {
187
- const div = document.createElement('div');
188
- //@ts-ignore
189
- let qr = new QRCode(div, {
190
- text: text,
191
- width: size,
192
- height: size,
193
- correctLevel: 1,
194
- version:40
195
- });
196
-
197
- // 等待 QR Code 生成完畢
198
- setTimeout(() => {
199
- resolve(div.querySelector('canvas')!!.toDataURL('image/png'));
200
- }, 200); // 延遲等待 QRCode 完成渲染
186
+ try {
187
+ const div = document.createElement('div');
188
+ //@ts-ignore
189
+ var qrcode_R = new QRCode(div, {
190
+ text: text,
191
+ width: 50,
192
+ height: 50,
193
+ colorDark: "#000000",
194
+ colorLight: "#ffffff",
195
+ //@ts-ignore
196
+ correctLevel: QRCode.CorrectLevel.M
197
+ });
198
+ // 等待 QR Code 生成完畢
199
+ setTimeout(() => {
200
+ resolve(div.querySelector('canvas')!!.toDataURL('image/png'));
201
+ }, 200); // 延遲等待 QRCode 完成渲染
202
+ }catch (e) {
203
+ console.log('qr生成失敗')
204
+ console.log('qr生成失敗',e)
205
+ }
201
206
  });
202
207
  }
203
-
204
- const ba = (new Blob([invoice.qrcode_0]).size - (new Blob([invoice.qrcode_1]).size)) * 1.1;
205
- console.log(`ba=>`, invoice.qrcode_0);
206
- console.log(`ba=>`, invoice.qrcode_1);
207
- for (let a = 0; a <= ba; a++) {
208
- invoice.qrcode_1 += '*';
209
- }
210
-
211
208
  mergeQRCodes([invoice.qrcode_0, invoice.qrcode_1]).then((res) => {
212
209
  console.log(`two-qrcode=>`, res);
213
210
  glitter.runJsInterFace('start-print', {
@@ -511,35 +508,43 @@ ${tempDiv.querySelector('.invoice-detail-sum')!!.children[2].textContent!.replac
511
508
  [
512
509
  'https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js',
513
510
  'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js',
514
- glitter.root_path + 'jslib/qrcode.min.js',
511
+ glitter.root_path + 'jslib/qrcode-d.js',
515
512
  ],
516
513
  () => {
517
514
 
518
515
  function generateQRCode(text: string, size: number) {
519
516
  return new Promise((resolve) => {
520
- const div = document.createElement('div');
521
- //@ts-ignore
522
- let qr = new QRCode(div, {
523
- text: text,
524
- width: size,
525
- height: size,
526
- correctLevel: 1,
527
- version: 40,
528
- });
529
-
530
- // 等待 QR Code 生成完畢
531
- setTimeout(() => {
532
- resolve(div.querySelector('canvas')!!.toDataURL('image/png').split('base64,')[1]);
533
- }, 200); // 延遲等待 QRCode 完成渲染
517
+ try {
518
+ const div = document.createElement('div');
519
+ //@ts-ignore
520
+ var qrcode_R = new QRCode(div, {
521
+ text: text,
522
+ width: 100,
523
+ height: 100,
524
+ colorDark: "#000000",
525
+ colorLight: "#ffffff",
526
+ //@ts-ignore
527
+ correctLevel: QRCode.CorrectLevel.M
528
+ });
529
+ // 等待 QR Code 生成完畢
530
+ setTimeout(() => {
531
+
532
+ resolve(div.querySelector('canvas')!!.toDataURL('image/png'));
533
+ }, 200); // 延遲等待 QRCode 完成渲染
534
+ }catch (e) {
535
+ console.log('qr生成失敗')
536
+ console.log('qr生成失敗',e)
537
+ }
534
538
  });
535
539
  }
536
540
 
537
541
  generateQRCode(code, 185).then((res: any) => {
542
+ console.log(`two-qrcode=>`, res);
538
543
  glitter.runJsInterFace('start-print', {
539
544
  'command-list': [
540
545
  {
541
546
  key: 'print-bitmap', data: {
542
- base64: res,
547
+ base64: res.split('base64,')[1],
543
548
  height: 185,
544
549
  width: 185,
545
550
  },
@@ -169,10 +169,12 @@ export class PaymentPage {
169
169
  <div class="d-flex flex-column align-items-center justify-content-center" style="gap:5px;width:75px;">
170
170
  <div style="height: 20px;"></div>
171
171
  <div
172
- style="width: 54px;height: 54px;border-radius: 5px;background: 50%/cover url('${data.preview_image ||
172
+ style="width: 70px;height: 70px;
173
+ min-width: 70px;min-height: 70px;
174
+ border-radius: 5px;background: 50%/cover url('${data.preview_image ||
173
175
  'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg'}')"
174
176
  ></div>
175
- <div style="font-size: 14px;height: 20px;" class="fw-500 ${data.pre_order ? `text-danger` : ``}">
177
+ <div style="font-size: 13px;height: 20px;" class="fw-500 ${data.pre_order ? `text-danger` : ``}">
176
178
  庫存:${(() => {
177
179
  if (`${data.show_understocking}` === 'false') {
178
180
  return `不追蹤`;
@@ -184,18 +186,19 @@ export class PaymentPage {
184
186
  </div>
185
187
  </div>
186
188
  <div
187
- class="d-flex flex-column"
189
+ class="d-flex flex-column py-2"
188
190
  style="font-size: 16px;font-style: normal;font-weight: 500;letter-spacing: 0.64px;margin-left: 12px;"
189
191
  >
190
- <div class="d-flex align-items-center" style="gap:10px;">
191
- ${data.title}${(() => {
192
+ <div class="d-flex justify-content-center flex-column" style="gap:5px;">
193
+ ${(() => {
192
194
  if (!data.pre_order) {
193
195
  return ``;
194
196
  }
195
197
  else {
196
- return BgWidget.dangerInsignia('需預購');
198
+ return `<div>${BgWidget.dangerInsignia('需預購')}</div>`;
197
199
  }
198
200
  })()}
201
+ ${data.title}
199
202
  </div>
200
203
  <span
201
204
  style="color: #949494;
@@ -188,10 +188,12 @@ export class PaymentPage {
188
188
  <div class="d-flex flex-column align-items-center justify-content-center" style="gap:5px;width:75px;">
189
189
  <div style="height: 20px;"></div>
190
190
  <div
191
- style="width: 54px;height: 54px;border-radius: 5px;background: 50%/cover url('${data.preview_image ||
191
+ style="width: 70px;height: 70px;
192
+ min-width: 70px;min-height: 70px;
193
+ border-radius: 5px;background: 50%/cover url('${data.preview_image ||
192
194
  'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg'}')"
193
195
  ></div>
194
- <div style="font-size: 14px;height: 20px;" class="fw-500 ${data.pre_order ? `text-danger` : ``}">
196
+ <div style="font-size: 13px;height: 20px;" class="fw-500 ${data.pre_order ? `text-danger` : ``}">
195
197
  庫存:${(() => {
196
198
  if (`${data.show_understocking}` === 'false') {
197
199
  return `不追蹤`;
@@ -204,17 +206,18 @@ export class PaymentPage {
204
206
  </div>
205
207
  </div>
206
208
  <div
207
- class="d-flex flex-column"
209
+ class="d-flex flex-column py-2"
208
210
  style="font-size: 16px;font-style: normal;font-weight: 500;letter-spacing: 0.64px;margin-left: 12px;"
209
211
  >
210
- <div class="d-flex align-items-center" style="gap:10px;">
211
- ${data.title}${(() => {
212
+ <div class="d-flex justify-content-center flex-column" style="gap:5px;">
213
+ ${(() => {
212
214
  if (!data.pre_order) {
213
215
  return ``;
214
216
  } else {
215
- return BgWidget.dangerInsignia('需預購');
217
+ return `<div>${BgWidget.dangerInsignia('需預購')}</div>`;
216
218
  }
217
219
  })()}
220
+ ${data.title}
218
221
  </div>
219
222
  <span
220
223
  style="color: #949494;
@@ -311,7 +311,7 @@ export class PosFunction {
311
311
  },
312
312
  divCreate: {
313
313
  class: '',
314
- style: `width: 338px; max-height: 200px; overflow-y: auto; padding: 25px 20px; background: white; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15); border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px;`,
314
+ style: `width: 338px; max-height: 400px; overflow-y: auto; padding: 25px 20px; background: white; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15); border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px;`,
315
315
  },
316
316
  }));
317
317
  }, 'selectUserSwitch');
@@ -338,7 +338,7 @@ export class PosFunction {
338
338
  },
339
339
  divCreate: {
340
340
  class: '',
341
- style: `width: 338px; max-height: 200px; overflow-y: auto; padding: 25px 20px; background: white; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15); border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px;`,
341
+ style: `width: 338px; max-height: 400px; overflow-y: auto; padding: 25px 20px; background: white; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15); border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px;`,
342
342
  },
343
343
  }));
344
344
  }, 'selectUserSwitch');
@@ -357,7 +357,7 @@ export class ProductsPage {
357
357
  }
358
358
  return '非展會銷售規格';
359
359
  }
360
- if (selectVariant.show_understocking && selectVariant.stock === 0) {
360
+ if (selectVariant.show_understocking && selectVariant.stock <= 0) {
361
361
  return '預購商品';
362
362
  }
363
363
  return '加入購物車';
@@ -370,7 +370,7 @@ export class ProductsPage {
370
370
  !selectVariant.exhibition_type) {
371
371
  return 'gray';
372
372
  }
373
- return selectVariant.show_understocking && selectVariant.stock === 0
373
+ return selectVariant.show_understocking && selectVariant.stock <= 0
374
374
  ? `#FF6C02`
375
375
  : `#393939`;
376
376
  })()};min-height: 58px;`,
@@ -565,11 +565,13 @@ export class ProductsPage {
565
565
  .map((item, index) => {
566
566
  return html `
567
567
  ${index > 0 ? `<div style="background-color: #DDD;height:1px;width: 100%;"></div>` : ''}
568
- <div class="d-flex align-items-center" style="height: 87px;">
568
+ <div class="d-flex align-items-center" style="min-height: 87px;">
569
569
  <div
570
570
  class="rounded-3"
571
571
  style="background: 50%/cover url('${item.preview_image ||
572
- 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg'}');height: 67px;width: 66px;margin-right: 12px;"
572
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg'}');height: 67px;width: 66px;margin-right: 12px;
573
+ min-height: 67px;min-width: 66px;
574
+ "
573
575
  ></div>
574
576
  <div class="d-flex flex-column flex-fill">
575
577
  <div>${item.title}</div>
@@ -486,7 +486,7 @@ export class ProductsPage {
486
486
  }
487
487
  return '非展會銷售規格';
488
488
  }
489
- if (selectVariant.show_understocking && selectVariant.stock === 0) {
489
+ if (selectVariant.show_understocking && selectVariant.stock <= 0) {
490
490
  return '預購商品';
491
491
  }
492
492
  return '加入購物車';
@@ -501,7 +501,7 @@ export class ProductsPage {
501
501
  ) {
502
502
  return 'gray';
503
503
  }
504
- return selectVariant.show_understocking && selectVariant.stock === 0
504
+ return selectVariant.show_understocking && selectVariant.stock <= 0
505
505
  ? `#FF6C02`
506
506
  : `#393939`;
507
507
  })()};min-height: 58px;`,
@@ -726,11 +726,13 @@ export class ProductsPage {
726
726
  .map((item, index) => {
727
727
  return html`
728
728
  ${index > 0 ? `<div style="background-color: #DDD;height:1px;width: 100%;"></div>` : ''}
729
- <div class="d-flex align-items-center" style="height: 87px;">
729
+ <div class="d-flex align-items-center" style="min-height: 87px;">
730
730
  <div
731
731
  class="rounded-3"
732
732
  style="background: 50%/cover url('${item.preview_image ||
733
- 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg'}');height: 67px;width: 66px;margin-right: 12px;"
733
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg'}');height: 67px;width: 66px;margin-right: 12px;
734
+ min-height: 67px;min-width: 66px;
735
+ "
734
736
  ></div>
735
737
  <div class="d-flex flex-column flex-fill">
736
738
  <div>${item.title}</div>