ts-glitter 14.3.9 → 14.4.2
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 +22 -20
- package/lowcode/backend-manager/bg-product.ts +85 -73
- package/lowcode/backend-manager/bg-recommend.js +31 -28
- package/lowcode/backend-manager/bg-recommend.ts +31 -28
- package/lowcode/cms-plugin/ai-message.ts +2 -1
- package/lowcode/cms-plugin/filter-options.js +6 -4
- package/lowcode/cms-plugin/filter-options.ts +8 -6
- package/lowcode/cms-plugin/module/product-excel.js +35 -14
- package/lowcode/cms-plugin/module/product-excel.ts +40 -15
- package/lowcode/cms-plugin/shopping-discount-setting.js +1 -1
- package/lowcode/cms-plugin/shopping-discount-setting.ts +5 -2
- package/lowcode/cms-plugin/shopping-invoice-manager.js +0 -1
- package/lowcode/cms-plugin/shopping-invoice-manager.ts +0 -1
- package/lowcode/cms-plugin/shopping-product-setting.js +265 -160
- package/lowcode/cms-plugin/shopping-product-setting.ts +295 -297
- package/lowcode/cms-plugin/shopping-product-stock.js +12 -16
- package/lowcode/cms-plugin/shopping-product-stock.ts +29 -35
- package/lowcode/glitter-base/route/shopping.js +25 -4
- package/lowcode/glitter-base/route/shopping.ts +52 -44
- package/lowcode/glitterBundle/html-component/widget.js +0 -3
- package/lowcode/glitterBundle/html-component/widget.ts +3 -3
- package/lowcode/public-components/blogs/blogs-01.js +138 -1
- package/lowcode/public-components/blogs/blogs-01.ts +142 -2
- package/lowcode/public-components/checkout/index.js +3 -2
- package/lowcode/public-components/checkout/index.ts +16 -3
- package/lowcode/public-components/product/product-detail.js +1 -0
- package/lowcode/public-components/product/product-detail.ts +1 -0
- package/lowcode/public-components/product/product-list.js +1 -0
- package/lowcode/public-components/product/product-list.ts +1 -0
- package/lowcode/public-components/user-manager/um-class.js +2 -2
- package/lowcode/public-components/user-manager/um-class.ts +2 -2
- package/lowcode/public-components/user-manager/um-rebate.js +18 -18
- package/lowcode/public-components/user-manager/um-rebate.ts +39 -38
- package/package.json +1 -1
- package/src/api-public/controllers/shop.js +18 -0
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +17 -1
- package/src/api-public/services/financial-service.d.ts +16 -0
- package/src/api-public/services/financial-service.js +70 -3
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +89 -4
- package/src/api-public/services/recommend.js +14 -0
- package/src/api-public/services/recommend.js.map +1 -1
- package/src/api-public/services/recommend.ts +15 -0
- package/src/api-public/services/shopping.d.ts +35 -0
- package/src/api-public/services/shopping.js +97 -9
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +136 -20
- package/src/services/template.js.map +1 -1
|
@@ -208,6 +208,10 @@ export class BgRecommend {
|
|
|
208
208
|
})()
|
|
209
209
|
),
|
|
210
210
|
},
|
|
211
|
+
{
|
|
212
|
+
key: '下單數',
|
|
213
|
+
value: `<span class="fs-7">${dd.orders ? dd.orders.toLocaleString() : 0}</span>`,
|
|
214
|
+
},
|
|
211
215
|
{
|
|
212
216
|
key: '總金額',
|
|
213
217
|
value: `<span class="fs-7">${dd.total_price ? dd.total_price.toLocaleString() : 0}</span>`,
|
|
@@ -216,10 +220,6 @@ export class BgRecommend {
|
|
|
216
220
|
key: '曝光量',
|
|
217
221
|
value: `<span class="fs-7">${dd.exposure ? dd.exposure.toLocaleString() : 0}</span>`,
|
|
218
222
|
},
|
|
219
|
-
{
|
|
220
|
-
key: '下單數',
|
|
221
|
-
value: `<span class="fs-7">${dd.orders ? dd.orders.toLocaleString() : 0}</span>`,
|
|
222
|
-
},
|
|
223
223
|
{
|
|
224
224
|
key: '轉換率',
|
|
225
225
|
value: `<span class="fs-7">${dd.conversion_rate ?? 0}%</span>`,
|
|
@@ -234,7 +234,9 @@ export class BgRecommend {
|
|
|
234
234
|
},
|
|
235
235
|
{
|
|
236
236
|
key: '期限',
|
|
237
|
-
value: `<div class="
|
|
237
|
+
value: html`<div class="me-2">
|
|
238
|
+
<span class="fs-7">${dd.content.startDate} ~ ${dd.content.endDate ?? '永不過期'}</span>
|
|
239
|
+
</div>`,
|
|
238
240
|
},
|
|
239
241
|
{
|
|
240
242
|
key: '狀態',
|
|
@@ -641,14 +643,14 @@ export class BgRecommend {
|
|
|
641
643
|
return {
|
|
642
644
|
bind: id,
|
|
643
645
|
view: () => {
|
|
644
|
-
const inputStyle = 'font-size: 16px; height:40px;
|
|
646
|
+
const inputStyle = 'font-size: 16px; height:40px;';
|
|
645
647
|
let map: any = [
|
|
646
648
|
BgWidget.mainCard(
|
|
647
649
|
[
|
|
648
|
-
html` <div class="tx_700">連結網址</div
|
|
649
|
-
|
|
650
|
+
html` <div class="tx_700 mb-2">連結網址</div>
|
|
651
|
+
<div class="tx_normal">分銷代碼</div>
|
|
650
652
|
<div style="margin: 4px 0 8px;">${BgWidget.grayNote('是一段唯一的識別碼,用於系統追蹤和記錄通過該代碼完成的銷售')}</div>
|
|
651
|
-
${
|
|
653
|
+
${BgWidget.editeInput({
|
|
652
654
|
gvc: gvc,
|
|
653
655
|
title: '',
|
|
654
656
|
default: vm.data.code ?? '',
|
|
@@ -720,10 +722,10 @@ export class BgRecommend {
|
|
|
720
722
|
].join('');
|
|
721
723
|
},
|
|
722
724
|
}),
|
|
723
|
-
html` <div class="tx_700">基本設定</div
|
|
724
|
-
|
|
725
|
+
html` <div class="tx_700 mb-2">基本設定</div>
|
|
726
|
+
<div class="tx_normal">分銷連結名稱</div>
|
|
725
727
|
${BgWidget.mbContainer(8)}
|
|
726
|
-
${
|
|
728
|
+
${BgWidget.editeInput({
|
|
727
729
|
gvc: gvc,
|
|
728
730
|
title: '',
|
|
729
731
|
default: vm.data.title ?? '',
|
|
@@ -1186,7 +1188,7 @@ export class BgRecommend {
|
|
|
1186
1188
|
? [
|
|
1187
1189
|
'',
|
|
1188
1190
|
html`<div class="tx_normal">名字</div>`,
|
|
1189
|
-
|
|
1191
|
+
BgWidget.editeInput({
|
|
1190
1192
|
gvc: gvc,
|
|
1191
1193
|
title: '',
|
|
1192
1194
|
default: user.content.name,
|
|
@@ -1196,7 +1198,7 @@ export class BgRecommend {
|
|
|
1196
1198
|
}),
|
|
1197
1199
|
html` <div class="tx_normal">電子信箱</div>
|
|
1198
1200
|
${BgWidget.grayNote('將作為登入帳號,系統會寄送隨機密碼至此信箱')}`,
|
|
1199
|
-
|
|
1201
|
+
BgWidget.editeInput({
|
|
1200
1202
|
gvc: gvc,
|
|
1201
1203
|
title: '',
|
|
1202
1204
|
default: user.email,
|
|
@@ -1205,7 +1207,7 @@ export class BgRecommend {
|
|
|
1205
1207
|
readonly: true,
|
|
1206
1208
|
}),
|
|
1207
1209
|
html`<div class="tx_normal">電話</div>`,
|
|
1208
|
-
|
|
1210
|
+
BgWidget.editeInput({
|
|
1209
1211
|
gvc: gvc,
|
|
1210
1212
|
title: '',
|
|
1211
1213
|
default: user.content.phone,
|
|
@@ -1228,7 +1230,7 @@ export class BgRecommend {
|
|
|
1228
1230
|
return html`<div>
|
|
1229
1231
|
${[
|
|
1230
1232
|
html`<div class="tx_normal">名字</div>`,
|
|
1231
|
-
|
|
1233
|
+
BgWidget.editeInput({
|
|
1232
1234
|
gvc: gvc,
|
|
1233
1235
|
title: '',
|
|
1234
1236
|
default: user ? user.content.name : vm.data.recommend_user.name ?? '',
|
|
@@ -1247,7 +1249,7 @@ export class BgRecommend {
|
|
|
1247
1249
|
return {
|
|
1248
1250
|
bind: id,
|
|
1249
1251
|
view: () => {
|
|
1250
|
-
return
|
|
1252
|
+
return BgWidget.editeInput({
|
|
1251
1253
|
gvc: gvc,
|
|
1252
1254
|
title: '',
|
|
1253
1255
|
default: user ? user.content.email : vm.data.recommend_user.email ?? '',
|
|
@@ -1267,7 +1269,7 @@ export class BgRecommend {
|
|
|
1267
1269
|
})()
|
|
1268
1270
|
),
|
|
1269
1271
|
html`<div class="tx_normal">電話</div>`,
|
|
1270
|
-
|
|
1272
|
+
BgWidget.editeInput({
|
|
1271
1273
|
gvc: gvc,
|
|
1272
1274
|
title: '',
|
|
1273
1275
|
default: user ? user.content.phone : vm.data.recommend_user.phone ?? '',
|
|
@@ -1312,9 +1314,10 @@ export class BgRecommend {
|
|
|
1312
1314
|
BgWidget.mainCard(
|
|
1313
1315
|
[
|
|
1314
1316
|
html` <div class="tx_700">活動時間</div>`,
|
|
1317
|
+
BgWidget.mbContainer(18),
|
|
1315
1318
|
html`<div class="tx_normal">開始時間</div>`,
|
|
1316
|
-
html` <div class="d-flex mb-
|
|
1317
|
-
${
|
|
1319
|
+
html` <div class="d-flex mb-2 ${document.body.clientWidth < 768 ? 'flex-column' : ''}" style="gap: 12px">
|
|
1320
|
+
${BgWidget.editeInput({
|
|
1318
1321
|
gvc: gvc,
|
|
1319
1322
|
title: '',
|
|
1320
1323
|
type: 'date',
|
|
@@ -1325,7 +1328,7 @@ export class BgRecommend {
|
|
|
1325
1328
|
vm.data.startDate = text;
|
|
1326
1329
|
},
|
|
1327
1330
|
})}
|
|
1328
|
-
${
|
|
1331
|
+
${BgWidget.editeInput({
|
|
1329
1332
|
gvc: gvc,
|
|
1330
1333
|
title: '',
|
|
1331
1334
|
type: 'time',
|
|
@@ -1343,8 +1346,8 @@ export class BgRecommend {
|
|
|
1343
1346
|
{
|
|
1344
1347
|
key: 'withEnd',
|
|
1345
1348
|
name: '設定結束時間',
|
|
1346
|
-
innerHtml: html`<div class="d-flex mt-
|
|
1347
|
-
${
|
|
1349
|
+
innerHtml: html`<div class="d-flex mt-1 ${document.body.clientWidth < 768 ? 'flex-column' : ''}" style="gap: 12px">
|
|
1350
|
+
${BgWidget.editeInput({
|
|
1348
1351
|
gvc: gvc,
|
|
1349
1352
|
title: '',
|
|
1350
1353
|
type: 'date',
|
|
@@ -1355,7 +1358,7 @@ export class BgRecommend {
|
|
|
1355
1358
|
vm.data.endDate = text;
|
|
1356
1359
|
},
|
|
1357
1360
|
})}
|
|
1358
|
-
${
|
|
1361
|
+
${BgWidget.editeInput({
|
|
1359
1362
|
gvc: gvc,
|
|
1360
1363
|
title: '',
|
|
1361
1364
|
type: 'time',
|
|
@@ -1381,7 +1384,7 @@ export class BgRecommend {
|
|
|
1381
1384
|
},
|
|
1382
1385
|
{ single: false }
|
|
1383
1386
|
),
|
|
1384
|
-
].join(
|
|
1387
|
+
].join('')
|
|
1385
1388
|
),
|
|
1386
1389
|
];
|
|
1387
1390
|
return map.join(BgWidget.mbContainer(24));
|
|
@@ -1685,7 +1688,7 @@ export class BgRecommend {
|
|
|
1685
1688
|
<div class="col-12 col-md-6">
|
|
1686
1689
|
<div class="tx_normal">姓名</div>
|
|
1687
1690
|
${BgWidget.mbContainer(8)}
|
|
1688
|
-
${
|
|
1691
|
+
${BgWidget.editeInput({
|
|
1689
1692
|
gvc: gvc,
|
|
1690
1693
|
title: '',
|
|
1691
1694
|
default: vm.data.name ?? '',
|
|
@@ -1699,7 +1702,7 @@ export class BgRecommend {
|
|
|
1699
1702
|
<div class="col-12 col-md-6">
|
|
1700
1703
|
<div class="tx_normal">電子信箱</div>
|
|
1701
1704
|
${BgWidget.mbContainer(8)}
|
|
1702
|
-
${
|
|
1705
|
+
${BgWidget.editeInput({
|
|
1703
1706
|
gvc: gvc,
|
|
1704
1707
|
title: '',
|
|
1705
1708
|
default: vm.data.email ?? '',
|
|
@@ -1712,7 +1715,7 @@ export class BgRecommend {
|
|
|
1712
1715
|
</div>`,
|
|
1713
1716
|
html`<div class="tx_normal">電話</div>
|
|
1714
1717
|
${BgWidget.mbContainer(8)}
|
|
1715
|
-
${
|
|
1718
|
+
${BgWidget.editeInput({
|
|
1716
1719
|
gvc: gvc,
|
|
1717
1720
|
title: '',
|
|
1718
1721
|
default: vm.data.phone ?? '',
|
|
@@ -320,8 +320,9 @@ FilterOptions.productFunnel = [
|
|
|
320
320
|
type: 'multi_checkbox',
|
|
321
321
|
name: '商品狀態',
|
|
322
322
|
data: [
|
|
323
|
-
{ key: 'active', name: '
|
|
324
|
-
{ key: 'draft', name: '
|
|
323
|
+
{ key: 'active', name: '啟用' },
|
|
324
|
+
{ key: 'draft', name: '草稿' },
|
|
325
|
+
{ key: 'schedule', name: '期間限定' },
|
|
325
326
|
],
|
|
326
327
|
},
|
|
327
328
|
];
|
|
@@ -365,8 +366,9 @@ FilterOptions.stockFunnel = [
|
|
|
365
366
|
type: 'multi_checkbox',
|
|
366
367
|
name: '商品狀態',
|
|
367
368
|
data: [
|
|
368
|
-
{ key: 'active', name: '
|
|
369
|
-
{ key: 'draft', name: '
|
|
369
|
+
{ key: 'active', name: '啟用' },
|
|
370
|
+
{ key: 'draft', name: '草稿' },
|
|
371
|
+
{ key: 'schedule', name: '期間限定' },
|
|
370
372
|
],
|
|
371
373
|
},
|
|
372
374
|
{
|
|
@@ -101,12 +101,12 @@ export class FilterOptions {
|
|
|
101
101
|
static invoiceFilterFrame = {
|
|
102
102
|
invoice_type: [],
|
|
103
103
|
issue_method: [],
|
|
104
|
-
status:[],
|
|
104
|
+
status: [],
|
|
105
105
|
created_time: ['', ''],
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
static allowanceFilterFrame = {
|
|
109
|
-
status:[],
|
|
109
|
+
status: [],
|
|
110
110
|
created_time: ['', ''],
|
|
111
111
|
};
|
|
112
112
|
|
|
@@ -336,8 +336,9 @@ export class FilterOptions {
|
|
|
336
336
|
type: 'multi_checkbox',
|
|
337
337
|
name: '商品狀態',
|
|
338
338
|
data: [
|
|
339
|
-
{ key: 'active', name: '
|
|
340
|
-
{ key: 'draft', name: '
|
|
339
|
+
{ key: 'active', name: '啟用' },
|
|
340
|
+
{ key: 'draft', name: '草稿' },
|
|
341
|
+
{ key: 'schedule', name: '期間限定' },
|
|
341
342
|
],
|
|
342
343
|
},
|
|
343
344
|
];
|
|
@@ -396,8 +397,9 @@ export class FilterOptions {
|
|
|
396
397
|
type: 'multi_checkbox',
|
|
397
398
|
name: '商品狀態',
|
|
398
399
|
data: [
|
|
399
|
-
{ key: 'active', name: '
|
|
400
|
-
{ key: 'draft', name: '
|
|
400
|
+
{ key: 'active', name: '啟用' },
|
|
401
|
+
{ key: 'draft', name: '草稿' },
|
|
402
|
+
{ key: 'schedule', name: '期間限定' },
|
|
401
403
|
],
|
|
402
404
|
},
|
|
403
405
|
{
|
|
@@ -85,7 +85,7 @@ export class ProductExcel {
|
|
|
85
85
|
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
86
86
|
const blobData = new Blob([buffer], { type: EXCEL_TYPE });
|
|
87
87
|
const data1 = data.response;
|
|
88
|
-
dialog.dataLoading({ visible: true });
|
|
88
|
+
dialog.dataLoading({ visible: true, text: '資料處理中' });
|
|
89
89
|
$.ajax({
|
|
90
90
|
url: data1.url,
|
|
91
91
|
type: 'put',
|
|
@@ -104,7 +104,7 @@ export class ProductExcel {
|
|
|
104
104
|
},
|
|
105
105
|
error: () => {
|
|
106
106
|
dialog.dataLoading({ visible: false });
|
|
107
|
-
dialog.errorMessage({ text: '
|
|
107
|
+
dialog.errorMessage({ text: '發生錯誤' });
|
|
108
108
|
},
|
|
109
109
|
});
|
|
110
110
|
});
|
|
@@ -144,10 +144,27 @@ export class ProductExcel {
|
|
|
144
144
|
}
|
|
145
145
|
importData(notifyId, file) {
|
|
146
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
yield this.loadScript();
|
|
148
|
-
const reader = new FileReader();
|
|
149
147
|
const dialog = new ShareDialog(this.gvc.glitter);
|
|
150
148
|
dialog.dataLoading({ visible: true, text: '資料處理中' });
|
|
149
|
+
yield this.loadScript();
|
|
150
|
+
const reader = new FileReader();
|
|
151
|
+
const allProductDomain = yield new Promise((resolve, reject) => {
|
|
152
|
+
ApiShop.getProductDomain({}).then((data) => {
|
|
153
|
+
if (data.result && data.response.data) {
|
|
154
|
+
const list = data.response.data.map((item) => {
|
|
155
|
+
if (item.seo) {
|
|
156
|
+
const seo = JSON.parse(item.seo);
|
|
157
|
+
return seo.domain ? `${seo.domain}` : '';
|
|
158
|
+
}
|
|
159
|
+
return '';
|
|
160
|
+
});
|
|
161
|
+
resolve(list.filter((domain) => domain.length > 0));
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
resolve([]);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
151
168
|
reader.onload = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
152
169
|
const arrayBuffer = e.target.result;
|
|
153
170
|
const workbook = new this.ExcelJS.Workbook();
|
|
@@ -188,16 +205,21 @@ export class ProductExcel {
|
|
|
188
205
|
weight: 0,
|
|
189
206
|
};
|
|
190
207
|
};
|
|
191
|
-
|
|
192
|
-
function hasDuplicates(arr) {
|
|
193
|
-
const filteredArr = arr.filter((item) => item.trim() !== '');
|
|
194
|
-
return new Set(filteredArr).size !== filteredArr.length;
|
|
195
|
-
}
|
|
196
|
-
if (hasDuplicates(domainList)) {
|
|
208
|
+
function errorCallback(text) {
|
|
197
209
|
error = true;
|
|
198
210
|
dialog.dataLoading({ visible: false });
|
|
199
|
-
dialog.infoMessage({ text
|
|
200
|
-
|
|
211
|
+
dialog.infoMessage({ text });
|
|
212
|
+
}
|
|
213
|
+
const domainList = data.map((item) => item[5]);
|
|
214
|
+
const filteredArr = domainList.filter((item) => item.trim() !== '');
|
|
215
|
+
const hasDuplicates = new Set(filteredArr).size !== filteredArr.length;
|
|
216
|
+
if (hasDuplicates) {
|
|
217
|
+
errorCallback('「商品連結」的值不可重複');
|
|
218
|
+
}
|
|
219
|
+
const productDomainSet = new Set(allProductDomain);
|
|
220
|
+
const duplicateDomain = domainList.find((domain) => domain.length > 0 && productDomainSet.has(domain));
|
|
221
|
+
if (duplicateDomain) {
|
|
222
|
+
errorCallback(`商品連結「${duplicateDomain}」已有產品使用,請更換該欄位的值`);
|
|
201
223
|
}
|
|
202
224
|
data.forEach((row, index) => {
|
|
203
225
|
var _a;
|
|
@@ -239,8 +261,7 @@ export class ProductExcel {
|
|
|
239
261
|
productData.collection.forEach((row) => {
|
|
240
262
|
let collection = row.replace(/\s+/g, '');
|
|
241
263
|
if (regex.test(collection)) {
|
|
242
|
-
|
|
243
|
-
dialog.infoMessage({ text: `第${index + 1}行的類別名稱不可包含空白格與以下符號:「 / 」「 \\ 」,並以「 , 」區分不同類別` });
|
|
264
|
+
errorCallback(`第${index + 1}行的類別名稱不可包含空白格與以下符號:「 / 」「 \\ 」,並以「 , 」區分不同類別`);
|
|
244
265
|
return;
|
|
245
266
|
}
|
|
246
267
|
function splitStringIncrementally(input) {
|
|
@@ -153,7 +153,7 @@ export class ProductExcel {
|
|
|
153
153
|
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
154
154
|
const blobData: Blob = new Blob([buffer], { type: EXCEL_TYPE });
|
|
155
155
|
const data1 = data.response;
|
|
156
|
-
dialog.dataLoading({ visible: true });
|
|
156
|
+
dialog.dataLoading({ visible: true, text: '資料處理中' });
|
|
157
157
|
$.ajax({
|
|
158
158
|
url: data1.url,
|
|
159
159
|
type: 'put',
|
|
@@ -172,7 +172,7 @@ export class ProductExcel {
|
|
|
172
172
|
},
|
|
173
173
|
error: () => {
|
|
174
174
|
dialog.dataLoading({ visible: false });
|
|
175
|
-
dialog.errorMessage({ text: '
|
|
175
|
+
dialog.errorMessage({ text: '發生錯誤' });
|
|
176
176
|
},
|
|
177
177
|
});
|
|
178
178
|
});
|
|
@@ -218,11 +218,28 @@ export class ProductExcel {
|
|
|
218
218
|
|
|
219
219
|
// 匯入excel
|
|
220
220
|
async importData(notifyId: string, file: any) {
|
|
221
|
-
await this.loadScript();
|
|
222
|
-
const reader = new FileReader();
|
|
223
221
|
const dialog = new ShareDialog(this.gvc.glitter);
|
|
224
222
|
dialog.dataLoading({ visible: true, text: '資料處理中' });
|
|
225
223
|
|
|
224
|
+
await this.loadScript();
|
|
225
|
+
const reader = new FileReader();
|
|
226
|
+
const allProductDomain: string[] = await new Promise<string[]>((resolve, reject) => {
|
|
227
|
+
ApiShop.getProductDomain({}).then((data) => {
|
|
228
|
+
if (data.result && data.response.data) {
|
|
229
|
+
const list = data.response.data.map((item: any) => {
|
|
230
|
+
if (item.seo) {
|
|
231
|
+
const seo = JSON.parse(item.seo);
|
|
232
|
+
return seo.domain ? `${seo.domain}` : '';
|
|
233
|
+
}
|
|
234
|
+
return '';
|
|
235
|
+
});
|
|
236
|
+
resolve(list.filter((domain: string) => domain.length > 0));
|
|
237
|
+
} else {
|
|
238
|
+
resolve([]);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
226
243
|
reader.onload = async (e) => {
|
|
227
244
|
const arrayBuffer = e.target!.result;
|
|
228
245
|
const workbook = new this.ExcelJS.Workbook();
|
|
@@ -253,7 +270,7 @@ export class ProductExcel {
|
|
|
253
270
|
preview_image: string;
|
|
254
271
|
hideIndex: string;
|
|
255
272
|
collection: string[];
|
|
256
|
-
status: 'active' | 'draft';
|
|
273
|
+
status: 'active' | 'draft' | 'schedule';
|
|
257
274
|
specs: { title: string; option: any }[];
|
|
258
275
|
variants: Variant[];
|
|
259
276
|
seo: {
|
|
@@ -284,17 +301,26 @@ export class ProductExcel {
|
|
|
284
301
|
weight: 0,
|
|
285
302
|
};
|
|
286
303
|
};
|
|
304
|
+
function errorCallback(text: string) {
|
|
305
|
+
error = true;
|
|
306
|
+
dialog.dataLoading({ visible: false });
|
|
307
|
+
dialog.infoMessage({ text });
|
|
308
|
+
}
|
|
287
309
|
|
|
288
310
|
const domainList = data.map((item: string[]) => item[5]);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
311
|
+
|
|
312
|
+
// 判斷excel中是否有重複的domain
|
|
313
|
+
const filteredArr = domainList.filter((item: string) => item.trim() !== ''); // 過濾掉空白字串
|
|
314
|
+
const hasDuplicates = new Set(filteredArr).size !== filteredArr.length;
|
|
315
|
+
if (hasDuplicates) {
|
|
316
|
+
errorCallback('「商品連結」的值不可重複');
|
|
292
317
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
318
|
+
|
|
319
|
+
// 判斷已建立產品中是否有重複存在的domain
|
|
320
|
+
const productDomainSet = new Set(allProductDomain);
|
|
321
|
+
const duplicateDomain = domainList.find((domain: string) => domain.length > 0 && productDomainSet.has(domain));
|
|
322
|
+
if (duplicateDomain) {
|
|
323
|
+
errorCallback(`商品連結「${duplicateDomain}」已有產品使用,請更換該欄位的值`);
|
|
298
324
|
}
|
|
299
325
|
|
|
300
326
|
data.forEach((row: any, index: number) => {
|
|
@@ -338,8 +364,7 @@ export class ProductExcel {
|
|
|
338
364
|
productData.collection.forEach((row: any) => {
|
|
339
365
|
let collection = row.replace(/\s+/g, '');
|
|
340
366
|
if (regex.test(collection)) {
|
|
341
|
-
|
|
342
|
-
dialog.infoMessage({ text: `第${index + 1}行的類別名稱不可包含空白格與以下符號:「 / 」「 \\ 」,並以「 , 」區分不同類別` });
|
|
367
|
+
errorCallback(`第${index + 1}行的類別名稱不可包含空白格與以下符號:「 / 」「 \\ 」,並以「 , 」區分不同類別`);
|
|
343
368
|
return;
|
|
344
369
|
}
|
|
345
370
|
|
|
@@ -1165,7 +1165,7 @@ export class ShoppingDiscountSetting {
|
|
|
1165
1165
|
bind: id,
|
|
1166
1166
|
view: () => {
|
|
1167
1167
|
var _a, _b;
|
|
1168
|
-
const inputStyle = 'display: block; width:200px;';
|
|
1168
|
+
const inputStyle = 'display: block; width: 200px;';
|
|
1169
1169
|
return [
|
|
1170
1170
|
html ` <div class="tx_700">全館總使用次數</div>
|
|
1171
1171
|
${BgWidget.mbContainer(18)}
|
|
@@ -1089,7 +1089,10 @@ export class ShoppingDiscountSetting {
|
|
|
1089
1089
|
loading: true,
|
|
1090
1090
|
data: [],
|
|
1091
1091
|
};
|
|
1092
|
-
BgProduct.getProductOpts(
|
|
1092
|
+
BgProduct.getProductOpts(
|
|
1093
|
+
voucherData.add_on_products!,
|
|
1094
|
+
voucherData.reBackType === 'add_on_items' ? 'addProduct' : 'giveaway'
|
|
1095
|
+
).then((res) => {
|
|
1093
1096
|
vm.data = res;
|
|
1094
1097
|
vm.loading = false;
|
|
1095
1098
|
gvc.notifyDataChange(vm.id);
|
|
@@ -1314,7 +1317,7 @@ export class ShoppingDiscountSetting {
|
|
|
1314
1317
|
return {
|
|
1315
1318
|
bind: id,
|
|
1316
1319
|
view: () => {
|
|
1317
|
-
const inputStyle = 'display: block; width:200px;';
|
|
1320
|
+
const inputStyle = 'display: block; width: 200px;';
|
|
1318
1321
|
return [
|
|
1319
1322
|
html` <div class="tx_700">全館總使用次數</div>
|
|
1320
1323
|
${BgWidget.mbContainer(18)}
|