ts-glitter 21.4.3 → 21.4.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 (37) hide show
  1. package/lowcode/Entry.js +2 -2
  2. package/lowcode/Entry.ts +2 -2
  3. package/lowcode/backend-manager/bg-product.js +8 -6
  4. package/lowcode/backend-manager/bg-product.ts +17 -15
  5. package/lowcode/backend-manager/bg-recommend.js +16 -5
  6. package/lowcode/backend-manager/bg-recommend.ts +15 -5
  7. package/lowcode/backend-manager/bg-widget.js +160 -160
  8. package/lowcode/backend-manager/bg-widget.ts +169 -166
  9. package/lowcode/cms-plugin/POS-setting.js +75 -23
  10. package/lowcode/cms-plugin/POS-setting.ts +87 -30
  11. package/lowcode/cms-plugin/menus-setting.js +165 -37
  12. package/lowcode/cms-plugin/menus-setting.ts +144 -21
  13. package/lowcode/cms-plugin/module/order-excel.js +8 -8
  14. package/lowcode/cms-plugin/module/order-excel.ts +10 -10
  15. package/lowcode/cms-plugin/module/stock-excel.js +184 -0
  16. package/lowcode/cms-plugin/module/stock-excel.ts +205 -0
  17. package/lowcode/cms-plugin/module/vendor-excel.js +375 -0
  18. package/lowcode/cms-plugin/module/vendor-excel.ts +450 -0
  19. package/lowcode/cms-plugin/order/order-module.js +6 -4
  20. package/lowcode/cms-plugin/order/order-module.ts +16 -14
  21. package/lowcode/cms-plugin/pos-pages/models.ts +6 -2
  22. package/lowcode/cms-plugin/pos-pages/products-page.js +589 -469
  23. package/lowcode/cms-plugin/pos-pages/products-page.ts +657 -491
  24. package/lowcode/cms-plugin/shopping-product-setting.js +7 -10
  25. package/lowcode/cms-plugin/shopping-product-setting.ts +12 -10
  26. package/lowcode/cms-plugin/shopping-setting-basic.js +2 -5
  27. package/lowcode/cms-plugin/shopping-setting-basic.ts +2 -5
  28. package/lowcode/cms-plugin/stock-history.js +39 -26
  29. package/lowcode/cms-plugin/stock-history.ts +58 -49
  30. package/lowcode/cms-plugin/stock-vendors.js +18 -13
  31. package/lowcode/cms-plugin/stock-vendors.ts +31 -16
  32. package/lowcode/public-components/layout-plugin/social-links-01.js +8 -0
  33. package/lowcode/public-components/layout-plugin/social-links-01.ts +15 -0
  34. package/package.json +1 -1
  35. package/src/api-public/services/schedule.js +6 -1
  36. package/src/api-public/services/schedule.js.map +1 -1
  37. package/src/api-public/services/schedule.ts +4 -1
@@ -3291,58 +3291,58 @@ ${obj.default ?? ''}</textarea
3291
3291
  const closeHeight = 56;
3292
3292
 
3293
3293
  obj.gvc.addStyle(`
3294
- .box-container-${text} {
3295
- position: relative;
3296
- height: ${closeHeight}px;
3297
- border: 1px solid #ddd;
3298
- border-radius: 10px;
3299
- overflow-y: hidden;
3300
- transition: height 0.3s ease-out;
3301
- }
3302
- .box-container-${text}.open-box {
3303
- max-height: ${height}px;
3304
- height: ${height}px;
3305
- overflow-y: auto;
3306
- }
3307
- .box-navbar-${text} {
3308
- position: sticky;
3309
- top: 0;
3310
- min-height: 20px;
3311
- background-color: #fff;
3312
- z-index: 10;
3313
- display: flex;
3314
- padding: 15px 20px;
3315
- align-items: flex-start;
3316
- justify-content: space-between;
3317
- cursor: pointer;
3318
- }
3319
- .arrow-icon-${text} {
3320
- color: #393939 !important;
3321
- box-shadow: none !important;
3322
- background-color: #fff !important;
3323
- background-image: url(${BgWidget.arrowDownDataImage('#000')}) !important;
3324
- background-repeat: no-repeat;
3325
- cursor: pointer;
3326
- height: 1rem;
3327
- border: 0;
3328
- margin-top: 0.35rem;
3329
- transition: transform 0.3s;
3330
- }
3331
- .arrow-icon-${text}.open-box {
3332
- margin-top: 0.15rem;
3333
- transform: rotate(180deg);
3334
- }
3335
- .box-inside-${text} {
3336
- padding: 0 1.5rem 1.5rem;
3337
- overflow-y: auto;
3338
- }
3294
+ .box-container-${text} {
3295
+ position: relative;
3296
+ height: ${closeHeight}px;
3297
+ border: 1px solid #ddd;
3298
+ border-radius: 10px;
3299
+ overflow-y: hidden;
3300
+ transition: height 0.3s ease-out;
3301
+ }
3302
+ .box-container-${text}.open-box {
3303
+ max-height: ${height}px;
3304
+ height: ${height}px;
3305
+ overflow-y: auto;
3306
+ }
3307
+ .box-navbar-${text} {
3308
+ position: sticky;
3309
+ top: 0;
3310
+ min-height: 20px;
3311
+ background-color: #fff;
3312
+ z-index: 10;
3313
+ display: flex;
3314
+ padding: 15px 20px;
3315
+ align-items: flex-start;
3316
+ justify-content: space-between;
3317
+ cursor: pointer;
3318
+ }
3319
+ .arrow-icon-${text} {
3320
+ color: #393939 !important;
3321
+ box-shadow: none !important;
3322
+ background-color: #fff !important;
3323
+ background-image: url(${BgWidget.arrowDownDataImage('#000')}) !important;
3324
+ background-repeat: no-repeat;
3325
+ cursor: pointer;
3326
+ height: 1rem;
3327
+ border: 0;
3328
+ margin-top: 0.35rem;
3329
+ transition: transform 0.3s;
3330
+ }
3331
+ .arrow-icon-${text}.open-box {
3332
+ margin-top: 0.15rem;
3333
+ transform: rotate(180deg);
3334
+ }
3335
+ .box-inside-${text} {
3336
+ padding: 0 1.5rem 1.5rem;
3337
+ overflow-y: auto;
3338
+ }
3339
3339
 
3340
- @media (max-width: 768px) {
3341
- .box-inside-${text} {
3342
- padding: 1rem;
3343
- }
3344
- }
3345
- `);
3340
+ @media (max-width: 768px) {
3341
+ .box-inside-${text} {
3342
+ padding: 1rem;
3343
+ }
3344
+ }
3345
+ `);
3346
3346
 
3347
3347
  return obj.gvc.bindView({
3348
3348
  bind: bvid,
@@ -3551,6 +3551,22 @@ ${obj.default ?? ''}</textarea
3551
3551
  let search = '';
3552
3552
  let selectTags: string[] = def || [];
3553
3553
 
3554
+ gvc.addStyle(`
3555
+ .select-tag-dialog {
3556
+ margin-top: 1px;
3557
+ border: 8px solid #fff;
3558
+ outline: 1px solid #aeaeae;
3559
+ height: 300px;
3560
+ width: 100%;
3561
+ border-radius: 5px;
3562
+ position: absolute;
3563
+ top: 0;
3564
+ background-color: #fff;
3565
+ border-radius: 5px;
3566
+ overflow: auto;
3567
+ }
3568
+ `);
3569
+
3554
3570
  return gvc.bindView({
3555
3571
  bind: id,
3556
3572
  view: () => {
@@ -3558,74 +3574,7 @@ ${obj.default ?? ''}</textarea
3558
3574
  return '';
3559
3575
  }
3560
3576
 
3561
- if (show) {
3562
- return html`<div
3563
- style="margin-top: 1px;border: 8px solid #fff; outline: 1px solid #aeaeae; height: 300px; width: 100%; border-radius: 5px; position: absolute; top: 0; background-color: #fff; border-radius: 5px; overflow: auto;"
3564
- >
3565
- <div class="position-relative">
3566
- <div
3567
- class="w-100 d-flex align-items-center gap-1 position-sticky mb-1"
3568
- style="top: 0; background-color: #fff;"
3569
- >
3570
- <div class="w-100">
3571
- <i
3572
- class="fa-regular fa-magnifying-glass"
3573
- style="font-size: 18px; color: #A0A0A0; position: absolute; left: 18px; top: 50%; transform: translateY(-50%);"
3574
- aria-hidden="true"
3575
- ></i>
3576
- <input
3577
- class="form-control h-100"
3578
- style="border-radius: 10px; border: 1px solid #DDD; padding-left: 50px; height: 100%;"
3579
- placeholder="${placeholder}"
3580
- onchange="${gvc.event(e => {
3581
- search = `${e.value}`.trim();
3582
- gvc.notifyDataChange(id);
3583
- })}"
3584
- value="${search}"
3585
- />
3586
- </div>
3587
- ${this.customButton({
3588
- button: {
3589
- color: 'black',
3590
- size: 'md',
3591
- },
3592
- text: {
3593
- name: '確認',
3594
- style: 'font-size: 14px;',
3595
- },
3596
- event: gvc.event(() => {
3597
- show = false;
3598
- gvc.notifyDataChange(id);
3599
- callback(selectTags);
3600
- }),
3601
- })}
3602
- </div>
3603
- <div class="p-2">
3604
- ${this.multiCheckboxContainer(
3605
- gvc,
3606
- tagList.filter(tag => tag.name.toLowerCase().includes(search.toLowerCase())),
3607
- selectTags,
3608
- text => {
3609
- if (search) {
3610
- selectTags = [
3611
- ...new Set(
3612
- selectTags
3613
- .filter(tag => {
3614
- return !tag.toLowerCase().includes(search.toLowerCase());
3615
- })
3616
- .concat(text)
3617
- ),
3618
- ];
3619
- } else {
3620
- selectTags = text;
3621
- }
3622
- },
3623
- { single: false }
3624
- )}
3625
- </div>
3626
- </div>
3627
- </div>`;
3628
- } else {
3577
+ if (!show) {
3629
3578
  return html`<div
3630
3579
  class="h-100"
3631
3580
  onclick="${gvc.event(() => {
@@ -3640,20 +3589,77 @@ ${obj.default ?? ''}</textarea
3640
3589
  ></i>
3641
3590
  <div
3642
3591
  class="form-control h-100"
3643
- style="border-radius: 10px; border: 1px solid #DDD; padding-left: 50px; height: 100%; color: #aeaeae; ${selectTags.length >
3644
- 0 && false
3645
- ? 'padding: 0.3rem 3rem;'
3646
- : ''}"
3592
+ style="border-radius: 10px; border: 1px solid #DDD; padding-left: 50px; height: 100%; color: #aeaeae;"
3647
3593
  >
3648
3594
  ${placeholder}
3649
- <!-- ${selectTags.length > 0
3650
- ? html`<div class="d-flex flex-wrap gap-2">
3651
- ${selectTags.map(item => this.normalInsignia(`#${item}`)).join('')}
3652
- </div>`
3653
- : placeholder} -->
3654
3595
  </div>
3655
3596
  </div>`;
3656
3597
  }
3598
+
3599
+ return html`<div class="select-tag-dialog">
3600
+ <div class="position-relative">
3601
+ <div
3602
+ class="w-100 d-flex align-items-center gap-1 position-sticky mb-1 top-0"
3603
+ style="background-color: #fff;"
3604
+ >
3605
+ <div class="w-100">
3606
+ <i
3607
+ class="fa-regular fa-magnifying-glass"
3608
+ style="font-size: 18px; color: #A0A0A0; position: absolute; left: 18px; top: 50%; transform: translateY(-50%);"
3609
+ aria-hidden="true"
3610
+ ></i>
3611
+ <input
3612
+ class="form-control h-100"
3613
+ style="border-radius: 10px; border: 1px solid #DDD; padding-left: 50px; height: 100%;"
3614
+ placeholder="${placeholder}"
3615
+ onchange="${gvc.event(e => {
3616
+ search = `${e.value}`.trim();
3617
+ gvc.notifyDataChange(id);
3618
+ })}"
3619
+ value="${search}"
3620
+ />
3621
+ </div>
3622
+ ${this.customButton({
3623
+ button: {
3624
+ color: 'black',
3625
+ size: 'md',
3626
+ },
3627
+ text: {
3628
+ name: '確認',
3629
+ style: 'font-size: 14px;',
3630
+ },
3631
+ event: gvc.event(() => {
3632
+ show = false;
3633
+ gvc.notifyDataChange(id);
3634
+ callback(selectTags);
3635
+ }),
3636
+ })}
3637
+ </div>
3638
+ <div class="p-2">
3639
+ ${this.multiCheckboxContainer(
3640
+ gvc,
3641
+ tagList.filter(tag => tag.name.toLowerCase().includes(search.toLowerCase())),
3642
+ selectTags,
3643
+ text => {
3644
+ if (search) {
3645
+ selectTags = [
3646
+ ...new Set(
3647
+ selectTags
3648
+ .filter(tag => {
3649
+ return !tag.toLowerCase().includes(search.toLowerCase());
3650
+ })
3651
+ .concat(text)
3652
+ ),
3653
+ ];
3654
+ } else {
3655
+ selectTags = text;
3656
+ }
3657
+ },
3658
+ { single: false }
3659
+ )}
3660
+ </div>
3661
+ </div>
3662
+ </div>`;
3657
3663
  },
3658
3664
  divCreate: {
3659
3665
  class: 'w-100 position-relative search-tags-filter',
@@ -3664,10 +3670,7 @@ ${obj.default ?? ''}</textarea
3664
3670
  tagList = await ApiUser.getPublicConfig('product_manager_tags', 'manager').then((dd: any) => {
3665
3671
  if (dd.result && dd.response?.value?.list) {
3666
3672
  return dd.response.value.list.map((item: string) => {
3667
- return {
3668
- key: item,
3669
- name: `#${item}`,
3670
- };
3673
+ return { key: item, name: `#${item}` };
3671
3674
  });
3672
3675
  }
3673
3676
  return [];
@@ -3988,16 +3991,16 @@ ${obj.default ?? ''}</textarea
3988
3991
  };
3989
3992
 
3990
3993
  obj.gvc.addStyle(`
3991
- .${vm.random}-opt {
3992
- background-color: white;
3993
- gap: 24px;
3994
- padding: 6px;
3995
- }
3996
- .${vm.random}-opt:hover {
3997
- border-radius: 5px;
3998
- background-color: #e8e8e8;
3999
- }
4000
- `);
3994
+ .${vm.random}-opt {
3995
+ background-color: white;
3996
+ gap: 24px;
3997
+ padding: 6px;
3998
+ }
3999
+ .${vm.random}-opt:hover {
4000
+ border-radius: 5px;
4001
+ background-color: #e8e8e8;
4002
+ }
4003
+ `);
4001
4004
 
4002
4005
  return obj.gvc.bindView({
4003
4006
  bind: vm.id,
@@ -5121,31 +5124,31 @@ ${obj.default ?? ''}</textarea
5121
5124
  const transX = obj.align === 'center' ? '-50%' : '0';
5122
5125
 
5123
5126
  obj.gvc.addStyle(`
5124
- .bounce-effect-${className} {
5125
- animation: bounce 0.5s alternate;
5126
- animation-iteration-count: 2;
5127
- position: fixed;
5128
- ${fixedStyle}
5129
- background-color: #393939;
5130
- opacity: 0.85;
5131
- color: white;
5132
- padding: 10px;
5133
- border-radius: 8px;
5134
- width: ${obj.width ?? 120}px;
5135
- text-align: center;
5136
- z-index: 11;
5137
- transform: translateX(${transX});
5138
- }
5127
+ .bounce-effect-${className} {
5128
+ animation: bounce 0.5s alternate;
5129
+ animation-iteration-count: 2;
5130
+ position: fixed;
5131
+ ${fixedStyle}
5132
+ background-color: #393939;
5133
+ opacity: 0.85;
5134
+ color: white;
5135
+ padding: 10px;
5136
+ border-radius: 8px;
5137
+ width: ${obj.width ?? 120}px;
5138
+ text-align: center;
5139
+ z-index: 11;
5140
+ transform: translateX(${transX});
5141
+ }
5139
5142
 
5140
- @keyframes bounce {
5141
- 0% {
5142
- transform: translate(${transX}, 0);
5143
- }
5144
- 100% {
5145
- transform: translate(${transX}, -6px);
5146
- }
5147
- }
5148
- `);
5143
+ @keyframes bounce {
5144
+ 0% {
5145
+ transform: translate(${transX}, 0);
5146
+ }
5147
+ 100% {
5148
+ transform: translate(${transX}, -6px);
5149
+ }
5150
+ }
5151
+ `);
5149
5152
  const htmlString = html` <div class="bounce-effect-${className}">${obj.text}</div>`;
5150
5153
  obj.gvc.glitter.document.body.insertAdjacentHTML('beforeend', htmlString);
5151
5154
  setTimeout(() => {
@@ -30,6 +30,7 @@ import { PosWidget } from './pos-widget.js';
30
30
  import { SaasOffer } from '../saas-offer.js';
31
31
  import { Language } from '../glitter-base/global/language.js';
32
32
  import { CreditCard } from './pos-pages/credit-card.js';
33
+ import { BgWidget } from '../backend-manager/bg-widget.js';
33
34
  const html = String.raw;
34
35
  export class POSSetting {
35
36
  static loginManager(gvc, mode, result) {
@@ -342,7 +343,6 @@ export class POSSetting {
342
343
  function changeSelectVariant(product) {
343
344
  let emptyArray = [];
344
345
  product.content.specs.forEach((spec) => {
345
- console.log(spec.option);
346
346
  emptyArray.push(spec.option.find((opt) => opt.select == true).title);
347
347
  });
348
348
  return product.content.variants.find((variant) => arraysEqual(variant.spec, emptyArray));
@@ -492,9 +492,9 @@ export class POSSetting {
492
492
  </svg>
493
493
  </div>
494
494
  </div>
495
- <div class="d-flex mt-2 align-items-center justify-content-end ">
496
- <span
497
- >${(() => {
495
+ <div class="d-flex flex-column gap-1 mt-2 align-items-end justify-content-center">
496
+ <div>
497
+ ${(() => {
498
498
  if (selectVariant.show_understocking === 'false') {
499
499
  return '此商品未追蹤庫存數量';
500
500
  }
@@ -503,8 +503,67 @@ export class POSSetting {
503
503
  return `庫存數量: ${selectVariant.exhibition_active_stock}`;
504
504
  }
505
505
  return `庫存數量: ${selectVariant.stock}`;
506
- })()}</span
507
- >
506
+ })()}
507
+ </div>
508
+ ${selectVariant.show_understocking === 'false'
509
+ ? ''
510
+ : BgWidget.blueNote('查看其他庫存點', gvc.event(() => {
511
+ BgWidget.settingDialog({
512
+ gvc,
513
+ title: '其他庫存點',
514
+ innerHTML: () => {
515
+ return BgWidget.tableV3({
516
+ gvc,
517
+ filter: [],
518
+ getData: vmi => {
519
+ const dataList = [];
520
+ function callback() {
521
+ vmi.pageSize = 1;
522
+ vmi.originalData = dataList;
523
+ vmi.tableData = getDatalist();
524
+ vmi.loading = false;
525
+ vmi.callback();
526
+ }
527
+ function getDatalist() {
528
+ return dataList.map((dd) => {
529
+ return [
530
+ {
531
+ key: '門市名稱',
532
+ value: `<span class="fs-7">${dd.name}</span>`,
533
+ },
534
+ {
535
+ key: '數量',
536
+ value: `<span class="fs-7">${dd.count || 0}</span>`,
537
+ },
538
+ ];
539
+ });
540
+ }
541
+ ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
542
+ var _a;
543
+ if (dd.result && Array.isArray((_a = dd.response.value) === null || _a === void 0 ? void 0 : _a.list)) {
544
+ dd.response.value.list.map((store) => {
545
+ var _a, _b, _c;
546
+ const n = (_c = (_b = (_a = selectVariant.stockList) === null || _a === void 0 ? void 0 : _a[store.id]) === null || _b === void 0 ? void 0 : _b.count) !== null && _c !== void 0 ? _c : 0;
547
+ dataList.push({
548
+ name: store.name,
549
+ count: n > 0 ? n : 0,
550
+ });
551
+ });
552
+ }
553
+ callback();
554
+ });
555
+ },
556
+ rowClick: () => { },
557
+ hiddenPageSplit: true,
558
+ });
559
+ },
560
+ footer_html: (fGVC) => {
561
+ return [
562
+ BgWidget.save(fGVC.event(() => gvc.closeDialog()), '確認'),
563
+ ].join();
564
+ },
565
+ });
566
+ }))}
508
567
  </div>
509
568
  `;
510
569
  },
@@ -766,13 +825,7 @@ export class POSSetting {
766
825
  query: '',
767
826
  productSearch: [],
768
827
  categorySearch: true,
769
- categories: [
770
- {
771
- key: 'all',
772
- value: '全部商品',
773
- select: true,
774
- },
775
- ],
828
+ categories: [],
776
829
  };
777
830
  let orderDetail = JSON.parse(JSON.stringify(new OrderDetail(0, 0)));
778
831
  glitter.share.reloadPosPage = () => gvc.notifyDataChange(vm.id);
@@ -870,7 +923,6 @@ export class POSSetting {
870
923
  PayConfig.pos_config = res.response.value;
871
924
  vm.loading = false;
872
925
  gvc.notifyDataChange(vm.id);
873
- console.log(`PayConfig.pos_config=>`, PayConfig.pos_config);
874
926
  });
875
927
  if (vm.type === 'home') {
876
928
  vm.type = 'menu';
@@ -1277,17 +1329,17 @@ export class POSSetting {
1277
1329
  ...(PayConfig.deviceType === 'pos'
1278
1330
  ? [
1279
1331
  html `<a
1280
- class="dropdown-item cursor_pointer d-flex align-items-center"
1281
- style="gap:10px;"
1282
- onclick="${gvc.event(() => {
1332
+ class="dropdown-item cursor_pointer d-flex align-items-center"
1333
+ style="gap:10px;"
1334
+ onclick="${gvc.event(() => {
1283
1335
  CreditCard.refundView(gvc);
1284
1336
  })}"
1285
- ><i
1286
- class="fa-regular fa-credit-card d-flex align-items-center justify-content-center"
1287
- style="width:20px;"
1288
- ></i
1289
- >信用卡刷退</a
1290
- >`,
1337
+ ><i
1338
+ class="fa-regular fa-credit-card d-flex align-items-center justify-content-center"
1339
+ style="width:20px;"
1340
+ ></i
1341
+ >信用卡刷退</a
1342
+ >`,
1291
1343
  html ` <a
1292
1344
  class="dropdown-item cursor_pointer d-flex align-items-center"
1293
1345
  style="gap:10px;"