ts-glitter 20.5.1 → 20.5.3

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 (44) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/cms-plugin/member-setting.js +2 -4
  4. package/lowcode/cms-plugin/member-setting.ts +2 -4
  5. package/lowcode/cms-plugin/module/user-excel.js +25 -21
  6. package/lowcode/cms-plugin/module/user-excel.ts +9 -6
  7. package/lowcode/cms-plugin/stock-history.ts +0 -1
  8. package/lowcode/cms-plugin/user-list.js +98 -97
  9. package/lowcode/cms-plugin/user-list.ts +111 -103
  10. package/lowcode/modules/checkInput.js +2 -2
  11. package/lowcode/modules/checkInput.ts +58 -61
  12. package/lowcode/public-components/checkout/index.js +0 -1
  13. package/lowcode/public-components/checkout/index.ts +0 -1
  14. package/lowcode/public-components/user-manager/um-info.js +49 -48
  15. package/lowcode/public-components/user-manager/um-info.ts +219 -204
  16. package/lowcode/public-components/user-manager/um-order.js +25 -22
  17. package/lowcode/public-components/user-manager/um-order.ts +32 -23
  18. package/lowcode/src/glitterBundle/module/Animation.js +7 -13
  19. package/lowcode/src/glitterBundle/module/Enum.js +2 -6
  20. package/lowcode/src/glitterBundle/module/Html_generate.js +50 -42
  21. package/lowcode/src/glitterBundle/module/PageManager.js +23 -30
  22. package/lowcode/src/glitterBundle/plugins/click-event.js +25 -19
  23. package/lowcode/src/glitterBundle/plugins/dialog-style-editor.js +13 -16
  24. package/lowcode/src/glitterBundle/plugins/editor-elem.js +1 -6
  25. package/lowcode/src/glitterBundle/plugins/editor.js +1 -5
  26. package/lowcode/src/glitterBundle/plugins/html-render.js +2 -5
  27. package/lowcode/src/glitterBundle/plugins/plugin-creater.js +28 -22
  28. package/lowcode/src/glitterBundle/plugins/seo-manager.js +1 -5
  29. package/lowcode/src/glitterBundle/plugins/style-attr.js +1 -5
  30. package/lowcode/src/glitterBundle/plugins/style-editor.js +1 -3
  31. package/package.json +1 -1
  32. package/src/api-public/services/financial-service.js +7 -6
  33. package/src/api-public/services/financial-service.js.map +1 -1
  34. package/src/api-public/services/financial-service.ts +11 -8
  35. package/src/api-public/services/model/handlePaymentTransaction.js +29 -2
  36. package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
  37. package/src/api-public/services/model/handlePaymentTransaction.ts +8 -9
  38. package/src/api-public/services/shopping.d.ts +1 -1
  39. package/src/api-public/services/shopping.js +12 -9
  40. package/src/api-public/services/shopping.js.map +1 -1
  41. package/src/api-public/services/shopping.ts +5 -3
  42. package/src/api-public/services/user.js +48 -61
  43. package/src/api-public/services/user.js.map +1 -1
  44. package/src/api-public/services/user.ts +62 -66
package/lowcode/Entry.js CHANGED
@@ -144,7 +144,7 @@ export class Entry {
144
144
  }
145
145
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
146
146
  console.log(`Entry-time:`, window.renderClock.stop());
147
- glitter.share.editerVersion = 'V_20.5.1';
147
+ glitter.share.editerVersion = 'V_20.5.3';
148
148
  glitter.share.start = new Date();
149
149
  const vm = { appConfig: [] };
150
150
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -146,7 +146,7 @@ export class Entry {
146
146
  }
147
147
  (window as any).renderClock = (window as any).renderClock ?? createClock();
148
148
  console.log(`Entry-time:`, (window as any).renderClock.stop());
149
- glitter.share.editerVersion = 'V_20.5.1';
149
+ glitter.share.editerVersion = 'V_20.5.3';
150
150
  glitter.share.start = new Date();
151
151
  const vm = { appConfig: [] };
152
152
  (window as any).saasConfig = {
@@ -132,7 +132,7 @@ export class MemberSetting {
132
132
  style="margin-bottom: 12px;"
133
133
  >
134
134
  註冊頁面表單
135
- <span class="" style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
135
+ <span style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
136
136
  </div>`,
137
137
  },
138
138
  {
@@ -142,9 +142,7 @@ export class MemberSetting {
142
142
  style="margin-bottom: 12px;"
143
143
  >
144
144
  設定頁面表單
145
- <span class="" style="color:#8D8D8D;font-size: 12px;"
146
- >於用戶設定頁面中設定顧客可填寫的額外資料</span
147
- >
145
+ <span style="color:#8D8D8D;font-size: 12px;">於用戶設定頁面中設定顧客可填寫的額外資料</span>
148
146
  </div>`,
149
147
  },
150
148
  ]);
@@ -148,7 +148,7 @@ export class MemberSetting {
148
148
  style="margin-bottom: 12px;"
149
149
  >
150
150
  註冊頁面表單
151
- <span class="" style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
151
+ <span style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
152
152
  </div>`,
153
153
  },
154
154
  {
@@ -158,9 +158,7 @@ export class MemberSetting {
158
158
  style="margin-bottom: 12px;"
159
159
  >
160
160
  設定頁面表單
161
- <span class="" style="color:#8D8D8D;font-size: 12px;"
162
- >於用戶設定頁面中設定顧客可填寫的額外資料</span
163
- >
161
+ <span style="color:#8D8D8D;font-size: 12px;">於用戶設定頁面中設定顧客可填寫的額外資料</span>
164
162
  </div>`,
165
163
  },
166
164
  ]);
@@ -87,24 +87,26 @@ export class UserExcel {
87
87
  }
88
88
  const formatDate = (date) => date ? gvc.glitter.ut.dateFormat(new Date(date), 'yyyy-MM-dd hh:mm') : '';
89
89
  const formatJSON = (obj) => Object.fromEntries(Object.entries(obj).filter(([key]) => column.includes(key)));
90
- const getUserJSON = (user) => formatJSON({
91
- ID: user.id,
92
- 會員編號: user.userID,
93
- 顧客名稱: user.userData.name,
94
- 電子信箱: user.userData.email,
95
- 電話: user.userData.phone,
96
- 生日: user.userData.birth,
97
- 地址: user.userData.address,
98
- 性別: user.userData.gender,
99
- 手機載具: user.userData.carrier_number,
100
- 統一編號: user.userData.gui_number,
101
- 公司: user.company || user.userData.company,
102
- 收貨人: user.userData.consignee_name,
103
- 收貨人地址: user.userData.consignee_address,
104
- 收貨人電子郵件: user.userData.consignee_email,
105
- 收貨人手機: user.userData.consignee_phone,
106
- 顧客備註: user.userData.managerNote,
107
- });
90
+ const getUserJSON = (user) => {
91
+ return formatJSON({
92
+ ID: user.id,
93
+ 會員編號: user.userID,
94
+ 顧客名稱: user.userData.name,
95
+ 電子信箱: user.userData.email,
96
+ 電話: user.userData.phone,
97
+ 生日: user.userData.birth,
98
+ 地址: user.userData.address,
99
+ 性別: user.userData.gender,
100
+ 手機載具: user.userData.carrier_number,
101
+ 統一編號: user.userData.gui_number,
102
+ 公司: user.company || user.userData.company,
103
+ 收貨人: user.userData.consignee_name,
104
+ 收貨人地址: user.userData.consignee_address,
105
+ 收貨人電子郵件: user.userData.consignee_email,
106
+ 收貨人手機: user.userData.consignee_phone,
107
+ 顧客備註: user.userData.managerNote,
108
+ });
109
+ };
108
110
  const getRecordJSON = (user) => {
109
111
  var _a;
110
112
  return formatJSON({
@@ -113,7 +115,7 @@ export class UserExcel {
113
115
  會員有效期: formatDate(user.member_deadline),
114
116
  會員標籤: ((_a = user.userData.tags) !== null && _a !== void 0 ? _a : []).join(','),
115
117
  註冊時間: formatDate(user.created_time),
116
- 現有購物金: user.rebate,
118
+ 購物金餘額: user.rebate,
117
119
  'LINE UID': user.userData.lineID,
118
120
  'FB UID': user.userData['fb-id'],
119
121
  });
@@ -255,6 +257,7 @@ export class UserExcel {
255
257
  lineID: user['LINE UID'],
256
258
  'fb-id': user['FB UID'],
257
259
  tags: ((_b = user['會員標籤']) !== null && _b !== void 0 ? _b : '').split(','),
260
+ rebate: user['購物金餘額'],
258
261
  };
259
262
  jsonData[i] = {
260
263
  account: userData.email,
@@ -334,7 +337,7 @@ export class UserExcel {
334
337
  : ''}
335
338
  <div class="d-flex flex-column w-100 align-items-start gap-3" style="padding: 20px">
336
339
  <div class="d-flex align-items-center gap-2">
337
- <div class="tx_700">透過XLSX檔案匯入商品</div>
340
+ <div class="tx_700">透過XLSX檔案匯入顧客</div>
338
341
  ${BgWidget.blueNote('下載範例', gvc.event(viewData.example.event))}
339
342
  </div>
340
343
  <input
@@ -417,6 +420,7 @@ UserExcel.importExampleData = [
417
420
  會員標籤: '台中,青年',
418
421
  'LINE UID': '12341234',
419
422
  'FB UID': '12341234',
423
+ 購物金餘額: '100',
420
424
  },
421
425
  ];
422
426
  UserExcel.headerColumn = {
@@ -438,6 +442,6 @@ UserExcel.headerColumn = {
438
442
  '收貨人手機',
439
443
  '顧客備註',
440
444
  ],
441
- 個人紀錄: ['黑名單', '會員等級', '會員有效期', '會員標籤', '註冊時間', '現有購物金', 'LINE UID', 'FB UID'],
445
+ 個人紀錄: ['黑名單', '會員等級', '會員有效期', '會員標籤', '註冊時間', '購物金餘額', 'LINE UID', 'FB UID'],
442
446
  訂單相關: ['最後購買日期', '最後消費金額', '最後出貨日期', '累積消費金額', '累積消費次數'],
443
447
  };
@@ -75,6 +75,7 @@ export class UserExcel {
75
75
  會員標籤: '台中,青年',
76
76
  'LINE UID': '12341234',
77
77
  'FB UID': '12341234',
78
+ 購物金餘額: '100',
78
79
  },
79
80
  ];
80
81
 
@@ -98,7 +99,7 @@ export class UserExcel {
98
99
  '收貨人手機',
99
100
  '顧客備註',
100
101
  ],
101
- 個人紀錄: ['黑名單', '會員等級', '會員有效期', '會員標籤', '註冊時間', '現有購物金', 'LINE UID', 'FB UID'],
102
+ 個人紀錄: ['黑名單', '會員等級', '會員有效期', '會員標籤', '註冊時間', '購物金餘額', 'LINE UID', 'FB UID'],
102
103
  訂單相關: ['最後購買日期', '最後消費金額', '最後出貨日期', '累積消費金額', '累積消費次數'],
103
104
  };
104
105
 
@@ -192,8 +193,8 @@ export class UserExcel {
192
193
  Object.fromEntries(Object.entries(obj).filter(([key]) => column.includes(key)));
193
194
 
194
195
  // 顧客欄位物件
195
- const getUserJSON = (user: User) =>
196
- formatJSON({
196
+ const getUserJSON = (user: User) => {
197
+ return formatJSON({
197
198
  ID: user.id,
198
199
  會員編號: user.userID,
199
200
  顧客名稱: user.userData.name,
@@ -211,8 +212,9 @@ export class UserExcel {
211
212
  收貨人手機: user.userData.consignee_phone,
212
213
  顧客備註: user.userData.managerNote,
213
214
  });
215
+ };
214
216
 
215
- // 紀錄欄位物件
217
+ // 個人紀錄欄位物件
216
218
  const getRecordJSON = (user: User) => {
217
219
  return formatJSON({
218
220
  黑名單: user.status === 1 ? '否' : '是',
@@ -220,7 +222,7 @@ export class UserExcel {
220
222
  會員有效期: formatDate(user.member_deadline),
221
223
  會員標籤: (user.userData.tags ?? []).join(','),
222
224
  註冊時間: formatDate(user.created_time),
223
- 現有購物金: user.rebate,
225
+ 購物金餘額: user.rebate,
224
226
  'LINE UID': user.userData.lineID,
225
227
  'FB UID': user.userData['fb-id'],
226
228
  });
@@ -400,6 +402,7 @@ export class UserExcel {
400
402
  lineID: user['LINE UID'],
401
403
  'fb-id': user['FB UID'],
402
404
  tags: (user['會員標籤'] ?? '').split(','),
405
+ rebate: user['購物金餘額'],
403
406
  };
404
407
 
405
408
  jsonData[i] = {
@@ -496,7 +499,7 @@ export class UserExcel {
496
499
  : ''}
497
500
  <div class="d-flex flex-column w-100 align-items-start gap-3" style="padding: 20px">
498
501
  <div class="d-flex align-items-center gap-2">
499
- <div class="tx_700">透過XLSX檔案匯入商品</div>
502
+ <div class="tx_700">透過XLSX檔案匯入顧客</div>
500
503
  ${BgWidget.blueNote('下載範例', gvc.event(viewData.example.event))}
501
504
  </div>
502
505
  <input
@@ -12,7 +12,6 @@ import { StockVendors, VendorData } from './stock-vendors.js';
12
12
  import { CheckInput } from '../modules/checkInput.js';
13
13
  import { Tool } from '../modules/tool.js';
14
14
  import { BgProduct, OptionsItem } from '../backend-manager/bg-product.js';
15
- import { al } from '@faker-js/faker/dist/airline-CBNP41sR.js';
16
15
 
17
16
  const html = String.raw;
18
17
 
@@ -1181,94 +1181,92 @@ export class UserList {
1181
1181
  </div>`,
1182
1182
  ].join(BgWidget.mbContainer(12)),
1183
1183
  [
1184
- html `<div class="tx_700">升級方式</div>`,
1184
+ html `
1185
+ <div class="d-flex align-items-center gap-2">
1186
+ <div class="tx_700">升級方式</div>
1187
+ ${BgWidget.blueNote('查看會員級數規則', gvc.event(() => {
1188
+ BgWidget.infoDialog({
1189
+ gvc: gvc,
1190
+ title: '會員規則',
1191
+ innerHTML: BgWidget.tableV3({
1192
+ gvc: gvc,
1193
+ getData: vd => {
1194
+ setTimeout(() => {
1195
+ vd.tableData = vm.data.member.map((leadData) => {
1196
+ return [
1197
+ {
1198
+ key: '會員等級',
1199
+ value: leadData.tag_name,
1200
+ },
1201
+ {
1202
+ key: '升級規則',
1203
+ value: (() => {
1204
+ let text = '';
1205
+ const val = parseInt(`${leadData.og.condition.value}`, 10).toLocaleString();
1206
+ const condition_type = leadData.og.condition.type === 'single' ? '單筆' : '累積';
1207
+ if (leadData.og.duration.type === 'noLimit') {
1208
+ text = `${condition_type}消費額達 NT$${val}`;
1209
+ }
1210
+ else {
1211
+ text = `${leadData.og.duration.value}天內${condition_type}消費額達 NT$${val}`;
1212
+ }
1213
+ return text;
1214
+ })(),
1215
+ },
1216
+ {
1217
+ key: '有效期限',
1218
+ value: (() => {
1219
+ const { type, value } = leadData.og.dead_line;
1220
+ let dead_line = '';
1221
+ if (type === 'date') {
1222
+ const deadlines = [
1223
+ {
1224
+ title: '一個月',
1225
+ value: 30,
1226
+ },
1227
+ {
1228
+ title: '三個月',
1229
+ value: 90,
1230
+ },
1231
+ {
1232
+ title: '六個月',
1233
+ value: 180,
1234
+ },
1235
+ {
1236
+ title: '一年',
1237
+ value: 365,
1238
+ },
1239
+ ];
1240
+ const matchedDeadline = deadlines.find(item => item.value === value);
1241
+ dead_line = matchedDeadline
1242
+ ? matchedDeadline.title
1243
+ : `${value}天`;
1244
+ }
1245
+ else if (type === 'noLimit') {
1246
+ dead_line = '沒有期限';
1247
+ }
1248
+ return dead_line;
1249
+ })(),
1250
+ },
1251
+ ];
1252
+ });
1253
+ vd.originalData = vm.data.member;
1254
+ vd.loading = false;
1255
+ vd.callback();
1256
+ }, 200);
1257
+ },
1258
+ filter: [],
1259
+ rowClick: () => { },
1260
+ hiddenPageSplit: true,
1261
+ }),
1262
+ });
1263
+ }))}
1264
+ </div>
1265
+ `,
1185
1266
  BgWidget.multiCheckboxContainer(gvc, [
1186
1267
  {
1187
1268
  key: 'auto',
1188
- name: html `<div>
1189
- 根據本站<span
1190
- style="color: #4D86DB; text-decoration: underline;"
1191
- onclick="${gvc.event((e, ev) => {
1192
- ev.stopPropagation();
1193
- BgWidget.infoDialog({
1194
- gvc: gvc,
1195
- title: '會員規則',
1196
- innerHTML: BgWidget.tableV3({
1197
- gvc: gvc,
1198
- getData: vd => {
1199
- setTimeout(() => {
1200
- vd.tableData = vm.data.member.map((leadData) => {
1201
- return [
1202
- {
1203
- key: '會員等級',
1204
- value: leadData.tag_name,
1205
- },
1206
- {
1207
- key: '升級條件',
1208
- value: (() => {
1209
- let text = '';
1210
- const val = parseInt(`${leadData.og.condition.value}`, 10).toLocaleString();
1211
- const condition_type = leadData.og.condition.type === 'single' ? '單筆' : '累積';
1212
- if (leadData.og.duration.type === 'noLimit') {
1213
- text = `${condition_type}消費額達 NT$${val}`;
1214
- }
1215
- else {
1216
- text = `${leadData.og.duration.value}天內${condition_type}消費額達 NT$${val}`;
1217
- }
1218
- return text;
1219
- })(),
1220
- },
1221
- {
1222
- key: '有效期限',
1223
- value: (() => {
1224
- const { type, value } = leadData.og.dead_line;
1225
- let dead_line = '';
1226
- if (type === 'date') {
1227
- const deadlines = [
1228
- {
1229
- title: '一個月',
1230
- value: 30,
1231
- },
1232
- {
1233
- title: '三個月',
1234
- value: 90,
1235
- },
1236
- {
1237
- title: '六個月',
1238
- value: 180,
1239
- },
1240
- {
1241
- title: '一年',
1242
- value: 365,
1243
- },
1244
- ];
1245
- const matchedDeadline = deadlines.find(item => item.value === value);
1246
- dead_line = matchedDeadline
1247
- ? matchedDeadline.title
1248
- : `${value}天`;
1249
- }
1250
- else if (type === 'noLimit') {
1251
- dead_line = '沒有期限';
1252
- }
1253
- return dead_line;
1254
- })(),
1255
- },
1256
- ];
1257
- });
1258
- vd.originalData = vm.data.member;
1259
- vd.loading = false;
1260
- vd.callback();
1261
- }, 200);
1262
- },
1263
- filter: [],
1264
- rowClick: () => { },
1265
- hiddenPageSplit: true,
1266
- }),
1267
- });
1268
- })}"
1269
- >會員規則</span
1270
- >自動升級
1271
- </div>`,
1269
+ name: '根據本站會員規則自動升級',
1272
1270
  },
1273
1271
  {
1274
1272
  key: 'manual',
@@ -1766,12 +1764,16 @@ export class UserList {
1766
1764
  bind: id,
1767
1765
  view: () => {
1768
1766
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
1769
- var _a, _b, _c;
1770
- const response = yield saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitterUserForm');
1771
- const result = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.response) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
1772
- const data = Array.isArray(result) ? result : [];
1773
- function loopForm(data, refer_obj) {
1774
- return data
1767
+ var _a, _b, _c, _d, _e;
1768
+ const getDefaultForm = yield saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitterUserForm');
1769
+ const defaultForm = (_c = (_b = (_a = getDefaultForm === null || getDefaultForm === void 0 ? void 0 : getDefaultForm.response) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
1770
+ const customerForm = ((_e = (_d = (yield ApiUser.getPublicConfig('customer_form_user_setting', 'manager'))) === null || _d === void 0 ? void 0 : _d.response) === null || _e === void 0 ? void 0 : _e.value) || { list: [] };
1771
+ const formList = [
1772
+ ...(Array.isArray(defaultForm) ? defaultForm : []),
1773
+ ...customerForm.list,
1774
+ ];
1775
+ function loopForm(dataArray, refer_obj) {
1776
+ return dataArray
1775
1777
  .map(item => {
1776
1778
  const { title, key, page } = item;
1777
1779
  const value = refer_obj[key] || '';
@@ -1821,7 +1823,7 @@ export class UserList {
1821
1823
  }
1822
1824
  const form_array_view = [
1823
1825
  html `<div style="display:flex; gap: 12px; flex-direction: column;">
1824
- ${loopForm(data, userData)}
1826
+ ${loopForm(formList, userData)}
1825
1827
  </div>`,
1826
1828
  ];
1827
1829
  resolve(form_array_view.join(html `<div class="my-4 border"></div>`));
@@ -1850,7 +1852,7 @@ export class UserList {
1850
1852
  dialog.infoMessage({ text: '請輸入正確的電子信箱格式' });
1851
1853
  return;
1852
1854
  }
1853
- if (!CheckInput.isEmpty(userData.phone) && !CheckInput.isTaiwanPhone(userData.phone)) {
1855
+ if (!CheckInput.isTaiwanPhone(userData.phone)) {
1854
1856
  dialog.infoMessage({ text: BgWidget.taiwanPhoneAlert() });
1855
1857
  return;
1856
1858
  }
@@ -1877,14 +1879,13 @@ export class UserList {
1877
1879
  pwd: gvc.glitter.getUUID(),
1878
1880
  userData: userData,
1879
1881
  }).then(r => {
1882
+ dialog.dataLoading({ visible: false });
1880
1883
  if (r.result) {
1881
- dialog.dataLoading({ visible: false });
1882
- dialog.infoMessage({ text: '成功新增會員' });
1884
+ dialog.successMessage({ text: '顧客新增成功' });
1883
1885
  vm.type = 'list';
1884
1886
  }
1885
1887
  else {
1886
- dialog.dataLoading({ visible: false });
1887
- dialog.errorMessage({ text: '會員建立失敗' });
1888
+ dialog.errorMessage({ text: '顧客新增失敗' });
1888
1889
  }
1889
1890
  });
1890
1891
  }