ts-glitter 21.5.2 → 21.5.4
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/cms-plugin/account-info.js +79 -67
- package/lowcode/cms-plugin/account-info.ts +327 -311
- package/lowcode/cms-plugin/information/information-module.ts +3 -1
- package/lowcode/cms-plugin/list-header-option.js +1 -0
- package/lowcode/cms-plugin/list-header-option.ts +1 -0
- package/lowcode/cms-plugin/shopping-information.js +468 -0
- package/lowcode/cms-plugin/shopping-information.ts +557 -0
- package/lowcode/cms-plugin/shopping-market-shopee.js +283 -231
- package/lowcode/cms-plugin/shopping-market-shopee.ts +401 -361
- package/lowcode/cms-plugin/shopping-order-manager.js +16 -4
- package/lowcode/cms-plugin/shopping-order-manager.ts +18 -3
- package/lowcode/glitter-base/global/language.js +4 -1
- package/lowcode/glitter-base/global/language.ts +4 -2
- package/lowcode/glitter-base/route/shopee.js +48 -11
- package/lowcode/glitter-base/route/shopee.ts +119 -80
- package/lowcode/glitterBundle/plugins/html-render.js +121 -90
- package/lowcode/glitterBundle/plugins/html-render.ts +367 -318
- package/lowcode/modules/image-library.js +2 -3
- package/lowcode/modules/image-library.ts +21 -7
- package/lowcode/public-components/checkout/index.js +90 -41
- package/lowcode/public-components/checkout/index.ts +101 -49
- package/lowcode/public-components/footer/footer-initial.js +11 -2
- package/lowcode/public-components/footer/footer-initial.ts +29 -18
- package/lowcode/public-components/headers/header-class.js +47 -35
- package/lowcode/public-components/headers/header-class.ts +54 -38
- package/lowcode/public-components/headers/sy-02.js +1 -1
- package/lowcode/public-components/headers/sy-02.ts +1 -1
- package/lowcode/public-components/headers/sy-03.js +1 -1
- package/lowcode/public-components/headers/sy-03.ts +1 -1
- package/lowcode/public-components/headers/sy-04.js +1 -1
- package/lowcode/public-components/headers/sy-04.ts +1 -1
- package/lowcode/public-components/headers/sy-05.js +1 -2
- package/lowcode/public-components/headers/sy-05.ts +1 -1
- package/lowcode/public-components/layout-plugin/social-links-01.js +122 -3
- package/lowcode/public-components/layout-plugin/social-links-01.ts +135 -10
- package/lowcode/public-components/product/pd-card-01.js +23 -14
- package/lowcode/public-components/product/pd-card-01.ts +25 -14
- package/lowcode/public-components/product/pd-card-02.js +23 -16
- package/lowcode/public-components/product/pd-card-02.ts +25 -16
- package/lowcode/public-components/product/pd-card-03.js +25 -16
- package/lowcode/public-components/product/pd-card-03.ts +27 -16
- package/lowcode/public-components/product/pd-class.js +1 -1
- package/lowcode/public-components/product/pd-class.ts +1 -1
- package/lowcode/public-components/terms-related/index.js +13 -2
- package/lowcode/public-components/terms-related/index.ts +15 -2
- package/lowcode/public-components/user-manager/um-class.js +490 -501
- package/lowcode/public-components/user-manager/um-class.ts +872 -882
- package/lowcode/public-components/user-manager/um-info.js +41 -40
- package/lowcode/public-components/user-manager/um-info.ts +54 -56
- package/lowcode/public-components/user-manager/um-login.js +10 -13
- package/lowcode/public-components/user-manager/um-login.ts +15 -23
- package/lowcode/public-components/user-manager/um-orderlist.js +60 -51
- package/lowcode/public-components/user-manager/um-orderlist.ts +289 -275
- package/lowcode/public-components/user-manager/um-rebate.js +104 -82
- package/lowcode/public-components/user-manager/um-rebate.ts +294 -267
- package/lowcode/public-components/user-manager/um-receive.js +582 -0
- package/lowcode/public-components/user-manager/um-receive.ts +599 -0
- package/lowcode/public-components/user-manager/um-wishlist.js +72 -68
- package/lowcode/public-components/user-manager/um-wishlist.ts +240 -230
- package/package.json +1 -1
- package/src/api-public/controllers/shopee.js +17 -0
- package/src/api-public/controllers/shopee.js.map +1 -1
- package/src/api-public/controllers/shopee.ts +32 -0
- package/src/api-public/services/monitor.d.ts +1 -0
- package/src/api-public/services/post.js +17 -7
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/rebate.js +2 -11
- package/src/api-public/services/rebate.js.map +1 -1
- package/src/api-public/services/rebate.ts +5 -12
- package/src/api-public/services/shopee.d.ts +23 -2
- package/src/api-public/services/shopee.js +230 -111
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopee.ts +1012 -838
- package/src/api-public/services/user.js +2 -2
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +3 -3
- package/src/index.js +17 -7
- package/src/index.js.map +1 -1
- package/src/modules/tool.d.ts +4 -4
- package/src/modules/tool.js +2 -1
- package/src/modules/tool.js.map +1 -1
- package/src/services/backend-service.js +17 -7
- package/src/services/backend-service.js.map +1 -1
- package/src/services/template.d.ts +1 -1
- package/src/services/template.js +24 -18
- package/src/services/template.js.map +1 -1
- package/src/services/template.ts +34 -37
|
@@ -10,12 +10,73 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
11
11
|
import { ApiUser } from '../glitter-base/route/user.js';
|
|
12
12
|
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
13
|
-
import { ApiShopee } from
|
|
14
|
-
import { ApiPageConfig } from
|
|
13
|
+
import { ApiShopee } from '../glitter-base/route/shopee.js';
|
|
14
|
+
import { ApiPageConfig } from '../api/pageConfig.js';
|
|
15
15
|
const css = String.raw;
|
|
16
16
|
export class MarketShopee {
|
|
17
17
|
static main(gvc) {
|
|
18
|
+
const html = String.raw;
|
|
18
19
|
const shopee = localStorage.getItem('shopeeCode');
|
|
20
|
+
const id = gvc.glitter.getUUID();
|
|
21
|
+
let loading = false;
|
|
22
|
+
let first = true;
|
|
23
|
+
function reload(id) {
|
|
24
|
+
gvc.notifyDataChange(id);
|
|
25
|
+
}
|
|
26
|
+
function showShopeeBlock(blockData) {
|
|
27
|
+
const blockID = gvc.glitter.getUUID();
|
|
28
|
+
return BgWidget.mainCard(html `
|
|
29
|
+
${gvc.bindView(() => {
|
|
30
|
+
return {
|
|
31
|
+
bind: blockID,
|
|
32
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
if (first) {
|
|
34
|
+
let res = yield ApiShopee.syncStatus();
|
|
35
|
+
loading = res.response.result;
|
|
36
|
+
first = false;
|
|
37
|
+
}
|
|
38
|
+
return [
|
|
39
|
+
html `
|
|
40
|
+
<div class="tx_700 d-flex flex-column">${blockData.title}</div>
|
|
41
|
+
${BgWidget.grayNote(blockData.subTitle)}
|
|
42
|
+
<div>
|
|
43
|
+
${loading
|
|
44
|
+
? BgWidget.grayButton(html ` <div class="d-flex align-items-center" style="gap:8px;">
|
|
45
|
+
<div class="spinner-border spinner" style="width:20px;height: 20px;"></div>
|
|
46
|
+
同步中請稍候...
|
|
47
|
+
</div>`, gvc.event(() => { }))
|
|
48
|
+
: ``}
|
|
49
|
+
<button
|
|
50
|
+
class="shopee-btn ${loading ? `d-none` : ``}"
|
|
51
|
+
onclick="${gvc.event(() => {
|
|
52
|
+
blockData.click(blockID);
|
|
53
|
+
})}"
|
|
54
|
+
>
|
|
55
|
+
${blockData.btnText}
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
`,
|
|
59
|
+
].join('');
|
|
60
|
+
}),
|
|
61
|
+
divCreate: {
|
|
62
|
+
class: `d-flex flex-column`,
|
|
63
|
+
style: 'gap:8px;',
|
|
64
|
+
},
|
|
65
|
+
onCreate: () => {
|
|
66
|
+
ApiShopee.syncStatus().then(res => {
|
|
67
|
+
loading = res.response.result;
|
|
68
|
+
if (gvc.glitter.share.shopee_interval) {
|
|
69
|
+
clearInterval(gvc.glitter.share.shopee_interval);
|
|
70
|
+
}
|
|
71
|
+
gvc.glitter.share.shopee_interval = setTimeout(() => {
|
|
72
|
+
gvc.notifyDataChange(blockID);
|
|
73
|
+
}, 1000);
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
})}
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
19
80
|
if (shopee) {
|
|
20
81
|
const data = JSON.parse(shopee);
|
|
21
82
|
ApiShopee.getToken(data.code, data.shop_id);
|
|
@@ -31,17 +92,158 @@ export class MarketShopee {
|
|
|
31
92
|
advertiser_ID: '',
|
|
32
93
|
commission: '',
|
|
33
94
|
},
|
|
34
|
-
config: {}
|
|
95
|
+
config: {},
|
|
35
96
|
};
|
|
36
|
-
const html = String.raw;
|
|
37
97
|
function save_shopee() {
|
|
38
98
|
ApiUser.setPublicConfig({
|
|
39
99
|
key: 'shopp_config',
|
|
40
100
|
value: vm.config,
|
|
41
|
-
user_id: 'manager'
|
|
101
|
+
user_id: 'manager',
|
|
42
102
|
});
|
|
43
103
|
}
|
|
44
|
-
|
|
104
|
+
function drawDialog(callback) {
|
|
105
|
+
const today = new Date().toISOString().split('T')[0];
|
|
106
|
+
let startDate = today;
|
|
107
|
+
let endDate = today;
|
|
108
|
+
gvc.glitter.innerDialog((gvc) => {
|
|
109
|
+
gvc.addStyle(css `
|
|
110
|
+
/* 外部容器 */
|
|
111
|
+
|
|
112
|
+
.shopee-sync {
|
|
113
|
+
background: #fff;
|
|
114
|
+
border: 1px solid #e0e0e0;
|
|
115
|
+
border-radius: 8px;
|
|
116
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
117
|
+
padding: 20px;
|
|
118
|
+
width: 300px;
|
|
119
|
+
text-align: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* 標題樣式 */
|
|
123
|
+
|
|
124
|
+
.sync-header {
|
|
125
|
+
font-size: 18px;
|
|
126
|
+
font-weight: bold;
|
|
127
|
+
color: #ee4d2d;
|
|
128
|
+
margin-bottom: 20px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* 輸入區域 */
|
|
132
|
+
|
|
133
|
+
.sync-body {
|
|
134
|
+
margin-bottom: 20px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.sync-body label {
|
|
138
|
+
display: block;
|
|
139
|
+
font-size: 14px;
|
|
140
|
+
color: #333;
|
|
141
|
+
margin-bottom: 5px;
|
|
142
|
+
text-align: left;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.sync-input {
|
|
146
|
+
width: 100%;
|
|
147
|
+
padding: 10px;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
border: 1px solid #ddd;
|
|
150
|
+
border-radius: 4px;
|
|
151
|
+
margin-bottom: 15px;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
outline: none;
|
|
154
|
+
transition: border-color 0.3s;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.sync-input:focus {
|
|
158
|
+
border-color: #ee4d2d;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* 按鈕樣式 */
|
|
162
|
+
|
|
163
|
+
.sync-button {
|
|
164
|
+
background-color: #ee4d2d;
|
|
165
|
+
color: #fff;
|
|
166
|
+
font-size: 16px;
|
|
167
|
+
font-weight: bold;
|
|
168
|
+
padding: 10px 20px;
|
|
169
|
+
border: none;
|
|
170
|
+
border-radius: 4px;
|
|
171
|
+
cursor: pointer;
|
|
172
|
+
transition: background-color 0.3s;
|
|
173
|
+
width: 100%;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.sync-button:hover {
|
|
177
|
+
background-color: #d44123;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.sync-button:active {
|
|
181
|
+
background-color: #b8341b;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* 響應式樣式 */
|
|
185
|
+
@media (max-width: 400px) {
|
|
186
|
+
.shopee-sync {
|
|
187
|
+
width: 90%;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`);
|
|
191
|
+
return html `
|
|
192
|
+
<div
|
|
193
|
+
id="date-sync"
|
|
194
|
+
style="position:relative;background: #fff;border: 1px solid #e0e0e0;border-radius: 8px;box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);padding: 20px;width: 300px;text-align: center;"
|
|
195
|
+
>
|
|
196
|
+
<i
|
|
197
|
+
class="fa-regular fa-circle-xmark fs-5 text-dark cursor_pointer"
|
|
198
|
+
style="position: absolute;right: 5px; top: 5px;"
|
|
199
|
+
onclick="${gvc.event(() => {
|
|
200
|
+
gvc.closeDialog();
|
|
201
|
+
})}"
|
|
202
|
+
></i>
|
|
203
|
+
<div class="sync-header">選擇同步商品的日期區間</div>
|
|
204
|
+
<div class="sync-body">
|
|
205
|
+
<label for="start-date">開始日期:</label>
|
|
206
|
+
<input
|
|
207
|
+
type="date"
|
|
208
|
+
id="start-date"
|
|
209
|
+
value="${startDate}"
|
|
210
|
+
class="sync-input"
|
|
211
|
+
onchange="${gvc.event((e) => {
|
|
212
|
+
startDate = e.value;
|
|
213
|
+
})}"
|
|
214
|
+
/>
|
|
215
|
+
<label for="end-date">結束日期:</label>
|
|
216
|
+
<input
|
|
217
|
+
type="date"
|
|
218
|
+
id="end-date"
|
|
219
|
+
value="${endDate}"
|
|
220
|
+
class="sync-input"
|
|
221
|
+
onchange="${gvc.event((e) => {
|
|
222
|
+
if (new Date(startDate) > new Date(endDate)) {
|
|
223
|
+
alert('開始日期不能晚於結束日期');
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
endDate = e.value;
|
|
227
|
+
})}"
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
<button
|
|
231
|
+
id="confirm-btn"
|
|
232
|
+
class="sync-button"
|
|
233
|
+
onclick="${gvc.event(() => {
|
|
234
|
+
callback(startDate, endDate, gvc);
|
|
235
|
+
})}"
|
|
236
|
+
>
|
|
237
|
+
確定
|
|
238
|
+
</button>
|
|
239
|
+
</div>
|
|
240
|
+
`;
|
|
241
|
+
}, 'sync');
|
|
242
|
+
}
|
|
243
|
+
Promise.all([
|
|
244
|
+
ApiUser.getPublicConfig(key, 'manager'),
|
|
245
|
+
ApiUser.getPublicConfig('shopp_config', 'manager'),
|
|
246
|
+
]).then(dd => {
|
|
45
247
|
var _a;
|
|
46
248
|
vm.loading = false;
|
|
47
249
|
dd[0].response.value && (vm.data = dd[0].response.value);
|
|
@@ -50,26 +252,26 @@ export class MarketShopee {
|
|
|
50
252
|
gvc.notifyDataChange(id);
|
|
51
253
|
});
|
|
52
254
|
gvc.addStyle(css `
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
255
|
+
.shopee-btn {
|
|
256
|
+
background-color: #fb5533; /* 主橙色 */
|
|
257
|
+
color: #ffffff; /* 白色文字 */
|
|
258
|
+
border: none; /* 無邊框 */
|
|
259
|
+
border-radius: 5px; /* 圓角按鍵 */
|
|
260
|
+
padding: 10px 20px; /* 按鍵內邊距 */
|
|
261
|
+
font-size: 16px; /* 文字大小 */
|
|
262
|
+
font-weight: bold; /* 粗體文字 */
|
|
263
|
+
cursor: pointer; /* 指針樣式 */
|
|
264
|
+
transition: all 0.3s ease; /* 漸變效果 */
|
|
265
|
+
}
|
|
64
266
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
267
|
+
.shopee-btn:hover {
|
|
268
|
+
background-color: #d94428; /* 深橙色 */
|
|
269
|
+
}
|
|
68
270
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
271
|
+
.shopee-btn:active {
|
|
272
|
+
background-color: #c03d24; /* 更深的橙色 */
|
|
273
|
+
}
|
|
274
|
+
`);
|
|
73
275
|
return {
|
|
74
276
|
bind: id,
|
|
75
277
|
view: () => {
|
|
@@ -78,16 +280,16 @@ export class MarketShopee {
|
|
|
78
280
|
}
|
|
79
281
|
const html = String.raw;
|
|
80
282
|
return [
|
|
81
|
-
html `
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</div>`,
|
|
283
|
+
html ` <div class="title-container">
|
|
284
|
+
${BgWidget.title('蝦皮串接與同步')}
|
|
285
|
+
<div class="flex-fill"></div>
|
|
286
|
+
</div>`,
|
|
86
287
|
BgWidget.mbContainer(18),
|
|
87
288
|
BgWidget.mainCard(html `
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
289
|
+
<div class="d-flex flex-column" style="gap:12px;">
|
|
290
|
+
<div class="tx_700 d-flex align-items-center" style="gap:5px;">
|
|
291
|
+
當前商店授權狀態
|
|
292
|
+
${gvc.bindView(() => {
|
|
91
293
|
const id = gvc.glitter.getUUID();
|
|
92
294
|
return {
|
|
93
295
|
bind: id,
|
|
@@ -101,218 +303,68 @@ export class MarketShopee {
|
|
|
101
303
|
else {
|
|
102
304
|
return BgWidget.warningInsignia('尚未授權');
|
|
103
305
|
}
|
|
104
|
-
})
|
|
306
|
+
}),
|
|
105
307
|
};
|
|
106
308
|
})}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
309
|
+
</div>
|
|
310
|
+
<div>
|
|
311
|
+
為了啟用蝦皮相關服務,請點擊下方按鈕進行授權操作,蝦皮授權有效期限為30天,請定期前往此頁面刷新有效期限。
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
<button
|
|
315
|
+
class="shopee-btn mt-3"
|
|
316
|
+
onclick="${gvc.event(() => {
|
|
317
|
+
localStorage.setItem('shopee', window.parent.location.href);
|
|
114
318
|
ApiShopee.generateAuth(window.parent.location.href);
|
|
115
|
-
})}"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
319
|
+
})}"
|
|
320
|
+
>
|
|
321
|
+
授權蝦皮
|
|
322
|
+
</button>
|
|
323
|
+
<button
|
|
324
|
+
class="shopee-btn mt-3"
|
|
325
|
+
onclick="${gvc.event(() => {
|
|
326
|
+
localStorage.setItem('shopee', window.parent.location.href);
|
|
327
|
+
ApiShopee.generateOrderAuth(window.parent.location.href);
|
|
328
|
+
})}"
|
|
329
|
+
>
|
|
330
|
+
授權蝦皮訂單同步
|
|
331
|
+
</button>
|
|
332
|
+
<button
|
|
333
|
+
id=""
|
|
334
|
+
class="shopee-btn mt-3 d-none"
|
|
335
|
+
onclick="${gvc.event(() => {
|
|
119
336
|
const dialog = new ShareDialog(gvc.glitter);
|
|
120
337
|
dialog.dataLoading({
|
|
121
|
-
visible: true
|
|
338
|
+
visible: true,
|
|
122
339
|
});
|
|
123
340
|
ApiShopee.syncProduct((res) => {
|
|
124
341
|
dialog.dataLoading({
|
|
125
|
-
visible: false
|
|
342
|
+
visible: false,
|
|
126
343
|
});
|
|
127
|
-
console.log("res -- ", res);
|
|
128
344
|
});
|
|
129
|
-
})}"
|
|
130
|
-
|
|
131
|
-
|
|
345
|
+
})}"
|
|
346
|
+
>
|
|
347
|
+
同步商品庫存
|
|
348
|
+
</button>
|
|
349
|
+
`),
|
|
132
350
|
BgWidget.mbContainer(18),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
loading = (yield ApiShopee.syncStatus()).response.result;
|
|
146
|
-
first = false;
|
|
147
|
-
}
|
|
148
|
-
return [
|
|
149
|
-
html `
|
|
150
|
-
<div class="tx_700 d-flex flex-column">匯入蝦皮商品
|
|
151
|
-
</div>
|
|
152
|
-
${BgWidget.grayNote('如要同步蝦皮商品庫存,請先匯入蝦皮商品。')}
|
|
153
|
-
<div>
|
|
154
|
-
${loading ? BgWidget.grayButton(`<div class="d-flex align-items-center" style="gap:8px;">
|
|
155
|
-
<div class="spinner-border spinner" style="width:20px;height: 20px;"></div>同步中請稍候...
|
|
156
|
-
</div>`, gvc.event(() => { })) : ``}
|
|
157
|
-
<button class="shopee-btn ${loading ? `d-none` : ``}" onclick="${gvc.event(() => {
|
|
158
|
-
const today = new Date().toISOString().split('T')[0];
|
|
159
|
-
let startDate = today;
|
|
160
|
-
let endDate = today;
|
|
161
|
-
gvc.glitter.innerDialog((gvc) => {
|
|
162
|
-
gvc.addStyle(html `
|
|
163
|
-
|
|
164
|
-
/* 外部容器 */
|
|
165
|
-
.shopee-sync {
|
|
166
|
-
background: #fff;
|
|
167
|
-
border: 1px solid #e0e0e0;
|
|
168
|
-
border-radius: 8px;
|
|
169
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
170
|
-
padding: 20px;
|
|
171
|
-
width: 300px;
|
|
172
|
-
text-align: center;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/* 標題樣式 */
|
|
176
|
-
.sync-header {
|
|
177
|
-
font-size: 18px;
|
|
178
|
-
font-weight: bold;
|
|
179
|
-
color: #ee4d2d;
|
|
180
|
-
margin-bottom: 20px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/* 輸入區域 */
|
|
184
|
-
.sync-body {
|
|
185
|
-
margin-bottom: 20px;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.sync-body label {
|
|
189
|
-
display: block;
|
|
190
|
-
font-size: 14px;
|
|
191
|
-
color: #333;
|
|
192
|
-
margin-bottom: 5px;
|
|
193
|
-
text-align: left;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.sync-input {
|
|
197
|
-
width: 100%;
|
|
198
|
-
padding: 10px;
|
|
199
|
-
font-size: 14px;
|
|
200
|
-
border: 1px solid #ddd;
|
|
201
|
-
border-radius: 4px;
|
|
202
|
-
margin-bottom: 15px;
|
|
203
|
-
box-sizing: border-box;
|
|
204
|
-
outline: none;
|
|
205
|
-
transition: border-color 0.3s;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.sync-input:focus {
|
|
209
|
-
border-color: #ee4d2d;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/* 按鈕樣式 */
|
|
213
|
-
.sync-button {
|
|
214
|
-
background-color: #ee4d2d;
|
|
215
|
-
color: #fff;
|
|
216
|
-
font-size: 16px;
|
|
217
|
-
font-weight: bold;
|
|
218
|
-
padding: 10px 20px;
|
|
219
|
-
border: none;
|
|
220
|
-
border-radius: 4px;
|
|
221
|
-
cursor: pointer;
|
|
222
|
-
transition: background-color 0.3s;
|
|
223
|
-
width: 100%;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.sync-button:hover {
|
|
227
|
-
background-color: #d44123;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.sync-button:active {
|
|
231
|
-
background-color: #b8341b;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/* 響應式樣式 */
|
|
235
|
-
@media (max-width: 400px) {
|
|
236
|
-
.shopee-sync {
|
|
237
|
-
width: 90%;
|
|
238
|
-
}
|
|
239
|
-
} `);
|
|
240
|
-
return html `
|
|
241
|
-
<div id="date-sync"
|
|
242
|
-
style="position:relative;background: #fff;border: 1px solid #e0e0e0;border-radius: 8px;box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);padding: 20px;width: 300px;text-align: center;">
|
|
243
|
-
<i
|
|
244
|
-
class="fa-regular fa-circle-xmark fs-5 text-dark cursor_pointer"
|
|
245
|
-
style="position: absolute;right: 5px; top: 5px;"
|
|
246
|
-
onclick="${gvc.event(() => {
|
|
247
|
-
gvc.closeDialog();
|
|
248
|
-
})}"
|
|
249
|
-
></i>
|
|
250
|
-
<div class="sync-header">選擇同步商品的日期區間</div>
|
|
251
|
-
<div class="sync-body">
|
|
252
|
-
<label for="start-date">開始日期:</label>
|
|
253
|
-
<input type="date" id="start-date" value="${startDate}"
|
|
254
|
-
class="sync-input" onchange="${gvc.event((e) => {
|
|
255
|
-
startDate = e.value;
|
|
256
|
-
})}"/>
|
|
257
|
-
<label for="end-date">結束日期:</label>
|
|
258
|
-
<input type="date" id="end-date" value="${endDate}"
|
|
259
|
-
class="sync-input" onchange="${gvc.event((e) => {
|
|
260
|
-
if (new Date(startDate) > new Date(endDate)) {
|
|
261
|
-
alert('開始日期不能晚於結束日期');
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
endDate = e.value;
|
|
265
|
-
})}"/>
|
|
266
|
-
</div>
|
|
267
|
-
<button id="confirm-btn" class="sync-button"
|
|
268
|
-
onclick="${gvc.event(() => {
|
|
269
|
-
const startTime = Math.floor(new Date(startDate).getTime() / 1000);
|
|
270
|
-
const endTime = Math.floor(new Date(endDate).getTime() / 1000);
|
|
271
|
-
ApiShopee.getItemList(startTime, endTime, (response) => { });
|
|
272
|
-
gvc.closeDialog();
|
|
273
|
-
loading = true;
|
|
274
|
-
reload();
|
|
275
|
-
})}">確定
|
|
276
|
-
</button>
|
|
277
|
-
</div>
|
|
278
|
-
`;
|
|
279
|
-
}, 'sync');
|
|
280
|
-
})}">匯入商品
|
|
281
|
-
</button>
|
|
282
|
-
</div>
|
|
283
|
-
`
|
|
284
|
-
].join('');
|
|
285
|
-
}),
|
|
286
|
-
divCreate: {
|
|
287
|
-
class: `d-flex flex-column`, style: 'gap:8px;'
|
|
288
|
-
}, onCreate: () => {
|
|
289
|
-
ApiShopee.syncStatus().then((res) => {
|
|
290
|
-
loading = res.response.result;
|
|
291
|
-
if (gvc.glitter.share.shopee_interval) {
|
|
292
|
-
clearInterval(gvc.glitter.share.shopee_interval);
|
|
293
|
-
}
|
|
294
|
-
gvc.glitter.share.shopee_interval = setTimeout(() => {
|
|
295
|
-
gvc.notifyDataChange(id);
|
|
296
|
-
}, 1000);
|
|
351
|
+
showShopeeBlock({
|
|
352
|
+
btnText: '匯入商品',
|
|
353
|
+
subTitle: '如要同步蝦皮商品庫存,請先匯入蝦皮商品。',
|
|
354
|
+
title: '匯入蝦皮商品',
|
|
355
|
+
url: '',
|
|
356
|
+
click: blockID => {
|
|
357
|
+
drawDialog((startDate, endDate, gvcDialog) => {
|
|
358
|
+
const startTime = Math.floor(new Date(startDate).getTime() / 1000);
|
|
359
|
+
const endTime = Math.floor(new Date(endDate).getTime() / 1000);
|
|
360
|
+
ApiShopee.getItemList(startTime, endTime, (response) => {
|
|
361
|
+
gvcDialog.closeDialog();
|
|
362
|
+
gvc.notifyDataChange(blockID);
|
|
297
363
|
});
|
|
298
|
-
|
|
299
|
-
};
|
|
300
|
-
})}
|
|
301
|
-
<button id="" class="shopee-btn mt-3 d-none"
|
|
302
|
-
onclick="${gvc.event(() => {
|
|
303
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
304
|
-
dialog.dataLoading({
|
|
305
|
-
visible: true
|
|
306
|
-
});
|
|
307
|
-
ApiShopee.syncProduct((res) => {
|
|
308
|
-
dialog.dataLoading({
|
|
309
|
-
visible: false
|
|
364
|
+
loading = true;
|
|
310
365
|
});
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
})}">同步商品庫存
|
|
314
|
-
</button>
|
|
315
|
-
`),
|
|
366
|
+
},
|
|
367
|
+
}),
|
|
316
368
|
].join('');
|
|
317
369
|
},
|
|
318
370
|
};
|