ts-glitter 17.8.4 → 17.8.6
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/module/product-excel.js +1 -1
- package/lowcode/cms-plugin/module/product-excel.ts +1 -1
- package/lowcode/cms-plugin/shopping-setting-basic.js +68 -54
- package/lowcode/cms-plugin/shopping-setting-basic.ts +68 -55
- package/lowcode/glitter-base/global/language.js +1 -0
- package/lowcode/glitter-base/global/language.ts +1 -0
- package/lowcode/glitter-base/route/api-cart.ts +1 -1
- package/lowcode/public-components/checkout/index.js +79 -3
- package/lowcode/public-components/checkout/index.ts +84 -3
- package/lowcode/public-components/headers/header-class.js +123 -95
- package/lowcode/public-components/headers/header-class.ts +197 -166
- package/lowcode/public-components/product/pd-class.js +26 -0
- package/lowcode/public-components/product/pd-class.ts +27 -0
- package/package.json +1 -1
package/lowcode/Entry.js
CHANGED
|
@@ -89,7 +89,7 @@ export class Entry {
|
|
|
89
89
|
}
|
|
90
90
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : clockF();
|
|
91
91
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
92
|
-
glitter.share.editerVersion = 'V_17.8.
|
|
92
|
+
glitter.share.editerVersion = 'V_17.8.6';
|
|
93
93
|
glitter.share.start = new Date();
|
|
94
94
|
const vm = {
|
|
95
95
|
appConfig: [],
|
package/lowcode/Entry.ts
CHANGED
|
@@ -90,7 +90,7 @@ export class Entry {
|
|
|
90
90
|
}
|
|
91
91
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
92
92
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
93
|
-
glitter.share.editerVersion = 'V_17.8.
|
|
93
|
+
glitter.share.editerVersion = 'V_17.8.6';
|
|
94
94
|
glitter.share.start = new Date();
|
|
95
95
|
const vm: {
|
|
96
96
|
appConfig: any;
|
|
@@ -282,7 +282,7 @@ export class ProductExcel {
|
|
|
282
282
|
const parts = input.split('/');
|
|
283
283
|
const result = [];
|
|
284
284
|
parts.reduce((acc, part) => {
|
|
285
|
-
const newAcc = acc ? `${acc}
|
|
285
|
+
const newAcc = acc ? `${acc} / ${part}` : part;
|
|
286
286
|
result.push(newAcc);
|
|
287
287
|
return newAcc;
|
|
288
288
|
}, '');
|
|
@@ -372,7 +372,7 @@ export class ProductExcel {
|
|
|
372
372
|
|
|
373
373
|
// 使用 reduce 来构建每一部分的拼接字符串
|
|
374
374
|
parts.reduce((acc, part) => {
|
|
375
|
-
const newAcc = acc ? `${acc}
|
|
375
|
+
const newAcc = acc ? `${acc} / ${part}` : part;
|
|
376
376
|
result.push(newAcc);
|
|
377
377
|
return newAcc;
|
|
378
378
|
}, '');
|
|
@@ -126,22 +126,34 @@ export class ShoppingSettingBasic {
|
|
|
126
126
|
preview_image: '',
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
if (postMD.product_category === 'kitchen'
|
|
130
|
-
postMD.variants.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return d2
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
if (postMD.product_category === 'kitchen') {
|
|
130
|
+
if (postMD.variants.length > 1) {
|
|
131
|
+
postMD.variants.map((dd) => {
|
|
132
|
+
var _a, _b, _c, _d;
|
|
133
|
+
dd.compare_price = 0;
|
|
134
|
+
dd.sale_price = dd.spec.map((d1, index) => {
|
|
135
|
+
var _a;
|
|
136
|
+
return parseInt((_a = postMD.specs[index].option.find((d2) => {
|
|
137
|
+
return d2.title === d1;
|
|
138
|
+
}).price) !== null && _a !== void 0 ? _a : "0", 10);
|
|
139
|
+
}).reduce((acc, cur) => acc + cur, 0);
|
|
140
|
+
dd.weight = parseFloat((_a = postMD.weight) !== null && _a !== void 0 ? _a : '0');
|
|
141
|
+
dd.v_height = parseFloat((_b = postMD.v_height) !== null && _b !== void 0 ? _b : '0');
|
|
142
|
+
dd.v_width = parseFloat((_c = postMD.v_width) !== null && _c !== void 0 ? _c : '0');
|
|
143
|
+
dd.v_length = parseFloat((_d = postMD.v_length) !== null && _d !== void 0 ? _d : '0');
|
|
144
|
+
dd.shipment_type = postMD.shipment_type;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
postMD.variants.map((dd) => {
|
|
149
|
+
var _a, _b, _c, _d;
|
|
150
|
+
dd.weight = parseFloat((_a = postMD.weight) !== null && _a !== void 0 ? _a : '0');
|
|
151
|
+
dd.v_height = parseFloat((_b = postMD.v_height) !== null && _b !== void 0 ? _b : '0');
|
|
152
|
+
dd.v_width = parseFloat((_c = postMD.v_width) !== null && _c !== void 0 ? _c : '0');
|
|
153
|
+
dd.v_length = parseFloat((_d = postMD.v_length) !== null && _d !== void 0 ? _d : '0');
|
|
154
|
+
dd.shipment_type = postMD.shipment_type;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
145
157
|
}
|
|
146
158
|
postMD.variants.map((dd) => {
|
|
147
159
|
dd.checked = undefined;
|
|
@@ -1210,7 +1222,7 @@ export class ShoppingSettingBasic {
|
|
|
1210
1222
|
},
|
|
1211
1223
|
};
|
|
1212
1224
|
})),
|
|
1213
|
-
(postMD.variants.length > 1)
|
|
1225
|
+
(postMD.variants.length > 1 || (postMD.product_category === 'kitchen'))
|
|
1214
1226
|
? (() => {
|
|
1215
1227
|
var _a;
|
|
1216
1228
|
if (postMD.product_category === 'kitchen') {
|
|
@@ -1320,59 +1332,61 @@ export class ShoppingSettingBasic {
|
|
|
1320
1332
|
</div>
|
|
1321
1333
|
</div>
|
|
1322
1334
|
`));
|
|
1323
|
-
|
|
1335
|
+
if (postMD.variants.length > 1) {
|
|
1336
|
+
map_.push(BgWidget.mainCard(`
|
|
1324
1337
|
<div class="d-flex flex-column" style="font-size: 16px;font-weight: 700;color:#393939;${postMD.shopee_id ? `` : `margin-bottom: 10px;`}">組合費用
|
|
1325
1338
|
${BgWidget.grayNote('購買金額為用戶選擇的選項價格去進行加總,如未輸入庫存數量則不追蹤庫存')}
|
|
1326
1339
|
</div>
|
|
1327
1340
|
|
|
1328
1341
|
` + obj.gvc.bindView(() => {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1342
|
+
const vm = {
|
|
1343
|
+
id: obj.gvc.glitter.getUUID()
|
|
1344
|
+
};
|
|
1345
|
+
return {
|
|
1346
|
+
bind: vm.id,
|
|
1347
|
+
view: () => {
|
|
1348
|
+
console.log(`postMD.specs==>`, postMD.specs);
|
|
1349
|
+
return html `
|
|
1337
1350
|
<div class="w-100 d-flex align-items-center border-bottom py-2 border-top">
|
|
1338
1351
|
<div class="fw-500" style="flex:1;">名稱</div>
|
|
1339
1352
|
<div class="fw-500" style="flex:1;">價格</div>
|
|
1340
1353
|
<div class="fw-500" style="flex:1;">庫存</div>
|
|
1341
1354
|
</div>
|
|
1342
1355
|
` + postMD.specs.map((dd) => {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1356
|
+
return dd.option.map((d1) => {
|
|
1357
|
+
var _a;
|
|
1358
|
+
d1.price = (_a = d1.price) !== null && _a !== void 0 ? _a : 0;
|
|
1359
|
+
return `<div class="w-100 d-flex align-items-center py-2">
|
|
1347
1360
|
<div class="fw-500" style="flex:1;">${dd.title} / ${d1.title}</div>
|
|
1348
1361
|
<div class="fw-50 pe-3" style="flex:1;">${BgWidget.editeInput({
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1362
|
+
gvc: gvc,
|
|
1363
|
+
title: '',
|
|
1364
|
+
default: `${d1.price}`,
|
|
1365
|
+
callback: (text) => {
|
|
1366
|
+
d1.price = parseInt(text, 10);
|
|
1367
|
+
updateVariants();
|
|
1368
|
+
},
|
|
1369
|
+
placeHolder: '價格',
|
|
1370
|
+
type: 'number'
|
|
1371
|
+
})}</div>
|
|
1359
1372
|
<div class="fw-50 " style="flex:1;">${BgWidget.editeInput({
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1373
|
+
gvc: gvc,
|
|
1374
|
+
title: '',
|
|
1375
|
+
default: `${d1.stock}`,
|
|
1376
|
+
callback: (text) => {
|
|
1377
|
+
d1.stock = text;
|
|
1378
|
+
},
|
|
1379
|
+
placeHolder: '不追蹤庫存',
|
|
1380
|
+
type: 'number'
|
|
1381
|
+
})}</div>
|
|
1369
1382
|
</div>`;
|
|
1383
|
+
}).join('');
|
|
1370
1384
|
}).join('');
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
};
|
|
1375
|
-
}
|
|
1385
|
+
},
|
|
1386
|
+
divCreate: {}
|
|
1387
|
+
};
|
|
1388
|
+
})));
|
|
1389
|
+
}
|
|
1376
1390
|
return map_.join(BgWidget.mbContainer(18));
|
|
1377
1391
|
}
|
|
1378
1392
|
else {
|
|
@@ -146,20 +146,31 @@ export class ShoppingSettingBasic {
|
|
|
146
146
|
preview_image: '',
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
if (postMD.product_category === 'kitchen'
|
|
150
|
-
postMD.variants.
|
|
151
|
-
dd
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return d2
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
149
|
+
if (postMD.product_category === 'kitchen') {
|
|
150
|
+
if(postMD.variants.length>1){
|
|
151
|
+
postMD.variants.map((dd) => {
|
|
152
|
+
dd.compare_price=0
|
|
153
|
+
dd.sale_price = dd.spec.map((d1, index) => {
|
|
154
|
+
return parseInt(postMD.specs[index].option.find((d2:any) => {
|
|
155
|
+
return d2.title === d1
|
|
156
|
+
}).price ?? "0",10)
|
|
157
|
+
}).reduce((acc, cur) => acc + cur, 0);
|
|
158
|
+
dd.weight=parseFloat(postMD.weight ?? '0');
|
|
159
|
+
dd.v_height=parseFloat(postMD.v_height ?? '0');
|
|
160
|
+
dd.v_width=parseFloat(postMD.v_width ?? '0');
|
|
161
|
+
dd.v_length=parseFloat(postMD.v_length ?? '0');
|
|
162
|
+
(dd.shipment_type as any)=postMD.shipment_type!!
|
|
163
|
+
})
|
|
164
|
+
}else{
|
|
165
|
+
postMD.variants.map((dd) => {
|
|
166
|
+
dd.weight=parseFloat(postMD.weight ?? '0');
|
|
167
|
+
dd.v_height=parseFloat(postMD.v_height ?? '0');
|
|
168
|
+
dd.v_width=parseFloat(postMD.v_width ?? '0');
|
|
169
|
+
dd.v_length=parseFloat(postMD.v_length ?? '0');
|
|
170
|
+
(dd.shipment_type as any)=postMD.shipment_type!!
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
163
174
|
}
|
|
164
175
|
|
|
165
176
|
postMD.variants.map((dd: any) => {
|
|
@@ -1345,7 +1356,7 @@ export class ShoppingSettingBasic {
|
|
|
1345
1356
|
};
|
|
1346
1357
|
})
|
|
1347
1358
|
),
|
|
1348
|
-
(postMD.variants.length > 1)
|
|
1359
|
+
(postMD.variants.length > 1 || (postMD.product_category === 'kitchen'))
|
|
1349
1360
|
? (() => {
|
|
1350
1361
|
if (postMD.product_category === 'kitchen') {
|
|
1351
1362
|
let map_:string[]=[]
|
|
@@ -1461,62 +1472,64 @@ export class ShoppingSettingBasic {
|
|
|
1461
1472
|
</div>
|
|
1462
1473
|
</div>
|
|
1463
1474
|
`))
|
|
1464
|
-
|
|
1475
|
+
if(postMD.variants.length>1){
|
|
1476
|
+
map_.push(BgWidget.mainCard(`
|
|
1465
1477
|
<div class="d-flex flex-column" style="font-size: 16px;font-weight: 700;color:#393939;${(postMD as any).shopee_id ? `` : `margin-bottom: 10px;`}">組合費用
|
|
1466
1478
|
${BgWidget.grayNote('購買金額為用戶選擇的選項價格去進行加總,如未輸入庫存數量則不追蹤庫存')}
|
|
1467
1479
|
</div>
|
|
1468
1480
|
|
|
1469
1481
|
` + obj.gvc.bindView(() => {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1482
|
+
const vm = {
|
|
1483
|
+
id: obj.gvc.glitter.getUUID()
|
|
1484
|
+
}
|
|
1485
|
+
return {
|
|
1486
|
+
bind: vm.id,
|
|
1487
|
+
view: () => {
|
|
1488
|
+
console.log(`postMD.specs==>`, postMD.specs)
|
|
1489
|
+
return html`
|
|
1478
1490
|
<div class="w-100 d-flex align-items-center border-bottom py-2 border-top">
|
|
1479
1491
|
<div class="fw-500" style="flex:1;">名稱</div>
|
|
1480
1492
|
<div class="fw-500" style="flex:1;">價格</div>
|
|
1481
1493
|
<div class="fw-500" style="flex:1;">庫存</div>
|
|
1482
1494
|
</div>
|
|
1483
1495
|
` + postMD.specs.map((dd) => {
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1496
|
+
return dd.option.map((d1: any) => {
|
|
1497
|
+
d1.price = d1.price ?? 0;
|
|
1498
|
+
return `<div class="w-100 d-flex align-items-center py-2">
|
|
1487
1499
|
<div class="fw-500" style="flex:1;">${dd.title} / ${d1.title}</div>
|
|
1488
1500
|
<div class="fw-50 pe-3" style="flex:1;">${
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
+
BgWidget.editeInput({
|
|
1502
|
+
gvc: gvc,
|
|
1503
|
+
title: '',
|
|
1504
|
+
default: `${d1.price}`,
|
|
1505
|
+
callback: (text) => {
|
|
1506
|
+
d1.price = parseInt(text,10);
|
|
1507
|
+
updateVariants()
|
|
1508
|
+
},
|
|
1509
|
+
placeHolder: '價格',
|
|
1510
|
+
type: 'number'
|
|
1511
|
+
})
|
|
1512
|
+
}</div>
|
|
1501
1513
|
<div class="fw-50 " style="flex:1;">${
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1514
|
+
BgWidget.editeInput({
|
|
1515
|
+
gvc: gvc,
|
|
1516
|
+
title: '',
|
|
1517
|
+
default: `${d1.stock}`,
|
|
1518
|
+
callback: (text) => {
|
|
1519
|
+
d1.stock = text;
|
|
1520
|
+
},
|
|
1521
|
+
placeHolder: '不追蹤庫存',
|
|
1522
|
+
type: 'number'
|
|
1523
|
+
})
|
|
1524
|
+
}</div>
|
|
1513
1525
|
</div>`
|
|
1526
|
+
}).join('')
|
|
1514
1527
|
}).join('')
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1528
|
+
},
|
|
1529
|
+
divCreate: {}
|
|
1530
|
+
}
|
|
1531
|
+
})))
|
|
1532
|
+
}
|
|
1520
1533
|
return map_.join(BgWidget.mbContainer(18))
|
|
1521
1534
|
} else {
|
|
1522
1535
|
return BgWidget.mainCard(
|
|
@@ -235,6 +235,7 @@ export class Language {
|
|
|
235
235
|
{ key: 'send_to_user_email', tw: '傳送至用戶信箱', cn: '传送至用户邮箱', en: 'Send to user email' },
|
|
236
236
|
{ key: 'mobile_barcode_device', tw: '手機條碼載具', cn: '手机条码载具', en: 'Mobile barcode device' },
|
|
237
237
|
{ key: 'add_to_cart', tw: '加入購物車', cn: '加入购物车', en: 'Add to Cart' },
|
|
238
|
+
{ key: 'confirm_select', tw: '確認選擇', cn: '确认选择', en: 'Confirm selection' },
|
|
238
239
|
{ key: 'add_to_cart_success', tw: '加入成功', cn: '加入成功', en: 'Added successfully' },
|
|
239
240
|
{
|
|
240
241
|
key: 'empty_cart_message',
|
|
@@ -242,6 +242,7 @@ export class Language {
|
|
|
242
242
|
{ key: 'send_to_user_email', tw: '傳送至用戶信箱', cn: '传送至用户邮箱', en: 'Send to user email' },
|
|
243
243
|
{ key: 'mobile_barcode_device', tw: '手機條碼載具', cn: '手机条码载具', en: 'Mobile barcode device' },
|
|
244
244
|
{ key: 'add_to_cart', tw: '加入購物車', cn: '加入购物车', en: 'Add to Cart' },
|
|
245
|
+
{ key: 'confirm_select', tw: '確認選擇', cn: '确认选择', en: 'Confirm selection' },
|
|
245
246
|
{ key: 'add_to_cart_success', tw: '加入成功', cn: '加入成功', en: 'Added successfully' },
|
|
246
247
|
{
|
|
247
248
|
key: 'empty_cart_message',
|
|
@@ -89,7 +89,7 @@ export class CheckoutIndex {
|
|
|
89
89
|
</div>`;
|
|
90
90
|
}
|
|
91
91
|
function giftBadge() {
|
|
92
|
-
return html ` <div class="${gClass('add-item-badge')}" style="background:
|
|
92
|
+
return html ` <div class="${gClass('add-item-badge')}" style="background: #FFE9B2;">
|
|
93
93
|
<div class="${gClass('add-item-text')}">${Language.text('gift')}</div>
|
|
94
94
|
</div>`;
|
|
95
95
|
}
|
|
@@ -657,7 +657,7 @@ export class CheckoutIndex {
|
|
|
657
657
|
<div class="d-flex flex-sm-row flex-column w-100 position-relative" style="gap: 8px; position: relative;">
|
|
658
658
|
<div class="${gClass('first-td')} justify-content-start d-none d-sm-flex" style="">
|
|
659
659
|
<div
|
|
660
|
-
style="width: 88px;height: 88px;border-radius: 20px;background: 50%/cover url('${item.preview_image}')"
|
|
660
|
+
style="min-width: 88px;width: 88px;height: 88px;border-radius: 20px;background: 50%/cover url('${item.preview_image}')"
|
|
661
661
|
></div>
|
|
662
662
|
<span class="ms-2 d-flex align-items-start flex-column " style="gap:5px;"
|
|
663
663
|
>${getBadgeClass()}${title}</span
|
|
@@ -1366,9 +1366,82 @@ export class CheckoutIndex {
|
|
|
1366
1366
|
class="${gClass('button-bgr')} mb-0 mt-2"
|
|
1367
1367
|
style="${isSelected ? (isSelected.id === pd.id ? `background: gray !important;` : ``) : ``}"
|
|
1368
1368
|
onclick="${gvc.event(() => {
|
|
1369
|
+
var _a;
|
|
1369
1370
|
if (isSelected && isSelected.id === pd.id) {
|
|
1370
1371
|
return;
|
|
1371
1372
|
}
|
|
1373
|
+
const titleFontColor = (_a = glitter.share.globalValue['theme_color.0.title']) !== null && _a !== void 0 ? _a : '#333333';
|
|
1374
|
+
gvc.glitter.innerDialog((gvc) => {
|
|
1375
|
+
var _a, _b;
|
|
1376
|
+
return html ` <div class="bg-white shadow rounded-3" style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 1000px;` : 'width:calc(100vw - 20px);'}">
|
|
1377
|
+
<div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto; position: relative;">
|
|
1378
|
+
<div class="w-100 d-flex align-items-center p-3 border-bottom" style="position: sticky; top: 0; background: #fff;z-index:12;">
|
|
1379
|
+
<div class="fw-bold fs-5" style="color:${titleFontColor}; white-space: nowrap;text-overflow: ellipsis;max-width: calc(100% - 40px); overflow: hidden;">
|
|
1380
|
+
${pd.title}
|
|
1381
|
+
</div>
|
|
1382
|
+
<div class="flex-fill"></div>
|
|
1383
|
+
<i
|
|
1384
|
+
class="fa-regular fa-circle-xmark fs-5 text-dark"
|
|
1385
|
+
style="cursor: pointer"
|
|
1386
|
+
onclick="${gvc.event(() => {
|
|
1387
|
+
gvc.closeDialog();
|
|
1388
|
+
})}"
|
|
1389
|
+
></i>
|
|
1390
|
+
</div>
|
|
1391
|
+
<div class="c_dialog">
|
|
1392
|
+
<div class="c_dialog_body">
|
|
1393
|
+
<div class="c_dialog_main" style="gap: 24px; max-height: calc(100vh - 100px); ${document.body.clientWidth < 800 ? `padding: 12px 20px;` : `padding: 30px;`}">
|
|
1394
|
+
${PdClass.selectSpec({
|
|
1395
|
+
gvc,
|
|
1396
|
+
titleFontColor: (_a = glitter.share.globalValue['theme_color.0.title']) !== null && _a !== void 0 ? _a : '#333333',
|
|
1397
|
+
prod: pd,
|
|
1398
|
+
vm: {
|
|
1399
|
+
specs: pd.specs.map((spec) => {
|
|
1400
|
+
return spec.option[0].title;
|
|
1401
|
+
}),
|
|
1402
|
+
quantity: '1',
|
|
1403
|
+
wishStatus: ((_b = glitter.share.wishList) !== null && _b !== void 0 ? _b : []).some((item) => {
|
|
1404
|
+
return item.id === dd.id;
|
|
1405
|
+
}),
|
|
1406
|
+
},
|
|
1407
|
+
preview: true,
|
|
1408
|
+
with_qty: false,
|
|
1409
|
+
is_gift: true,
|
|
1410
|
+
callback: () => {
|
|
1411
|
+
console.log(`vm.cartData=>`, vm.cartData);
|
|
1412
|
+
let find = vm.cartData.lineItems.find((d1) => {
|
|
1413
|
+
return dd.add_on_products.find((d2) => {
|
|
1414
|
+
return d2.id === d1.id;
|
|
1415
|
+
});
|
|
1416
|
+
});
|
|
1417
|
+
console.log(`find=>`, find);
|
|
1418
|
+
if (find) {
|
|
1419
|
+
apiCart.setCart((cartItem) => {
|
|
1420
|
+
cartItem.line_items.map((dd) => {
|
|
1421
|
+
if (dd.id === find.id) {
|
|
1422
|
+
dd.count--;
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
cartItem.line_items = cartItem.line_items.filter((dd) => {
|
|
1426
|
+
return dd.count > 0;
|
|
1427
|
+
});
|
|
1428
|
+
refreshCartData();
|
|
1429
|
+
gvc.closeDialog();
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
else {
|
|
1433
|
+
refreshCartData();
|
|
1434
|
+
gvc.closeDialog();
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
})}
|
|
1438
|
+
</div>
|
|
1439
|
+
</div>
|
|
1440
|
+
</div>
|
|
1441
|
+
</div>
|
|
1442
|
+
</div>`;
|
|
1443
|
+
}, Tool.randomString(7));
|
|
1444
|
+
return;
|
|
1372
1445
|
return gvc.glitter.innerDialog((gvc) => {
|
|
1373
1446
|
var _a, _b;
|
|
1374
1447
|
return html ` <div
|
|
@@ -1382,6 +1455,7 @@ export class CheckoutIndex {
|
|
|
1382
1455
|
class="w-100 d-flex align-items-center p-3 border-bottom"
|
|
1383
1456
|
style="position: sticky; top: 0; background: #fff;"
|
|
1384
1457
|
>
|
|
1458
|
+
<div class="fw-bold fs-5">${pd.title}</div>
|
|
1385
1459
|
<div class="flex-fill"></div>
|
|
1386
1460
|
<i
|
|
1387
1461
|
class="fa-regular fa-circle-xmark fs-5 text-dark"
|
|
@@ -1407,7 +1481,9 @@ export class CheckoutIndex {
|
|
|
1407
1481
|
return item.id === dd.id;
|
|
1408
1482
|
}),
|
|
1409
1483
|
},
|
|
1484
|
+
preview: true,
|
|
1410
1485
|
with_qty: false,
|
|
1486
|
+
is_gift: true,
|
|
1411
1487
|
callback: () => {
|
|
1412
1488
|
let find = vm.cartData.lineItems.find((d1) => {
|
|
1413
1489
|
return dd.add_on_products.find((d2) => {
|
|
@@ -2641,7 +2717,7 @@ export class CheckoutIndex {
|
|
|
2641
2717
|
.map((dd) => {
|
|
2642
2718
|
gift += dd.count;
|
|
2643
2719
|
});
|
|
2644
|
-
return
|
|
2720
|
+
return gift < gift_need;
|
|
2645
2721
|
})()) {
|
|
2646
2722
|
dialog.errorMessage({
|
|
2647
2723
|
text: Language.text('please_select_gift'),
|