ts-glitter 13.9.8 → 13.9.9

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
@@ -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.9.8';
73
+ glitter.share.editerVersion = 'V_13.9.9';
74
74
  glitter.share.start = new Date();
75
75
  const vm = {
76
76
  appConfig: [],
@@ -572,7 +572,7 @@ export class Entry {
572
572
  function loopVersion() {
573
573
  ApiPageConfig.getGlitterVersion().then((res) => {
574
574
  console.log('glitterVersion:', res.response.result);
575
- if (!glitter.share.editerVersion.includes(res.response.result)) {
575
+ if (res.result && (!glitter.share.editerVersion.includes(res.response.result))) {
576
576
  const dialog = new ShareDialog(glitter);
577
577
  dialog.checkYesOrNot({
578
578
  text: '新版本已發佈,是否進行更新?',
package/lowcode/Entry.ts CHANGED
@@ -72,7 +72,7 @@ export class Entry {
72
72
  }
73
73
  (window as any).renderClock = (window as any).renderClock ?? clockF();
74
74
  console.log(`Entry-time:`, (window as any).renderClock.stop());
75
- glitter.share.editerVersion = 'V_13.9.8';
75
+ glitter.share.editerVersion = 'V_13.9.9';
76
76
  glitter.share.start = new Date();
77
77
  const vm: {
78
78
  appConfig: any;
@@ -645,7 +645,7 @@ export class Entry {
645
645
  function loopVersion() {
646
646
  ApiPageConfig.getGlitterVersion().then((res) => {
647
647
  console.log('glitterVersion:', res.response.result);
648
- if (!glitter.share.editerVersion.includes(res.response.result)) {
648
+ if (res.result && (!glitter.share.editerVersion.includes(res.response.result))) {
649
649
  const dialog = new ShareDialog(glitter);
650
650
  dialog.checkYesOrNot({
651
651
  text: '新版本已發佈,是否進行更新?',
@@ -598,10 +598,20 @@ export class CheckoutIndex {
598
598
  }`);
599
599
  }
600
600
  function refreshCartData() {
601
- loadings.page = true;
602
- gvc.notifyDataChange(ids.page);
603
- gvc.notifyDataChange('js-cart-count');
601
+ const dialog = new ShareDialog(gvc.glitter);
602
+ dialog.dataLoading({ visible: true });
603
+ gvc.addMtScript([
604
+ {
605
+ src: `https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js`,
606
+ },
607
+ ], () => {
608
+ loadings.page = false;
609
+ dialog.dataLoading({ visible: false });
610
+ gvc.notifyDataChange(ids.page);
611
+ }, () => {
612
+ });
604
613
  }
614
+ refreshCartData();
605
615
  return gvc.bindView((() => {
606
616
  return {
607
617
  bind: ids.page,
@@ -687,13 +697,11 @@ export class CheckoutIndex {
687
697
  ${item.spec ? item.spec.join(' / ') : ''}
688
698
  </div>
689
699
  <div class="${gClass('td')} d-flex flex-column align-items-start align-items-sm-center" style="gap:10px;">
690
- <div class="${item.discount_price ? `` : `d-none`}">
700
+ <div class="">
691
701
  ${(() => {
692
- return `NT.${financial(item.sale_price - item.discount_price)}`;
702
+ return `NT.${parseInt(item.sale_price, 10).toLocaleString()}`;
693
703
  })()}
694
704
  </div>
695
- <div style="${(item.discount_price) ? `text-decoration: line-through;` : ``}">${((item.discount_price)) ? `原價:${item.sale_price.toLocaleString()}` : `${item.sale_price.toLocaleString()}`}
696
- </div>
697
705
  </div>
698
706
  <div class="${gClass('td')}">
699
707
  <select
@@ -729,7 +737,7 @@ export class CheckoutIndex {
729
737
  </div>
730
738
  <span class="d-block d-md-none" style="position: absolute;bottom:0px;right:0px;">合計 NT. ${((item.discount_price) ? ((item.sale_price - item.discount_price) * item.count) : (item.sale_price * item.count)).toLocaleString()}</span>
731
739
  <div class="${gClass('td')} d-none d-md-flex" style="bottom:0px;right:10px;">
732
- <span class="d-none d-md-block">合計 NT. ${((item.discount_price) ? ((item.sale_price - item.discount_price) * item.count) : (item.sale_price * item.count)).toLocaleString()}</span>
740
+ <span class="d-none d-md-block">合計 NT. ${(item.sale_price * item.count).toLocaleString()}</span>
733
741
  <div class="d-none d-md-block" style="position: absolute; right: -10px; transform: translateY(-50%); top: 50%;">
734
742
  <i class="fa-solid fa-xmark-large"
735
743
  style="cursor: pointer;" onclick="${gvc.event(() => {
@@ -797,18 +805,6 @@ export class CheckoutIndex {
797
805
  return html `<div style="height: 400px">${spinner()}</div>`;
798
806
  }
799
807
  else {
800
- if (vmi.dataList.length === 0) {
801
- return html `<div class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto">
802
- <lottie-player
803
- style="max-width: 100%;width: 300px;"
804
- src="https://assets10.lottiefiles.com/packages/lf20_rc6CDU.json"
805
- speed="1"
806
- loop="true"
807
- background="transparent"
808
- ></lottie-player>
809
- <span class="mb-5 fs-5">目前沒有任何優惠券呦</span>
810
- </div>`;
811
- }
812
808
  const header = [
813
809
  {
814
810
  title: '優惠券名稱',
@@ -911,33 +907,41 @@ export class CheckoutIndex {
911
907
  .join('')}
912
908
  `;
913
909
  }
914
- return html `<div>
915
- <div class="d-flex">
916
- <label class="${gClass('label')}">輸入代碼</label>
917
- <input class="${gClass('input')}" type="text" />
918
- <button class="${gClass('button-bgr')}" onclick="${gvc.event((e) => {
910
+ return html `
911
+ <div>
912
+ <div class="d-flex flex-column flex-sm-row align-items-center ">
913
+ <div class="d-flex align-items-center">
914
+ <input class="${gClass('input')}" type="text"
915
+ style="border-top-right-radius: 0;border-bottom-right-radius: 0px;" placeholder="請輸入優惠代碼"/>
916
+ <button class="${gClass('button-bgr')}" style="width:100px;border-top-left-radius: 0;border-bottom-left-radius: 0px;"
917
+ onclick="${gvc.event((e) => {
919
918
  checkCodeValue(e.value);
920
919
  })}">
921
- <span class="${gClass('button-text')}">確認</span>
922
- </button>
923
- </div>
924
- <div class="w-100 d-sm-none mb-3 s162413">
920
+ <span class="${gClass('button-text')}" style="">確認</span>
921
+ </button>
922
+ </div>
923
+ </div>
924
+ <div class="w-100 d-sm-none mb-3 s162413">
925
925
  ${vmi.dataList
926
926
  .map((item) => {
927
- return html `<div class="um-mobile-area">
928
- ${formatText(item.content)
927
+ return html `
928
+ <div class="um-mobile-area">
929
+ ${formatText(item.content)
929
930
  .map((dd, index) => {
930
931
  if (header[index].title === '') {
931
932
  return dd;
932
933
  }
933
- return html `<div class="um-mobile-text">${header[index].title}: ${dd}</div>`;
934
+ return html `
935
+ <div class="um-mobile-text">
936
+ ${header[index].title}: ${dd}
937
+ </div>`;
934
938
  })
935
939
  .join('')}
936
- </div>`;
940
+ </div>`;
937
941
  })
938
942
  .join('')}
939
- </div>
940
- </div>`;
943
+ </div>
944
+ </div>`;
941
945
  }
942
946
  },
943
947
  divCreate: {},
@@ -1015,9 +1019,14 @@ export class CheckoutIndex {
1015
1019
  })}"></i>` : '新增'}</div>
1016
1020
  </div>
1017
1021
  ${(() => {
1018
- let tempRebate = 0;
1019
- const dialog = new ShareDialog(gvc.glitter);
1020
- return `<div class="${gClass(['price-row', 'text-2'])}">
1022
+ if (!GlobalUser.token) {
1023
+ return ``;
1024
+ }
1025
+ else {
1026
+ return ` ${(() => {
1027
+ let tempRebate = 0;
1028
+ const dialog = new ShareDialog(gvc.glitter);
1029
+ return `<div class="${gClass(['price-row', 'text-2'])}">
1021
1030
  <div>購物金折抵</div>
1022
1031
  <div>- NT. ${vm.cartData.use_rebate.toLocaleString()}</div>
1023
1032
  </div>
@@ -1025,9 +1034,9 @@ export class CheckoutIndex {
1025
1034
  <div class="${gClass(['price-row', 'text-2'])}">
1026
1035
  <div
1027
1036
  style=" justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document
1028
- .body.clientWidth > 768
1029
- ? 'gap: 18px; '
1030
- : ' gap: 0px; '}"
1037
+ .body.clientWidth > 768
1038
+ ? 'gap: 18px; '
1039
+ : ' gap: 0px; '}"
1031
1040
  class="w-100"
1032
1041
  >
1033
1042
  <input
@@ -1035,85 +1044,88 @@ export class CheckoutIndex {
1035
1044
  placeholder="請輸入購物金"
1036
1045
  value="${vm.cartData.use_rebate || ''}"
1037
1046
  onchange="${gvc.event((e, event) => {
1038
- if (CheckInput.isNumberString(e.value)) {
1039
- tempRebate = parseInt(e.value, 10);
1040
- }
1041
- else {
1042
- dialog.errorMessage({ text: `請輸入數值` });
1043
- gvc.notifyDataChange(ids.page);
1044
- }
1045
- })}"
1047
+ if (CheckInput.isNumberString(e.value)) {
1048
+ tempRebate = parseInt(e.value, 10);
1049
+ }
1050
+ else {
1051
+ dialog.errorMessage({ text: `請輸入數值` });
1052
+ gvc.notifyDataChange(ids.page);
1053
+ }
1054
+ })}"
1046
1055
  />
1047
1056
  <div class="${gClass('group-button')}" >
1048
1057
  <div class="${gClass('button-text')}"
1049
1058
  onclick="${gvc.event((e) => __awaiter(this, void 0, void 0, function* () {
1050
- const sum = yield new Promise((resolve, reject) => {
1051
- ApiShop.getRebate({}).then((res) => __awaiter(this, void 0, void 0, function* () {
1052
- if (res.result && res.response.sum) {
1053
- resolve(res.response.sum);
1059
+ const sum = yield new Promise((resolve, reject) => {
1060
+ ApiShop.getRebate({}).then((res) => __awaiter(this, void 0, void 0, function* () {
1061
+ if (res.result && res.response.sum) {
1062
+ resolve(res.response.sum);
1063
+ }
1064
+ else {
1065
+ resolve(0);
1066
+ }
1067
+ }));
1068
+ });
1069
+ const limit = vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
1070
+ console.log({
1071
+ total: vm.cartData.total,
1072
+ use_rebate: vm.cartData.use_rebate,
1073
+ shipment_fee: vm.cartData.shipment_fee,
1074
+ });
1075
+ if (tempRebate > Math.min(sum, limit)) {
1076
+ dialog.errorMessage({ text: `請輸入 0 到 ${Math.min(sum, limit)} 的數值` });
1054
1077
  }
1055
1078
  else {
1056
- resolve(0);
1079
+ ApiCart.setCart((cartItem) => {
1080
+ cartItem.use_rebate = tempRebate;
1081
+ refreshCartData();
1082
+ });
1057
1083
  }
1058
- }));
1059
- });
1060
- const limit = vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
1061
- console.log({
1062
- total: vm.cartData.total,
1063
- use_rebate: vm.cartData.use_rebate,
1064
- shipment_fee: vm.cartData.shipment_fee,
1065
- });
1066
- if (tempRebate > Math.min(sum, limit)) {
1067
- dialog.errorMessage({ text: `請輸入 0 到 ${Math.min(sum, limit)} 的數值` });
1068
- }
1069
- else {
1070
- ApiCart.setCart((cartItem) => {
1071
- cartItem.use_rebate = tempRebate;
1072
- refreshCartData();
1073
- });
1074
- }
1075
- }))}">
1084
+ }))}">
1076
1085
  套用
1077
1086
  </div>
1078
1087
  </div>
1079
1088
  </div>
1080
1089
  </div>`;
1081
- })()}
1090
+ })()}
1082
1091
  <div class="${gClass(['price-row', 'text-2'])}">
1083
1092
 
1084
1093
  ${(() => {
1085
- return gvc.bindView(() => {
1086
- return {
1087
- bind: gvc.glitter.getUUID(),
1088
- view: () => __awaiter(this, void 0, void 0, function* () {
1089
- const sum = yield new Promise((resolve, reject) => {
1090
- ApiShop.getRebate({}).then((res) => __awaiter(this, void 0, void 0, function* () {
1091
- if (res.result && res.response.sum) {
1092
- resolve(res.response.sum);
1094
+ return gvc.bindView(() => {
1095
+ return {
1096
+ bind: gvc.glitter.getUUID(),
1097
+ view: () => __awaiter(this, void 0, void 0, function* () {
1098
+ const sum = (yield new Promise((resolve, reject) => {
1099
+ ApiShop.getRebate({}).then((res) => __awaiter(this, void 0, void 0, function* () {
1100
+ if (res.result && res.response.sum) {
1101
+ resolve(res.response.sum);
1102
+ }
1103
+ else {
1104
+ resolve(0);
1105
+ }
1106
+ }));
1107
+ }));
1108
+ if (!vm.cartData.useRebateInfo) {
1109
+ return '';
1110
+ }
1111
+ const info = vm.cartData.useRebateInfo;
1112
+ if (info.condition) {
1113
+ return `還差$ ${info.condition.toLocaleString()} 即可使用購物金折抵`;
1114
+ }
1115
+ if (info.limit) {
1116
+ return `您目前剩餘 ${sum || 0} 點購物金<br />此份訂單最多可折抵 ${info.limit.toLocaleString()} 點購物金`;
1093
1117
  }
1094
1118
  else {
1095
- resolve(0);
1119
+ return `您目前剩餘 ${sum || 0} 點購物金`;
1096
1120
  }
1097
- }));
1098
- });
1099
- if (!vm.cartData.useRebateInfo) {
1100
- return '';
1101
- }
1102
- const info = vm.cartData.useRebateInfo;
1103
- if (info.condition) {
1104
- return `還差$ ${info.condition.toLocaleString()} 即可使用購物金折抵`;
1105
- }
1106
- if (info.limit) {
1107
- return `您目前剩餘 ${sum || 0} 點購物金<br />此份訂單最多可折抵 ${info.limit.toLocaleString()} 點購物金`;
1108
- }
1109
- else {
1110
- return `您目前剩餘 ${sum || 0} 點購物金`;
1111
- }
1112
- })
1113
- };
1114
- });
1121
+ })
1122
+ };
1123
+ });
1124
+ })()}
1125
+ </div>`;
1126
+ }
1115
1127
  })()}
1116
- </div>
1128
+
1117
1129
  </div>
1118
1130
  </section>`;
1119
1131
  },
@@ -1966,84 +1978,6 @@ export class CheckoutIndex {
1966
1978
  },
1967
1979
  divCreate: {},
1968
1980
  onCreate: () => {
1969
- if (loadings.page) {
1970
- new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1971
- new Promise((resolve, reject) => {
1972
- setTimeout(() => {
1973
- resolve(ApiCart.cart);
1974
- });
1975
- }).then((res) => __awaiter(this, void 0, void 0, function* () {
1976
- var _a;
1977
- const cartData = {
1978
- line_items: [],
1979
- total: 0,
1980
- user_info: {
1981
- shipment: localStorage.getItem('shipment-select'),
1982
- },
1983
- };
1984
- if (res.line_items) {
1985
- res.user_info = {
1986
- shipment: localStorage.getItem('shipment-select'),
1987
- };
1988
- const cart = res;
1989
- ApiShop.getCheckout(cart).then((res) => {
1990
- if (res.result) {
1991
- resolve(res.response.data);
1992
- }
1993
- else {
1994
- resolve([]);
1995
- }
1996
- });
1997
- }
1998
- else {
1999
- for (const b of Object.keys(res)) {
2000
- cartData.line_items.push({
2001
- id: b.split('-')[0],
2002
- count: res[b],
2003
- spec: b.split('-').filter((dd, index) => {
2004
- return index !== 0;
2005
- }),
2006
- });
2007
- }
2008
- const voucher = ApiCart.cart.code;
2009
- const rebate = ApiCart.cart.use_rebate || 0;
2010
- const distributionCode = (_a = localStorage.getItem('distributionCode')) !== null && _a !== void 0 ? _a : '';
2011
- ApiShop.getCheckout({
2012
- line_items: cartData.line_items.map((dd) => {
2013
- return {
2014
- id: dd.id,
2015
- spec: dd.spec,
2016
- count: dd.count,
2017
- };
2018
- }),
2019
- code: voucher,
2020
- use_rebate: GlobalUser.token && rebate ? rebate : undefined,
2021
- distribution_code: distributionCode,
2022
- user_info: {
2023
- shipment: localStorage.getItem('shipment-select'),
2024
- },
2025
- }).then((res) => {
2026
- if (res.result) {
2027
- resolve(res.response.data);
2028
- }
2029
- else {
2030
- resolve([]);
2031
- }
2032
- });
2033
- }
2034
- }));
2035
- })).then((data) => {
2036
- vm.cartData = data;
2037
- gvc.addMtScript([
2038
- {
2039
- src: `https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js`,
2040
- },
2041
- ], () => {
2042
- loadings.page = false;
2043
- gvc.notifyDataChange(ids.page);
2044
- }, () => { });
2045
- });
2046
- }
2047
1981
  },
2048
1982
  };
2049
1983
  })());