ts-glitter 21.3.1 → 21.3.3
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-customer-message.js +4 -2
- package/lowcode/backend-manager/bg-customer-message.ts +4 -2
- package/lowcode/cms-plugin/module/product-excel.js +169 -129
- package/lowcode/cms-plugin/module/product-excel.ts +174 -130
- package/lowcode/cms-plugin/shopping-discount-setting.js +640 -600
- package/lowcode/cms-plugin/shopping-discount-setting.ts +782 -716
- package/lowcode/cms-plugin/shopping-finance-setting.js +372 -407
- package/lowcode/cms-plugin/shopping-finance-setting.ts +918 -968
- package/lowcode/glitter-base/global/language.js +12 -0
- package/lowcode/glitter-base/global/language.ts +12 -0
- package/lowcode/glitter-base/route/api-track.js +2 -2
- package/lowcode/glitter-base/route/api-track.ts +20 -20
- package/lowcode/public-components/checkout/index.js +27 -5
- package/lowcode/public-components/checkout/index.ts +34 -6
- package/lowcode/public-components/headers/header-class.js +13 -18
- package/lowcode/public-components/headers/header-class.ts +16 -20
- package/lowcode/public-components/modules/cart-module.js +6 -0
- package/lowcode/public-components/modules/cart-module.ts +6 -0
- package/lowcode/public-components/product/pd-class.js +1 -3
- package/lowcode/public-components/product/pd-class.ts +1 -3
- package/omr85cp878.json +1 -0
- package/package.json +1 -1
- package/src/api-public/services/checkout-event.js +26 -12
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +34 -12
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/post.js +7 -17
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/shopee.js +7 -17
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopping.d.ts +44 -27
- package/src/api-public/services/shopping.js +56 -11
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +125 -58
- package/src/index.js +7 -17
- package/src/index.js.map +1 -1
package/lowcode/Entry.js
CHANGED
|
@@ -146,7 +146,7 @@ export class Entry {
|
|
|
146
146
|
}
|
|
147
147
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
148
148
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
149
|
-
glitter.share.editerVersion = 'V_21.3.
|
|
149
|
+
glitter.share.editerVersion = 'V_21.3.3';
|
|
150
150
|
glitter.share.start = new Date();
|
|
151
151
|
const vm = { appConfig: [] };
|
|
152
152
|
window.saasConfig = {
|
package/lowcode/Entry.ts
CHANGED
|
@@ -150,7 +150,7 @@ export class Entry {
|
|
|
150
150
|
}
|
|
151
151
|
(window as any).renderClock = (window as any).renderClock ?? createClock();
|
|
152
152
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
153
|
-
glitter.share.editerVersion = 'V_21.3.
|
|
153
|
+
glitter.share.editerVersion = 'V_21.3.3';
|
|
154
154
|
glitter.share.start = new Date();
|
|
155
155
|
const vm = { appConfig: [] };
|
|
156
156
|
(window as any).saasConfig = {
|
|
@@ -365,9 +365,10 @@ export class BgCustomerMessage {
|
|
|
365
365
|
}
|
|
366
366
|
const view = [
|
|
367
367
|
html ` <div
|
|
368
|
-
class="position-
|
|
368
|
+
class="position-fixed bottom-0 start-0 bgf6 d-flex align-items-center justify-content-between border-top p-2 border-bottom shadow"
|
|
369
|
+
style="width:480px;max-width: 100vw;"
|
|
369
370
|
>
|
|
370
|
-
|
|
371
|
+
<div></div>
|
|
371
372
|
${BgWidget.darkButton('儲存', gvc.event(() => {
|
|
372
373
|
save();
|
|
373
374
|
}))}
|
|
@@ -972,6 +973,7 @@ export class BgCustomerMessage {
|
|
|
972
973
|
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
|
973
974
|
</div>
|
|
974
975
|
</div>
|
|
976
|
+
<div style="height: 80px;"></div>
|
|
975
977
|
`);
|
|
976
978
|
}));
|
|
977
979
|
},
|
|
@@ -391,9 +391,10 @@ export class BgCustomerMessage {
|
|
|
391
391
|
|
|
392
392
|
const view = [
|
|
393
393
|
html` <div
|
|
394
|
-
class="position-
|
|
394
|
+
class="position-fixed bottom-0 start-0 bgf6 d-flex align-items-center justify-content-between border-top p-2 border-bottom shadow"
|
|
395
|
+
style="width:480px;max-width: 100vw;"
|
|
395
396
|
>
|
|
396
|
-
|
|
397
|
+
<div></div>
|
|
397
398
|
${BgWidget.darkButton(
|
|
398
399
|
'儲存',
|
|
399
400
|
gvc.event(() => {
|
|
@@ -1072,6 +1073,7 @@ export class BgCustomerMessage {
|
|
|
1072
1073
|
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
|
1073
1074
|
</div>
|
|
1074
1075
|
</div>
|
|
1076
|
+
<div style="height: 80px;"></div>
|
|
1075
1077
|
`);
|
|
1076
1078
|
});
|
|
1077
1079
|
},
|
|
@@ -20,13 +20,18 @@ export class ProductExcel {
|
|
|
20
20
|
this.lineName = lineName;
|
|
21
21
|
}
|
|
22
22
|
checkString(value) {
|
|
23
|
-
|
|
23
|
+
try {
|
|
24
|
+
if (CheckInput.isEmpty(value)) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
28
|
+
return `${value}`;
|
|
29
|
+
}
|
|
24
30
|
return '';
|
|
25
31
|
}
|
|
26
|
-
|
|
27
|
-
return
|
|
32
|
+
catch (error) {
|
|
33
|
+
return '';
|
|
28
34
|
}
|
|
29
|
-
return '';
|
|
30
35
|
}
|
|
31
36
|
checkNumber(value) {
|
|
32
37
|
return CheckInput.isEmpty(value) || !CheckInput.isNumberString(`${value}`) ? 0 : value;
|
|
@@ -219,6 +224,8 @@ export class ProductExcel {
|
|
|
219
224
|
'安全庫存數量',
|
|
220
225
|
'商品條碼',
|
|
221
226
|
'商品簡述',
|
|
227
|
+
'商品標籤',
|
|
228
|
+
'管理員標籤',
|
|
222
229
|
];
|
|
223
230
|
}
|
|
224
231
|
static exampleKitchen() {
|
|
@@ -278,6 +285,9 @@ export class ProductExcel {
|
|
|
278
285
|
'100',
|
|
279
286
|
'10',
|
|
280
287
|
'CODE1230',
|
|
288
|
+
'簡述內容',
|
|
289
|
+
'標籤A,標籤B',
|
|
290
|
+
'標籤C,標籤D',
|
|
281
291
|
],
|
|
282
292
|
[
|
|
283
293
|
'',
|
|
@@ -515,93 +525,15 @@ export class ProductExcel {
|
|
|
515
525
|
});
|
|
516
526
|
}
|
|
517
527
|
static exportCommodity(gvc, getFormData) {
|
|
518
|
-
const
|
|
519
|
-
name: '',
|
|
520
|
-
status: '',
|
|
521
|
-
category: '',
|
|
522
|
-
productType: '',
|
|
523
|
-
img: '',
|
|
524
|
-
SEO_domain: '',
|
|
525
|
-
SEO_title: '',
|
|
526
|
-
SEO_desc: '',
|
|
527
|
-
spec1: '',
|
|
528
|
-
spec1Value: '',
|
|
529
|
-
spec2: '',
|
|
530
|
-
spec2Value: '',
|
|
531
|
-
spec3: '',
|
|
532
|
-
spec3Value: '',
|
|
533
|
-
sku: '',
|
|
534
|
-
cost: '',
|
|
535
|
-
sale_price: '',
|
|
536
|
-
compare_price: '',
|
|
537
|
-
benefit: '',
|
|
538
|
-
shipment_type: '',
|
|
539
|
-
length: '',
|
|
540
|
-
width: '',
|
|
541
|
-
height: '',
|
|
542
|
-
weight: '',
|
|
543
|
-
weightUnit: '',
|
|
544
|
-
stockPolicy: '',
|
|
545
|
-
stock: '',
|
|
546
|
-
save_stock: '',
|
|
547
|
-
barcode: '',
|
|
548
|
-
sub_title: '',
|
|
549
|
-
};
|
|
528
|
+
const rowInitDataKeys = this.rowDataKeys;
|
|
550
529
|
const dialog = new ShareDialog(gvc.glitter);
|
|
551
530
|
dialog.dataLoading({ visible: true });
|
|
552
531
|
ApiShop.getProduct(getFormData).then(response => {
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
return ({
|
|
559
|
-
id: index === 0 ? productData.content.id || '' : '',
|
|
560
|
-
name: index === 0 ? productData.content.title || '未命名商品' : '',
|
|
561
|
-
status: index === 0
|
|
562
|
-
? (() => {
|
|
563
|
-
var _a;
|
|
564
|
-
switch ((_a = productData.content) === null || _a === void 0 ? void 0 : _a.status) {
|
|
565
|
-
case 'draft':
|
|
566
|
-
return '草稿';
|
|
567
|
-
case 'schedule':
|
|
568
|
-
return '期間限定';
|
|
569
|
-
default:
|
|
570
|
-
return '啟用';
|
|
571
|
-
}
|
|
572
|
-
})()
|
|
573
|
-
: '',
|
|
574
|
-
category: index === 0 ? expo.checkString(productData.content.collection.join(' , ')) : '',
|
|
575
|
-
productType: index === 0 ? expo.checkString(this.getProductTypeString(productData.content)) : '',
|
|
576
|
-
img: expo.checkString((productData.content.variants[index] && productData.content.variants[index].preview_image) ||
|
|
577
|
-
productData.content.preview_image[0]),
|
|
578
|
-
SEO_domain: index === 0 ? expo.checkString((_b = (_a = productData.content) === null || _a === void 0 ? void 0 : _a.seo) === null || _b === void 0 ? void 0 : _b.domain) : '',
|
|
579
|
-
SEO_title: index === 0 ? expo.checkString((_d = (_c = productData.content) === null || _c === void 0 ? void 0 : _c.seo) === null || _d === void 0 ? void 0 : _d.title) : '',
|
|
580
|
-
SEO_desc: index === 0 ? expo.checkString((_f = (_e = productData.content) === null || _e === void 0 ? void 0 : _e.seo) === null || _f === void 0 ? void 0 : _f.content) : '',
|
|
581
|
-
spec1: index === 0 ? expo.checkString((_h = (_g = productData.content) === null || _g === void 0 ? void 0 : _g.specs[0]) === null || _h === void 0 ? void 0 : _h.title) : '',
|
|
582
|
-
spec1Value: expo.checkString((_j = productData.content.variants[index]) === null || _j === void 0 ? void 0 : _j.spec[0]),
|
|
583
|
-
spec2: index === 0 ? expo.checkString((_l = (_k = productData.content) === null || _k === void 0 ? void 0 : _k.specs[1]) === null || _l === void 0 ? void 0 : _l.title) : '',
|
|
584
|
-
spec2Value: expo.checkString((_m = productData.content.variants[index]) === null || _m === void 0 ? void 0 : _m.spec[1]),
|
|
585
|
-
spec3: index === 0 ? expo.checkString((_p = (_o = productData.content) === null || _o === void 0 ? void 0 : _o.specs[2]) === null || _p === void 0 ? void 0 : _p.title) : '',
|
|
586
|
-
spec3Value: expo.checkString((_q = productData.content.variants[index]) === null || _q === void 0 ? void 0 : _q.spec[2]),
|
|
587
|
-
sku: expo.checkString((_r = productData.content.variants[index]) === null || _r === void 0 ? void 0 : _r.sku),
|
|
588
|
-
cost: expo.checkNumber((_s = productData.content.variants[index]) === null || _s === void 0 ? void 0 : _s.cost),
|
|
589
|
-
sale_price: expo.checkNumber((_t = productData.content.variants[index]) === null || _t === void 0 ? void 0 : _t.sale_price),
|
|
590
|
-
compare_price: expo.checkNumber((_u = productData.content.variants[index]) === null || _u === void 0 ? void 0 : _u.compare_price),
|
|
591
|
-
benefit: expo.checkNumber((_v = productData.content.variants[index]) === null || _v === void 0 ? void 0 : _v.profit),
|
|
592
|
-
shipment_type: getShipmentType((_w = productData.content.variants[index]) === null || _w === void 0 ? void 0 : _w.shipment_type),
|
|
593
|
-
length: expo.checkNumber(((_x = productData.content.variants[index]) === null || _x === void 0 ? void 0 : _x.v_length) || 0),
|
|
594
|
-
width: expo.checkNumber(((_y = productData.content.variants[index]) === null || _y === void 0 ? void 0 : _y.v_width) || 0),
|
|
595
|
-
height: expo.checkNumber(((_z = productData.content.variants[index]) === null || _z === void 0 ? void 0 : _z.v_height) || 0),
|
|
596
|
-
weight: expo.checkNumber(((_0 = productData.content.variants[index]) === null || _0 === void 0 ? void 0 : _0.weight) || 0),
|
|
597
|
-
weightUnit: expo.checkString(((_1 = productData.content.variants[index]) === null || _1 === void 0 ? void 0 : _1.weightUnit) || 'KG'),
|
|
598
|
-
stockPolicy: ((_2 = productData.content.variants[index]) === null || _2 === void 0 ? void 0 : _2.show_understocking) === 'true' ? '追蹤' : '不追蹤',
|
|
599
|
-
stock: expo.checkNumber((_3 = productData.content.variants[index]) === null || _3 === void 0 ? void 0 : _3.stock),
|
|
600
|
-
save_stock: expo.checkNumber((_4 = productData.content.variants[index]) === null || _4 === void 0 ? void 0 : _4.save_stock),
|
|
601
|
-
barcode: expo.checkString((_5 = productData.content.variants[index]) === null || _5 === void 0 ? void 0 : _5.barcode),
|
|
602
|
-
sub_title: expo.checkString(productData.content.language_data[Language.getLanguage()].sub_title),
|
|
603
|
-
});
|
|
604
|
-
};
|
|
532
|
+
const products = response.response.data;
|
|
533
|
+
const exporter = new ProductExcel(gvc, ProductExcel.exampleHeader(), rowInitDataKeys);
|
|
534
|
+
const exportData = products.flatMap((productData) => {
|
|
535
|
+
const product = productData.content;
|
|
536
|
+
const lang = Language.getLanguage();
|
|
605
537
|
const getShipmentType = (type) => {
|
|
606
538
|
switch (type) {
|
|
607
539
|
case 'volume':
|
|
@@ -612,12 +544,59 @@ export class ProductExcel {
|
|
|
612
544
|
return '依重量計算';
|
|
613
545
|
}
|
|
614
546
|
};
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
547
|
+
const getProductStatus = (status) => {
|
|
548
|
+
switch (status) {
|
|
549
|
+
case 'draft':
|
|
550
|
+
return '草稿';
|
|
551
|
+
case 'schedule':
|
|
552
|
+
return '期間限定';
|
|
553
|
+
default:
|
|
554
|
+
return '啟用';
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
const getBaseRowData = (variant, index) => {
|
|
558
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
559
|
+
return {
|
|
560
|
+
id: index === 0 ? product.id || '' : '',
|
|
561
|
+
name: index === 0 ? product.title || '未命名商品' : '',
|
|
562
|
+
status: index === 0 ? getProductStatus(product.status) : '',
|
|
563
|
+
category: index === 0 ? exporter.checkString((_a = product.collection) === null || _a === void 0 ? void 0 : _a.filter(Boolean).join(', ')) : '',
|
|
564
|
+
productType: index === 0 ? exporter.checkString(this.getProductTypeString(product)) : '',
|
|
565
|
+
img: exporter.checkString((variant === null || variant === void 0 ? void 0 : variant.preview_image) || ((_b = product.preview_image) === null || _b === void 0 ? void 0 : _b[0])),
|
|
566
|
+
SEO_domain: index === 0 ? exporter.checkString((_c = product.seo) === null || _c === void 0 ? void 0 : _c.domain) : '',
|
|
567
|
+
SEO_title: index === 0 ? exporter.checkString((_d = product.seo) === null || _d === void 0 ? void 0 : _d.title) : '',
|
|
568
|
+
SEO_desc: index === 0 ? exporter.checkString((_e = product.seo) === null || _e === void 0 ? void 0 : _e.content) : '',
|
|
569
|
+
spec1: index === 0 ? exporter.checkString((_g = (_f = product.specs) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.title) : '',
|
|
570
|
+
spec1Value: exporter.checkString((_h = variant === null || variant === void 0 ? void 0 : variant.spec) === null || _h === void 0 ? void 0 : _h[0]),
|
|
571
|
+
spec2: index === 0 ? exporter.checkString((_k = (_j = product.specs) === null || _j === void 0 ? void 0 : _j[1]) === null || _k === void 0 ? void 0 : _k.title) : '',
|
|
572
|
+
spec2Value: exporter.checkString((_l = variant === null || variant === void 0 ? void 0 : variant.spec) === null || _l === void 0 ? void 0 : _l[1]),
|
|
573
|
+
spec3: index === 0 ? exporter.checkString((_o = (_m = product.specs) === null || _m === void 0 ? void 0 : _m[2]) === null || _o === void 0 ? void 0 : _o.title) : '',
|
|
574
|
+
spec3Value: exporter.checkString((_p = variant === null || variant === void 0 ? void 0 : variant.spec) === null || _p === void 0 ? void 0 : _p[2]),
|
|
575
|
+
sku: exporter.checkString(variant === null || variant === void 0 ? void 0 : variant.sku),
|
|
576
|
+
cost: exporter.checkNumber(variant === null || variant === void 0 ? void 0 : variant.cost),
|
|
577
|
+
sale_price: exporter.checkNumber(variant === null || variant === void 0 ? void 0 : variant.sale_price),
|
|
578
|
+
compare_price: exporter.checkNumber(variant === null || variant === void 0 ? void 0 : variant.compare_price),
|
|
579
|
+
benefit: exporter.checkNumber(variant === null || variant === void 0 ? void 0 : variant.profit),
|
|
580
|
+
shipment_type: getShipmentType(variant === null || variant === void 0 ? void 0 : variant.shipment_type),
|
|
581
|
+
length: exporter.checkNumber((variant === null || variant === void 0 ? void 0 : variant.v_length) || 0),
|
|
582
|
+
width: exporter.checkNumber((variant === null || variant === void 0 ? void 0 : variant.v_width) || 0),
|
|
583
|
+
height: exporter.checkNumber((variant === null || variant === void 0 ? void 0 : variant.v_height) || 0),
|
|
584
|
+
weight: exporter.checkNumber((variant === null || variant === void 0 ? void 0 : variant.weight) || 0),
|
|
585
|
+
weightUnit: exporter.checkString((variant === null || variant === void 0 ? void 0 : variant.weightUnit) || 'KG'),
|
|
586
|
+
stockPolicy: (variant === null || variant === void 0 ? void 0 : variant.show_understocking) === 'true' ? '追蹤' : '不追蹤',
|
|
587
|
+
stock: exporter.checkNumber(variant === null || variant === void 0 ? void 0 : variant.stock),
|
|
588
|
+
save_stock: exporter.checkNumber(variant === null || variant === void 0 ? void 0 : variant.save_stock),
|
|
589
|
+
barcode: exporter.checkString(variant === null || variant === void 0 ? void 0 : variant.barcode),
|
|
590
|
+
sub_title: index === 0 ? exporter.checkString(((_r = (_q = product.language_data) === null || _q === void 0 ? void 0 : _q[lang]) === null || _r === void 0 ? void 0 : _r.sub_title) || '') : '',
|
|
591
|
+
product_general_tag: index === 0
|
|
592
|
+
? exporter.checkString(((_u = (_t = (_s = product.product_tag) === null || _s === void 0 ? void 0 : _s.language) === null || _t === void 0 ? void 0 : _t[lang]) === null || _u === void 0 ? void 0 : _u.filter(Boolean).join(', ')) || '')
|
|
593
|
+
: '',
|
|
594
|
+
product_customize_tag: index === 0 ? exporter.checkString(((_v = product.product_customize_tag) === null || _v === void 0 ? void 0 : _v.filter(Boolean).join(', ')) || '') : '',
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
return product.variants.map((variant, index) => getBaseRowData(variant, index));
|
|
619
598
|
});
|
|
620
|
-
|
|
599
|
+
exporter.export(exportData, `商品列表_${gvc.glitter.ut.dateFormat(new Date(), 'yyyyMMddhhmmss')}`);
|
|
621
600
|
dialog.dataLoading({ visible: false });
|
|
622
601
|
});
|
|
623
602
|
}
|
|
@@ -678,7 +657,7 @@ export class ProductExcel {
|
|
|
678
657
|
}
|
|
679
658
|
})()
|
|
680
659
|
: '',
|
|
681
|
-
category: index === 0 ? expo.checkString(productData.content.collection.join('
|
|
660
|
+
category: index === 0 ? expo.checkString(productData.content.collection.filter(Boolean).join(', ')) : '',
|
|
682
661
|
productType: index === 0 ? expo.checkString(this.getProductTypeString(productData.content)) : '',
|
|
683
662
|
img: expo.checkString(productData.content.preview_image[0]),
|
|
684
663
|
SEO_domain: index === 0 ? expo.checkString((_b = (_a = productData.content) === null || _a === void 0 ? void 0 : _a.seo) === null || _b === void 0 ? void 0 : _b.domain) : '',
|
|
@@ -723,7 +702,7 @@ export class ProductExcel {
|
|
|
723
702
|
}
|
|
724
703
|
})()
|
|
725
704
|
: '',
|
|
726
|
-
category: index === 0 ? expo.checkString(productData.content.collection.join('
|
|
705
|
+
category: index === 0 ? expo.checkString(productData.content.collection.filter(Boolean).join(', ')) : '',
|
|
727
706
|
productType: index === 0 ? expo.checkString(this.getProductTypeString(productData.content)) : '',
|
|
728
707
|
img: expo.checkString((productData.content.variants[index] && productData.content.variants[index].preview_image) ||
|
|
729
708
|
productData.content.preview_image[0]),
|
|
@@ -827,7 +806,10 @@ export class ProductExcel {
|
|
|
827
806
|
status,
|
|
828
807
|
collection,
|
|
829
808
|
accurate_search_collection }),
|
|
830
|
-
checked: Object.assign(Object.assign({}, baseFormData), { id_list: dataArray
|
|
809
|
+
checked: Object.assign(Object.assign({}, baseFormData), { id_list: dataArray
|
|
810
|
+
.map((item) => item.id)
|
|
811
|
+
.filter(Boolean)
|
|
812
|
+
.join(',') }),
|
|
831
813
|
all: baseFormData,
|
|
832
814
|
};
|
|
833
815
|
return formDataMap[vm.select] || baseFormData;
|
|
@@ -1095,13 +1077,15 @@ export class ProductExcel {
|
|
|
1095
1077
|
keywords: '',
|
|
1096
1078
|
},
|
|
1097
1079
|
template: '',
|
|
1080
|
+
product_tag: {
|
|
1081
|
+
language: {},
|
|
1082
|
+
},
|
|
1098
1083
|
};
|
|
1099
1084
|
productData.id = id_list[postMD.length];
|
|
1100
1085
|
productData.title = this.checkString(row[0]);
|
|
1101
|
-
productData.sub_title = this.checkString(row[29]);
|
|
1102
1086
|
productData.status = row[1] == '啟用' ? 'active' : 'draft';
|
|
1103
1087
|
productData.collection = (_b = row[2].split(',')) !== null && _b !== void 0 ? _b : [];
|
|
1104
|
-
productData.collection = productData.collection.map((item) => item.replace(/\s+/g, ''));
|
|
1088
|
+
productData.collection = productData.collection.map((item) => item.trim().replace(/\s+/g, ''));
|
|
1105
1089
|
productData.collection.forEach((row) => {
|
|
1106
1090
|
let collection = row.replace(/\s+/g, '');
|
|
1107
1091
|
function splitStringIncrementally(input) {
|
|
@@ -1142,6 +1126,7 @@ export class ProductExcel {
|
|
|
1142
1126
|
productData.seo.domain = this.checkString(row[5]);
|
|
1143
1127
|
productData.seo.title = this.checkString(row[6]);
|
|
1144
1128
|
productData.seo.content = this.checkString(row[7]);
|
|
1129
|
+
productData.product_category = product_category;
|
|
1145
1130
|
let indices = [8, 10, 12];
|
|
1146
1131
|
indices.forEach(index => {
|
|
1147
1132
|
if (row[index]) {
|
|
@@ -1151,6 +1136,25 @@ export class ProductExcel {
|
|
|
1151
1136
|
});
|
|
1152
1137
|
}
|
|
1153
1138
|
});
|
|
1139
|
+
productData.sub_title = this.checkString(row[29]);
|
|
1140
|
+
productData.product_tag.language[Language.getLanguage()] = (() => {
|
|
1141
|
+
var _a;
|
|
1142
|
+
try {
|
|
1143
|
+
return (_a = row[30].split(',').map((item) => item.trim().replace(/\s+/g, ''))) !== null && _a !== void 0 ? _a : [];
|
|
1144
|
+
}
|
|
1145
|
+
catch (error) {
|
|
1146
|
+
return [];
|
|
1147
|
+
}
|
|
1148
|
+
})();
|
|
1149
|
+
productData.product_customize_tag = (() => {
|
|
1150
|
+
var _a;
|
|
1151
|
+
try {
|
|
1152
|
+
return (_a = row[31].split(',').map((item) => item.trim().replace(/\s+/g, ''))) !== null && _a !== void 0 ? _a : [];
|
|
1153
|
+
}
|
|
1154
|
+
catch (error) {
|
|
1155
|
+
return [];
|
|
1156
|
+
}
|
|
1157
|
+
})();
|
|
1154
1158
|
}
|
|
1155
1159
|
let indices = [9, 11, 13];
|
|
1156
1160
|
indices.forEach((rowindex, key) => {
|
|
@@ -1362,34 +1366,70 @@ export class ProductExcel {
|
|
|
1362
1366
|
}, vm.id);
|
|
1363
1367
|
}
|
|
1364
1368
|
}
|
|
1365
|
-
ProductExcel.getInitData = () =>
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1369
|
+
ProductExcel.getInitData = () => {
|
|
1370
|
+
return {
|
|
1371
|
+
name: '',
|
|
1372
|
+
status: '',
|
|
1373
|
+
category: '',
|
|
1374
|
+
productType: '',
|
|
1375
|
+
img: '',
|
|
1376
|
+
SEO_domain: '',
|
|
1377
|
+
SEO_title: '',
|
|
1378
|
+
SEO_desc: '',
|
|
1379
|
+
spec1: '',
|
|
1380
|
+
spec1Value: '',
|
|
1381
|
+
spec2: '',
|
|
1382
|
+
spec2Value: '',
|
|
1383
|
+
spec3: '',
|
|
1384
|
+
spec3Value: '',
|
|
1385
|
+
sku: '',
|
|
1386
|
+
cost: '',
|
|
1387
|
+
sale_price: '',
|
|
1388
|
+
compare_price: '',
|
|
1389
|
+
benefit: '',
|
|
1390
|
+
shipment_type: '',
|
|
1391
|
+
length: '',
|
|
1392
|
+
width: '',
|
|
1393
|
+
height: '',
|
|
1394
|
+
weight: '',
|
|
1395
|
+
weightUnit: '',
|
|
1396
|
+
stockPolicy: '',
|
|
1397
|
+
stock: '',
|
|
1398
|
+
save_stock: '',
|
|
1399
|
+
barcode: '',
|
|
1400
|
+
};
|
|
1401
|
+
};
|
|
1402
|
+
ProductExcel.rowDataKeys = [
|
|
1403
|
+
'name',
|
|
1404
|
+
'status',
|
|
1405
|
+
'category',
|
|
1406
|
+
'productType',
|
|
1407
|
+
'img',
|
|
1408
|
+
'SEO_domain',
|
|
1409
|
+
'SEO_title',
|
|
1410
|
+
'SEO_desc',
|
|
1411
|
+
'spec1',
|
|
1412
|
+
'spec1Value',
|
|
1413
|
+
'spec2',
|
|
1414
|
+
'spec2Value',
|
|
1415
|
+
'spec3',
|
|
1416
|
+
'spec3Value',
|
|
1417
|
+
'sku',
|
|
1418
|
+
'cost',
|
|
1419
|
+
'sale_price',
|
|
1420
|
+
'compare_price',
|
|
1421
|
+
'benefit',
|
|
1422
|
+
'shipment_type',
|
|
1423
|
+
'length',
|
|
1424
|
+
'width',
|
|
1425
|
+
'height',
|
|
1426
|
+
'weight',
|
|
1427
|
+
'weightUnit',
|
|
1428
|
+
'stockPolicy',
|
|
1429
|
+
'stock',
|
|
1430
|
+
'save_stock',
|
|
1431
|
+
'barcode',
|
|
1432
|
+
'sub_title',
|
|
1433
|
+
'product_general_tag',
|
|
1434
|
+
'product_customize_tag',
|
|
1435
|
+
];
|