ts-glitter 21.7.7 → 21.7.8
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-blog.js +1 -6
- package/lowcode/backend-manager/bg-blog.ts +1 -11
- package/lowcode/backend-manager/bg-dialog.js +176 -0
- package/lowcode/backend-manager/bg-dialog.ts +230 -0
- package/lowcode/backend-manager/bg-product.js +1 -3
- package/lowcode/backend-manager/bg-product.ts +1 -5
- package/lowcode/cms-plugin/module/delivery-html.js +56 -5
- package/lowcode/cms-plugin/module/delivery-html.ts +69 -14
- package/lowcode/cms-plugin/shopping-discount-setting.js +234 -1468
- package/lowcode/cms-plugin/shopping-discount-setting.ts +302 -1732
- package/lowcode/jslib/lottie-player.js +143 -39
- package/lowcode/public-components/product/pd-card-01.js +1 -1
- package/lowcode/public-components/product/pd-card-01.ts +5 -8
- package/lowcode/public-components/product/pd-card-02.js +3 -2
- package/lowcode/public-components/product/pd-card-02.ts +7 -10
- package/lowcode/public-components/product/pd-card-03.js +3 -2
- package/lowcode/public-components/product/pd-card-03.ts +7 -9
- package/package.json +1 -1
- package/src/api-public/services/checkout-event.js +17 -7
- package/src/api-public/services/checkout-event.js.map +5 -1
- package/src/api-public/services/financial-serviceV2.js +17 -7
- package/src/api-public/services/financial-serviceV2.js.map +1 -1
- package/src/api-public/services/monitor.d.ts +0 -1
- package/src/api-public/services/shopee.js +17 -7
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopping.js +3 -3
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +3 -5
- package/src/api-public/services/user.js +17 -7
- package/src/api-public/services/user.js.map +5 -1
- package/src/app-project/serverless/src/index.js +17 -7
- package/src/app-project/serverless/src/index.js.map +1 -1
- package/src/app-project/serverless/src/modules/CryptoJS.js +17 -7
- package/src/app-project/serverless/src/modules/CryptoJS.js.map +1 -1
- package/src/app-project/serverless/src/modules/ssh.js +17 -7
- package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
- package/src/index.js +3 -3
- package/src/modules/CryptoJS.js +17 -7
- package/src/modules/CryptoJS.js.map +1 -1
- package/src/modules/database.d.ts +1 -1
- package/src/modules/ssh.js +17 -7
- package/src/modules/ssh.js.map +1 -1
- package/src/modules/tool.d.ts +4 -4
- package/src/modules/tool.js +1 -2
- package/src/modules/tool.js.map +1 -1
- package/src/services/app.js +17 -7
- package/src/services/app.js.map +1 -1
|
@@ -5,6 +5,7 @@ import { ApiUser } from '../../glitter-base/route/user.js';
|
|
|
5
5
|
import { CartData, OrderData } from './data.js';
|
|
6
6
|
import { ShipmentConfig } from '../../glitter-base/global/shipment-config.js';
|
|
7
7
|
import { PaymentConfig } from '../../glitter-base/global/payment-config.js';
|
|
8
|
+
import { OrderExcel } from './order-excel.js';
|
|
8
9
|
|
|
9
10
|
const html = String.raw;
|
|
10
11
|
|
|
@@ -15,9 +16,13 @@ type InfoObject = {
|
|
|
15
16
|
subtitle: string;
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
interface DeliveryCartData extends CartData {
|
|
20
|
+
custom_receive_info: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
export class DeliveryHTML {
|
|
19
24
|
// 列印事件
|
|
20
|
-
static print(ogvc: GVC, dataArray:
|
|
25
|
+
static print(ogvc: GVC, dataArray: DeliveryCartData[], type: PrintType) {
|
|
21
26
|
const prefix = Tool.randomString(3);
|
|
22
27
|
const containerID = Tool.randomString(3);
|
|
23
28
|
|
|
@@ -78,6 +83,31 @@ export class DeliveryHTML {
|
|
|
78
83
|
},
|
|
79
84
|
onCreate: () => {
|
|
80
85
|
if (loading) {
|
|
86
|
+
async function processInChunks(dataArray: DeliveryCartData[]) {
|
|
87
|
+
const chunkSize = 20;
|
|
88
|
+
|
|
89
|
+
for (let i = 0; i < dataArray.length; i += chunkSize) {
|
|
90
|
+
const chunk = dataArray.slice(i, i + chunkSize);
|
|
91
|
+
|
|
92
|
+
await Promise.all(
|
|
93
|
+
chunk.map(async data => {
|
|
94
|
+
const d = await OrderExcel.getCustomizeMap(data);
|
|
95
|
+
const temp: Record<string, any> = {};
|
|
96
|
+
const receiveKeys = [...d.keys()].filter(key => key.includes('收件人資訊'));
|
|
97
|
+
|
|
98
|
+
for (const key of receiveKeys) {
|
|
99
|
+
const value = d.get(key);
|
|
100
|
+
if (value && value !== '-') {
|
|
101
|
+
temp[key.split('-')[1].trim()] = value;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
data.custom_receive_info = temp;
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
81
111
|
Promise.all([
|
|
82
112
|
// 讀取台灣郵遞區號
|
|
83
113
|
fetch(new URL('../../assets/json/twzipcode.json', import.meta.url).href)
|
|
@@ -94,11 +124,14 @@ export class DeliveryHTML {
|
|
|
94
124
|
|
|
95
125
|
// 所有付款方式
|
|
96
126
|
PaymentConfig.getSupportPayment(true),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
vm.
|
|
127
|
+
|
|
128
|
+
// 補上客製化收件人資料
|
|
129
|
+
processInChunks(dataArray),
|
|
130
|
+
]).then(results => {
|
|
131
|
+
vm.twZipcode = results[0];
|
|
132
|
+
vm.store = results[1];
|
|
133
|
+
vm.shippingMethod = results[2];
|
|
134
|
+
vm.paymentMethod = results[3];
|
|
102
135
|
|
|
103
136
|
loading = false;
|
|
104
137
|
gvc.notifyDataChange(id);
|
|
@@ -357,10 +390,10 @@ export class DeliveryHTML {
|
|
|
357
390
|
}
|
|
358
391
|
|
|
359
392
|
// 出貨明細 - 配送資訊
|
|
360
|
-
static shipmentDetail(vm: any, glitter: any, data:
|
|
393
|
+
static shipmentDetail(vm: any, glitter: any, data: DeliveryCartData) {
|
|
361
394
|
const orderData = data.orderData;
|
|
362
395
|
|
|
363
|
-
function paymentStatus(cart:
|
|
396
|
+
function paymentStatus(cart: DeliveryCartData) {
|
|
364
397
|
const statusMessages: Record<string, string> = {
|
|
365
398
|
'0': cart.orderData.proof_purchase ? '待核款' : '未付款',
|
|
366
399
|
'1': '已付款',
|
|
@@ -379,6 +412,18 @@ export class DeliveryHTML {
|
|
|
379
412
|
? `${orderData.user_info.CVSStoreName} (${orderData.user_info.CVSAddress})`
|
|
380
413
|
: [orderData.user_info.city, orderData.user_info.area, orderData.user_info.address].filter(Boolean).join('');
|
|
381
414
|
|
|
415
|
+
const receive_temp: string[][] = [];
|
|
416
|
+
const receive_keys = Object.keys(data.custom_receive_info);
|
|
417
|
+
for (let i = 0; i < receive_keys.length; i += 2) {
|
|
418
|
+
const key1 = receive_keys[i];
|
|
419
|
+
const key2 = receive_keys[i + 1];
|
|
420
|
+
receive_temp.push(key2 ? [key1, key2] : [key1]);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function printReceiveTd(key: string) {
|
|
424
|
+
return key && data.custom_receive_info[key] ? html`<td>${key}:${data.custom_receive_info[key]}</td>` : '';
|
|
425
|
+
}
|
|
426
|
+
|
|
382
427
|
return html`<div class="details">
|
|
383
428
|
<table>
|
|
384
429
|
<tr>
|
|
@@ -401,6 +446,16 @@ export class DeliveryHTML {
|
|
|
401
446
|
<td>付款狀態:${paymentStatus(data)}</td>
|
|
402
447
|
<td>收件人信箱:${orderData.user_info.email}</td>
|
|
403
448
|
</tr>
|
|
449
|
+
${receive_temp
|
|
450
|
+
.map(keys => {
|
|
451
|
+
const appendTd = keys.map(key => printReceiveTd(key)).join('');
|
|
452
|
+
return appendTd
|
|
453
|
+
? html`<tr>
|
|
454
|
+
${appendTd}
|
|
455
|
+
</tr>`
|
|
456
|
+
: '';
|
|
457
|
+
})
|
|
458
|
+
.join('')}
|
|
404
459
|
</table>
|
|
405
460
|
</div>`;
|
|
406
461
|
}
|
|
@@ -482,7 +537,7 @@ export class DeliveryHTML {
|
|
|
482
537
|
}
|
|
483
538
|
|
|
484
539
|
// 取得出貨明細頁面
|
|
485
|
-
static getShipmentPage(vm: any, gvc: GVC, data:
|
|
540
|
+
static getShipmentPage(vm: any, gvc: GVC, data: DeliveryCartData) {
|
|
486
541
|
const glitter = gvc.glitter;
|
|
487
542
|
const orderData = data.orderData;
|
|
488
543
|
|
|
@@ -496,7 +551,7 @@ export class DeliveryHTML {
|
|
|
496
551
|
}
|
|
497
552
|
|
|
498
553
|
// 列印出貨明細
|
|
499
|
-
static shipmentHTML(vm: any, gvc: GVC, dataArray:
|
|
554
|
+
static shipmentHTML(vm: any, gvc: GVC, dataArray: DeliveryCartData[]) {
|
|
500
555
|
return dataArray
|
|
501
556
|
.map(data => {
|
|
502
557
|
try {
|
|
@@ -511,7 +566,7 @@ export class DeliveryHTML {
|
|
|
511
566
|
}
|
|
512
567
|
|
|
513
568
|
// 列印揀貨單
|
|
514
|
-
static pickHTML(vm: any, glitter: any, dataArray:
|
|
569
|
+
static pickHTML(vm: any, glitter: any, dataArray: DeliveryCartData[]) {
|
|
515
570
|
const formulaLineItems = () => {
|
|
516
571
|
const mergedItems = dataArray
|
|
517
572
|
.flatMap(data => data.orderData.lineItems)
|
|
@@ -568,7 +623,7 @@ export class DeliveryHTML {
|
|
|
568
623
|
}
|
|
569
624
|
|
|
570
625
|
// 列印地址貼條
|
|
571
|
-
static addressHTML(vm: any, dataArray:
|
|
626
|
+
static addressHTML(vm: any, dataArray: DeliveryCartData[]) {
|
|
572
627
|
const dataMap = dataArray.map(order => {
|
|
573
628
|
const orderData = order.orderData;
|
|
574
629
|
|
|
@@ -619,8 +674,8 @@ export class DeliveryHTML {
|
|
|
619
674
|
}
|
|
620
675
|
|
|
621
676
|
// 列印出貨明細 + 地址貼條
|
|
622
|
-
static shipAddrHTML(vm: any, gvc: GVC, dataArray:
|
|
623
|
-
const section = (data:
|
|
677
|
+
static shipAddrHTML(vm: any, gvc: GVC, dataArray: DeliveryCartData[]) {
|
|
678
|
+
const section = (data: DeliveryCartData) => {
|
|
624
679
|
const orderData = data.orderData;
|
|
625
680
|
|
|
626
681
|
// 取得台灣郵遞區號
|