ts-glitter 13.8.841 → 13.8.843
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/pos-pages/products-page.js +18 -9
- package/lowcode/cms-plugin/pos-pages/products-page.ts +84 -76
- package/lowcode/cms-plugin/shopping-product-setting.js +3 -1
- package/lowcode/cms-plugin/shopping-product-setting.ts +11 -11
- package/lowcode/view-model/saas-view-model.js +2 -2
- package/lowcode/view-model/saas-view-model.ts +2 -2
- package/package.json +1 -1
package/lowcode/Entry.js
CHANGED
|
@@ -70,7 +70,7 @@ export class Entry {
|
|
|
70
70
|
}
|
|
71
71
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
72
72
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
73
|
-
glitter.share.editerVersion = 'V_13.8.
|
|
73
|
+
glitter.share.editerVersion = 'V_13.8.843';
|
|
74
74
|
glitter.share.start = new Date();
|
|
75
75
|
const vm = {
|
|
76
76
|
appConfig: [],
|
package/lowcode/Entry.ts
CHANGED
|
@@ -71,7 +71,7 @@ export class Entry {
|
|
|
71
71
|
}
|
|
72
72
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
73
73
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
74
|
-
glitter.share.editerVersion = 'V_13.8.
|
|
74
|
+
glitter.share.editerVersion = 'V_13.8.843';
|
|
75
75
|
glitter.share.start = new Date();
|
|
76
76
|
const vm: {
|
|
77
77
|
appConfig: any;
|
|
@@ -108,6 +108,7 @@ export class ProductsPage {
|
|
|
108
108
|
return vm.productSearch.map((data) => {
|
|
109
109
|
var _a, _b, _c, _d;
|
|
110
110
|
let selectVariant = data.content.variants[0];
|
|
111
|
+
selectVariant.show_understocking = (selectVariant.show_understocking) === 'true';
|
|
111
112
|
let count = 1;
|
|
112
113
|
data.content.specs.forEach((spec) => {
|
|
113
114
|
spec.option[0].select = true;
|
|
@@ -236,7 +237,7 @@ export class ProductsPage {
|
|
|
236
237
|
</svg>
|
|
237
238
|
</div>
|
|
238
239
|
</div>
|
|
239
|
-
<div class="d-flex mt-2 align-items-center justify-content-end ${selectVariant.show_understocking ? `d-none` : ``}">
|
|
240
|
+
<div class="d-flex mt-2 align-items-center justify-content-end ${selectVariant.show_understocking === 'true' ? `d-none` : ``}">
|
|
240
241
|
<span>庫存數量:${selectVariant.stock}</span>
|
|
241
242
|
</div>
|
|
242
243
|
`;
|
|
@@ -249,7 +250,8 @@ export class ProductsPage {
|
|
|
249
250
|
})}
|
|
250
251
|
</div>
|
|
251
252
|
</div>
|
|
252
|
-
<div class="d-flex mt-4 justify-content-between"
|
|
253
|
+
<div class="d-flex mt-4 justify-content-between"
|
|
254
|
+
style="gap:10px;">
|
|
253
255
|
${gvc.bindView(() => {
|
|
254
256
|
return {
|
|
255
257
|
bind: 'close',
|
|
@@ -276,7 +278,7 @@ export class ProductsPage {
|
|
|
276
278
|
return {
|
|
277
279
|
bind: 'product_btn',
|
|
278
280
|
view: () => {
|
|
279
|
-
if (
|
|
281
|
+
if (selectVariant.show_understocking && selectVariant.stock === 0) {
|
|
280
282
|
return `尚無庫存`;
|
|
281
283
|
}
|
|
282
284
|
return `加入購物車`;
|
|
@@ -284,11 +286,16 @@ export class ProductsPage {
|
|
|
284
286
|
divCreate: () => {
|
|
285
287
|
return {
|
|
286
288
|
class: `d-flex align-items-center justify-content-center`,
|
|
287
|
-
style: `flex:1;padding: 12px 24px;font-size: 20px;color: #FFF;font-weight: 500;border-radius: 10px;background: ${(
|
|
289
|
+
style: `flex:1;padding: 12px 24px;font-size: 20px;color: #FFF;font-weight: 500;border-radius: 10px;background: ${(selectVariant.show_understocking && selectVariant.stock === 0) ? `#B8B8B8;` : `#393939;`}min-height: 58px;`,
|
|
288
290
|
option: [
|
|
289
291
|
{
|
|
290
292
|
key: 'onclick',
|
|
291
293
|
value: gvc.event(() => {
|
|
294
|
+
if (selectVariant.show_understocking && selectVariant.stock === 0) {
|
|
295
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
296
|
+
dialog.errorMessage({ text: ' 庫存數量不足' });
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
292
299
|
let addItem = orderDetail.lineItems.find((item) => {
|
|
293
300
|
console.log(data);
|
|
294
301
|
console.log(item);
|
|
@@ -389,7 +396,8 @@ export class ProductsPage {
|
|
|
389
396
|
${(index > 0) ? `<div style="background-color: #DDD;height:1px;width: 100%;"></div>` : ""}
|
|
390
397
|
<div class="d-flex align-items-center"
|
|
391
398
|
style="height: 87px;">
|
|
392
|
-
<div class="rounded-3"
|
|
399
|
+
<div class="rounded-3"
|
|
400
|
+
style="background: 50%/cover url('${item.preview_image}');height: 67px;width: 66px;margin-right: 12px;"></div>
|
|
393
401
|
<div class="d-flex flex-column flex-fill">
|
|
394
402
|
<div>${item.title}</div>
|
|
395
403
|
<div class="d-flex" style="gap:4px;">
|
|
@@ -435,7 +443,7 @@ export class ProductsPage {
|
|
|
435
443
|
</div>
|
|
436
444
|
|
|
437
445
|
</div>
|
|
438
|
-
<div class="h-100 d-flex flex-column align-items-end justify-content-between"
|
|
446
|
+
<div class="h-100 d-flex flex-column align-items-end justify-content-between">
|
|
439
447
|
<div class="" onclick="${gvc.event(() => {
|
|
440
448
|
orderDetail.lineItems.splice(index, 1);
|
|
441
449
|
if (document.querySelector('.js-cart-count')) {
|
|
@@ -455,7 +463,7 @@ export class ProductsPage {
|
|
|
455
463
|
stroke-linecap="round"/>
|
|
456
464
|
</svg>
|
|
457
465
|
</div>
|
|
458
|
-
|
|
466
|
+
|
|
459
467
|
<div style="color:#393939;font-size: 18px;font-style: normal;font-weight: 500;letter-spacing: 0.72px;">
|
|
460
468
|
$${(item.sale_price * item.count).toLocaleString()}
|
|
461
469
|
</div>
|
|
@@ -561,14 +569,15 @@ export class ProductsPage {
|
|
|
561
569
|
</div>
|
|
562
570
|
</div>`;
|
|
563
571
|
if (document.body.offsetWidth < 800) {
|
|
564
|
-
gvc.glitter.setDrawer(view, () => {
|
|
572
|
+
gvc.glitter.setDrawer(view, () => {
|
|
573
|
+
});
|
|
565
574
|
return ``;
|
|
566
575
|
}
|
|
567
576
|
else {
|
|
568
577
|
return view;
|
|
569
578
|
}
|
|
570
579
|
})()}
|
|
571
|
-
|
|
580
|
+
|
|
572
581
|
`;
|
|
573
582
|
}
|
|
574
583
|
}
|
|
@@ -8,13 +8,13 @@ import {Swal} from "../../modules/sweetAlert.js";
|
|
|
8
8
|
const html = String.raw
|
|
9
9
|
|
|
10
10
|
export class ProductsPage {
|
|
11
|
-
public static main(obj: { gvc: GVC,vm: ViewModel,orderDetail:OrderDetail }) {
|
|
11
|
+
public static main(obj: { gvc: GVC, vm: ViewModel, orderDetail: OrderDetail }) {
|
|
12
12
|
const swal = new Swal(obj.gvc);
|
|
13
13
|
const gvc = obj.gvc
|
|
14
14
|
const vm = obj.vm
|
|
15
|
-
const orderDetail=obj.orderDetail
|
|
15
|
+
const orderDetail = obj.orderDetail
|
|
16
16
|
const dialog = new ShareDialog(gvc.glitter);
|
|
17
|
-
(orderDetail as any).total=orderDetail.total || 0;
|
|
17
|
+
(orderDetail as any).total = orderDetail.total || 0;
|
|
18
18
|
return html`
|
|
19
19
|
<div class="left-panel"
|
|
20
20
|
style="${(document.body.offsetWidth < 800) ? `width:calc(100%);padding-top: 42px` : `width:calc(100% - 352px);padding-top: 32px ;padding-bottom:32px;`}overflow: hidden;">
|
|
@@ -60,7 +60,7 @@ export class ProductsPage {
|
|
|
60
60
|
},
|
|
61
61
|
divCreate: {
|
|
62
62
|
class: `d-flex px-3 `,
|
|
63
|
-
style: `width:100%;overflow: scroll;padding-bottom:32px;${(document.body.clientWidth>992) ? `padding-left:32px !important;padding-right:32px !important
|
|
63
|
+
style: `width:100%;overflow: scroll;padding-bottom:32px;${(document.body.clientWidth > 992) ? `padding-left:32px !important;padding-right:32px !important;` : `padding-top:20px;`}`
|
|
64
64
|
}
|
|
65
65
|
})}
|
|
66
66
|
${gvc.bindView({
|
|
@@ -100,7 +100,7 @@ export class ProductsPage {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
if (vm.searchable) {
|
|
103
|
-
dialog.dataLoading({visible:true})
|
|
103
|
+
dialog.dataLoading({visible: true})
|
|
104
104
|
ApiShop.getProduct({
|
|
105
105
|
page: 0,
|
|
106
106
|
collection: (category.key == 'all' ? '' : category.key),
|
|
@@ -110,19 +110,20 @@ export class ProductsPage {
|
|
|
110
110
|
}).then(res => {
|
|
111
111
|
vm.searchable = false;
|
|
112
112
|
vm.productSearch = res.response.data;
|
|
113
|
-
dialog.dataLoading({visible:false})
|
|
113
|
+
dialog.dataLoading({visible: false})
|
|
114
114
|
gvc.notifyDataChange(`productShow`)
|
|
115
115
|
})
|
|
116
116
|
}
|
|
117
117
|
if (vm.productSearch.length > 0) {
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
return vm.productSearch.map((data) => {
|
|
120
120
|
let selectVariant = data.content.variants[0];
|
|
121
|
+
selectVariant.show_understocking=(selectVariant.show_understocking)==='true'
|
|
121
122
|
let count = 1;
|
|
122
123
|
data.content.specs.forEach((spec: any) => {
|
|
123
124
|
spec.option[0].select = true;
|
|
124
125
|
})
|
|
125
|
-
|
|
126
|
+
|
|
126
127
|
return html`
|
|
127
128
|
<div class="d-flex flex-column mb-4 mb-sm-0"
|
|
128
129
|
style="max-width:${maxwidth}px;flex-basis: 188px;flex-grow: 1;border-radius: 10px;box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.08);"
|
|
@@ -192,7 +193,7 @@ export class ProductsPage {
|
|
|
192
193
|
}
|
|
193
194
|
},
|
|
194
195
|
divCreate: {
|
|
195
|
-
style: `gap:8px;margin-bottom:${data.content.specs.length ? `24px
|
|
196
|
+
style: `gap:8px;margin-bottom:${data.content.specs.length ? `24px` : `0px`};margin-top:16px;`,
|
|
196
197
|
class: `d-flex flex-column`
|
|
197
198
|
}
|
|
198
199
|
})}
|
|
@@ -203,7 +204,7 @@ export class ProductsPage {
|
|
|
203
204
|
view: () => {
|
|
204
205
|
if (count > 1 && selectVariant.stock < count && !selectVariant.show_understocking) {
|
|
205
206
|
count = selectVariant.stock;
|
|
206
|
-
|
|
207
|
+
|
|
207
208
|
dialog.infoMessage({text: `此商品僅剩${selectVariant.stock}個庫存`})
|
|
208
209
|
}
|
|
209
210
|
return html`
|
|
@@ -247,7 +248,7 @@ export class ProductsPage {
|
|
|
247
248
|
</svg>
|
|
248
249
|
</div>
|
|
249
250
|
</div>
|
|
250
|
-
<div class="d-flex mt-2 align-items-center justify-content-end ${selectVariant.show_understocking ? `d-none
|
|
251
|
+
<div class="d-flex mt-2 align-items-center justify-content-end ${selectVariant.show_understocking==='true' ? `d-none` : ``}">
|
|
251
252
|
<span>庫存數量:${selectVariant.stock}</span>
|
|
252
253
|
</div>
|
|
253
254
|
`
|
|
@@ -261,7 +262,8 @@ export class ProductsPage {
|
|
|
261
262
|
})}
|
|
262
263
|
</div>
|
|
263
264
|
</div>
|
|
264
|
-
<div class="d-flex mt-4 justify-content-between"
|
|
265
|
+
<div class="d-flex mt-4 justify-content-between"
|
|
266
|
+
style="gap:10px;">
|
|
265
267
|
${
|
|
266
268
|
gvc.bindView(() => {
|
|
267
269
|
|
|
@@ -289,11 +291,10 @@ export class ProductsPage {
|
|
|
289
291
|
}
|
|
290
292
|
${
|
|
291
293
|
gvc.bindView(() => {
|
|
292
|
-
|
|
293
294
|
return {
|
|
294
295
|
bind: 'product_btn',
|
|
295
296
|
view: () => {
|
|
296
|
-
if (
|
|
297
|
+
if (selectVariant.show_understocking && selectVariant.stock === 0) {
|
|
297
298
|
return `尚無庫存`
|
|
298
299
|
}
|
|
299
300
|
return `加入購物車`
|
|
@@ -301,11 +302,16 @@ export class ProductsPage {
|
|
|
301
302
|
divCreate: () => {
|
|
302
303
|
return {
|
|
303
304
|
class: `d-flex align-items-center justify-content-center`,
|
|
304
|
-
style: `flex:1;padding: 12px 24px;font-size: 20px;color: #FFF;font-weight: 500;border-radius: 10px;background: ${(
|
|
305
|
+
style: `flex:1;padding: 12px 24px;font-size: 20px;color: #FFF;font-weight: 500;border-radius: 10px;background: ${(selectVariant.show_understocking && selectVariant.stock === 0) ? `#B8B8B8;` : `#393939;`}min-height: 58px;`,
|
|
305
306
|
option: [
|
|
306
307
|
{
|
|
307
308
|
key: 'onclick',
|
|
308
309
|
value: gvc.event(() => {
|
|
310
|
+
if(selectVariant.show_understocking && selectVariant.stock === 0){
|
|
311
|
+
const dialog=new ShareDialog(gvc.glitter)
|
|
312
|
+
dialog.errorMessage({text:' 庫存數量不足'})
|
|
313
|
+
return
|
|
314
|
+
}
|
|
309
315
|
let addItem = orderDetail.lineItems.find((item: any) => {
|
|
310
316
|
console.log(data)
|
|
311
317
|
console.log(item)
|
|
@@ -325,7 +331,7 @@ export class ProductsPage {
|
|
|
325
331
|
sku: selectVariant.sku
|
|
326
332
|
})
|
|
327
333
|
}
|
|
328
|
-
if(document.querySelector('.js-cart-count')){
|
|
334
|
+
if (document.querySelector('.js-cart-count')) {
|
|
329
335
|
(document.querySelector('.js-cart-count') as any).recreateView()
|
|
330
336
|
}
|
|
331
337
|
gvc.glitter.closeDiaLog()
|
|
@@ -363,7 +369,7 @@ export class ProductsPage {
|
|
|
363
369
|
</div>
|
|
364
370
|
`
|
|
365
371
|
}).join('')
|
|
366
|
-
}else{
|
|
372
|
+
} else {
|
|
367
373
|
return POSSetting.emptyView('查無相關商品')
|
|
368
374
|
}
|
|
369
375
|
return html``
|
|
@@ -383,9 +389,9 @@ export class ProductsPage {
|
|
|
383
389
|
}
|
|
384
390
|
})}
|
|
385
391
|
</div>
|
|
386
|
-
${(()=>{
|
|
387
|
-
const view
|
|
388
|
-
style="height: 100%;width: 352px;max-width:100%;overflow: auto;${(document.body.clientWidth>800) ? `padding: 36px 24px
|
|
392
|
+
${(() => {
|
|
393
|
+
const view = `<div class=""
|
|
394
|
+
style="height: 100%;width: 352px;max-width:100%;overflow: auto;${(document.body.clientWidth > 800) ? `padding: 36px 24px;` : `padding: 10px 12px;`};background: #FFF;box-shadow: 1px 0 10px 0 rgba(0, 0, 0, 0.10);">
|
|
389
395
|
<div style="color:#393939;font-size: 32px;font-weight: 700;letter-spacing: 3px;margin-bottom: 32px;">
|
|
390
396
|
購物車
|
|
391
397
|
</div>
|
|
@@ -397,32 +403,33 @@ export class ProductsPage {
|
|
|
397
403
|
orderDetail.lineItems.forEach((item) => {
|
|
398
404
|
orderDetail.subtotal += item.sale_price * item.count;
|
|
399
405
|
})
|
|
400
|
-
|
|
406
|
+
|
|
401
407
|
return html`
|
|
402
408
|
<div style="display: flex;flex-direction: column;gap: 18px;">
|
|
403
409
|
${orderDetail.lineItems.map((item, index) => {
|
|
404
|
-
|
|
410
|
+
return html`
|
|
405
411
|
${(index > 0) ? `<div style="background-color: #DDD;height:1px;width: 100%;"></div>` : ""}
|
|
406
412
|
<div class="d-flex align-items-center"
|
|
407
413
|
style="height: 87px;">
|
|
408
|
-
<div class="rounded-3"
|
|
414
|
+
<div class="rounded-3"
|
|
415
|
+
style="background: 50%/cover url('${item.preview_image}');height: 67px;width: 66px;margin-right: 12px;"></div>
|
|
409
416
|
<div class="d-flex flex-column flex-fill">
|
|
410
417
|
<div>${item.title}</div>
|
|
411
418
|
<div class="d-flex" style="gap:4px;">
|
|
412
419
|
${(item.spec.length > 0) ? item.spec.map((spec) => {
|
|
413
|
-
|
|
420
|
+
return html`
|
|
414
421
|
<div style="color: #949494;font-size: 16px;font-style: normal;font-weight: 500;">
|
|
415
422
|
${spec}
|
|
416
423
|
</div>`
|
|
417
|
-
|
|
424
|
+
}).join('') : "單一規格"}
|
|
418
425
|
</div>
|
|
419
426
|
<div class="d-flex align-items-center"
|
|
420
427
|
style="margin-top:6px;">
|
|
421
428
|
<div style="display: flex;width: 30px;height: 30px;padding: 8px;justify-content: center;align-items: center;border-radius: 10px;background: #393939;"
|
|
422
429
|
onclick="${gvc.event(() => {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
item.count = (item.count < 2) ? item.count : item.count - 1;
|
|
431
|
+
gvc.notifyDataChange('order')
|
|
432
|
+
})}">
|
|
426
433
|
<svg xmlns="http://www.w3.org/2000/svg"
|
|
427
434
|
width="10" height="10"
|
|
428
435
|
viewBox="0 0 10 10"
|
|
@@ -436,14 +443,14 @@ export class ProductsPage {
|
|
|
436
443
|
value="${item.count}">
|
|
437
444
|
<div style="display: flex;width: 30px;height: 30px;padding: 8px;justify-content: center;align-items: center;border-radius: 10px;background: #393939;"
|
|
438
445
|
onclick="${gvc.event(() => {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
446
|
+
item.count++
|
|
447
|
+
gvc.notifyDataChange('order')
|
|
448
|
+
})}">
|
|
442
449
|
<svg xmlns="http://www.w3.org/2000/svg"
|
|
443
450
|
width="10" height="10"
|
|
444
451
|
viewBox="0 0 10 10" fill="none"
|
|
445
452
|
onclick="${gvc.event(() => {
|
|
446
|
-
|
|
453
|
+
})}">
|
|
447
454
|
<path d="M5.76923 0.769231C5.76923 0.34375 5.42548 0 5 0C4.57452 0 4.23077 0.34375 4.23077 0.769231V4.23077H0.769231C0.34375 4.23077 0 4.57452 0 5C0 5.42548 0.34375 5.76923 0.769231 5.76923H4.23077V9.23077C4.23077 9.65625 4.57452 10 5 10C5.42548 10 5.76923 9.65625 5.76923 9.23077V5.76923H9.23077C9.65625 5.76923 10 5.42548 10 5C10 4.57452 9.65625 4.23077 9.23077 4.23077H5.76923V0.769231Z"
|
|
448
455
|
fill="white"/>
|
|
449
456
|
</svg>
|
|
@@ -451,10 +458,10 @@ export class ProductsPage {
|
|
|
451
458
|
</div>
|
|
452
459
|
|
|
453
460
|
</div>
|
|
454
|
-
<div class="h-100 d-flex flex-column align-items-end justify-content-between"
|
|
455
|
-
<div class="" onclick="${gvc.event(()=>{
|
|
456
|
-
orderDetail.lineItems.splice(index,1)
|
|
457
|
-
if(document.querySelector('.js-cart-count')){
|
|
461
|
+
<div class="h-100 d-flex flex-column align-items-end justify-content-between">
|
|
462
|
+
<div class="" onclick="${gvc.event(() => {
|
|
463
|
+
orderDetail.lineItems.splice(index, 1)
|
|
464
|
+
if (document.querySelector('.js-cart-count')) {
|
|
458
465
|
(document.querySelector('.js-cart-count') as any).recreateView()
|
|
459
466
|
}
|
|
460
467
|
gvc.notifyDataChange('order')
|
|
@@ -471,31 +478,31 @@ export class ProductsPage {
|
|
|
471
478
|
stroke-linecap="round"/>
|
|
472
479
|
</svg>
|
|
473
480
|
</div>
|
|
474
|
-
|
|
481
|
+
|
|
475
482
|
<div style="color:#393939;font-size: 18px;font-style: normal;font-weight: 500;letter-spacing: 0.72px;">
|
|
476
483
|
$${(item.sale_price * item.count).toLocaleString()}
|
|
477
484
|
</div>
|
|
478
485
|
</div>
|
|
479
486
|
</div>
|
|
480
487
|
`
|
|
481
|
-
|
|
488
|
+
}).join('')}
|
|
482
489
|
</div>
|
|
483
490
|
<div class="w-100"
|
|
484
491
|
style="margin-top: 24px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;display: flex;padding: 24px;flex-direction: column;justify-content: center;">
|
|
485
492
|
<div class=" w-100 d-flex flex-column" style="gap:6px;">
|
|
486
493
|
${(() => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
494
|
+
let tempData = [
|
|
495
|
+
{
|
|
496
|
+
left: `小計總額`,
|
|
497
|
+
right: parseInt((orderDetail.subtotal ?? 0) as any, 10).toLocaleString()
|
|
498
|
+
},
|
|
499
|
+
// {
|
|
500
|
+
// left: `活動折扣`,
|
|
501
|
+
// right: parseInt((orderDetail.discount ?? 0) as any, 10).toLocaleString()
|
|
502
|
+
// }
|
|
503
|
+
]
|
|
504
|
+
return tempData.map((data) => {
|
|
505
|
+
return html`
|
|
499
506
|
<div class="w-100 d-flex">
|
|
500
507
|
<div style="font-size: 16px;font-style: normal;font-weight: 500;">
|
|
501
508
|
${data.left}
|
|
@@ -506,8 +513,8 @@ export class ProductsPage {
|
|
|
506
513
|
</div>
|
|
507
514
|
</div>
|
|
508
515
|
`
|
|
509
|
-
|
|
510
|
-
|
|
516
|
+
}).join(``)
|
|
517
|
+
})()}
|
|
511
518
|
</div>
|
|
512
519
|
<div class="d-flex align-items-center justify-content-center"
|
|
513
520
|
style="margin:18px 0;">
|
|
@@ -527,26 +534,26 @@ export class ProductsPage {
|
|
|
527
534
|
</div>
|
|
528
535
|
`
|
|
529
536
|
}, divCreate: {class: `display: flex;flex-direction: column;gap: 24px;`},
|
|
530
|
-
onCreate:()=>{
|
|
531
|
-
const dialog=new ShareDialog(gvc.glitter)
|
|
537
|
+
onCreate: () => {
|
|
538
|
+
const dialog = new ShareDialog(gvc.glitter)
|
|
532
539
|
obj.gvc.glitter.share.scan_back = (text: string) => {
|
|
533
|
-
dialog.dataLoading({visible:true})
|
|
540
|
+
dialog.dataLoading({visible: true})
|
|
534
541
|
ApiShop.getProduct({
|
|
535
542
|
page: 0,
|
|
536
543
|
limit: 50000,
|
|
537
|
-
accurate_search_text:true,
|
|
538
|
-
search:text,
|
|
544
|
+
accurate_search_text: true,
|
|
545
|
+
search: text,
|
|
539
546
|
orderBy: 'created_time_desc'
|
|
540
547
|
}).then(res => {
|
|
541
|
-
dialog.dataLoading({visible:false})
|
|
542
|
-
if(res.response.data[0]){
|
|
543
|
-
const data=res.response.data[0]
|
|
544
|
-
const selectVariant=res.response.data[0].content.variants.find((d1:any)=>{
|
|
545
|
-
return d1.barcode===text
|
|
548
|
+
dialog.dataLoading({visible: false})
|
|
549
|
+
if (res.response.data[0]) {
|
|
550
|
+
const data = res.response.data[0]
|
|
551
|
+
const selectVariant = res.response.data[0].content.variants.find((d1: any) => {
|
|
552
|
+
return d1.barcode === text
|
|
546
553
|
})
|
|
547
|
-
if(!orderDetail.lineItems.find((dd)=>{
|
|
548
|
-
return (dd.id+dd.spec.join('-'))===(data.id + selectVariant.spec.join('-'))
|
|
549
|
-
})){
|
|
554
|
+
if (!orderDetail.lineItems.find((dd) => {
|
|
555
|
+
return (dd.id + dd.spec.join('-')) === (data.id + selectVariant.spec.join('-'))
|
|
556
|
+
})) {
|
|
550
557
|
orderDetail.lineItems.push({
|
|
551
558
|
id: data.id,
|
|
552
559
|
title: data.content.title,
|
|
@@ -555,16 +562,16 @@ export class ProductsPage {
|
|
|
555
562
|
count: 0,
|
|
556
563
|
sale_price: selectVariant.sale_price,
|
|
557
564
|
sku: selectVariant.sku
|
|
558
|
-
})
|
|
565
|
+
})
|
|
559
566
|
}
|
|
560
|
-
orderDetail.lineItems.find((dd)=>{
|
|
561
|
-
return (dd.id+dd.spec.join('-'))===(data.id + selectVariant.spec.join('-'))
|
|
567
|
+
orderDetail.lineItems.find((dd) => {
|
|
568
|
+
return (dd.id + dd.spec.join('-')) === (data.id + selectVariant.spec.join('-'))
|
|
562
569
|
})!.count++
|
|
563
570
|
gvc.notifyDataChange('order')
|
|
564
|
-
}else{
|
|
565
|
-
swal.toast({icon:'error',title:'無此商品'})
|
|
571
|
+
} else {
|
|
572
|
+
swal.toast({icon: 'error', title: '無此商品'})
|
|
566
573
|
}
|
|
567
|
-
|
|
574
|
+
|
|
568
575
|
gvc.notifyDataChange(`order`)
|
|
569
576
|
})
|
|
570
577
|
}
|
|
@@ -579,14 +586,15 @@ export class ProductsPage {
|
|
|
579
586
|
送出訂單
|
|
580
587
|
</div>
|
|
581
588
|
</div>`
|
|
582
|
-
if(document.body.offsetWidth<800){
|
|
583
|
-
gvc.glitter.setDrawer(view,()=>{
|
|
584
|
-
|
|
585
|
-
|
|
589
|
+
if (document.body.offsetWidth < 800) {
|
|
590
|
+
gvc.glitter.setDrawer(view, () => {
|
|
591
|
+
})
|
|
592
|
+
return ``
|
|
593
|
+
} else {
|
|
586
594
|
return view
|
|
587
595
|
}
|
|
588
596
|
})()}
|
|
589
|
-
|
|
597
|
+
|
|
590
598
|
`
|
|
591
599
|
}
|
|
592
600
|
}
|
|
@@ -483,6 +483,7 @@ export class ShoppingProductSetting {
|
|
|
483
483
|
product_type: type,
|
|
484
484
|
});
|
|
485
485
|
case 'list':
|
|
486
|
+
window.parent.glitter.share.checkData = () => { return true; };
|
|
486
487
|
const filterID = gvc.glitter.getUUID();
|
|
487
488
|
vm.tableId = gvc.glitter.getUUID();
|
|
488
489
|
vm.dataList = [];
|
|
@@ -1125,7 +1126,7 @@ export class ShoppingProductSetting {
|
|
|
1125
1126
|
key: '庫存',
|
|
1126
1127
|
value: (() => {
|
|
1127
1128
|
const sum = dd.content.variants.reduce((acc, curr) => acc + curr.stock, 0);
|
|
1128
|
-
return html `${(dd.content.variants.length >
|
|
1129
|
+
return html `${(dd.content.variants.length > 1) ? `${dd.content.variants.length}個子類` : ``}${(sum > 1) ? `有${sum}件庫存` : html `<span style="color:#8E0E2B">有${sum}件庫存</span>`}`;
|
|
1129
1130
|
})(),
|
|
1130
1131
|
},
|
|
1131
1132
|
{
|
|
@@ -2091,6 +2092,7 @@ export class ShoppingProductSetting {
|
|
|
2091
2092
|
dialog.checkYesOrNot({
|
|
2092
2093
|
text: '尚未儲存內容,是否確認跳轉?', callback: (response) => {
|
|
2093
2094
|
if (response) {
|
|
2095
|
+
window.parent.glitter.share.checkData = () => { return true; };
|
|
2094
2096
|
obj.vm.type = 'list';
|
|
2095
2097
|
}
|
|
2096
2098
|
}
|
|
@@ -614,6 +614,7 @@ export class ShoppingProductSetting {
|
|
|
614
614
|
product_type: type,
|
|
615
615
|
});
|
|
616
616
|
case 'list':
|
|
617
|
+
(window.parent as any).glitter.share.checkData=()=>{return true}
|
|
617
618
|
const filterID = gvc.glitter.getUUID();
|
|
618
619
|
vm.tableId = gvc.glitter.getUUID();
|
|
619
620
|
vm.dataList = [];
|
|
@@ -1366,7 +1367,7 @@ export class ShoppingProductSetting {
|
|
|
1366
1367
|
key: '庫存',
|
|
1367
1368
|
value: (() => {
|
|
1368
1369
|
const sum = dd.content.variants.reduce((acc: any, curr: any) => acc + curr.stock, 0);
|
|
1369
|
-
return html`${(dd.content.variants.length >
|
|
1370
|
+
return html`${(dd.content.variants.length > 1) ? `${dd.content.variants.length}個子類` : ``}${(sum>1)?`有${sum}件庫存`:html`<span style="color:#8E0E2B">有${sum}件庫存</span>`}`
|
|
1370
1371
|
|
|
1371
1372
|
})(),
|
|
1372
1373
|
},
|
|
@@ -2467,16 +2468,16 @@ export class ShoppingProductSetting {
|
|
|
2467
2468
|
html`
|
|
2468
2469
|
<div class="title-container">
|
|
2469
2470
|
${BgWidget.goBack(
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2471
|
+
obj.gvc.event(() => {
|
|
2472
|
+
if ((window.parent as any).glitter.share.checkData && (!(window.parent as any).glitter.share.checkData())) {
|
|
2473
|
+
const dialog = new ShareDialog(gvc.glitter)
|
|
2474
|
+
dialog.checkYesOrNot({
|
|
2475
|
+
text: '尚未儲存內容,是否確認跳轉?', callback: (response) => {
|
|
2476
|
+
if(response){
|
|
2477
|
+
(window.parent as any).glitter.share.checkData=()=>{return true}
|
|
2478
|
+
obj.vm.type = 'list';
|
|
2478
2479
|
}
|
|
2479
|
-
})
|
|
2480
|
+
}})
|
|
2480
2481
|
}else{
|
|
2481
2482
|
obj.vm.type = 'list';
|
|
2482
2483
|
}
|
|
@@ -2771,7 +2772,6 @@ export class ShoppingProductSetting {
|
|
|
2771
2772
|
<img src="${url.data}"/>`;
|
|
2772
2773
|
})
|
|
2773
2774
|
.join('');
|
|
2774
|
-
|
|
2775
2775
|
editor.html.set(editor.html.get(0).replace(mark, html`<div class="d-flex flex-column">${imgHTML}</div>`));
|
|
2776
2776
|
editor.undo.saveStep();
|
|
2777
2777
|
} else {
|
|
@@ -567,8 +567,8 @@ export class SaasViewModel {
|
|
|
567
567
|
BgWidget.editeInput({
|
|
568
568
|
gvc: gvc,
|
|
569
569
|
title: html `
|
|
570
|
-
<div class="d-flex flex-column" style="gap:3px;"
|
|
571
|
-
${BgWidget.grayNote('
|
|
570
|
+
<div class="d-flex flex-column" style="gap:3px;">商家聯絡電話
|
|
571
|
+
${BgWidget.grayNote('正確填寫重要資料,避免遺漏重要通知')}
|
|
572
572
|
</div>`,
|
|
573
573
|
default: userData.userData.contact_phone,
|
|
574
574
|
callback: (text) => {
|
|
@@ -583,8 +583,8 @@ export class SaasViewModel {
|
|
|
583
583
|
BgWidget.editeInput({
|
|
584
584
|
gvc: gvc,
|
|
585
585
|
title: html`
|
|
586
|
-
<div class="d-flex flex-column" style="gap:3px;"
|
|
587
|
-
${BgWidget.grayNote('
|
|
586
|
+
<div class="d-flex flex-column" style="gap:3px;">商家聯絡電話
|
|
587
|
+
${BgWidget.grayNote('正確填寫重要資料,避免遺漏重要通知')}
|
|
588
588
|
</div>`,
|
|
589
589
|
default: userData.userData.contact_phone,
|
|
590
590
|
callback: (text) => {
|