ts-glitter 13.8.748 → 13.8.749

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 CHANGED
@@ -68,7 +68,7 @@ export class Entry {
68
68
  }
69
69
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
70
70
  console.log(`Entry-time:`, window.renderClock.stop());
71
- glitter.share.editerVersion = 'V_13.8.748';
71
+ glitter.share.editerVersion = 'V_13.8.749';
72
72
  glitter.share.start = new Date();
73
73
  const vm = {
74
74
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -68,7 +68,7 @@ export class Entry {
68
68
  }
69
69
  (window as any).renderClock = (window as any).renderClock ?? clockF();
70
70
  console.log(`Entry-time:`, (window as any).renderClock.stop());
71
- glitter.share.editerVersion = 'V_13.8.748';
71
+ glitter.share.editerVersion = 'V_13.8.749';
72
72
  glitter.share.start = new Date();
73
73
  const vm: {
74
74
  appConfig: any;
@@ -739,3 +739,4 @@ let clockF = () => {
739
739
  },
740
740
  };
741
741
  };
742
+
@@ -19,6 +19,8 @@ import { PosSetting } from "./pos-pages/pos-setting.js";
19
19
  import { PayConfig } from "./pos-pages/pay-config.js";
20
20
  import { ApiPageConfig } from "../api/pageConfig.js";
21
21
  import { PosHomePage } from "./pos-pages/pos-home-page.js";
22
+ import { ApiShop } from "../glitter-base/route/shopping.js";
23
+ import { Swal } from "../modules/sweetAlert.js";
22
24
  function getConfig() {
23
25
  const saasConfig = window.parent.saasConfig;
24
26
  return saasConfig;
@@ -228,6 +230,21 @@ height: 51px;
228
230
  gvc.glitter.addStyleLink('./css/editor.css');
229
231
  return gvc.bindView(() => {
230
232
  const id = gvc.glitter.getUUID();
233
+ let timer_vm = {
234
+ timer: 0,
235
+ last_string: ''
236
+ };
237
+ let scannerObserver = function (event) {
238
+ if (event.key.toLowerCase() !== 'enter') {
239
+ clearInterval(timer_vm.timer);
240
+ timer_vm.last_string += event.key;
241
+ timer_vm.timer = setTimeout(() => {
242
+ POSSetting.scannerCallback(gvc, timer_vm.last_string);
243
+ timer_vm.last_string = '';
244
+ }, 150);
245
+ }
246
+ console.log(`event.key==>`, event.key);
247
+ };
231
248
  return {
232
249
  bind: id,
233
250
  view: () => __awaiter(this, void 0, void 0, function* () {
@@ -251,15 +268,74 @@ height: 51px;
251
268
  }
252
269
  }),
253
270
  divCreate: {},
271
+ onCreate: () => {
272
+ document.removeEventListener('keydown', scannerObserver);
273
+ document.addEventListener('keydown', scannerObserver);
274
+ },
275
+ onDestroy: () => {
276
+ document.removeEventListener('keydown', scannerObserver);
277
+ }
254
278
  };
255
279
  });
256
280
  }
281
+ static scannerCallback(gvc, text) {
282
+ const dialog = new ShareDialog(gvc.glitter);
283
+ const swal = new Swal(gvc);
284
+ console.log(`text===>`, text);
285
+ if (text.indexOf(`variants-`) === 0) {
286
+ dialog.dataLoading({ visible: true, text: '搜尋商品...' });
287
+ text = text.replace(`variants-`, '');
288
+ ApiShop.getProduct({
289
+ page: 0,
290
+ limit: 50000,
291
+ accurate_search_text: true,
292
+ search: text,
293
+ orderBy: 'created_time_desc'
294
+ }).then(res => {
295
+ dialog.dataLoading({ visible: false });
296
+ if (res.response.data[0]) {
297
+ const data = res.response.data[0];
298
+ console.log(`data===>`, data);
299
+ const selectVariant = res.response.data[0].content.variants.find((d1) => {
300
+ return d1.barcode === text;
301
+ });
302
+ if (!OrderDetail.singleInstance.lineItems.find((dd) => {
303
+ return (dd.id + dd.spec.join('-')) === (data.id + selectVariant.spec.join('-'));
304
+ })) {
305
+ OrderDetail.singleInstance.lineItems.push({
306
+ id: data.id,
307
+ title: data.content.title,
308
+ preview_image: (selectVariant.preview_image.length > 1) ? selectVariant.preview_image : data.content.preview_image[0],
309
+ spec: selectVariant.spec,
310
+ count: 0,
311
+ sale_price: selectVariant.sale_price,
312
+ sku: selectVariant.sku
313
+ });
314
+ }
315
+ OrderDetail.singleInstance.lineItems.find((dd) => {
316
+ return (dd.id + dd.spec.join('-')) === (data.id + selectVariant.spec.join('-'));
317
+ }).count++;
318
+ gvc.notifyDataChange(['order', 'checkout-page']);
319
+ }
320
+ else {
321
+ swal.toast({ icon: 'error', title: '無此商品' });
322
+ }
323
+ });
324
+ }
325
+ }
257
326
  static posView(gvc) {
258
327
  const glitter = gvc.glitter;
259
328
  const vm = {
260
329
  id: glitter.getUUID(),
261
330
  filterID: glitter.getUUID(),
262
- type: 'home',
331
+ get type() {
332
+ var _a;
333
+ return (_a = localStorage.getItem('show_pos_page')) !== null && _a !== void 0 ? _a : "home";
334
+ },
335
+ set type(value) {
336
+ localStorage.setItem('show_pos_page', `${value}`);
337
+ gvc.notifyDataChange(vm.id);
338
+ },
263
339
  order: {},
264
340
  query: '',
265
341
  productSearch: [],
@@ -282,15 +358,11 @@ height: 51px;
282
358
  };
283
359
  if (localStorage.getItem('pos_order_detail')) {
284
360
  orderDetail = JSON.parse(localStorage.getItem('pos_order_detail'));
285
- if (orderDetail.lineItems && orderDetail.lineItems.length > 0) {
286
- vm.type = 'home';
287
- }
288
361
  }
289
362
  else {
290
363
  orderDetail.user_info.shipment = 'now';
291
364
  }
292
365
  if (!orderDetail.lineItems || orderDetail.lineItems.length === 0) {
293
- vm.type = 'home';
294
366
  orderDetail.user_info.shipment = 'now';
295
367
  }
296
368
  gvc.addStyle(`
@@ -306,7 +378,6 @@ height: 51px;
306
378
  return (gvc.bindView(() => {
307
379
  return {
308
380
  bind: vm.id,
309
- dataList: [{ obj: vm, key: 'type' }],
310
381
  view: () => __awaiter(this, void 0, void 0, function* () {
311
382
  const ap_config = (yield ApiUser.getPublicConfig('store-information', 'manager')).response.value;
312
383
  PayConfig.pos_config = ap_config;
@@ -579,6 +650,7 @@ cursor: pointer;
579
650
  view: () => __awaiter(this, void 0, void 0, function* () {
580
651
  let view = (() => {
581
652
  try {
653
+ OrderDetail.singleInstance = orderDetail;
582
654
  orderDetail.user_info.shipment = orderDetail.user_info.shipment || 'now';
583
655
  if (vm.type == 'payment') {
584
656
  return PaymentPage.main({
@@ -588,7 +660,7 @@ cursor: pointer;
588
660
  });
589
661
  }
590
662
  else if (vm.type === 'order') {
591
- return `<div class="vw-100" style="overflow-y: scroll;">${ShoppingOrderManager.main(gvc, { isPOS: true })}</div>`;
663
+ return `<div class="vw-100 px-lg-3" style="overflow-y: scroll;">${ShoppingOrderManager.main(gvc, { isPOS: true })}</div>`;
592
664
  }
593
665
  else if (vm.type === 'setting') {
594
666
  return PosSetting.main({ gvc: gvc, vm: vm });
@@ -616,7 +688,6 @@ cursor: pointer;
616
688
  })}
617
689
  ${gvc.bindView({
618
690
  bind: 'nav-slide',
619
- dataList: [{ obj: vm, key: 'type' }],
620
691
  view: () => {
621
692
  let page = [
622
693
  {
@@ -11,6 +11,8 @@ import {PosSetting} from "./pos-pages/pos-setting.js";
11
11
  import {PayConfig} from "./pos-pages/pay-config.js";
12
12
  import {ApiPageConfig} from "../api/pageConfig.js";
13
13
  import {PosHomePage} from "./pos-pages/pos-home-page.js";
14
+ import {ApiShop} from "../glitter-base/route/shopping.js";
15
+ import {Swal} from "../modules/sweetAlert.js";
14
16
 
15
17
  function getConfig() {
16
18
  const saasConfig: { config: any; api: any } = (window.parent as any).saasConfig;
@@ -168,6 +170,11 @@ height: 51px;
168
170
  gvc.glitter.share.shop_config = {
169
171
  shop_name: ''
170
172
  }
173
+
174
+ // document.addEventListener('keydown', function(event) {
175
+ // console.log(`event.key==>`,event.key)
176
+ // event.preventDefault(); // 阻止事件
177
+ // });
171
178
  return new Promise(async (resolve, reject) => {
172
179
  ApiUser.getPublicConfig('store-information', 'manager').then((res) => {
173
180
  gvc.glitter.share.shop_config.shop_name = res.response.value.shop_name;
@@ -263,6 +270,24 @@ height: 51px;
263
270
  gvc.glitter.addStyleLink('./css/editor.css');
264
271
  return gvc.bindView(() => {
265
272
  const id = gvc.glitter.getUUID();
273
+ let timer_vm:{
274
+ timer:any,
275
+ last_string:''
276
+ }= {
277
+ timer:0,
278
+ last_string:''
279
+ }
280
+ let scannerObserver=function(event:KeyboardEvent) {
281
+ if(event.key.toLowerCase()!=='enter'){
282
+ clearInterval(timer_vm.timer);
283
+ timer_vm.last_string+=event.key;
284
+ timer_vm.timer=setTimeout(()=>{
285
+ POSSetting.scannerCallback(gvc,timer_vm.last_string)
286
+ timer_vm.last_string=''
287
+ },150)
288
+ }
289
+ console.log(`event.key==>`,event.key);
290
+ }
266
291
  return {
267
292
  bind: id,
268
293
  view: async () => {
@@ -288,16 +313,78 @@ height: 51px;
288
313
  }
289
314
  },
290
315
  divCreate: {},
316
+ onCreate:()=>{
317
+ document.removeEventListener('keydown',scannerObserver)
318
+ document.addEventListener('keydown', scannerObserver);
319
+ },
320
+ onDestroy:()=>{
321
+ document.removeEventListener('keydown',scannerObserver)
322
+ }
291
323
  };
292
324
  });
293
325
  }
294
326
 
327
+ public static scannerCallback(gvc:GVC,text:string){
328
+ const dialog=new ShareDialog(gvc.glitter)
329
+ const swal = new Swal(gvc);
330
+ console.log(`text===>`,text)
331
+ if(text.indexOf(`variants-`)===0){
332
+ dialog.dataLoading({visible:true,text:'搜尋商品...'})
333
+ text=text.replace(`variants-`,'')
334
+ ApiShop.getProduct({
335
+ page: 0,
336
+ limit: 50000,
337
+ accurate_search_text:true,
338
+ search:text,
339
+ orderBy: 'created_time_desc'
340
+ }).then(res => {
341
+ dialog.dataLoading({visible:false})
342
+ if(res.response.data[0]){
343
+ const data=res.response.data[0]
344
+ console.log(`data===>`,data)
345
+ const selectVariant=res.response.data[0].content.variants.find((d1:any)=>{
346
+ return d1.barcode===text
347
+ })
348
+ if(!OrderDetail.singleInstance.lineItems.find((dd)=>{
349
+ return (dd.id+dd.spec.join('-'))===(data.id + selectVariant.spec.join('-'))
350
+ })){
351
+ OrderDetail.singleInstance.lineItems.push({
352
+ id: data.id,
353
+ title: data.content.title,
354
+ preview_image: (selectVariant.preview_image.length > 1) ? selectVariant.preview_image : data.content.preview_image[0],
355
+ spec: selectVariant.spec,
356
+ count: 0,
357
+ sale_price: selectVariant.sale_price,
358
+ sku: selectVariant.sku
359
+ })
360
+ }
361
+ OrderDetail.singleInstance.lineItems.find((dd)=>{
362
+ return (dd.id+dd.spec.join('-'))===(data.id + selectVariant.spec.join('-'))
363
+ })!.count++;
364
+
365
+ gvc.notifyDataChange(['order','checkout-page'])
366
+ }else{
367
+ swal.toast({icon:'error',title:'無此商品'})
368
+ }
369
+ })
370
+ }
371
+
372
+
373
+ }
374
+
295
375
  public static posView(gvc: GVC) {
296
376
  const glitter = gvc.glitter;
377
+
297
378
  const vm: ViewModel = {
298
379
  id: glitter.getUUID(),
299
380
  filterID: glitter.getUUID(),
300
- type: 'home',
381
+ get type(){
382
+ return localStorage.getItem('show_pos_page') ?? "home"
383
+ },
384
+ set type(value){
385
+ localStorage.setItem('show_pos_page',`${value}`)
386
+ gvc.notifyDataChange(vm.id)
387
+ },
301
388
  order: {},
302
389
  query: '',
303
390
  productSearch: [],
@@ -321,15 +408,11 @@ height: 51px;
321
408
  };
322
409
  if (localStorage.getItem('pos_order_detail')) {
323
410
  orderDetail = JSON.parse(localStorage.getItem('pos_order_detail') as string);
324
- if (orderDetail.lineItems && orderDetail.lineItems.length > 0) {
325
- vm.type = 'home';
326
- }
327
411
  } else {
328
412
  (orderDetail.user_info.shipment as any) = 'now';
329
413
  }
330
414
 
331
415
  if (!orderDetail.lineItems || orderDetail.lineItems.length === 0) {
332
- vm.type = 'home';
333
416
  (orderDetail.user_info.shipment as any) = 'now';
334
417
  }
335
418
 
@@ -347,7 +430,6 @@ height: 51px;
347
430
  gvc.bindView(() => {
348
431
  return {
349
432
  bind: vm.id,
350
- dataList: [{obj: vm, key: 'type'}],
351
433
  view: async () => {
352
434
  const ap_config = (await ApiUser.getPublicConfig('store-information', 'manager')).response.value;
353
435
  PayConfig.pos_config = ap_config;
@@ -625,6 +707,7 @@ cursor: pointer;
625
707
  view: async () => {
626
708
  let view = (() => {
627
709
  try {
710
+ OrderDetail.singleInstance=orderDetail;
628
711
  (orderDetail.user_info.shipment as any) = (orderDetail.user_info.shipment as any) || 'now';
629
712
  if (vm.type == 'payment') {
630
713
  return PaymentPage.main({
@@ -634,7 +717,7 @@ cursor: pointer;
634
717
 
635
718
  });
636
719
  } else if (vm.type === 'order') {
637
- return `<div class="vw-100" style="overflow-y: scroll;">${ShoppingOrderManager.main(gvc, {isPOS: true})}</div>`;
720
+ return `<div class="vw-100 px-lg-3" style="overflow-y: scroll;">${ShoppingOrderManager.main(gvc, {isPOS: true})}</div>`;
638
721
  } else if (vm.type === 'setting') {
639
722
  return PosSetting.main({gvc: gvc, vm: vm})
640
723
  } else if (vm.type === 'home') {
@@ -659,7 +742,6 @@ cursor: pointer;
659
742
  })}
660
743
  ${gvc.bindView({
661
744
  bind: 'nav-slide',
662
- dataList: [{obj: vm, key: 'type'}],
663
745
  view: () => {
664
746
  let page = [
665
747
  {
@@ -31,3 +31,4 @@ export class OrderDetail {
31
31
  return this.subtotal + this.shipment - this.discount;
32
32
  }
33
33
  }
34
+ OrderDetail.singleInstance = new OrderDetail(0, 0);
@@ -69,6 +69,8 @@ export class OrderDetail {
69
69
  get total(): number {
70
70
  return this.subtotal + this.shipment - this.discount;
71
71
  }
72
+
73
+ public static singleInstance:OrderDetail=new OrderDetail(0,0)
72
74
  }
73
75
 
74
76
  export interface VoucherData {
@@ -120,3 +122,4 @@ export type ViewModel = {
120
122
  categories: any[];
121
123
  paySelect: string;
122
124
  };
125
+
@@ -65,7 +65,7 @@ export class PaymentPage {
65
65
  const dialog = new ShareDialog(gvc.glitter);
66
66
  PaymentPage.storeHistory(obj.ogOrderData);
67
67
  return gvc.bindView(() => {
68
- const id = gvc.glitter.getUUID();
68
+ const id = 'checkout-page';
69
69
  function refreshOrderView() {
70
70
  gvc.notifyDataChange(id);
71
71
  }
@@ -297,11 +297,10 @@ background: #FFF;`
297
297
  single: true,
298
298
  api: (data) => {
299
299
  return new Promise((resolve) => {
300
- ApiUser.getUserListOrders({
300
+ ApiUser.getUserList({
301
301
  page: 0,
302
302
  limit: 50,
303
- search: data.query,
304
- orderString: data.orderString,
303
+ search: data.query
305
304
  }).then((dd) => {
306
305
  if (dd.response.data) {
307
306
  resolve(dd.response.data.map((item) => {
@@ -65,7 +65,7 @@ export class PaymentPage {
65
65
  PaymentPage.storeHistory(obj.ogOrderData);
66
66
 
67
67
  return gvc.bindView(() => {
68
- const id = gvc.glitter.getUUID();
68
+ const id = 'checkout-page';
69
69
 
70
70
  function refreshOrderView() {
71
71
  gvc.notifyDataChange(id);
@@ -317,11 +317,10 @@ background: #FFF;`
317
317
  orderString: string
318
318
  }) => {
319
319
  return new Promise((resolve) => {
320
- ApiUser.getUserListOrders({
320
+ ApiUser.getUserList({
321
321
  page: 0,
322
322
  limit: 50,
323
- search: data.query,
324
- orderString: data.orderString,
323
+ search: data.query
325
324
  }).then((dd) => {
326
325
  if (dd.response.data) {
327
326
  resolve(
@@ -13,7 +13,7 @@ export class ProductsPage {
13
13
  orderDetail.total = orderDetail.total || 0;
14
14
  return html `
15
15
  <div class="left-panel"
16
- style="${(document.body.offsetWidth < 800) ? `width:calc(100%);padding-top: 32px` : `width:calc(100% - 352px);padding: 32px 36px`};overflow: hidden;">
16
+ style="${(document.body.offsetWidth < 800) ? `width:calc(100%);padding-top: 32px` : `width:calc(100% - 352px);padding-top: 32px ;padding-bottom:32px;`}overflow: hidden;">
17
17
  ${gvc.bindView({
18
18
  bind: `category`,
19
19
  view: () => {
@@ -52,8 +52,8 @@ export class ProductsPage {
52
52
  }
53
53
  },
54
54
  divCreate: {
55
- class: `d-flex px-3 px-lg-2`,
56
- style: `width:100%;overflow: scroll;padding-bottom:32px;`
55
+ class: `d-flex px-3 `,
56
+ style: `width:100%;overflow: scroll;padding-bottom:32px;${(document.body.clientWidth > 992) ? `padding-left:32px !important;padding-right:32px !important;` : ``}`
57
57
  }
58
58
  })}
59
59
  ${gvc.bindView({
@@ -362,7 +362,7 @@ export class ProductsPage {
362
362
  else {
363
363
  return {
364
364
  class: `d-flex flex-wrap w-100 product-show p-2`,
365
- style: `gap:26px;overflow:scroll;max-height:100%;`
365
+ style: `gap:26px;overflow:scroll;max-height:100%;padding-bottom:100px !important;margin-left:32px;margin-right:32px;`
366
366
  };
367
367
  }
368
368
  }
@@ -17,7 +17,7 @@ export class ProductsPage {
17
17
  (orderDetail as any).total=orderDetail.total || 0;
18
18
  return html`
19
19
  <div class="left-panel"
20
- style="${(document.body.offsetWidth < 800) ? `width:calc(100%);padding-top: 32px` : `width:calc(100% - 352px);padding: 32px 36px`};overflow: hidden;">
20
+ style="${(document.body.offsetWidth < 800) ? `width:calc(100%);padding-top: 32px` : `width:calc(100% - 352px);padding-top: 32px ;padding-bottom:32px;`}overflow: hidden;">
21
21
  ${gvc.bindView({
22
22
  bind: `category`,
23
23
  view: () => {
@@ -59,8 +59,8 @@ export class ProductsPage {
59
59
 
60
60
  },
61
61
  divCreate: {
62
- class: `d-flex px-3 px-lg-2`,
63
- style: `width:100%;overflow: scroll;padding-bottom:32px;`
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;`:``}`
64
64
  }
65
65
  })}
66
66
  ${gvc.bindView({
@@ -377,7 +377,7 @@ export class ProductsPage {
377
377
  } else {
378
378
  return {
379
379
  class: `d-flex flex-wrap w-100 product-show p-2`,
380
- style: `gap:26px;overflow:scroll;max-height:100%;`
380
+ style: `gap:26px;overflow:scroll;max-height:100%;padding-bottom:100px !important;margin-left:32px;margin-right:32px;`
381
381
  }
382
382
  }
383
383
  }
@@ -1353,7 +1353,7 @@ export class ShoppingProductSetting {
1353
1353
  return html `
1354
1354
  <div style="font-weight: 700;">規格</div>
1355
1355
  <div>${variant.spec.length > 0 ? variant.spec.join(' / ') : '單一規格'}</div>
1356
- <div style="font-weight: 700;">圖片</div>
1356
+ <div style="font-weight: 700;">規格圖片</div>
1357
1357
  <div
1358
1358
  class="d-flex align-items-center justify-content-center rounded-3 shadow"
1359
1359
  style="min-width:135px;135px;height:135px;cursor:pointer;background: 50%/cover url('${variant.preview_image || BgWidget.noImageURL}');"
@@ -1640,7 +1640,7 @@ export class ShoppingProductSetting {
1640
1640
  src: 'https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js',
1641
1641
  },
1642
1642
  ], () => {
1643
- window.parent.QRCode.toDataURL(variant.barcode, {
1643
+ window.parent.QRCode.toDataURL(`variants-` + variant.barcode, {
1644
1644
  width: 200,
1645
1645
  margin: 2,
1646
1646
  }, function (err, url) {
@@ -1671,7 +1671,15 @@ export class ShoppingProductSetting {
1671
1671
  placeholder="請輸入商品條碼"
1672
1672
  value="${(_b = variant.barcode) !== null && _b !== void 0 ? _b : ''}"
1673
1673
  onchange="${gvc.event((e) => {
1674
- variant.barcode = e.value;
1674
+ const regex = /^[a-zA-Z0-9]+$/;
1675
+ if (!regex.test(e.value)) {
1676
+ e.value = '';
1677
+ const dialog = new ShareDialog(gvc.glitter);
1678
+ dialog.errorMessage({ text: '條碼僅能輸入英數字' });
1679
+ }
1680
+ else {
1681
+ variant.barcode = e.value;
1682
+ }
1675
1683
  })}"
1676
1684
  />
1677
1685
  </div>
@@ -1618,7 +1618,7 @@ export class ShoppingProductSetting {
1618
1618
  return html`
1619
1619
  <div style="font-weight: 700;">規格</div>
1620
1620
  <div>${variant.spec.length > 0 ? variant.spec.join(' / ') : '單一規格'}</div>
1621
- <div style="font-weight: 700;">圖片</div>
1621
+ <div style="font-weight: 700;">規格圖片</div>
1622
1622
  <div
1623
1623
  class="d-flex align-items-center justify-content-center rounded-3 shadow"
1624
1624
  style="min-width:135px;135px;height:135px;cursor:pointer;background: 50%/cover url('${variant.preview_image || BgWidget.noImageURL}');"
@@ -1922,7 +1922,7 @@ export class ShoppingProductSetting {
1922
1922
  ],
1923
1923
  () => {
1924
1924
  (window.parent as any).QRCode.toDataURL(
1925
- variant.barcode,
1925
+ `variants-`+variant.barcode,
1926
1926
  {
1927
1927
  width: 200,
1928
1928
  margin: 2,
@@ -1960,7 +1960,17 @@ export class ShoppingProductSetting {
1960
1960
  placeholder="請輸入商品條碼"
1961
1961
  value="${variant.barcode ?? ''}"
1962
1962
  onchange="${gvc.event((e) => {
1963
- variant.barcode = e.value;
1963
+ // 正则表达式检查是否只包含英文字母和数字
1964
+ const regex = /^[a-zA-Z0-9]+$/;
1965
+ // 测试字符串是否匹配正则表达式
1966
+ if(!regex.test(e.value)){
1967
+ e.value=''
1968
+ const dialog=new ShareDialog(gvc.glitter)
1969
+ dialog.errorMessage({text:'條碼僅能輸入英數字'})
1970
+ }else{
1971
+ variant.barcode = e.value;
1972
+ }
1973
+
1964
1974
  })}"
1965
1975
  />
1966
1976
  </div>
@@ -470,11 +470,16 @@ export class UMInfo {
470
470
  onCreate: () => {
471
471
  if (loadings.view) {
472
472
  UmClass.getUserData(gvc).then((resp) => {
473
- vm.data = resp;
474
- const members = JSON.parse(JSON.stringify(vm.data.member)).reverse();
475
- vm.memberNext = members.find((dd) => !dd.trigger);
476
- loadings.view = false;
477
- gvc.notifyDataChange(ids.view);
473
+ try {
474
+ vm.data = resp;
475
+ const members = JSON.parse(JSON.stringify(vm.data.member)).reverse();
476
+ vm.memberNext = members.find((dd) => !dd.trigger);
477
+ loadings.view = false;
478
+ gvc.notifyDataChange(ids.view);
479
+ }
480
+ catch (e) {
481
+ gvc.glitter.href = './login';
482
+ }
478
483
  });
479
484
  }
480
485
  },
@@ -567,11 +567,15 @@ export class UMInfo {
567
567
  onCreate: () => {
568
568
  if (loadings.view) {
569
569
  UmClass.getUserData(gvc).then((resp: any) => {
570
- vm.data = resp;
571
- const members = JSON.parse(JSON.stringify(vm.data.member)).reverse() as Member[];
572
- vm.memberNext = members.find((dd) => !dd.trigger);
573
- loadings.view = false;
574
- gvc.notifyDataChange(ids.view);
570
+ try {
571
+ vm.data = resp;
572
+ const members = JSON.parse(JSON.stringify(vm.data.member)).reverse() as Member[];
573
+ vm.memberNext = members.find((dd) => !dd.trigger);
574
+ loadings.view = false;
575
+ gvc.notifyDataChange(ids.view);
576
+ }catch (e){
577
+ gvc.glitter.href='./login'
578
+ }
575
579
  });
576
580
  }
577
581
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "13.8.748",
3
+ "version": "13.8.749",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1598,7 +1598,6 @@ class Shopping {
1598
1598
  }
1599
1599
  async getCheckOut(query) {
1600
1600
  try {
1601
- console.log('here -- ');
1602
1601
  let querySql = ['1=1'];
1603
1602
  let orderString = 'order by id desc';
1604
1603
  if (query.search && query.searchType) {