ts-glitter 20.8.7 → 20.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +1 -1
- package/lowcode/backend-manager/bg-product.ts +1 -1
- package/lowcode/backend-manager/bg-recommend.js +1 -1
- package/lowcode/backend-manager/bg-recommend.ts +2 -2
- package/lowcode/backend-manager/bg-shopping.js +2 -5
- package/lowcode/backend-manager/bg-shopping.ts +2 -5
- package/lowcode/cms-plugin/POS-setting.js +58 -34
- package/lowcode/cms-plugin/POS-setting.ts +69 -33
- package/lowcode/cms-plugin/data-analyze-orders.js +0 -1
- package/lowcode/cms-plugin/data-analyze-orders.ts +1 -1
- package/lowcode/cms-plugin/data-analyze.js +1 -21
- package/lowcode/cms-plugin/data-analyze.ts +25 -25
- package/lowcode/cms-plugin/filter-options.js +1 -1
- package/lowcode/cms-plugin/filter-options.ts +1 -2
- package/lowcode/cms-plugin/information/information-module.js +275 -0
- package/lowcode/cms-plugin/information/information-module.ts +308 -0
- package/lowcode/cms-plugin/pos-pages/models.ts +3 -1
- package/lowcode/cms-plugin/pos-pages/payment-page.js +3 -11
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +3 -11
- package/lowcode/cms-plugin/pos-pages/pos-function.js +1 -0
- package/lowcode/cms-plugin/pos-pages/pos-function.ts +1 -0
- package/lowcode/cms-plugin/pos-pages/products-page.js +1 -1
- package/lowcode/cms-plugin/pos-pages/products-page.ts +1 -1
- package/lowcode/cms-plugin/product-service.js +4 -9
- package/lowcode/cms-plugin/product-service.ts +4 -13
- package/lowcode/cms-plugin/shopping-discount-setting.js +76 -27
- package/lowcode/cms-plugin/shopping-discount-setting.ts +123 -63
- package/lowcode/cms-plugin/shopping-information.js +21 -167
- package/lowcode/cms-plugin/shopping-information.ts +35 -191
- package/lowcode/cms-plugin/shopping-order-return.js +212 -360
- package/lowcode/cms-plugin/shopping-order-return.ts +349 -482
- package/lowcode/cms-plugin/shopping-product-setting.js +8 -0
- package/lowcode/cms-plugin/shopping-product-setting.ts +12 -4
- package/lowcode/form-view/e-commerce/product-select.js +59 -51
- package/lowcode/form-view/e-commerce/product-select.ts +279 -266
- package/lowcode/glitter-base/global/language.js +2 -1
- package/lowcode/glitter-base/global/language.ts +2 -1
- package/lowcode/public-components/checkout/index.ts +2078 -2078
- package/lowcode/public-components/headers/sy-02.js +190 -179
- package/lowcode/public-components/headers/sy-02.ts +397 -370
- package/lowcode/public-components/headers/sy-03.js +133 -107
- package/lowcode/public-components/headers/sy-03.ts +276 -244
- package/lowcode/public-components/headers/sy-04.js +181 -146
- package/lowcode/public-components/headers/sy-04.ts +289 -247
- package/lowcode/public-components/product/pd-class.js +31 -23
- package/lowcode/public-components/product/pd-class.ts +51 -29
- package/lowcode/public-components/user-manager/um-voucher.js +1 -0
- package/lowcode/public-components/user-manager/um-voucher.ts +1 -0
- package/package.json +1 -1
- package/src/Language.js +1 -1
- package/src/Language.js.map +1 -1
- package/src/Language.ts +1 -1
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/chat.js.map +1 -1
- package/src/api-public/controllers/customer-sessions.js.map +1 -1
- package/src/api-public/controllers/fb-message.js.map +1 -1
- package/src/api-public/controllers/fb-service.js.map +1 -1
- package/src/api-public/controllers/invoice.js.map +1 -1
- package/src/api-public/controllers/line-message.js.map +1 -1
- package/src/api-public/controllers/oauth.js.map +1 -1
- package/src/api-public/controllers/progress.js.map +1 -1
- package/src/api-public/controllers/rebate.js.map +1 -1
- package/src/api-public/controllers/recommend.js.map +1 -1
- package/src/api-public/controllers/reconciliation.js.map +1 -1
- package/src/api-public/controllers/shop.js +5 -2
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +7 -3
- package/src/api-public/controllers/shopee.js.map +1 -1
- package/src/api-public/controllers/sms.js.map +1 -1
- package/src/api-public/controllers/smtp.js.map +1 -1
- package/src/api-public/controllers/stock.js.map +1 -1
- package/src/api-public/controllers/track.js.map +1 -1
- package/src/api-public/controllers/voucher.js.map +1 -1
- package/src/api-public/models/glitter-finance.js +1 -2
- package/src/api-public/models/glitter-finance.js.map +1 -1
- package/src/api-public/services/EcInvoice.js.map +1 -1
- package/src/api-public/services/article.js.map +1 -1
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/chat.js.map +1 -1
- package/src/api-public/services/checkout-event.d.ts +1 -0
- package/src/api-public/services/checkout-event.js +17 -7
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +21 -9
- package/src/api-public/services/checkout.js.map +1 -1
- package/src/api-public/services/custom-code.js.map +1 -1
- package/src/api-public/services/customer-sessions.js.map +1 -1
- package/src/api-public/services/data-analyze.js +209 -196
- package/src/api-public/services/data-analyze.js.map +1 -1
- package/src/api-public/services/data-analyze.ts +219 -205
- package/src/api-public/services/delivery.js.map +1 -1
- package/src/api-public/services/ezpay/tool.d.ts +0 -1
- package/src/api-public/services/ezpay/tool.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-order.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-product.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-user.js.map +1 -1
- package/src/api-public/services/fb-api.js.map +1 -1
- package/src/api-public/services/filter-protect-data.js.map +1 -1
- package/src/api-public/services/financial-service.js +0 -1
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/form-check.js.map +1 -1
- package/src/api-public/services/graph-api.js.map +1 -1
- package/src/api-public/services/initial-fake-data.js.map +1 -1
- package/src/api-public/services/invoice.d.ts +3 -9
- package/src/api-public/services/invoice.js +66 -85
- package/src/api-public/services/invoice.js.map +1 -1
- package/src/api-public/services/invoice.ts +287 -293
- package/src/api-public/services/language-setting.js.map +1 -1
- package/src/api-public/services/mail.js.map +1 -1
- package/src/api-public/services/manager.js.map +1 -1
- package/src/api-public/services/paynow-logistics.js.map +1 -1
- package/src/api-public/services/phone-verify.js.map +1 -1
- package/src/api-public/services/pos.js.map +1 -1
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/product-initial.js.map +1 -1
- package/src/api-public/services/rebate.js.map +1 -1
- package/src/api-public/services/reconciliation.js.map +1 -1
- package/src/api-public/services/schedule.d.ts +1 -0
- package/src/api-public/services/schedule.js +27 -0
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +30 -0
- package/src/api-public/services/shopping.d.ts +4 -3
- package/src/api-public/services/shopping.js +40 -20
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +52 -28
- package/src/api-public/services/stock.js.map +1 -1
- package/src/api-public/services/terms-check.js.map +1 -1
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/user-update.js.map +1 -1
- package/src/api-public/services/user.d.ts +10 -0
- package/src/api-public/services/user.js +35 -8
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +50 -7
- package/src/api-public/services/voucher.js.map +1 -1
- package/src/api-public/utils/ut-database.js.map +1 -1
- package/src/app-project/android/app/src/main/res/xml/network_security_config.xml +3 -3
- package/src/app-project/android/app/src/main/res/xml/s.xml +5 -5
- package/src/app-project/android/gradlew.bat +94 -94
- package/src/app-project/serverless/src/controllers/index.js.map +1 -1
- package/src/app-project/serverless/src/controllers/sample.js.map +1 -1
- package/src/app-project/serverless/src/modules/database.d.ts +1 -2
- package/src/app-project/serverless/src/modules/database.js.map +1 -1
- package/src/app-project/serverless/src/modules/exception.js.map +1 -1
- package/src/app-project/serverless/src/modules/hooks.js.map +1 -1
- package/src/app-project/serverless/src/modules/logger.js.map +1 -1
- package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
- package/src/app-project/serverless/src/modules/redis.js.map +1 -1
- package/src/app-project/serverless/src/modules/response.js.map +1 -1
- package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
- package/src/controllers/ai.js.map +1 -1
- package/src/controllers/global-event.js.map +1 -1
- package/src/controllers/page.js.map +1 -1
- package/src/controllers/private_config.js.map +1 -1
- package/src/export/export-test.js.map +1 -1
- package/src/firebase/message.js +1 -2
- package/src/firebase/message.js.map +1 -1
- package/src/helper/app_creater.js +1 -2
- package/src/helper/app_creater.js.map +1 -1
- package/src/helper/glitter-util.d.ts +0 -1
- package/src/helper/glitter-util.js.map +1 -1
- package/src/lambda/interface.d.ts +1 -1
- package/src/lambda/interface.js +2 -2
- package/src/lambda/interface.js.map +1 -1
- package/src/modules/database.js +4 -3
- package/src/modules/database.js.map +1 -1
- package/src/modules/database.ts +4 -4
- package/src/modules/exception.js.map +1 -1
- package/src/modules/hooks.js.map +1 -1
- package/src/modules/response.js.map +1 -1
- package/src/modules/ssh.js.map +1 -1
- package/src/public-config-initial/auto-fcm.js.map +1 -1
- package/src/run.js.map +1 -1
- package/src/run.ts +12 -12
- package/src/services/ai.js.map +1 -1
- package/src/services/ses.js +1 -2
- package/src/services/ses.js.map +1 -1
- package/src/services/system-schedule.js.map +1 -1
- package/src/update-progress-track.js.map +1 -1
- package/src/update-script.js.map +1 -1
|
@@ -1,279 +1,292 @@
|
|
|
1
|
-
import {GVC} from '../../glitterBundle/GVController.js';
|
|
2
|
-
import {EditorElem} from '../../glitterBundle/plugins/editor-elem.js';
|
|
3
|
-
import {ApiShop} from '../../glitter-base/route/shopping.js';
|
|
4
|
-
import {BgWidget} from '../../backend-manager/bg-widget.js';
|
|
5
|
-
import {BgProduct} from '../../backend-manager/bg-product.js';
|
|
6
|
-
import {Tool} from '../../modules/tool.js';
|
|
1
|
+
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
|
+
import { EditorElem } from '../../glitterBundle/plugins/editor-elem.js';
|
|
3
|
+
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
4
|
+
import { BgWidget } from '../../backend-manager/bg-widget.js';
|
|
5
|
+
import { BgProduct } from '../../backend-manager/bg-product.js';
|
|
6
|
+
import { Tool } from '../../modules/tool.js';
|
|
7
7
|
|
|
8
8
|
export class ProductSelect {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
public static getData(bundle: { gvc: GVC; formData: any; key: string; callback: (data: any) => void }) {
|
|
10
|
+
const glitter = bundle.gvc.glitter;
|
|
11
|
+
bundle.formData[bundle.key] = bundle.formData[bundle.key] ?? '';
|
|
12
|
+
return bundle.gvc.bindView(() => {
|
|
13
|
+
const id = glitter.getUUID();
|
|
14
|
+
let interval: any = 0;
|
|
15
|
+
const vm = {
|
|
16
|
+
title: '',
|
|
17
|
+
};
|
|
18
|
+
ApiShop.getProduct({
|
|
19
|
+
page: 0,
|
|
20
|
+
limit: 50,
|
|
21
|
+
id: bundle.formData[bundle.key],
|
|
22
|
+
}).then(data => {
|
|
23
|
+
if (data.result && data.response.result) {
|
|
24
|
+
vm.title = data.response.data.content.title;
|
|
25
|
+
} else {
|
|
26
|
+
vm.title = '';
|
|
27
|
+
}
|
|
28
|
+
bundle.gvc.notifyDataChange(id);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
bind: id,
|
|
33
|
+
view: () => {
|
|
34
|
+
return EditorElem.searchInputDynamic({
|
|
35
|
+
title: '搜尋商品',
|
|
36
|
+
gvc: bundle.gvc,
|
|
37
|
+
def: vm.title,
|
|
38
|
+
search: (text, callback) => {
|
|
39
|
+
clearInterval(interval);
|
|
40
|
+
interval = setTimeout(() => {
|
|
41
|
+
ApiShop.getProduct({
|
|
42
|
+
page: 0,
|
|
43
|
+
limit: 50,
|
|
44
|
+
search: '',
|
|
45
|
+
}).then(data => {
|
|
46
|
+
callback(
|
|
47
|
+
data.response.data.map((dd: any) => {
|
|
48
|
+
return dd.content.title;
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
}, 100);
|
|
53
|
+
},
|
|
54
|
+
callback: text => {
|
|
55
|
+
ApiShop.getProduct({
|
|
19
56
|
page: 0,
|
|
20
57
|
limit: 50,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
58
|
+
search: text,
|
|
59
|
+
}).then(data => {
|
|
60
|
+
bundle.formData['product_title'] = text;
|
|
61
|
+
bundle.formData[bundle.key] = data.response.data.find((dd: any) => {
|
|
62
|
+
return dd.content.title === text;
|
|
63
|
+
}).id;
|
|
64
|
+
bundle.callback(bundle.formData[bundle.key]);
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
placeHolder: '請輸入商品名稱',
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
divCreate: {
|
|
71
|
+
style: '',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
}
|
|
30
76
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
search: '',
|
|
45
|
-
}).then((data) => {
|
|
46
|
-
callback(
|
|
47
|
-
data.response.data.map((dd: any) => {
|
|
48
|
-
return dd.content.title;
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
}, 100);
|
|
53
|
-
},
|
|
54
|
-
callback: (text) => {
|
|
55
|
-
ApiShop.getProduct({
|
|
56
|
-
page: 0,
|
|
57
|
-
limit: 50,
|
|
58
|
-
search: text,
|
|
59
|
-
}).then((data) => {
|
|
60
|
-
bundle.formData['product_title'] = text;
|
|
61
|
-
bundle.formData[bundle.key] = data.response.data.find((dd: any) => {
|
|
62
|
-
return dd.content.title === text;
|
|
63
|
-
}).id;
|
|
64
|
-
bundle.callback(bundle.formData[bundle.key]);
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
placeHolder: '請輸入商品名稱',
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
divCreate: {
|
|
71
|
-
style: '',
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
});
|
|
77
|
+
public static getProducts(bundle: {
|
|
78
|
+
gvc: GVC;
|
|
79
|
+
formData: any;
|
|
80
|
+
key: string;
|
|
81
|
+
callback: (data: any) => void;
|
|
82
|
+
title: string;
|
|
83
|
+
}) {
|
|
84
|
+
const html = String.raw;
|
|
85
|
+
const gvc = bundle.gvc;
|
|
86
|
+
if (Array.isArray(bundle.formData[bundle.key]) || typeof bundle.formData[bundle.key] !== 'object') {
|
|
87
|
+
bundle.formData[bundle.key] = {
|
|
88
|
+
select: 'product',
|
|
89
|
+
};
|
|
75
90
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
bundle.formData[bundle.key].
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
BgProduct.productsDialog({
|
|
164
|
-
gvc: gvc,
|
|
165
|
-
default: bundle.formData[bundle.key].value,
|
|
166
|
-
callback: async (value) => {
|
|
167
|
-
bundle.formData[bundle.key].value = value;
|
|
168
|
-
bundle.callback(bundle.formData[bundle.key].value);
|
|
169
|
-
gvc.notifyDataChange(subVM.id);
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
} else if (bundle.formData[bundle.key].select === 'collection') {
|
|
173
|
-
bundle.formData[bundle.key].value = bundle.formData[bundle.key].value ?? [];
|
|
174
|
-
BgProduct.collectionsDialog({
|
|
175
|
-
gvc: gvc,
|
|
176
|
-
default: bundle.formData[bundle.key].value,
|
|
177
|
-
callback: async (value) => {
|
|
178
|
-
bundle.formData[bundle.key].value = value;
|
|
179
|
-
bundle.callback(bundle.formData[bundle.key].value);
|
|
180
|
-
gvc.notifyDataChange(subVM.id);
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}),
|
|
185
|
-
{textStyle: 'font-weight: 400;'}
|
|
186
|
-
)}
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
<div class="d-flex flex-column gap-2" id="${subVM.containerId}">
|
|
190
|
-
${gvc.map(
|
|
191
|
-
subVM.dataList.map((opt: any, index: number) => {
|
|
192
|
-
switch (bundle.formData[bundle.key].select) {
|
|
193
|
-
case 'collection':
|
|
194
|
-
return html`
|
|
195
|
-
<div class="d-flex align-items-center form-check-label c_updown_label gap-3">
|
|
196
|
-
<span class="tx_normal">${index + 1}. ${opt}</span>
|
|
197
|
-
</div>`;
|
|
198
|
-
case 'product':
|
|
199
|
-
return html`
|
|
200
|
-
<div class="d-flex align-items-center form-check-label c_updown_label px-1"
|
|
201
|
-
style="justify-content: space-between"
|
|
202
|
-
data-index="${opt.key}">
|
|
203
|
-
<div class="d-flex align-items-center gap-3 cursor_move" style="max-width: calc(100% - 50px);">
|
|
204
|
-
<i class="fa-solid fa-grip-dots-vertical dragItem"></i>
|
|
205
|
-
${BgWidget.validImageBox({
|
|
206
|
-
gvc,
|
|
207
|
-
image: opt.image,
|
|
208
|
-
width: 40,
|
|
209
|
-
})}
|
|
210
|
-
<div class="tx_normal ${opt.note ? 'mb-1' : ''}" style="white-space:normal;">
|
|
211
|
-
${opt.value}
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
<i
|
|
215
|
-
class="fa-regular fa-trash cursor_pointer"
|
|
216
|
-
onclick="${gvc.event(() => {
|
|
217
|
-
bundle.formData[bundle.key].value = bundle.formData[bundle.key].value.filter((id: number) => {
|
|
218
|
-
return id !== opt.key;
|
|
219
|
-
});
|
|
220
|
-
bundle.callback(bundle.formData[bundle.key].value);
|
|
221
|
-
gvc.notifyDataChange(subVM.id);
|
|
222
|
-
})}"
|
|
223
|
-
></i>
|
|
224
|
-
</div>`;
|
|
225
|
-
case 'all':
|
|
226
|
-
return ``;
|
|
227
|
-
}
|
|
228
|
-
})
|
|
229
|
-
)}
|
|
230
|
-
</div>
|
|
231
|
-
</div>`);
|
|
232
|
-
});
|
|
233
|
-
},
|
|
234
|
-
onCreate: () => {
|
|
235
|
-
if (subVM.loading) {
|
|
236
|
-
gvc.addMtScript(
|
|
237
|
-
[
|
|
238
|
-
{
|
|
239
|
-
src: 'https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js',
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
() => {
|
|
243
|
-
const si = setInterval(() => {
|
|
244
|
-
if ((window as any).Sortable !== undefined) {
|
|
245
|
-
subVM.loading = false;
|
|
246
|
-
clearInterval(si);
|
|
247
|
-
gvc.notifyDataChange(subVM.id);
|
|
248
|
-
}
|
|
249
|
-
}, 300);
|
|
91
|
+
const subVM: any = {
|
|
92
|
+
dataList: [],
|
|
93
|
+
id: gvc.glitter.getUUID(),
|
|
94
|
+
containerId: Tool.randomString(6),
|
|
95
|
+
loading: true,
|
|
96
|
+
};
|
|
97
|
+
const is_page =
|
|
98
|
+
(window.parent as any).glitter.getUrlParameter('page').startsWith('shop') ||
|
|
99
|
+
(window.parent as any).glitter.getUrlParameter('page').startsWith('hidden');
|
|
100
|
+
//隱形賣場和一頁商店僅能單選
|
|
101
|
+
if (is_page) {
|
|
102
|
+
if (bundle.formData[bundle.key].select !== 'product') {
|
|
103
|
+
bundle.formData[bundle.key].select = 'product';
|
|
104
|
+
bundle.formData[bundle.key].value = [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return gvc.bindView(() => {
|
|
108
|
+
return {
|
|
109
|
+
bind: subVM.id,
|
|
110
|
+
view: () => {
|
|
111
|
+
if (subVM.loading) {
|
|
112
|
+
return BgWidget.spinner();
|
|
113
|
+
}
|
|
114
|
+
return new Promise(async resolve => {
|
|
115
|
+
subVM.dataList = await (async () => {
|
|
116
|
+
try {
|
|
117
|
+
switch (bundle.formData[bundle.key].select) {
|
|
118
|
+
case 'product':
|
|
119
|
+
return await BgProduct.getProductOpts(bundle.formData[bundle.key].value);
|
|
120
|
+
case 'collection':
|
|
121
|
+
return bundle.formData[bundle.key].value;
|
|
122
|
+
default:
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
} catch (e) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
129
|
+
resolve(
|
|
130
|
+
html` <div class="d-flex flex-column py-2 my-2 border-top" style="gap: 18px;">
|
|
131
|
+
<div
|
|
132
|
+
class="d-flex align-items-center gray-bottom-line-18 pb-2"
|
|
133
|
+
style="gap: 10px; justify-content: space-between;"
|
|
134
|
+
>
|
|
135
|
+
<div class="flex-fill ">
|
|
136
|
+
${EditorElem.select({
|
|
137
|
+
title: bundle.title,
|
|
138
|
+
gvc: gvc,
|
|
139
|
+
def: bundle.formData[bundle.key].select,
|
|
140
|
+
array: is_page
|
|
141
|
+
? [{ value: 'product', title: '特定商品' }]
|
|
142
|
+
: [
|
|
143
|
+
{ value: 'collection', title: '商品系列' },
|
|
144
|
+
{ value: 'product', title: '特定商品' },
|
|
145
|
+
{ value: 'all', title: '所有商品' },
|
|
146
|
+
],
|
|
147
|
+
callback: text => {
|
|
148
|
+
bundle.formData[bundle.key].select = text;
|
|
149
|
+
bundle.formData[bundle.key].value = [];
|
|
150
|
+
bundle.callback(bundle.formData[bundle.key].value);
|
|
151
|
+
gvc.notifyDataChange(subVM.id);
|
|
152
|
+
},
|
|
153
|
+
})}
|
|
154
|
+
</div>
|
|
155
|
+
<div
|
|
156
|
+
class="${bundle.formData[bundle.key].select === 'all' ? `d-none` : ``}"
|
|
157
|
+
style="margin-top: 30px;"
|
|
158
|
+
>
|
|
159
|
+
${BgWidget.grayButton(
|
|
160
|
+
(() => {
|
|
161
|
+
switch (bundle.formData[bundle.key].select) {
|
|
162
|
+
case 'product':
|
|
163
|
+
case 'collection':
|
|
164
|
+
return `選取`;
|
|
165
|
+
}
|
|
166
|
+
return ``;
|
|
167
|
+
})(),
|
|
168
|
+
gvc.event(() => {
|
|
169
|
+
if (bundle.formData[bundle.key].select === 'product') {
|
|
170
|
+
bundle.formData[bundle.key].value = bundle.formData[bundle.key].value ?? [];
|
|
171
|
+
BgProduct.productsDialog({
|
|
172
|
+
gvc: gvc,
|
|
173
|
+
default: bundle.formData[bundle.key].value,
|
|
174
|
+
callback: async value => {
|
|
175
|
+
bundle.formData[bundle.key].value = value;
|
|
176
|
+
bundle.callback(bundle.formData[bundle.key].value);
|
|
177
|
+
gvc.notifyDataChange(subVM.id);
|
|
250
178
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
179
|
+
});
|
|
180
|
+
} else if (bundle.formData[bundle.key].select === 'collection') {
|
|
181
|
+
bundle.formData[bundle.key].value = bundle.formData[bundle.key].value ?? [];
|
|
182
|
+
BgProduct.collectionsDialog({
|
|
183
|
+
gvc: gvc,
|
|
184
|
+
default: bundle.formData[bundle.key].value,
|
|
185
|
+
callback: async value => {
|
|
186
|
+
bundle.formData[bundle.key].value = value;
|
|
187
|
+
bundle.callback(bundle.formData[bundle.key].value);
|
|
188
|
+
gvc.notifyDataChange(subVM.id);
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
193
|
+
{ textStyle: 'font-weight: 400;' }
|
|
194
|
+
)}
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
<div class="d-flex flex-column gap-2" id="${subVM.containerId}">
|
|
198
|
+
${gvc.map(
|
|
199
|
+
subVM.dataList.map((opt: any, index: number) => {
|
|
200
|
+
switch (bundle.formData[bundle.key].select) {
|
|
201
|
+
case 'collection':
|
|
202
|
+
return html` <div class="d-flex align-items-center form-check-label c_updown_label gap-3">
|
|
203
|
+
<span class="tx_normal">${index + 1}. ${opt}</span>
|
|
204
|
+
</div>`;
|
|
205
|
+
case 'product':
|
|
206
|
+
return html` <div
|
|
207
|
+
class="d-flex align-items-center form-check-label c_updown_label px-1"
|
|
208
|
+
style="justify-content: space-between"
|
|
209
|
+
data-index="${opt.key}"
|
|
210
|
+
>
|
|
211
|
+
<div
|
|
212
|
+
class="d-flex align-items-center gap-3 cursor_move"
|
|
213
|
+
style="max-width: calc(100% - 50px);"
|
|
214
|
+
>
|
|
215
|
+
<i class="fa-solid fa-grip-dots-vertical dragItem"></i>
|
|
216
|
+
${BgWidget.validImageBox({
|
|
217
|
+
gvc,
|
|
218
|
+
image: opt.image,
|
|
219
|
+
width: 40,
|
|
220
|
+
})}
|
|
221
|
+
<div class="tx_normal ${opt.note ? 'mb-1' : ''}" style="white-space:normal;">
|
|
222
|
+
${opt.value}
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
<i
|
|
226
|
+
class="fa-regular fa-trash cursor_pointer"
|
|
227
|
+
onclick="${gvc.event(() => {
|
|
228
|
+
bundle.formData[bundle.key].value = bundle.formData[bundle.key].value.filter(
|
|
229
|
+
(id: number) => {
|
|
230
|
+
return id !== opt.key;
|
|
231
|
+
}
|
|
232
|
+
);
|
|
268
233
|
bundle.callback(bundle.formData[bundle.key].value);
|
|
269
234
|
gvc.notifyDataChange(subVM.id);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
235
|
+
})}"
|
|
236
|
+
></i>
|
|
237
|
+
</div>`;
|
|
238
|
+
case 'all':
|
|
239
|
+
return ``;
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
</div>`
|
|
245
|
+
);
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
onCreate: () => {
|
|
249
|
+
if (subVM.loading) {
|
|
250
|
+
gvc.addMtScript(
|
|
251
|
+
[
|
|
252
|
+
{
|
|
253
|
+
src: 'https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js',
|
|
273
254
|
},
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
255
|
+
],
|
|
256
|
+
() => {
|
|
257
|
+
const si = setInterval(() => {
|
|
258
|
+
if ((window as any).Sortable !== undefined) {
|
|
259
|
+
subVM.loading = false;
|
|
260
|
+
clearInterval(si);
|
|
261
|
+
gvc.notifyDataChange(subVM.id);
|
|
262
|
+
}
|
|
263
|
+
}, 300);
|
|
264
|
+
},
|
|
265
|
+
() => {}
|
|
266
|
+
);
|
|
267
|
+
} else {
|
|
268
|
+
const el = document.querySelector(`#${subVM.containerId}`) as HTMLElement;
|
|
269
|
+
(window as any).Sortable.create(el, {
|
|
270
|
+
animation: 150,
|
|
271
|
+
handle: '.dragItem',
|
|
272
|
+
onEnd: function () {
|
|
273
|
+
const elements = el.querySelectorAll('[data-index]');
|
|
274
|
+
const dataIndices = Array.from(elements).map(element => element.getAttribute('data-index'));
|
|
275
|
+
const value = dataIndices.map(index => {
|
|
276
|
+
if (index) {
|
|
277
|
+
return parseInt(index, 10);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
bundle.formData[bundle.key].value = value;
|
|
281
|
+
bundle.callback(bundle.formData[bundle.key].value);
|
|
282
|
+
gvc.notifyDataChange(subVM.id);
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
});
|
|
289
|
+
}
|
|
277
290
|
}
|
|
278
291
|
|
|
279
292
|
(window as any).glitter.setModule(import.meta.url, ProductSelect);
|
|
@@ -259,6 +259,7 @@ export class Language {
|
|
|
259
259
|
{ key: 'send_to_user_email', tw: '傳送至用戶信箱', cn: '传送至用户邮箱', en: 'Send to user email' },
|
|
260
260
|
{ key: 'mobile_barcode_device', tw: '手機條碼載具', cn: '手机条码载具', en: 'Mobile barcode device' },
|
|
261
261
|
{ key: 'add_to_cart', tw: '加入購物車', cn: '加入购物车', en: 'Add to Cart' },
|
|
262
|
+
{ key: 'preorder_item', tw: '預購商品', cn: '预购商品', en: 'Preorder Item' },
|
|
262
263
|
{ key: 'confirm_select', tw: '確認選擇', cn: '确认选择', en: 'Confirm selection' },
|
|
263
264
|
{ key: 'add_to_cart_success', tw: '加入成功', cn: '加入成功', en: 'Added successfully' },
|
|
264
265
|
{
|
|
@@ -435,7 +436,7 @@ export class Language {
|
|
|
435
436
|
{ key: 'search', tw: '搜尋', cn: '搜索', en: 'Search' },
|
|
436
437
|
{ key: 'all_products', tw: '所有商品', cn: '所有商品', en: 'All Products' },
|
|
437
438
|
{ key: 'product_categories', tw: '商品分類', cn: '商品分类', en: 'Product Categories' },
|
|
438
|
-
{ key: 'products', tw: '
|
|
439
|
+
{ key: 'products', tw: '特定商品', cn: '特定商品', en: 'Products' },
|
|
439
440
|
{ key: 'filter', tw: '篩選', cn: '筛选', en: 'Filter' },
|
|
440
441
|
{ key: 'sort_by_date', tw: '依照系統預設', cn: '依照系統預設', en: 'Sort by Default' },
|
|
441
442
|
{ key: 'sort_by_price_asc', tw: '價格由低至高', cn: '价格由低到高', en: 'Price Low to High' },
|
|
@@ -268,6 +268,7 @@ export class Language {
|
|
|
268
268
|
{ key: 'send_to_user_email', tw: '傳送至用戶信箱', cn: '传送至用户邮箱', en: 'Send to user email' },
|
|
269
269
|
{ key: 'mobile_barcode_device', tw: '手機條碼載具', cn: '手机条码载具', en: 'Mobile barcode device' },
|
|
270
270
|
{ key: 'add_to_cart', tw: '加入購物車', cn: '加入购物车', en: 'Add to Cart' },
|
|
271
|
+
{ key: 'preorder_item', tw: '預購商品', cn: '预购商品', en: 'Preorder Item' },
|
|
271
272
|
{ key: 'confirm_select', tw: '確認選擇', cn: '确认选择', en: 'Confirm selection' },
|
|
272
273
|
{ key: 'add_to_cart_success', tw: '加入成功', cn: '加入成功', en: 'Added successfully' },
|
|
273
274
|
{
|
|
@@ -444,7 +445,7 @@ export class Language {
|
|
|
444
445
|
{ key: 'search', tw: '搜尋', cn: '搜索', en: 'Search' },
|
|
445
446
|
{ key: 'all_products', tw: '所有商品', cn: '所有商品', en: 'All Products' },
|
|
446
447
|
{ key: 'product_categories', tw: '商品分類', cn: '商品分类', en: 'Product Categories' },
|
|
447
|
-
{ key: 'products', tw: '
|
|
448
|
+
{ key: 'products', tw: '特定商品', cn: '特定商品', en: 'Products' },
|
|
448
449
|
{ key: 'filter', tw: '篩選', cn: '筛选', en: 'Filter' },
|
|
449
450
|
{ key: 'sort_by_date', tw: '依照系統預設', cn: '依照系統預設', en: 'Sort by Default' },
|
|
450
451
|
{ key: 'sort_by_price_asc', tw: '價格由低至高', cn: '价格由低到高', en: 'Price Low to High' },
|