ts-glitter 22.5.7 → 22.5.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.
Files changed (91) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-product.js +13 -13
  4. package/lowcode/backend-manager/bg-product.ts +13 -13
  5. package/lowcode/backend-manager/bg-shopping.js +8 -13
  6. package/lowcode/backend-manager/bg-shopping.ts +8 -15
  7. package/lowcode/backend-manager/bg-widget.js +62 -49
  8. package/lowcode/backend-manager/bg-widget.ts +129 -93
  9. package/lowcode/cms-plugin/POS-setting.js +30 -9
  10. package/lowcode/cms-plugin/POS-setting.ts +49 -16
  11. package/lowcode/cms-plugin/cms-router.js +27 -21
  12. package/lowcode/cms-plugin/cms-router.ts +116 -101
  13. package/lowcode/cms-plugin/filter-options.js +25 -17
  14. package/lowcode/cms-plugin/filter-options.ts +27 -17
  15. package/lowcode/cms-plugin/module/product-excel.js +2 -0
  16. package/lowcode/cms-plugin/module/product-excel.ts +2 -0
  17. package/lowcode/cms-plugin/module/product-setting.js +13 -12
  18. package/lowcode/cms-plugin/module/product-setting.ts +26 -23
  19. package/lowcode/cms-plugin/order/order-module.js +91 -68
  20. package/lowcode/cms-plugin/order/order-module.ts +105 -73
  21. package/lowcode/cms-plugin/pos-checkout-setting.js +46 -39
  22. package/lowcode/cms-plugin/pos-checkout-setting.ts +237 -227
  23. package/lowcode/cms-plugin/pos-config-setting.js +25 -23
  24. package/lowcode/cms-plugin/pos-config-setting.ts +35 -32
  25. package/lowcode/cms-plugin/pos-pages/payment-function.js +253 -139
  26. package/lowcode/cms-plugin/pos-pages/payment-function.ts +405 -279
  27. package/lowcode/cms-plugin/pos-pages/payment-page.js +348 -267
  28. package/lowcode/cms-plugin/pos-pages/payment-page.ts +378 -296
  29. package/lowcode/cms-plugin/pos-pages/pos-function.js +76 -19
  30. package/lowcode/cms-plugin/pos-pages/pos-function.ts +84 -19
  31. package/lowcode/cms-plugin/shopping-discount-setting.js +2 -2
  32. package/lowcode/cms-plugin/shopping-discount-setting.ts +2 -2
  33. package/lowcode/cms-plugin/shopping-finance-setting.js +1590 -1701
  34. package/lowcode/cms-plugin/shopping-finance-setting.ts +1967 -2011
  35. package/lowcode/cms-plugin/shopping-order-manager.js +74 -62
  36. package/lowcode/cms-plugin/shopping-order-manager.ts +119 -85
  37. package/lowcode/cms-plugin/shopping-product-text.js +874 -531
  38. package/lowcode/cms-plugin/shopping-product-text.ts +1656 -1305
  39. package/lowcode/cms-plugin/shopping-setting-advance.js +1 -1
  40. package/lowcode/cms-plugin/shopping-setting-advance.ts +2 -1
  41. package/lowcode/cms-plugin/shopping-setting-basic.js +152 -124
  42. package/lowcode/cms-plugin/shopping-setting-basic.ts +315 -247
  43. package/lowcode/css/editor.css +3 -2
  44. package/lowcode/glitter-base/global/language.js +5 -3
  45. package/lowcode/glitter-base/global/language.ts +8 -6
  46. package/lowcode/glitter-base/global/payment-config.js +6 -0
  47. package/lowcode/glitter-base/global/payment-config.ts +6 -3
  48. package/lowcode/public-components/product/pd-class.js +1 -3
  49. package/lowcode/public-components/product/pd-class.ts +1 -3
  50. package/lowcode/public-components/user-manager/um-order.js +2 -1
  51. package/lowcode/public-components/user-manager/um-order.ts +2 -1
  52. package/package.json +1 -1
  53. package/src/api-public/controllers/index.js +14 -3
  54. package/src/api-public/controllers/index.js.map +1 -1
  55. package/src/api-public/controllers/index.ts +16 -3
  56. package/src/api-public/controllers/shop.js +14 -7
  57. package/src/api-public/controllers/shop.js.map +1 -1
  58. package/src/api-public/controllers/shop.ts +14 -8
  59. package/src/api-public/services/data-analyze.d.ts +1 -1
  60. package/src/api-public/services/ezpay/tool.d.ts +0 -1
  61. package/src/api-public/services/financial-serviceV2.js +7 -17
  62. package/src/api-public/services/financial-serviceV2.js.map +1 -1
  63. package/src/api-public/services/schedule.js +1 -1
  64. package/src/api-public/services/schedule.js.map +1 -1
  65. package/src/api-public/services/schedule.ts +1 -1
  66. package/src/api-public/services/shopee.js.map +1 -1
  67. package/src/api-public/services/updated-table-checked.js +20 -0
  68. package/src/api-public/services/updated-table-checked.js.map +1 -1
  69. package/src/api-public/services/updated-table-checked.ts +21 -0
  70. package/src/api-public/services/user.js +22 -12
  71. package/src/api-public/services/user.js.map +1 -1
  72. package/src/api-public/services/user.ts +31 -22
  73. package/src/app-project/serverless/src/modules/database.d.ts +1 -1
  74. package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
  75. package/src/helper/glitter-util.d.ts +0 -1
  76. package/src/index.js +3 -3
  77. package/src/index.js.map +13 -1
  78. package/src/modules/tool.d.ts +2 -0
  79. package/src/modules/tool.js +7 -0
  80. package/src/modules/tool.js.map +1 -1
  81. package/src/modules/tool.ts +7 -0
  82. package/src/seo-config.js +3 -3
  83. package/src/seo-config.js.map +9 -1
  84. package/src/services/private_config.js +11 -0
  85. package/src/services/private_config.js.map +1 -1
  86. package/src/services/private_config.ts +11 -0
  87. package/src/services/saas-table-check.js +12 -0
  88. package/src/services/saas-table-check.js.map +1 -1
  89. package/src/services/saas-table-check.ts +12 -0
  90. package/src/services/ses.js +3 -4
  91. package/src/services/ses.js.map +1 -1
@@ -905,111 +905,112 @@ export class ShoppingSettingBasic {
905
905
  }
906
906
 
907
907
  function drawProductImageBlock() {
908
- return BgWidget.mainCard(html`<!--繪製商品圖片展示區塊-->
909
- <div
910
- class="d-flex align-items-center justify-content-between"
911
- style="color: #393939;font-size: 16px;font-weight: 700;margin-bottom: 18px;"
912
- >
913
- <div class="d-flex align-items-center">圖片${BgWidget.languageInsignia(sel_lan(), 'margin-left:5px;')}</div>
914
- <div class="d-flex align-items-center gap-2">
915
- ${BgWidget.customButton({
916
- button: {
917
- color: 'black',
918
- size: 'sm',
919
- },
920
- text: {
921
- name: '上傳圖片',
922
- },
923
- event: gvc.event(() => {
924
- EditorElem.uploadFileFunction({
925
- gvc: gvc,
926
- callback: (images: any) => {
927
- const addImage = (urlArray: string[]) => {
908
+ return BgWidget.mainCard(
909
+ html`<!--繪製商品圖片展示區塊-->
910
+ <div
911
+ class="d-flex align-items-center justify-content-between"
912
+ style="color: #393939;font-size: 16px;font-weight: 700;margin-bottom: 18px;"
913
+ >
914
+ <div class="d-flex align-items-center">圖片${BgWidget.languageInsignia(sel_lan(), 'margin-left:5px;')}</div>
915
+ <div class="d-flex align-items-center gap-2">
916
+ ${BgWidget.customButton({
917
+ button: {
918
+ color: 'black',
919
+ size: 'sm',
920
+ },
921
+ text: {
922
+ name: '上傳圖片',
923
+ },
924
+ event: gvc.event(() => {
925
+ EditorElem.uploadFileFunction({
926
+ gvc: gvc,
927
+ callback: (images: any) => {
928
+ const addImage = (urlArray: string[]) => {
929
+ if (urlArray.length > 0) {
930
+ language_data.preview_image.push(...urlArray);
931
+ saveImageLib(urlArray);
932
+ obj.gvc.notifyDataChange('image_view');
933
+ } else {
934
+ dialog.errorMessage({ text: '請選擇至少一張圖片' });
935
+ }
936
+ };
937
+ addImage(images);
938
+ },
939
+ type: `image/*`,
940
+ return_array: true,
941
+ multiple: true,
942
+ });
943
+ }),
944
+ })}
945
+ ${BgWidget.customButton({
946
+ button: {
947
+ color: 'black',
948
+ size: 'sm',
949
+ },
950
+ text: {
951
+ name: '從圖片庫選取',
952
+ },
953
+ event: gvc.event(() => {
954
+ imageLibrary.selectImageLibrary(
955
+ gvc,
956
+ urlArray => {
928
957
  if (urlArray.length > 0) {
929
- language_data.preview_image.push(...urlArray);
930
- saveImageLib(urlArray);
958
+ language_data.preview_image.push(
959
+ ...urlArray.map((data: any) => {
960
+ return data.data;
961
+ })
962
+ );
931
963
  obj.gvc.notifyDataChange('image_view');
932
964
  } else {
933
965
  dialog.errorMessage({ text: '請選擇至少一張圖片' });
934
966
  }
935
- };
936
- addImage(images);
937
- },
938
- type: `image/*`,
939
- return_array: true,
940
- multiple: true,
941
- });
942
- }),
943
- })}
944
- ${BgWidget.customButton({
945
- button: {
946
- color: 'black',
947
- size: 'sm',
948
- },
949
- text: {
950
- name: '從圖片庫選取',
951
- },
952
- event: gvc.event(() => {
953
- imageLibrary.selectImageLibrary(
954
- gvc,
955
- urlArray => {
956
- if (urlArray.length > 0) {
957
- language_data.preview_image.push(
958
- ...urlArray.map((data: any) => {
959
- return data.data;
960
- })
961
- );
962
- obj.gvc.notifyDataChange('image_view');
963
- } else {
964
- dialog.errorMessage({ text: '請選擇至少一張圖片' });
965
- }
966
- },
967
- html` <div class="d-flex flex-column" style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">
968
- 圖片庫
969
- </div>`,
970
- { mul: true }
971
- );
972
- }),
973
- })}
967
+ },
968
+ html` <div class="d-flex flex-column" style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">
969
+ 圖片庫
970
+ </div>`,
971
+ { mul: true }
972
+ );
973
+ }),
974
+ })}
975
+ </div>
974
976
  </div>
975
- </div>
976
- ${obj.gvc.bindView(() => {
977
- return {
978
- bind: 'image_view',
979
- view: () => {
980
- return (
981
- html` <div class="my-2"></div>` +
982
- EditorElem.flexMediaManagerV2({
983
- gvc: obj.gvc,
984
- data: language_data.preview_image,
985
- event: {
986
- delete: (index: number) => {
987
- postMD.variants.forEach((variant: any) => {
988
- if (variant.preview_image === language_data.preview_image[index]) {
989
- variant.preview_image = language_data.preview_image[0] ?? BgWidget.noImageURL;
990
- }
991
- if (variant[`preview_image_${vm.language}`] === language_data.preview_image[index]) {
992
- variant[`preview_image_${vm.language}`] =
993
- language_data.preview_image[0] ?? BgWidget.noImageURL;
994
- }
995
- });
996
- ShoppingSettingBasic.updateVariants(gvc, postMD, shipment_config, variantsViewID, obj);
977
+ ${obj.gvc.bindView(() => {
978
+ return {
979
+ bind: 'image_view',
980
+ view: () => {
981
+ return (
982
+ html` <div class="my-2"></div>` +
983
+ EditorElem.flexMediaManagerV2({
984
+ gvc: obj.gvc,
985
+ data: language_data.preview_image,
986
+ event: {
987
+ delete: (index: number) => {
988
+ postMD.variants.forEach((variant: any) => {
989
+ if (variant.preview_image === language_data.preview_image[index]) {
990
+ variant.preview_image = language_data.preview_image[0] ?? BgWidget.noImageURL;
991
+ }
992
+ if (variant[`preview_image_${vm.language}`] === language_data.preview_image[index]) {
993
+ variant[`preview_image_${vm.language}`] =
994
+ language_data.preview_image[0] ?? BgWidget.noImageURL;
995
+ }
996
+ });
997
+ ShoppingSettingBasic.updateVariants(gvc, postMD, shipment_config, variantsViewID, obj);
998
+ },
997
999
  },
998
- },
999
- })
1000
- );
1001
- },
1002
- divCreate: {
1003
- class: `d-flex w-100`,
1004
- style: `overflow-y:scroll;height:180px;`,
1005
- },
1006
- };
1007
- })}
1008
- `);
1000
+ })
1001
+ );
1002
+ },
1003
+ divCreate: {
1004
+ class: `d-flex w-100`,
1005
+ style: `overflow-y:scroll;height:180px;`,
1006
+ },
1007
+ };
1008
+ })} `
1009
+ );
1009
1010
  }
1010
1011
 
1011
1012
  function drawReserveLocations() {
1012
- if (postMD.product_category === 'reserve') {
1013
+ if (postMD.product_category === 'reserve' && undefined) {
1013
1014
  function getStockStore() {
1014
1015
  ApiUser.getPublicConfig('store_manager', 'manager').then((storeData: any) => {
1015
1016
  if (storeData.result) {
@@ -1186,32 +1187,33 @@ export class ShoppingSettingBasic {
1186
1187
  `;
1187
1188
  }
1188
1189
 
1189
- return BgWidget.mainCard(html`<!--繪製預約門市選擇區塊-->
1190
- <div class="d-flex flex-column" style="gap:18px;">
1191
- <div class="d-flex align-items-center">
1192
- 服務地點${BgWidget.languageInsignia(sel_lan(), 'margin-left:5px;')}
1193
- </div>
1194
- <div class="d-flex flex-wrap" style="gap:12px;">
1195
- ${stockList.length == 0
1196
- ? html` <div class="w-100 d-flex align-items-center justify-content-center tx_gray_16">
1197
- 尚未設置門市,請前往POS實體門市>門市設定
1198
- </div>`
1199
- : postMD.reserve_locations.map(drawLocation).join('')}
1200
- </div>
1201
- <div
1202
- class="d-flex justify-content-center align-items-center cursor_pointer"
1203
- style="gap:4px;color: #36B;"
1204
- onclick="${gvc.event(() => {
1205
- popoutSelectLocation(newStoreList => {
1206
- postMD.reserve_locations = newStoreList;
1207
- gvc.notifyDataChange(section_ID.reserve_locations);
1208
- });
1209
- })}"
1210
- >
1211
- 新增服務地點 <i class="fa-solid fa-plus"></i>
1212
- </div>
1213
- </div>
1214
- `);
1190
+ return BgWidget.mainCard(
1191
+ html`<!--繪製預約門市選擇區塊-->
1192
+ <div class="d-flex flex-column" style="gap:18px;">
1193
+ <div class="d-flex align-items-center">
1194
+ 服務地點${BgWidget.languageInsignia(sel_lan(), 'margin-left:5px;')}
1195
+ </div>
1196
+ <div class="d-flex flex-wrap" style="gap:12px;">
1197
+ ${stockList.length == 0
1198
+ ? html` <div class="w-100 d-flex align-items-center justify-content-center tx_gray_16">
1199
+ 尚未設置門市,請前往POS實體門市>門市設定
1200
+ </div>`
1201
+ : postMD.reserve_locations.map(drawLocation).join('')}
1202
+ </div>
1203
+ <div
1204
+ class="d-flex justify-content-center align-items-center cursor_pointer"
1205
+ style="gap:4px;color: #36B;"
1206
+ onclick="${gvc.event(() => {
1207
+ popoutSelectLocation(newStoreList => {
1208
+ postMD.reserve_locations = newStoreList;
1209
+ gvc.notifyDataChange(section_ID.reserve_locations);
1210
+ });
1211
+ })}"
1212
+ >
1213
+ 新增服務地點 <i class="fa-solid fa-plus"></i>
1214
+ </div>
1215
+ </div> `
1216
+ );
1215
1217
  },
1216
1218
  divCreate: {},
1217
1219
  });
@@ -1226,23 +1228,24 @@ export class ShoppingSettingBasic {
1226
1228
  return gvc.bindView({
1227
1229
  bind: section_ID.store_product_config_panel,
1228
1230
  view: () => {
1229
- return BgWidget.mainCard(html`<!--繪製單一門市的商品配置面板-->
1230
- <div class="d-flex flex-column">
1231
- <div class="tx_700">依門市管理</div>
1232
- <div class="tx_gray_14">其他門市將預設套用此門市的設定,如需修改,請切換至對應門市進行調整</div>
1233
- </div>
1234
- ${BgWidget.select({
1235
- default: postMD.reserve_locations[0].id,
1236
- gvc: gvc,
1237
- options: postMD.reserve_locations.map(location => {
1238
- return {
1239
- value: location.name,
1240
- key: location.id,
1241
- };
1242
- }),
1243
- callback(value: any): void {},
1244
- })}
1245
- `);
1231
+ return BgWidget.mainCard(
1232
+ html`<!--繪製單一門市的商品配置面板-->
1233
+ <div class="d-flex flex-column">
1234
+ <div class="tx_700">依門市管理</div>
1235
+ <div class="tx_gray_14">其他門市將預設套用此門市的設定,如需修改,請切換至對應門市進行調整</div>
1236
+ </div>
1237
+ ${BgWidget.select({
1238
+ default: postMD.reserve_locations[0].id,
1239
+ gvc: gvc,
1240
+ options: postMD.reserve_locations.map(location => {
1241
+ return {
1242
+ value: location.name,
1243
+ key: location.id,
1244
+ };
1245
+ }),
1246
+ callback(value: any): void {},
1247
+ })} `
1248
+ );
1246
1249
  },
1247
1250
  divCreate: {},
1248
1251
  });
@@ -1258,14 +1261,15 @@ export class ShoppingSettingBasic {
1258
1261
  if (postMD.variants.length === 1) {
1259
1262
  try {
1260
1263
  (postMD.variants[0] as any).editable = true;
1261
- return html`
1262
- <!-- 繪製 編輯商品規格編輯區塊-->
1263
- `+ ShoppingProductSetting.editProductSpec({
1264
- vm: obj.vm,
1265
- defData: postMD,
1266
- gvc: gvc,
1267
- single: true,
1268
- });
1264
+ return (
1265
+ html` <!-- 繪製 編輯商品規格編輯區塊--> ` +
1266
+ ShoppingProductSetting.editProductSpec({
1267
+ vm: obj.vm,
1268
+ defData: postMD,
1269
+ gvc: gvc,
1270
+ single: true,
1271
+ })
1272
+ );
1269
1273
  } catch (e) {
1270
1274
  console.error(e);
1271
1275
  return '';
@@ -1298,7 +1302,7 @@ export class ShoppingSettingBasic {
1298
1302
  dataList: [{ obj: createPage, key: 'page' }],
1299
1303
  view: () => {
1300
1304
  let returnHTML = html`
1301
- <!-- 繪製商品規格列表區塊-->
1305
+ <!-- 繪製商品規格列表區塊-->
1302
1306
  <div
1303
1307
  class="d-flex align-items-center justify-content-between"
1304
1308
  style="font-size: 16px;font-weight: 700;"
@@ -1955,34 +1959,46 @@ export class ShoppingSettingBasic {
1955
1959
  : '';
1956
1960
  }
1957
1961
 
1958
- function drawReservationSettings(){
1959
- function drawTitle(title: string , subTitle: string , inputKey: string){
1960
- return html`
1961
- <div class="d-flex flex-column w-100" >
1962
+ function drawReservationSettings() {
1963
+ if (postMD.product_category === 'reserve' && undefined) {
1964
+ function drawTitle(title: string, subTitle: string, inputKey: string) {
1965
+ return html`
1966
+ <div class="d-flex flex-column w-100">
1962
1967
  <div class="tx_700 ">${title}</div>
1963
- ${subTitle
1964
- ? html`<div class="tx_gray_14" style="margin: 4px 0 8px 0;">${subTitle}</div>`
1965
- : html`<div style="height: 18px;"></div>`}
1968
+ ${subTitle
1969
+ ? html`<div class="tx_gray_14" style="margin: 4px 0 8px 0;">${subTitle}</div>`
1970
+ : html`<div style="height: 18px;"></div>`}
1966
1971
  <div class="d-flex" style="gap: 18px;">
1967
- <div class="d-flex flex-fill align-items-center" style="height: 40px;padding: 0 18px;border-radius: 10px;border: 1px solid #DDD;">
1968
- <input class="border-0 h-100 flex-fill" >
1972
+ <div
1973
+ class="d-flex flex-fill align-items-center"
1974
+ style="height: 40px;padding: 0 18px;border-radius: 10px;border: 1px solid #DDD;"
1975
+ >
1976
+ <input class="border-0 h-100 flex-fill" />
1969
1977
  <div class="tx_gray_14 ms-auto">小時</div>
1970
1978
  </div>
1971
- <div class="d-flex flex-fill align-items-center" style="height: 40px;padding: 0 18px;border-radius: 10px;border: 1px solid #DDD;">
1972
- <input class="border-0 h-100 flex-fill" >
1979
+ <div
1980
+ class="d-flex flex-fill align-items-center"
1981
+ style="height: 40px;padding: 0 18px;border-radius: 10px;border: 1px solid #DDD;"
1982
+ >
1983
+ <input class="border-0 h-100 flex-fill" />
1973
1984
  <div class="tx_gray_14 ms-auto">分鐘</div>
1974
1985
  </div>
1975
1986
  </div>
1976
1987
  </div>
1977
- `
1988
+ `;
1989
+ }
1990
+ return BgWidget.mainCard(html`
1991
+ ${drawTitle('預設服務時長', '', 'defaultServiceDuration')}
1992
+ <div class="tx_700">預設服務時長</div>
1993
+ `);
1978
1994
  }
1979
1995
  return ``
1980
- return BgWidget.mainCard(html`
1981
- ${drawTitle("預設服務時長" , "" , "defaultServiceDuration")}
1982
- <div class="tx_700">
1983
- 預設服務時長
1984
- </div>
1985
- `)
1996
+ // return BgWidget.mainCard(html`
1997
+ // ${drawTitle("預設服務時長" , "" , "defaultServiceDuration")}
1998
+ // <div class="tx_700">
1999
+ // 預設服務時長
2000
+ // </div>
2001
+ // `)
1986
2002
  }
1987
2003
 
1988
2004
  ShoppingSettingBasic.updateVariants(gvc, postMD, shipment_config, variantsViewID, obj);
@@ -3369,53 +3385,110 @@ export class ShoppingSettingBasic {
3369
3385
  };
3370
3386
  })()
3371
3387
  )}
3372
- ${['sale_price', 'stock']
3373
- .filter(dd => {
3374
- return (
3375
- dd === 'sale_price' || document.body.clientWidth > 768
3376
- );
3377
- })
3378
- .map((dd, index) => {
3379
- return html` <div
3380
- class="text-center px-1"
3381
- style="color:#393939;font-size: 16px;font-weight: 400;width: ${document
3382
- .body.clientWidth > 800
3383
- ? `17.5%;`
3384
- : 'auto;max-width:140px;'}"
3385
- >
3386
- <input
3387
- style="width: 100%;height: 40px;padding: 0px 18px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;"
3388
- value="${(data as any)[dd] ?? 0}"
3389
- min="0"
3390
- ${index === 1 ? `readonly` : ''}
3391
- onclick="${gvc.event(() => {
3392
- if (index === 1) {
3393
- ProductSetting.showBatchEditDialog({
3394
- gvc: gvc,
3395
- postMD: postMD,
3396
- selected: postMD.variants,
3397
- callback: () => {
3398
- gvc.notifyDataChange(vm.id);
3399
- },
3400
- });
3401
- }
3402
- })}"
3403
- oninput="${gvc.event(e => {
3404
- const regex = /^[0-9]*$/;
3405
- if (!regex.test(e.value)) {
3406
- e.value = e.value
3407
- .replace(/[^0-9]/g, '')
3408
- .replace(/e/gi, '');
3409
- }
3410
- })}"
3411
- onchange="${gvc.event(e => {
3412
- (data as any)[dd] = e.value;
3413
- gvc.notifyDataChange(vm.id);
3414
- })}"
3415
- />
3416
- </div>`;
3417
- })
3418
- .join('')}
3388
+ ${(() => {
3389
+ const fieldsToDisplay = ['sale_price', 'stock'].filter(
3390
+ field => {
3391
+ return (
3392
+ field === 'sale_price' ||
3393
+ document.body.clientWidth > 768
3394
+ );
3395
+ }
3396
+ );
3397
+
3398
+ const renderFields = fieldsToDisplay.map(
3399
+ (field, index) => {
3400
+ // 建立輸入欄位
3401
+ const inputProps = {
3402
+ style:
3403
+ 'width: 100%;height: 40px;padding: 0px 18px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;',
3404
+ value: (data as any)[field] ?? 0,
3405
+ min: '0',
3406
+ readonly: index === 1 ? 'readonly' : '',
3407
+ };
3408
+
3409
+ // 處理點擊事件 - 庫存編輯對話框
3410
+ const clickHandler =
3411
+ index === 1
3412
+ ? gvc.event(() => {
3413
+ ProductSetting.showBatchEditDialog({
3414
+ gvc: gvc,
3415
+ postMD: postMD,
3416
+ selected: postMD.variants,
3417
+ callback: () => {
3418
+ gvc.notifyDataChange(vm.id);
3419
+ },
3420
+ });
3421
+ })
3422
+ : '';
3423
+
3424
+ // 處理輸入驗證 - 只允許數字
3425
+ const inputHandler = gvc.event(e => {
3426
+ const regex = /^[0-9]*$/;
3427
+ if (!regex.test(e.value)) {
3428
+ e.value = e.value
3429
+ .replace(/[^0-9]/g, '')
3430
+ .replace(/e/gi, '');
3431
+ }
3432
+ });
3433
+
3434
+ // 處理變更事件 - 更新數據
3435
+ const changeHandler = gvc.event(e => {
3436
+ (data as any)[field] = e.value;
3437
+ gvc.notifyDataChange(vm.id);
3438
+ });
3439
+
3440
+ // 組合輸入欄位HTML
3441
+ const inputHTML = html`
3442
+ <input
3443
+ style="${inputProps.style}"
3444
+ value="${inputProps.value}"
3445
+ min="${inputProps.min}"
3446
+ ${inputProps.readonly}
3447
+ onclick="${clickHandler}"
3448
+ oninput="${inputHandler}"
3449
+ onchange="${changeHandler}"
3450
+ />
3451
+ `;
3452
+
3453
+ // 如果是庫存且不顯示庫存不足,則顯示破折號
3454
+ if (
3455
+ field === 'stock' &&
3456
+ data.show_understocking === 'false'
3457
+ ) {
3458
+ return html`
3459
+ <div
3460
+ class="text-center px-1"
3461
+ style="color: #393939; font-size: 14px; font-weight: 400; cursor: pointer;
3462
+ width: ${document.body.clientWidth > 800
3463
+ ? '17.5%;'
3464
+ : 'auto; max-width:140px;'}"
3465
+ onclick="${clickHandler}"
3466
+ >
3467
+ 不追蹤庫存
3468
+ </div>
3469
+ `;
3470
+ }
3471
+
3472
+ // 返回欄位容器
3473
+ return html`
3474
+ <div
3475
+ class="text-center px-1"
3476
+ style="color:#393939;font-size: 16px;font-weight: 400;width: ${document
3477
+ .body.clientWidth > 800
3478
+ ? '17.5%;'
3479
+ : 'auto;max-width:140px;'}"
3480
+ >
3481
+ ${inputHTML}
3482
+ </div>
3483
+ `;
3484
+ }
3485
+ );
3486
+
3487
+ // 最終返回所有欄位的HTML字串
3488
+ const fieldsHtml = renderFields.join('');
3489
+
3490
+ return fieldsHtml;
3491
+ })()}
3419
3492
  <div
3420
3493
  class="d-none d-sm-block"
3421
3494
  style="color:#393939;font-size: 16px;font-weight: 400;width: 20%;"
@@ -3619,16 +3692,17 @@ ${language_data.seo.content ?? ''}</textarea
3619
3692
  postMD.active_schedule = original;
3620
3693
  },
3621
3694
  innerHTML: gvc => {
3622
- return html` <div class="d-flex flex-column gap-3">
3695
+ return html` <div class="d-flex flex-column gap-2">
3623
3696
  ${BgWidget.grayNote(
3624
- html`若系統時間大於設定的開始時間,${cat_title}狀態將會從「待上架」自動變成「上架」`
3697
+ html`系統會根據所設定的時間,自動將${cat_title}上架或下架`,
3698
+ 'margin-bottom: 8px;'
3625
3699
  )}
3626
3700
  <div
3627
- class="d-flex mb-1 ${document.body.clientWidth < 768 ? 'flex-column' : ''}"
3701
+ class="d-flex ${document.body.clientWidth < 768 ? 'flex-column' : ''}"
3628
3702
  style="gap: 12px"
3629
3703
  >
3630
3704
  <div class="d-flex flex-column">
3631
- <span class="tx_normal me-2">開始日期</span>
3705
+ <span class="tx_normal me-2">上架時間</span>
3632
3706
  ${BgWidget.editeInput({
3633
3707
  gvc: gvc,
3634
3708
  title: '',
@@ -3642,7 +3716,7 @@ ${language_data.seo.content ?? ''}</textarea
3642
3716
  })}
3643
3717
  </div>
3644
3718
  <div class="d-flex flex-column">
3645
- <span class="tx_normal me-2">開始時間</span>
3719
+ <span class="tx_normal me-2">&ensp;</span>
3646
3720
  ${BgWidget.editeInput({
3647
3721
  gvc: gvc,
3648
3722
  title: '',
@@ -3665,39 +3739,33 @@ ${language_data.seo.content ?? ''}</textarea
3665
3739
  },
3666
3740
  {
3667
3741
  key: 'withEnd',
3668
- name: '結束時間',
3742
+ name: '下架時間',
3669
3743
  innerHtml: html` <div
3670
- class="d-flex mt-0 mt-md-1 ${document.body.clientWidth < 768 ? 'flex-column' : ''}"
3744
+ class="d-flex ${document.body.clientWidth < 768 ? 'flex-column' : ''}"
3671
3745
  style="gap: 12px"
3672
3746
  >
3673
- <div class="d-flex flex-column">
3674
- <span class="tx_normal me-2">結束日期</span>
3675
- ${BgWidget.editeInput({
3676
- gvc: gvc,
3677
- title: '',
3678
- type: 'date',
3679
- style: inputStyle,
3680
- default: `${original.endDate ?? ''}`,
3681
- placeHolder: '',
3682
- callback: text => {
3683
- postMD.active_schedule.endDate = text;
3684
- },
3685
- })}
3686
- </div>
3687
- <div class="d-flex flex-column">
3688
- <span class="tx_normal me-2">結束時間</span>
3689
- ${BgWidget.editeInput({
3690
- gvc: gvc,
3691
- title: '',
3692
- type: 'time',
3693
- style: inputStyle,
3694
- default: `${original.endTime ?? ''}`,
3695
- placeHolder: '',
3696
- callback: text => {
3697
- postMD.active_schedule.endTime = text;
3698
- },
3699
- })}
3700
- </div>
3747
+ ${BgWidget.editeInput({
3748
+ gvc: gvc,
3749
+ title: '',
3750
+ type: 'date',
3751
+ style: inputStyle,
3752
+ default: `${original.endDate ?? ''}`,
3753
+ placeHolder: '',
3754
+ callback: text => {
3755
+ postMD.active_schedule.endDate = text;
3756
+ },
3757
+ })}
3758
+ ${BgWidget.editeInput({
3759
+ gvc: gvc,
3760
+ title: '',
3761
+ type: 'time',
3762
+ style: inputStyle,
3763
+ default: `${original.endTime ?? ''}`,
3764
+ placeHolder: '',
3765
+ callback: text => {
3766
+ postMD.active_schedule.endTime = text;
3767
+ },
3768
+ })}
3701
3769
  </div>`,
3702
3770
  },
3703
3771
  ],