ts-glitter 22.4.6 → 22.4.9
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.
- package/lib/glitterBundle/Glitter.css +74 -62
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +49 -32
- package/lowcode/backend-manager/bg-product.ts +57 -39
- package/lowcode/backend-manager/bg-widget.js +17 -0
- package/lowcode/backend-manager/bg-widget.ts +18 -0
- package/lowcode/cms-plugin/information/information-module.js +5 -5
- package/lowcode/cms-plugin/information/information-module.ts +9 -5
- package/lowcode/cms-plugin/menus-setting.js +69 -55
- package/lowcode/cms-plugin/menus-setting.ts +77 -61
- package/lowcode/cms-plugin/module/form-module.js +109 -89
- package/lowcode/cms-plugin/module/form-module.ts +680 -650
- package/lowcode/cms-plugin/module/product-excel.js +1 -0
- package/lowcode/cms-plugin/module/product-excel.ts +2 -0
- package/lowcode/cms-plugin/pos-pages/payment-page.js +28 -10
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +29 -10
- package/lowcode/cms-plugin/shopping-allowance-manager.js +0 -1
- package/lowcode/cms-plugin/shopping-allowance-manager.ts +0 -1
- package/lowcode/cms-plugin/shopping-collections.js +367 -193
- package/lowcode/cms-plugin/shopping-collections.ts +664 -243
- package/lowcode/cms-plugin/shopping-information.js +392 -38
- package/lowcode/cms-plugin/shopping-information.ts +479 -87
- package/lowcode/cms-plugin/shopping-product-setting.js +2 -2
- package/lowcode/cms-plugin/shopping-product-setting.ts +2 -2
- package/lowcode/cms-plugin/shopping-setting-advance.js +906 -766
- package/lowcode/cms-plugin/shopping-setting-advance.ts +977 -841
- package/lowcode/cms-plugin/shopping-setting-basic.js +1547 -1285
- package/lowcode/cms-plugin/shopping-setting-basic.ts +1742 -1466
- package/lowcode/cms-plugin/stock-stores.js +1 -0
- package/lowcode/cms-plugin/stock-stores.ts +1 -0
- package/lowcode/cms-plugin/user-list.js +47 -12
- package/lowcode/cms-plugin/user-list.ts +52 -14
- package/lowcode/css/editor.css +6 -0
- package/lowcode/glitterBundle/Glitter.css +74 -62
- package/lowcode/jslib/nestable/index.html +317 -0
- package/lowcode/jslib/nestable/jquery.nestable.js +484 -0
- package/lowcode/official_view_component/form-widget/input-custom.js +98 -6
- package/lowcode/official_view_component/form-widget/input-custom.ts +121 -16
- package/lowcode/public-components/headers/header-class.js +63 -0
- package/lowcode/public-components/headers/header-class.ts +65 -0
- package/lowcode/public-components/headers/sy-02.js +386 -400
- package/lowcode/public-components/headers/sy-02.ts +482 -492
- package/lowcode/public-components/headers/sy-03.js +42 -43
- package/lowcode/public-components/headers/sy-03.ts +46 -43
- package/lowcode/public-components/headers/sy-04.js +43 -41
- package/lowcode/public-components/headers/sy-04.ts +48 -41
- package/lowcode/public-components/headers/sy-05.js +30 -27
- package/lowcode/public-components/headers/sy-05.ts +33 -27
- package/lowcode/public-components/product/product-list.js +160 -148
- package/lowcode/public-components/product/product-list.ts +186 -165
- package/lowcode/public-models/product.ts +26 -1
- package/lowcode/src/glitterBundle/Glitter.css +74 -62
- package/package.json +1 -1
- package/rxmnt81tnk.json +1 -0
- package/src/api-public/controllers/shop.js +10 -4
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +14 -9
- package/src/api-public/services/ezpay/tool.d.ts +1 -0
- package/src/api-public/services/mail.js +1 -1
- package/src/api-public/services/mail.js.map +1 -1
- package/src/api-public/services/mail.ts +1 -1
- package/src/api-public/services/monitor.js.map +1 -1
- package/src/api-public/services/monitor.ts +2 -0
- package/src/api-public/services/schedule.d.ts +0 -1
- package/src/api-public/services/schedule.js +12 -35
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +15 -39
- package/src/api-public/services/shopee.js +7 -17
- package/src/api-public/services/shopping.d.ts +27 -6
- package/src/api-public/services/shopping.js +364 -85
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +510 -101
- package/src/api-public/services/updated-table-checked.js +58 -1
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/updated-table-checked.ts +62 -1
- package/src/api-public/services/user-update.js +14 -0
- package/src/api-public/services/user-update.js.map +1 -1
- package/src/api-public/services/user-update.ts +15 -0
- package/src/api-public/services/user.js +1 -1
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +1 -1
- package/src/app-project/serverless/src/modules/database.d.ts +1 -1
- package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
- package/src/helper/glitter-util.d.ts +1 -0
- package/src/index.js +7 -4
- package/src/index.js.map +1 -1
- package/src/index.ts +45 -36
- package/src/modules/firebase.js +1 -0
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/firebase.ts +1 -0
- package/src/seo-config.d.ts +2 -1
- package/src/seo-config.js +28 -22
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +33 -26
- package/src/services/saas-table-check.js.map +1 -1
- package/src/services/ses.js +4 -3
- package/src/services/ses.js.map +1 -1
- package/src/services/system-schedule.js.map +1 -1
- package/src/services/system-schedule.ts +1 -0
|
@@ -9,14 +9,7 @@ import { Language } from '../../glitter-base/global/language.js';
|
|
|
9
9
|
* Page: sy01_pd_collection
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
id: number;
|
|
14
|
-
content: {
|
|
15
|
-
collection: string[];
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
interface LanguageData {
|
|
12
|
+
interface Seo {
|
|
20
13
|
title: string;
|
|
21
14
|
seo: {
|
|
22
15
|
domain: string;
|
|
@@ -27,17 +20,22 @@ interface LanguageData {
|
|
|
27
20
|
|
|
28
21
|
type Collection = {
|
|
29
22
|
title: string;
|
|
30
|
-
code: string;
|
|
31
23
|
array: Collection[];
|
|
32
|
-
|
|
24
|
+
checked?: boolean;
|
|
25
|
+
product_id?: number[];
|
|
33
26
|
parentTitles: string[];
|
|
34
27
|
subCollections: string[];
|
|
35
28
|
allCollections: string[];
|
|
36
29
|
seo_title: string;
|
|
37
30
|
seo_content: string;
|
|
38
31
|
seo_image: string;
|
|
39
|
-
|
|
40
|
-
language_data:
|
|
32
|
+
code: string;
|
|
33
|
+
language_data: {
|
|
34
|
+
'en-US': Seo;
|
|
35
|
+
'zh-CN': Seo;
|
|
36
|
+
'zh-TW': Seo;
|
|
37
|
+
};
|
|
38
|
+
hidden?: boolean;
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
const html = String.raw;
|
|
@@ -65,22 +63,22 @@ export class ProductList {
|
|
|
65
63
|
const height = (document.body.clientWidth > 768 ? 56 : 59) * (obj.length + 1);
|
|
66
64
|
const closeHeight = 56;
|
|
67
65
|
|
|
66
|
+
const currentPage = decodeURIComponent((obj.gvc.glitter.getUrlParameter('page') || '').split('/').reverse()[0]);
|
|
67
|
+
|
|
68
68
|
obj.gvc.addStyle(`
|
|
69
69
|
.box-item:hover {
|
|
70
|
-
background-color: #
|
|
70
|
+
background-color: #dddddd;
|
|
71
71
|
}
|
|
72
72
|
.box-container-${text} {
|
|
73
73
|
position: relative;
|
|
74
74
|
height: ${closeHeight}px;
|
|
75
|
-
overflow-y: hidden;
|
|
76
75
|
transition: height 0.3s ease-out;
|
|
77
76
|
}
|
|
78
77
|
.box-container-${text}.open-box {
|
|
79
78
|
max-height: ${height}px;
|
|
80
79
|
height: ${height}px;
|
|
81
|
-
overflow-y: auto;
|
|
82
80
|
}
|
|
83
|
-
.box-navbar
|
|
81
|
+
.box-navbar {
|
|
84
82
|
position: sticky;
|
|
85
83
|
top: 0;
|
|
86
84
|
min-height: 20px;
|
|
@@ -89,12 +87,14 @@ export class ProductList {
|
|
|
89
87
|
padding: 16px;
|
|
90
88
|
align-items: flex-start;
|
|
91
89
|
justify-content: space-between;
|
|
92
|
-
|
|
90
|
+
}
|
|
91
|
+
.box-navbar:hover {
|
|
92
|
+
background-color: #f5f5f5;
|
|
93
93
|
}
|
|
94
94
|
.arrow-icon-${text} {
|
|
95
95
|
color: #393939 !important;
|
|
96
96
|
box-shadow: none !important;
|
|
97
|
-
background
|
|
97
|
+
background: transparent;
|
|
98
98
|
background-image: url(${this.arrowDownDataImage('#000')}) !important;
|
|
99
99
|
background-repeat: no-repeat;
|
|
100
100
|
cursor: pointer;
|
|
@@ -108,21 +108,21 @@ export class ProductList {
|
|
|
108
108
|
transform: rotate(180deg);
|
|
109
109
|
}
|
|
110
110
|
.box-inside-${text} {
|
|
111
|
-
padding: 0 1.5rem 1.5rem;
|
|
112
|
-
|
|
111
|
+
padding: 0 0 1.5rem 1.5rem;
|
|
112
|
+
min-height: 56px;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
@media (max-width: 768px) {
|
|
116
116
|
.box-inside-${text} {
|
|
117
117
|
padding: 0 1rem 0.5rem;
|
|
118
|
-
overflow-x: hidden;
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
`);
|
|
122
121
|
|
|
123
|
-
return html` <div class="box-tag-${obj.tag} box-container-${text} ${obj.openOnInit ?
|
|
122
|
+
return html` <div class="box-tag-${obj.tag} box-container-${text} ${obj.openOnInit ? 'open-box' : ''}">
|
|
124
123
|
<div
|
|
125
|
-
class="box-navbar
|
|
124
|
+
class="box-navbar ${obj.guideClass ?? ''}"
|
|
125
|
+
style="${currentPage === (obj.code || obj.title) ? 'background-color: #dddddd' : ''}"
|
|
126
126
|
onclick="${obj.gvc.event(e => {
|
|
127
127
|
if (!obj.autoClose) {
|
|
128
128
|
const boxes = document.querySelectorAll(`.box-tag-${obj.tag}`);
|
|
@@ -141,29 +141,34 @@ export class ProductList {
|
|
|
141
141
|
setTimeout(() => {
|
|
142
142
|
e.parentElement.classList.toggle('open-box');
|
|
143
143
|
e.parentElement.querySelector(`.arrow-icon-${text}`).classList.toggle('open-box');
|
|
144
|
+
|
|
144
145
|
const container = window.document.querySelector(`.box-container-${text}`) as any;
|
|
146
|
+
const inside = window.document.querySelector(`.box-inside-${text}`) as any;
|
|
147
|
+
|
|
145
148
|
if (e.parentElement.classList.contains('open-box')) {
|
|
146
149
|
const si = setInterval(() => {
|
|
147
|
-
const inside = window.document.querySelector(`.box-inside-${text}`) as any;
|
|
148
150
|
if (inside) {
|
|
149
151
|
const insideHeight = inside.clientHeight;
|
|
150
152
|
if (insideHeight + closeHeight < height) {
|
|
151
|
-
container.style.height = `${insideHeight + closeHeight + 20}px`;
|
|
153
|
+
// container.style.height = `${insideHeight + closeHeight + 20}px`;
|
|
152
154
|
} else {
|
|
153
|
-
container.style.height = `${height}px`;
|
|
155
|
+
// container.style.height = `${height}px`;
|
|
154
156
|
}
|
|
157
|
+
container.style.height = `${height}px`;
|
|
158
|
+
inside.style.display = 'block';
|
|
155
159
|
clearInterval(si);
|
|
156
160
|
}
|
|
157
161
|
}, 100);
|
|
158
162
|
} else {
|
|
159
163
|
container.style.height = `${closeHeight}px`;
|
|
164
|
+
inside.style.display = 'none';
|
|
160
165
|
}
|
|
161
166
|
}, 50);
|
|
162
167
|
})}"
|
|
163
168
|
>
|
|
164
169
|
<div
|
|
165
170
|
class="d-flex tx_700"
|
|
166
|
-
style="color: ${obj.fontColor};"
|
|
171
|
+
style="color: ${obj.fontColor}; cursor: pointer;"
|
|
167
172
|
onclick="${obj.gvc.event(() => {
|
|
168
173
|
obj.changePage('collections/' + obj.code, 'page', {});
|
|
169
174
|
obj.gvc.glitter.closeDrawer();
|
|
@@ -172,10 +177,15 @@ export class ProductList {
|
|
|
172
177
|
${obj.title}
|
|
173
178
|
</div>
|
|
174
179
|
<div class="d-flex">
|
|
175
|
-
<button class="box-tag-${obj.tag} arrow-icon-${text}"></button>
|
|
180
|
+
<button class="box-tag-${obj.tag} arrow-icon-${text} ${obj.openOnInit ? 'open-box' : ''}"></button>
|
|
176
181
|
</div>
|
|
177
182
|
</div>
|
|
178
|
-
<div
|
|
183
|
+
<div
|
|
184
|
+
class="box-inside-${text} ${obj.guideClass ? `box-inside-${obj.guideClass}` : ''} "
|
|
185
|
+
style="${obj.openOnInit ? '' : 'display: none;'}"
|
|
186
|
+
>
|
|
187
|
+
${obj.insideHTML}
|
|
188
|
+
</div>
|
|
179
189
|
</div>`;
|
|
180
190
|
}
|
|
181
191
|
|
|
@@ -359,6 +369,8 @@ export class ProductList {
|
|
|
359
369
|
};
|
|
360
370
|
});
|
|
361
371
|
|
|
372
|
+
const currentPage = decodeURIComponent((glitter.getUrlParameter('page') || '').split('/').reverse()[0]);
|
|
373
|
+
|
|
362
374
|
function updateCollections(data: { collections: Collection[] }): Collection[] {
|
|
363
375
|
const flattenCollections = (
|
|
364
376
|
collections: Collection[],
|
|
@@ -381,7 +393,7 @@ export class ProductList {
|
|
|
381
393
|
return title;
|
|
382
394
|
}
|
|
383
395
|
})(),
|
|
384
|
-
array:
|
|
396
|
+
array: array,
|
|
385
397
|
product_id: product_id ?? [],
|
|
386
398
|
checked: false,
|
|
387
399
|
parentTitles: parentTitles.length ? [...parentTitles] : [],
|
|
@@ -467,6 +479,16 @@ export class ProductList {
|
|
|
467
479
|
return flattenCollections(data.collections, [], topLevelCollections);
|
|
468
480
|
}
|
|
469
481
|
|
|
482
|
+
function getTotalChildCount(item: Collection): number {
|
|
483
|
+
if (item.array.length === 0) {
|
|
484
|
+
return 0;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const arr = item.array.filter(child => !child.hidden);
|
|
488
|
+
|
|
489
|
+
return arr.reduce((sum, child) => sum + getTotalChildCount(child), arr.length);
|
|
490
|
+
}
|
|
491
|
+
|
|
470
492
|
async function getProductList() {
|
|
471
493
|
const orderByParam = glitter.getUrlParameter('order_by');
|
|
472
494
|
const page = parseInt(`${vm.pageIndex}`, 10) - 1;
|
|
@@ -476,6 +498,7 @@ export class ProductList {
|
|
|
476
498
|
if (collection) {
|
|
477
499
|
gvc.glitter.setUrlParameter('search', undefined);
|
|
478
500
|
}
|
|
501
|
+
|
|
479
502
|
const titleMatch = gvc.glitter.getUrlParameter('search');
|
|
480
503
|
const maxPrice = '';
|
|
481
504
|
const minPrice = '';
|
|
@@ -493,6 +516,7 @@ export class ProductList {
|
|
|
493
516
|
with_hide_index: 'false',
|
|
494
517
|
id_list: gvc.glitter.getUrlParameter('ai-search') || undefined,
|
|
495
518
|
};
|
|
519
|
+
|
|
496
520
|
return new Promise<[]>((resolve, reject) => {
|
|
497
521
|
ApiShop.getProduct(inputObj).then(data => {
|
|
498
522
|
try {
|
|
@@ -509,141 +533,136 @@ export class ProductList {
|
|
|
509
533
|
}
|
|
510
534
|
|
|
511
535
|
function getCollectionHTML() {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
536
|
+
const id = glitter.getUUID();
|
|
537
|
+
const undefinedOption = '請選擇項目';
|
|
538
|
+
let loading = true;
|
|
539
|
+
|
|
540
|
+
return gvc.bindView({
|
|
541
|
+
bind: id,
|
|
542
|
+
view: () => {
|
|
543
|
+
if (loading) {
|
|
544
|
+
return ProductList.spinner();
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
const firstCols = vm.collections.filter(
|
|
548
|
+
(item: any) => item.parentTitles.length === 0 && !Boolean(item.hidden)
|
|
549
|
+
);
|
|
550
|
+
|
|
551
|
+
function printUL(col: Collection) {
|
|
552
|
+
return html`<div
|
|
553
|
+
class="box-navbar"
|
|
554
|
+
style="${currentPage === (col.code || col.title) ? 'background: #dddddd;' : ''}"
|
|
555
|
+
onclick="${gvc.event(() => {
|
|
556
|
+
changePage(`collections/${col.code || col.title}`, 'page', {});
|
|
557
|
+
gvc.glitter.closeDrawer();
|
|
558
|
+
})}"
|
|
559
|
+
>
|
|
560
|
+
<div style="font-weight: 500;">
|
|
561
|
+
<div class="d-flex tx_700" style="color: ${fontColor}; cursor: pointer;">${col.title}</div>
|
|
562
|
+
</div>
|
|
563
|
+
</div>`;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function renderItem(item: Collection, depth: number, index: number) {
|
|
567
|
+
let subHTML = '';
|
|
568
|
+
|
|
569
|
+
try {
|
|
570
|
+
if (item.array.length > 0) {
|
|
571
|
+
item.array.map((col: Collection, index: number) => {
|
|
572
|
+
if (!Boolean(col.hidden)) {
|
|
573
|
+
subHTML += col.array.length > 0 ? renderItem(col, depth + 1, index) : printUL(col);
|
|
574
|
+
}
|
|
524
575
|
});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const openOnInit = (() => {
|
|
579
|
+
// 找到目前頁面對應的分類項目
|
|
580
|
+
const currentItem = vm.collections.find((col: any) => (col.code || col.title) === currentPage);
|
|
581
|
+
if (!currentItem) return false;
|
|
525
582
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
583
|
+
// 如果 item.title 是 currentItem 的 parentTitles 之一,表示要開啟
|
|
584
|
+
return currentItem.parentTitles.includes(item.title);
|
|
585
|
+
})();
|
|
586
|
+
|
|
587
|
+
return html` <div
|
|
588
|
+
class="${index + 1 === firstCols.length ? '' : ''}"
|
|
589
|
+
style="${item.array.length > 0 && subHTML.length > 0 ? '' : 'padding: 16px;'}"
|
|
590
|
+
>
|
|
591
|
+
${item.array.length > 0 && subHTML.length > 0
|
|
592
|
+
? ProductList.openBoxContainer({
|
|
593
|
+
gvc,
|
|
594
|
+
tag: `collection-box-${depth}-${index}`,
|
|
595
|
+
title: item.title,
|
|
596
|
+
code: item.code,
|
|
597
|
+
insideHTML: subHTML,
|
|
598
|
+
length: getTotalChildCount(item),
|
|
599
|
+
changePage,
|
|
600
|
+
fontColor,
|
|
601
|
+
openOnInit,
|
|
602
|
+
})
|
|
603
|
+
: html`<div
|
|
529
604
|
class="d-flex tx_700"
|
|
530
|
-
style="color: ${fontColor};"
|
|
605
|
+
style="color: ${fontColor}; cursor: pointer;"
|
|
531
606
|
onclick="${gvc.event(() => {
|
|
532
|
-
changePage('
|
|
607
|
+
changePage('collections/' + item.code, 'page', {});
|
|
533
608
|
gvc.glitter.closeDrawer();
|
|
534
609
|
})}"
|
|
535
610
|
>
|
|
536
|
-
${
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
})()}
|
|
545
|
-
</div>
|
|
546
|
-
</li>
|
|
547
|
-
${cols
|
|
548
|
-
.map((item: any, index: number) => {
|
|
549
|
-
let subHTML = '';
|
|
550
|
-
if (item.subCollections.length > 0) {
|
|
551
|
-
for (const col of vm.collections) {
|
|
552
|
-
if (
|
|
553
|
-
item.subCollections.includes(col.title) &&
|
|
554
|
-
col.parentTitles[0] === item.title &&
|
|
555
|
-
!Boolean(col.hidden)
|
|
556
|
-
) {
|
|
557
|
-
subHTML += html`<ul
|
|
558
|
-
class="mt-1 pt-2 mx-n4 px-4 mb-n2 pb-2 box-item"
|
|
559
|
-
style="${decodeURIComponent(
|
|
560
|
-
(glitter.getUrlParameter('page') || '').split('/').reverse()[0]
|
|
561
|
-
) === (col.code || col.title)
|
|
562
|
-
? `background:#f5f5f5;`
|
|
563
|
-
: ``}"
|
|
564
|
-
onclick="${gvc.event(() => {
|
|
565
|
-
changePage(`collections/${col.code || col.title}`, 'page', {});
|
|
566
|
-
gvc.glitter.closeDrawer();
|
|
567
|
-
})}"
|
|
568
|
-
>
|
|
569
|
-
<li style="font-weight: 500; line-height: 40px;">
|
|
570
|
-
<div class="d-flex tx_700" style="color: ${fontColor};">${col.title}</div>
|
|
571
|
-
</li>
|
|
572
|
-
</ul>`;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
611
|
+
${item.title}
|
|
612
|
+
</div>`}
|
|
613
|
+
</div>`;
|
|
614
|
+
} catch (error) {
|
|
615
|
+
console.error('Product-list RenderItem Error: ', error);
|
|
616
|
+
return '發生錯誤';
|
|
617
|
+
}
|
|
618
|
+
}
|
|
576
619
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
.concat(
|
|
595
|
-
vm.collections
|
|
596
|
-
.filter((col: any) => {
|
|
597
|
-
return (
|
|
598
|
-
item.subCollections.includes(col.title) && col.parentTitles[0] === item.title
|
|
599
|
-
);
|
|
600
|
-
})
|
|
601
|
-
.map((dd: any) => {
|
|
602
|
-
return dd.code || dd.title;
|
|
603
|
-
})
|
|
604
|
-
)
|
|
605
|
-
.includes(
|
|
606
|
-
decodeURIComponent((glitter.getUrlParameter('page') || '').split('/').reverse()[0])
|
|
607
|
-
),
|
|
608
|
-
})
|
|
609
|
-
: html`<div
|
|
610
|
-
class="d-flex tx_700"
|
|
611
|
-
style="color: ${fontColor};"
|
|
612
|
-
onclick="${gvc.event(() => {
|
|
613
|
-
changePage('collections/' + item.code, 'page', {});
|
|
614
|
-
gvc.glitter.closeDrawer();
|
|
615
|
-
})}"
|
|
616
|
-
>
|
|
617
|
-
${item.title}
|
|
618
|
-
</div>`}
|
|
619
|
-
</li>`;
|
|
620
|
-
})
|
|
621
|
-
.join('')}
|
|
622
|
-
</ul>`;
|
|
623
|
-
}
|
|
624
|
-
},
|
|
625
|
-
divCreate: {
|
|
626
|
-
style: 'position: sticky; top: 7.5rem;',
|
|
627
|
-
},
|
|
628
|
-
onCreate: () => {
|
|
629
|
-
if (loading) {
|
|
630
|
-
ApiShop.getCollection().then((data: any) => {
|
|
631
|
-
if (data.result && data.response.value.length > 0) {
|
|
632
|
-
setAdTag();
|
|
633
|
-
vm.allParents = ['(無)'].concat(data.response.value.map((item: { title: string }) => item.title));
|
|
634
|
-
vm.collections = updateCollections({
|
|
635
|
-
collections: data.response.value,
|
|
636
|
-
});
|
|
637
|
-
updatePageTitle();
|
|
620
|
+
return html`<div class="${PdClass.isPhone() ? '' : 'border'} navbar-nav me-auto mb-2 mb-lg-0">
|
|
621
|
+
<div style="padding: 16px;">
|
|
622
|
+
<div
|
|
623
|
+
class="d-flex tx_700"
|
|
624
|
+
style="color: ${fontColor}; cursor: pointer;"
|
|
625
|
+
onclick="${gvc.event(() => {
|
|
626
|
+
changePage('all-product', 'page', {});
|
|
627
|
+
gvc.glitter.closeDrawer();
|
|
628
|
+
})}"
|
|
629
|
+
>
|
|
630
|
+
${(() => {
|
|
631
|
+
if (gvc.glitter.getUrlParameter('ai-search')) {
|
|
632
|
+
return Language.text('ai_choose');
|
|
633
|
+
} else if (gvc.glitter.getUrlParameter('search')) {
|
|
634
|
+
return `${Language.text('search')}: ${gvc.glitter.getUrlParameter('search')}`;
|
|
635
|
+
} else {
|
|
636
|
+
return Language.text('all_products');
|
|
638
637
|
}
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
})()}
|
|
639
|
+
</div>
|
|
640
|
+
</div>
|
|
641
|
+
${firstCols.map((item: any, index: number) => renderItem(item, 0, index)).join('')}
|
|
642
|
+
</div>`;
|
|
643
|
+
},
|
|
644
|
+
divCreate: {
|
|
645
|
+
style: PdClass.isPhone() ? '' : 'position: sticky; top: 7.5rem;',
|
|
646
|
+
},
|
|
647
|
+
onCreate: () => {
|
|
648
|
+
if (loading) {
|
|
649
|
+
ApiShop.getCollection().then((data: any) => {
|
|
650
|
+
if (data.result && data.response.value.length > 0) {
|
|
651
|
+
setAdTag();
|
|
652
|
+
vm.allParents = [undefinedOption].concat(
|
|
653
|
+
data.response.value.map((item: { title: string }) => item.title)
|
|
654
|
+
);
|
|
655
|
+
vm.collections = updateCollections({
|
|
656
|
+
collections: data.response.value,
|
|
641
657
|
});
|
|
658
|
+
updatePageTitle();
|
|
642
659
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
660
|
+
loading = false;
|
|
661
|
+
gvc.notifyDataChange(id);
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
});
|
|
647
666
|
}
|
|
648
667
|
|
|
649
668
|
function collectionTitle(titleText: string) {
|
|
@@ -759,7 +778,9 @@ export class ProductList {
|
|
|
759
778
|
<div class="container d-flex mt-2" style="min-height: 1000px;">
|
|
760
779
|
<div
|
|
761
780
|
class="d-none d-sm-block mt-4"
|
|
762
|
-
style="${PdClass.isPad()
|
|
781
|
+
style="${PdClass.isPad()
|
|
782
|
+
? 'width: 180px; min-width: 180px;'
|
|
783
|
+
: 'width: 282px; min-width: 282px; margin-bottom: 300px;'}"
|
|
763
784
|
>
|
|
764
785
|
${getCollectionHTML()}
|
|
765
786
|
</div>
|
|
@@ -776,18 +797,12 @@ export class ProductList {
|
|
|
776
797
|
})}
|
|
777
798
|
</div>`}
|
|
778
799
|
<div class="d-flex justify-content-between mb-3">
|
|
779
|
-
${
|
|
780
|
-
? html`<
|
|
781
|
-
${gvc.bindView({
|
|
782
|
-
bind: ids.pageTitle,
|
|
783
|
-
view: () => vm.title,
|
|
784
|
-
})}
|
|
785
|
-
</div>`
|
|
786
|
-
: html`<button
|
|
800
|
+
${PdClass.isPhone()
|
|
801
|
+
? html`<button
|
|
787
802
|
class="filter-btn"
|
|
788
803
|
onclick="${gvc.event(() => {
|
|
789
804
|
glitter.setDrawer(
|
|
790
|
-
html`<div class="
|
|
805
|
+
html`<div class="py-3 px-2" style="height: 100vh; overflow: scroll;">
|
|
791
806
|
<div
|
|
792
807
|
class="fw-500 mb-3"
|
|
793
808
|
style="font-size: 24px; color: ${fontColor};padding-top:${gvc.glitter.share
|
|
@@ -805,7 +820,13 @@ export class ProductList {
|
|
|
805
820
|
>
|
|
806
821
|
<i class="fa-regular fa-filter-list me-1"></i>
|
|
807
822
|
${Language.text('filter')}
|
|
808
|
-
</button>`
|
|
823
|
+
</button>`
|
|
824
|
+
: html`<div class="fw-500" style="font-size: 24px; color: ${fontColor}">
|
|
825
|
+
${gvc.bindView({
|
|
826
|
+
bind: ids.pageTitle,
|
|
827
|
+
view: () => vm.title,
|
|
828
|
+
})}
|
|
829
|
+
</div>`}
|
|
809
830
|
<select
|
|
810
831
|
class="form-select form-select-xs"
|
|
811
832
|
style="width: 200px;"
|
|
@@ -55,7 +55,19 @@ interface ChangeLog {
|
|
|
55
55
|
changed_json: any;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
interface Available{
|
|
59
|
+
earliest:{
|
|
60
|
+
value:string,
|
|
61
|
+
unit:'day' | 'month'
|
|
62
|
+
}
|
|
63
|
+
latest:{
|
|
64
|
+
value:string,
|
|
65
|
+
unit:'day' | 'month'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
export interface Product {
|
|
70
|
+
available_time: Available;
|
|
59
71
|
sync_shopee_stock?: boolean;
|
|
60
72
|
shopee_id: number;
|
|
61
73
|
tax?: string;
|
|
@@ -74,7 +86,7 @@ export interface Product {
|
|
|
74
86
|
addProduct: boolean;
|
|
75
87
|
giveaway: boolean;
|
|
76
88
|
};
|
|
77
|
-
product_category: 'course' | 'commodity' | 'kitchen' | 'weighing';
|
|
89
|
+
product_category: 'course' | 'commodity' | 'kitchen' | 'weighing' | 'reserve';
|
|
78
90
|
visible: 'true' | 'false';
|
|
79
91
|
content: string;
|
|
80
92
|
preview_image: string[];
|
|
@@ -138,6 +150,19 @@ export interface Product {
|
|
|
138
150
|
comments: any[];
|
|
139
151
|
multi_sale_price?: MultiSalePrice[];
|
|
140
152
|
records: ChangeLog[];
|
|
153
|
+
reserve_locations:Store[]
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface Store{
|
|
157
|
+
id:string,
|
|
158
|
+
address:string,
|
|
159
|
+
manager_name:string,
|
|
160
|
+
manager_phone:string,
|
|
161
|
+
name:string,
|
|
162
|
+
note:string,
|
|
163
|
+
dataPin:string,
|
|
164
|
+
checked:boolean,
|
|
165
|
+
is_shop:boolean
|
|
141
166
|
}
|
|
142
167
|
|
|
143
168
|
export type MultiSaleType = 'store' | 'level' | 'tags';
|