ts-glitter 18.0.1 → 18.0.4

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
@@ -90,7 +90,7 @@ export class Entry {
90
90
  }
91
91
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : clockF();
92
92
  console.log(`Entry-time:`, window.renderClock.stop());
93
- glitter.share.editerVersion = 'V_18.0.1';
93
+ glitter.share.editerVersion = 'V_18.0.4';
94
94
  glitter.share.start = new Date();
95
95
  const vm = {
96
96
  appConfig: [],
@@ -340,23 +340,6 @@ export class Entry {
340
340
  window.root.classList.add('light-mode');
341
341
  function toNext() {
342
342
  console.log(`to-next-time:`, window.renderClock.stop());
343
- glitter.runJsInterFace('pos-device', {}, (res) => {
344
- PayConfig.deviceType = res.deviceType === 'neostra' ? 'pos' : 'web';
345
- if (PayConfig.deviceType === 'pos') {
346
- const script = document.createElement('script');
347
- script.type = 'text/javascript';
348
- script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mui/3.7.1/js/mui.min.js';
349
- script.integrity = 'sha512-5LSZkoyayM01bXhnlp2T6+RLFc+dE4SIZofQMxy/ydOs3D35mgQYf6THIQrwIMmgoyjI+bqjuuj4fQcGLyJFYg==';
350
- script.referrerPolicy = 'no-referrer';
351
- script.crossOrigin = 'anonymous';
352
- document.head.appendChild(script);
353
- glitter.addMtScript(['https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js', 'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js'], () => { }, () => { });
354
- setTimeout(() => {
355
- window.IminPrintInstance = new IminPrinter();
356
- window.IminPrintInstance.connect();
357
- }, 3000);
358
- }
359
- });
360
343
  running().then(() => __awaiter(this, void 0, void 0, function* () {
361
344
  {
362
345
  console.log(`to-page-time:`, window.renderClock.stop());
@@ -577,6 +560,23 @@ export class Entry {
577
560
  });
578
561
  }
579
562
  static resourceInitial(glitter, vm, callback) {
563
+ glitter.runJsInterFace('pos-device', {}, (res) => {
564
+ PayConfig.deviceType = res.deviceType === 'neostra' ? 'pos' : 'web';
565
+ if (PayConfig.deviceType === 'pos') {
566
+ const script = document.createElement('script');
567
+ script.type = 'text/javascript';
568
+ script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mui/3.7.1/js/mui.min.js';
569
+ script.integrity = 'sha512-5LSZkoyayM01bXhnlp2T6+RLFc+dE4SIZofQMxy/ydOs3D35mgQYf6THIQrwIMmgoyjI+bqjuuj4fQcGLyJFYg==';
570
+ script.referrerPolicy = 'no-referrer';
571
+ script.crossOrigin = 'anonymous';
572
+ document.head.appendChild(script);
573
+ glitter.addMtScript(['https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js', 'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js'], () => { }, () => { });
574
+ setTimeout(() => {
575
+ window.IminPrintInstance = new IminPrinter();
576
+ window.IminPrintInstance.connect();
577
+ }, 3000);
578
+ }
579
+ });
580
580
  glitter.runJsInterFace('getTopInset', {}, (response) => {
581
581
  glitter.share.top_inset = response.data;
582
582
  }, {
package/lowcode/Entry.ts CHANGED
@@ -91,7 +91,7 @@ export class Entry {
91
91
  }
92
92
  (window as any).renderClock = (window as any).renderClock ?? clockF();
93
93
  console.log(`Entry-time:`, (window as any).renderClock.stop());
94
- glitter.share.editerVersion = 'V_18.0.1';
94
+ glitter.share.editerVersion = 'V_18.0.4';
95
95
  glitter.share.start = new Date();
96
96
  const vm: {
97
97
  appConfig: any;
@@ -354,32 +354,6 @@ export class Entry {
354
354
 
355
355
  function toNext() {
356
356
  console.log(`to-next-time:`, (window as any).renderClock.stop());
357
- //設定裝置類型
358
- glitter.runJsInterFace('pos-device', {}, (res) => {
359
- PayConfig.deviceType = res.deviceType === 'neostra' ? 'pos' : 'web';
360
- //POS機台啟用列印功能
361
- if (PayConfig.deviceType === 'pos') {
362
- const script = document.createElement('script');
363
- script.type = 'text/javascript';
364
- script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mui/3.7.1/js/mui.min.js';
365
- script.integrity = 'sha512-5LSZkoyayM01bXhnlp2T6+RLFc+dE4SIZofQMxy/ydOs3D35mgQYf6THIQrwIMmgoyjI+bqjuuj4fQcGLyJFYg==';
366
- script.referrerPolicy = 'no-referrer';
367
- script.crossOrigin = 'anonymous';
368
- // 当脚本加载完成后执行回调函数
369
- document.head.appendChild(script);
370
- glitter.addMtScript(
371
- ['https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js', 'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js'],
372
- () => {},
373
- () => {}
374
- );
375
- setTimeout(() => {
376
- //@ts-ignore
377
- window.IminPrintInstance = new IminPrinter();
378
- //@ts-ignore
379
- window.IminPrintInstance.connect();
380
- }, 3000);
381
- }
382
- });
383
357
  running().then(async () => {
384
358
  {
385
359
  console.log(`to-page-time:`, (window as any).renderClock.stop());
@@ -644,6 +618,32 @@ export class Entry {
644
618
 
645
619
  // 資源初始化
646
620
  public static resourceInitial(glitter: Glitter, vm: any, callback: (data: any) => void) {
621
+ //判斷是否為POS裝置的Initial
622
+ glitter.runJsInterFace('pos-device', {}, (res) => {
623
+ PayConfig.deviceType = res.deviceType === 'neostra' ? 'pos' : 'web';
624
+ //POS機台啟用列印功能
625
+ if (PayConfig.deviceType === 'pos') {
626
+ const script = document.createElement('script');
627
+ script.type = 'text/javascript';
628
+ script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mui/3.7.1/js/mui.min.js';
629
+ script.integrity = 'sha512-5LSZkoyayM01bXhnlp2T6+RLFc+dE4SIZofQMxy/ydOs3D35mgQYf6THIQrwIMmgoyjI+bqjuuj4fQcGLyJFYg==';
630
+ script.referrerPolicy = 'no-referrer';
631
+ script.crossOrigin = 'anonymous';
632
+ // 当脚本加载完成后执行回调函数
633
+ document.head.appendChild(script);
634
+ glitter.addMtScript(
635
+ ['https://oss-sg.imin.sg/web/iMinPartner/js/imin-printer.min.js', 'https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js'],
636
+ () => {},
637
+ () => {}
638
+ );
639
+ setTimeout(() => {
640
+ //@ts-ignore
641
+ window.IminPrintInstance = new IminPrinter();
642
+ //@ts-ignore
643
+ window.IminPrintInstance.connect();
644
+ }, 3000);
645
+ }
646
+ });
647
647
  //取得APP的上間隔距離
648
648
  glitter.runJsInterFace(
649
649
  'getTopInset',
@@ -144,7 +144,7 @@ export class ProductExcel {
144
144
  return { header, width: maxLengths[index] + 2 };
145
145
  });
146
146
  }
147
- importData(notifyId, file) {
147
+ importData(notifyId, file, product_category) {
148
148
  return __awaiter(this, void 0, void 0, function* () {
149
149
  const dialog = new ShareDialog(this.gvc.glitter);
150
150
  dialog.dataLoading({ visible: true, text: '資料處理中' });
@@ -223,7 +223,7 @@ export class ProductExcel {
223
223
  }
224
224
 
225
225
  // 匯入excel
226
- async importData(notifyId: string, file: any) {
226
+ async importData(notifyId: string, file: any,product_category:'course' | 'commodity' | 'kitchen') {
227
227
  const dialog = new ShareDialog(this.gvc.glitter);
228
228
  dialog.dataLoading({visible: true, text: '資料處理中'});
229
229
 
@@ -187,6 +187,7 @@ export class ShoppingProductSetting {
187
187
  ${[
188
188
  BgWidget.grayButton('匯入', gvc.event(() => {
189
189
  gvc.glitter.innerDialog((gvc) => {
190
+ let support_ = ShoppingProductSetting.getSupportProductCategory()[0].key;
190
191
  return gvc.bindView({
191
192
  bind: 'importView',
192
193
  view: () => {
@@ -196,6 +197,17 @@ export class ShoppingProductSetting {
196
197
  >
197
198
  匯入商品
198
199
  </div>
200
+ <div style="display: flex;flex-direction: column;align-items: flex-start;gap: 16px;align-items: flex-start;padding: 20px 20px 0px;">
201
+ <div>匯入的商品類型</div>
202
+ ${BgWidget.multiCheckboxContainer(gvc, ShoppingProductSetting.getSupportProductCategory().map((dd) => {
203
+ return {
204
+ key: dd.key,
205
+ name: dd.value,
206
+ };
207
+ }), [support_], (res) => {
208
+ support_ = res[0];
209
+ }, { single: true })}
210
+ </div>
199
211
  <div style="display: flex;width: 100%;align-items: flex-start;gap: 16px;padding:20px;flex-direction: column">
200
212
  <div style="display: flex;align-items: baseline;gap: 12px;align-self: stretch;">
201
213
  <div style="color:#393939;font-size: 16px;font-weight: 400;">
@@ -211,6 +211,7 @@ export class ShoppingProductSetting {
211
211
  '匯入',
212
212
  gvc.event(() => {
213
213
  gvc.glitter.innerDialog((gvc: GVC) => {
214
+ let support_=ShoppingProductSetting.getSupportProductCategory()[0].key
214
215
  return gvc.bindView({
215
216
  bind: 'importView',
216
217
  view: () => {
@@ -220,6 +221,24 @@ export class ShoppingProductSetting {
220
221
  >
221
222
  匯入商品
222
223
  </div>
224
+ <div style="display: flex;flex-direction: column;align-items: flex-start;gap: 16px;align-items: flex-start;padding: 20px 20px 0px;">
225
+ <div>匯入的商品類型</div>
226
+ ${BgWidget.multiCheckboxContainer(
227
+ gvc,
228
+ ShoppingProductSetting.getSupportProductCategory().map((dd) => {
229
+ return {
230
+ key: dd.key,
231
+ name: dd.value,
232
+ }
233
+ })
234
+ ,
235
+ [support_],
236
+ (res: any) => {
237
+ support_ = res[0];
238
+ },
239
+ {single: true}
240
+ )}
241
+ </div>
223
242
  <div style="display: flex;width: 100%;align-items: flex-start;gap: 16px;padding:20px;flex-direction: column">
224
243
  <div style="display: flex;align-items: baseline;gap: 12px;align-self: stretch;">
225
244
  <div style="color:#393939;font-size: 16px;font-weight: 400;">
@@ -1573,6 +1573,14 @@ export class CheckoutIndex {
1573
1573
  ${gvc.bindView({
1574
1574
  bind: ids.shipping,
1575
1575
  view: () => {
1576
+ if ((vm.cartData.customer_info.payment_select === 'cash_on_delivery' && (!ShipmentConfig.supermarketList.includes(vm.cartData.user_info.shipment)))) {
1577
+ const find = this.getShipmentMethod(vm.cartData).find((d1) => {
1578
+ return ShipmentConfig.supermarketList.includes(d1.value);
1579
+ });
1580
+ vm.cartData.user_info.shipment = find && find.value;
1581
+ this.storeLocalData(vm.cartData);
1582
+ refreshCartData();
1583
+ }
1576
1584
  return html ` <div>
1577
1585
  <select
1578
1586
  class="w-100 ${gClass('select')}"
@@ -1597,6 +1605,9 @@ export class CheckoutIndex {
1597
1605
  >
1598
1606
  ${(() => {
1599
1607
  return this.getShipmentMethod(vm.cartData)
1608
+ .filter((dd) => {
1609
+ return !(vm.cartData.customer_info.payment_select === 'cash_on_delivery' && !(ShipmentConfig.supermarketList.includes(dd.value)));
1610
+ })
1600
1611
  .map((dd) => {
1601
1612
  return html ` <option value="${dd.value}" ${vm.cartData.user_info.shipment === dd.value ? `selected` : ``}>
1602
1613
  ${Language.text(`ship_${dd.value}`) || Language.getLanguageCustomText(dd.name)}
@@ -1679,6 +1679,14 @@ export class CheckoutIndex {
1679
1679
  ${gvc.bindView({
1680
1680
  bind: ids.shipping,
1681
1681
  view: () => {
1682
+ if((vm.cartData.customer_info.payment_select==='cash_on_delivery' && (!ShipmentConfig.supermarketList.includes(vm.cartData.user_info.shipment)))){
1683
+ const find=this.getShipmentMethod(vm.cartData).find((d1:any)=>{
1684
+ return ShipmentConfig.supermarketList.includes(d1.value)
1685
+ })
1686
+ vm.cartData.user_info.shipment=find && find.value;
1687
+ this.storeLocalData(vm.cartData);
1688
+ refreshCartData();
1689
+ }
1682
1690
  return html` <div>
1683
1691
  <select
1684
1692
  class="w-100 ${gClass('select')}"
@@ -1703,6 +1711,10 @@ export class CheckoutIndex {
1703
1711
  >
1704
1712
  ${(() => {
1705
1713
  return this.getShipmentMethod(vm.cartData)
1714
+ .filter((dd: { name: string; value: string })=>{
1715
+ return !(vm.cartData.customer_info.payment_select==='cash_on_delivery' && !(ShipmentConfig.supermarketList.includes(dd.value)))
1716
+
1717
+ })
1706
1718
  .map((dd: { name: string; value: string }) => {
1707
1719
  return html` <option value="${dd.value}" ${vm.cartData.user_info.shipment === dd.value ? `selected` : ``}>
1708
1720
  ${Language.text(`ship_${dd.value}`) || Language.getLanguageCustomText(dd.name)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "18.0.1",
3
+ "version": "18.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {