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.
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/cms-plugin/member-setting.js +2 -4
- package/lowcode/cms-plugin/member-setting.ts +2 -4
- package/lowcode/cms-plugin/module/user-excel.js +25 -21
- package/lowcode/cms-plugin/module/user-excel.ts +9 -6
- package/lowcode/cms-plugin/stock-history.ts +0 -1
- package/lowcode/cms-plugin/user-list.js +98 -97
- package/lowcode/cms-plugin/user-list.ts +111 -103
- package/lowcode/modules/checkInput.js +2 -2
- package/lowcode/modules/checkInput.ts +58 -61
- package/lowcode/public-components/checkout/index.js +0 -1
- package/lowcode/public-components/checkout/index.ts +0 -1
- package/lowcode/public-components/user-manager/um-info.js +49 -48
- package/lowcode/public-components/user-manager/um-info.ts +219 -204
- package/lowcode/public-components/user-manager/um-order.js +25 -22
- package/lowcode/public-components/user-manager/um-order.ts +32 -23
- package/lowcode/src/glitterBundle/module/Animation.js +7 -13
- package/lowcode/src/glitterBundle/module/Enum.js +2 -6
- package/lowcode/src/glitterBundle/module/Html_generate.js +50 -42
- package/lowcode/src/glitterBundle/module/PageManager.js +23 -30
- package/lowcode/src/glitterBundle/plugins/click-event.js +25 -19
- package/lowcode/src/glitterBundle/plugins/dialog-style-editor.js +13 -16
- package/lowcode/src/glitterBundle/plugins/editor-elem.js +1 -6
- package/lowcode/src/glitterBundle/plugins/editor.js +1 -5
- package/lowcode/src/glitterBundle/plugins/html-render.js +2 -5
- package/lowcode/src/glitterBundle/plugins/plugin-creater.js +28 -22
- package/lowcode/src/glitterBundle/plugins/seo-manager.js +1 -5
- package/lowcode/src/glitterBundle/plugins/style-attr.js +1 -5
- package/lowcode/src/glitterBundle/plugins/style-editor.js +1 -3
- package/package.json +1 -1
- package/src/api-public/services/financial-service.js +7 -6
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +11 -8
- package/src/api-public/services/model/handlePaymentTransaction.js +29 -2
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +8 -9
- package/src/api-public/services/shopping.d.ts +1 -1
- package/src/api-public/services/shopping.js +12 -9
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +5 -3
- package/src/api-public/services/user.js +48 -61
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +62 -66
|
@@ -1357,103 +1357,104 @@ export class UserList {
|
|
|
1357
1357
|
</div>`,
|
|
1358
1358
|
].join(BgWidget.mbContainer(12)),
|
|
1359
1359
|
[
|
|
1360
|
-
html
|
|
1360
|
+
html`
|
|
1361
|
+
<div class="d-flex align-items-center gap-2">
|
|
1362
|
+
<div class="tx_700">升級方式</div>
|
|
1363
|
+
${BgWidget.blueNote(
|
|
1364
|
+
'查看會員級數規則',
|
|
1365
|
+
gvc.event(() => {
|
|
1366
|
+
BgWidget.infoDialog({
|
|
1367
|
+
gvc: gvc,
|
|
1368
|
+
title: '會員規則',
|
|
1369
|
+
innerHTML: BgWidget.tableV3({
|
|
1370
|
+
gvc: gvc,
|
|
1371
|
+
getData: vd => {
|
|
1372
|
+
setTimeout(() => {
|
|
1373
|
+
vd.tableData = vm.data.member.map((leadData: any) => {
|
|
1374
|
+
return [
|
|
1375
|
+
{
|
|
1376
|
+
key: '會員等級',
|
|
1377
|
+
value: leadData.tag_name,
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
key: '升級規則',
|
|
1381
|
+
value: (() => {
|
|
1382
|
+
let text = '';
|
|
1383
|
+
const val = parseInt(
|
|
1384
|
+
`${leadData.og.condition.value}`,
|
|
1385
|
+
10
|
|
1386
|
+
).toLocaleString();
|
|
1387
|
+
const condition_type =
|
|
1388
|
+
leadData.og.condition.type === 'single' ? '單筆' : '累積';
|
|
1389
|
+
if (leadData.og.duration.type === 'noLimit') {
|
|
1390
|
+
text = `${condition_type}消費額達 NT$${val}`;
|
|
1391
|
+
} else {
|
|
1392
|
+
text = `${leadData.og.duration.value}天內${condition_type}消費額達 NT$${val}`;
|
|
1393
|
+
}
|
|
1394
|
+
return text;
|
|
1395
|
+
})(),
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
key: '有效期限',
|
|
1399
|
+
value: (() => {
|
|
1400
|
+
const { type, value } = leadData.og.dead_line;
|
|
1401
|
+
let dead_line = '';
|
|
1402
|
+
|
|
1403
|
+
if (type === 'date') {
|
|
1404
|
+
const deadlines = [
|
|
1405
|
+
{
|
|
1406
|
+
title: '一個月',
|
|
1407
|
+
value: 30,
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
title: '三個月',
|
|
1411
|
+
value: 90,
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
title: '六個月',
|
|
1415
|
+
value: 180,
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
title: '一年',
|
|
1419
|
+
value: 365,
|
|
1420
|
+
},
|
|
1421
|
+
];
|
|
1422
|
+
|
|
1423
|
+
const matchedDeadline = deadlines.find(
|
|
1424
|
+
item => item.value === value
|
|
1425
|
+
);
|
|
1426
|
+
dead_line = matchedDeadline
|
|
1427
|
+
? matchedDeadline.title
|
|
1428
|
+
: `${value}天`;
|
|
1429
|
+
} else if (type === 'noLimit') {
|
|
1430
|
+
dead_line = '沒有期限';
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
return dead_line;
|
|
1434
|
+
})(),
|
|
1435
|
+
},
|
|
1436
|
+
];
|
|
1437
|
+
});
|
|
1438
|
+
vd.originalData = vm.data.member;
|
|
1439
|
+
vd.loading = false;
|
|
1440
|
+
vd.callback();
|
|
1441
|
+
}, 200);
|
|
1442
|
+
},
|
|
1443
|
+
filter: [],
|
|
1444
|
+
rowClick: () => {},
|
|
1445
|
+
hiddenPageSplit: true,
|
|
1446
|
+
}),
|
|
1447
|
+
});
|
|
1448
|
+
})
|
|
1449
|
+
)}
|
|
1450
|
+
</div>
|
|
1451
|
+
`,
|
|
1361
1452
|
BgWidget.multiCheckboxContainer(
|
|
1362
1453
|
gvc,
|
|
1363
1454
|
[
|
|
1364
1455
|
{
|
|
1365
1456
|
key: 'auto',
|
|
1366
|
-
name:
|
|
1367
|
-
根據本站<span
|
|
1368
|
-
style="color: #4D86DB; text-decoration: underline;"
|
|
1369
|
-
onclick="${gvc.event((e, ev) => {
|
|
1370
|
-
ev.stopPropagation();
|
|
1371
|
-
BgWidget.infoDialog({
|
|
1372
|
-
gvc: gvc,
|
|
1373
|
-
title: '會員規則',
|
|
1374
|
-
innerHTML: BgWidget.tableV3({
|
|
1375
|
-
gvc: gvc,
|
|
1376
|
-
getData: vd => {
|
|
1377
|
-
setTimeout(() => {
|
|
1378
|
-
vd.tableData = vm.data.member.map((leadData: any) => {
|
|
1379
|
-
return [
|
|
1380
|
-
{
|
|
1381
|
-
key: '會員等級',
|
|
1382
|
-
value: leadData.tag_name,
|
|
1383
|
-
},
|
|
1384
|
-
{
|
|
1385
|
-
key: '升級條件',
|
|
1386
|
-
value: (() => {
|
|
1387
|
-
let text = '';
|
|
1388
|
-
const val = parseInt(
|
|
1389
|
-
`${leadData.og.condition.value}`,
|
|
1390
|
-
10
|
|
1391
|
-
).toLocaleString();
|
|
1392
|
-
const condition_type =
|
|
1393
|
-
leadData.og.condition.type === 'single' ? '單筆' : '累積';
|
|
1394
|
-
if (leadData.og.duration.type === 'noLimit') {
|
|
1395
|
-
text = `${condition_type}消費額達 NT$${val}`;
|
|
1396
|
-
} else {
|
|
1397
|
-
text = `${leadData.og.duration.value}天內${condition_type}消費額達 NT$${val}`;
|
|
1398
|
-
}
|
|
1399
|
-
return text;
|
|
1400
|
-
})(),
|
|
1401
|
-
},
|
|
1402
|
-
{
|
|
1403
|
-
key: '有效期限',
|
|
1404
|
-
value: (() => {
|
|
1405
|
-
const { type, value } = leadData.og.dead_line;
|
|
1406
|
-
let dead_line = '';
|
|
1407
|
-
|
|
1408
|
-
if (type === 'date') {
|
|
1409
|
-
const deadlines = [
|
|
1410
|
-
{
|
|
1411
|
-
title: '一個月',
|
|
1412
|
-
value: 30,
|
|
1413
|
-
},
|
|
1414
|
-
{
|
|
1415
|
-
title: '三個月',
|
|
1416
|
-
value: 90,
|
|
1417
|
-
},
|
|
1418
|
-
{
|
|
1419
|
-
title: '六個月',
|
|
1420
|
-
value: 180,
|
|
1421
|
-
},
|
|
1422
|
-
{
|
|
1423
|
-
title: '一年',
|
|
1424
|
-
value: 365,
|
|
1425
|
-
},
|
|
1426
|
-
];
|
|
1427
|
-
|
|
1428
|
-
const matchedDeadline = deadlines.find(
|
|
1429
|
-
item => item.value === value
|
|
1430
|
-
);
|
|
1431
|
-
dead_line = matchedDeadline
|
|
1432
|
-
? matchedDeadline.title
|
|
1433
|
-
: `${value}天`;
|
|
1434
|
-
} else if (type === 'noLimit') {
|
|
1435
|
-
dead_line = '沒有期限';
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
return dead_line;
|
|
1439
|
-
})(),
|
|
1440
|
-
},
|
|
1441
|
-
];
|
|
1442
|
-
});
|
|
1443
|
-
vd.originalData = vm.data.member;
|
|
1444
|
-
vd.loading = false;
|
|
1445
|
-
vd.callback();
|
|
1446
|
-
}, 200);
|
|
1447
|
-
},
|
|
1448
|
-
filter: [],
|
|
1449
|
-
rowClick: () => {},
|
|
1450
|
-
hiddenPageSplit: true,
|
|
1451
|
-
}),
|
|
1452
|
-
});
|
|
1453
|
-
})}"
|
|
1454
|
-
>會員規則</span
|
|
1455
|
-
>自動升級
|
|
1456
|
-
</div>`,
|
|
1457
|
+
name: '根據本站會員規則自動升級',
|
|
1457
1458
|
},
|
|
1458
1459
|
{
|
|
1459
1460
|
key: 'manual',
|
|
@@ -2022,15 +2023,23 @@ export class UserList {
|
|
|
2022
2023
|
bind: id,
|
|
2023
2024
|
view: () => {
|
|
2024
2025
|
return new Promise(async resolve => {
|
|
2025
|
-
const
|
|
2026
|
+
const getDefaultForm = await saasConfig.api.getPrivateConfig(
|
|
2026
2027
|
saasConfig.config.appName,
|
|
2027
2028
|
'glitterUserForm'
|
|
2028
2029
|
);
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2030
|
+
const defaultForm = getDefaultForm?.response?.result?.[0]?.value;
|
|
2031
|
+
|
|
2032
|
+
const customerForm = (
|
|
2033
|
+
await ApiUser.getPublicConfig('customer_form_user_setting', 'manager')
|
|
2034
|
+
)?.response?.value || { list: [] };
|
|
2035
|
+
|
|
2036
|
+
const formList = [
|
|
2037
|
+
...(Array.isArray(defaultForm) ? defaultForm : []),
|
|
2038
|
+
...customerForm.list,
|
|
2039
|
+
];
|
|
2031
2040
|
|
|
2032
|
-
function loopForm(
|
|
2033
|
-
return
|
|
2041
|
+
function loopForm(dataArray: any[], refer_obj: any): string {
|
|
2042
|
+
return dataArray
|
|
2034
2043
|
.map(item => {
|
|
2035
2044
|
const { title, key, page } = item;
|
|
2036
2045
|
const value = refer_obj[key] || '';
|
|
@@ -2083,7 +2092,7 @@ export class UserList {
|
|
|
2083
2092
|
// 預設用戶表單
|
|
2084
2093
|
const form_array_view: any = [
|
|
2085
2094
|
html`<div style="display:flex; gap: 12px; flex-direction: column;">
|
|
2086
|
-
${loopForm(
|
|
2095
|
+
${loopForm(formList, userData)}
|
|
2087
2096
|
</div>`,
|
|
2088
2097
|
];
|
|
2089
2098
|
|
|
@@ -2121,7 +2130,7 @@ export class UserList {
|
|
|
2121
2130
|
return;
|
|
2122
2131
|
}
|
|
2123
2132
|
|
|
2124
|
-
if (!CheckInput.
|
|
2133
|
+
if (!CheckInput.isTaiwanPhone(userData.phone)) {
|
|
2125
2134
|
dialog.infoMessage({ text: BgWidget.taiwanPhoneAlert() });
|
|
2126
2135
|
return;
|
|
2127
2136
|
}
|
|
@@ -2148,13 +2157,12 @@ export class UserList {
|
|
|
2148
2157
|
pwd: gvc.glitter.getUUID(),
|
|
2149
2158
|
userData: userData,
|
|
2150
2159
|
}).then(r => {
|
|
2160
|
+
dialog.dataLoading({ visible: false });
|
|
2151
2161
|
if (r.result) {
|
|
2152
|
-
dialog.
|
|
2153
|
-
dialog.infoMessage({ text: '成功新增會員' });
|
|
2162
|
+
dialog.successMessage({ text: '顧客新增成功' });
|
|
2154
2163
|
vm.type = 'list';
|
|
2155
2164
|
} else {
|
|
2156
|
-
dialog.
|
|
2157
|
-
dialog.errorMessage({ text: '會員建立失敗' });
|
|
2165
|
+
dialog.errorMessage({ text: '顧客新增失敗' });
|
|
2158
2166
|
}
|
|
2159
2167
|
});
|
|
2160
2168
|
}
|
|
@@ -28,11 +28,11 @@ export class CheckInput {
|
|
|
28
28
|
return regex.test(input);
|
|
29
29
|
}
|
|
30
30
|
static isChineseEnglishNumberHyphen(input) {
|
|
31
|
-
const regex = /^[
|
|
31
|
+
const regex = /^[\u4e00-\u9fa5a-zA-Z0-9-]+$/;
|
|
32
32
|
return regex.test(input);
|
|
33
33
|
}
|
|
34
34
|
static isBirthString(input) {
|
|
35
|
-
if (input.length !== 8) {
|
|
35
|
+
if (!input || input.length !== 8) {
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
const year = parseInt(input.substring(0, 4), 10);
|
|
@@ -1,62 +1,59 @@
|
|
|
1
1
|
export class CheckInput {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return date.getFullYear() === year && date.getMonth() + 1 === month && date.getDate() === day;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
2
|
+
static isEmpty(input: any): boolean {
|
|
3
|
+
return input === undefined || typeof input === 'undefined' || input === null || input.length === 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static isURL(input: string): boolean {
|
|
7
|
+
try {
|
|
8
|
+
return Boolean(new URL(input));
|
|
9
|
+
} catch (e) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static isEmail(input: string): boolean {
|
|
15
|
+
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
16
|
+
return regex.test(input);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static isTaiwanPhone(input: string): boolean {
|
|
20
|
+
const landlineRegex = /^0\d{1,2}-\d{6,8}(#\d{1,5})?$/;
|
|
21
|
+
const mobileRegex = /^09\d{8}$/;
|
|
22
|
+
return landlineRegex.test(input) || mobileRegex.test(input);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static isNumberString(input: string): boolean {
|
|
26
|
+
const num = parseFloat(input);
|
|
27
|
+
|
|
28
|
+
return !isNaN(num);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static isEnglishNumberHyphen(input: string): boolean {
|
|
32
|
+
const regex = /^[a-zA-Z0-9-]+$/;
|
|
33
|
+
return regex.test(input);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static isChineseEnglishNumberHyphen(input: string): boolean {
|
|
37
|
+
const regex = /^[\u4e00-\u9fa5a-zA-Z0-9-]+$/;
|
|
38
|
+
return regex.test(input);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static isBirthString(input: string): boolean {
|
|
42
|
+
// 檢查長度是否為8位數
|
|
43
|
+
if (!input || input.length !== 8) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 分割出年、月、日
|
|
48
|
+
const year = parseInt(input.substring(0, 4), 10);
|
|
49
|
+
const month = parseInt(input.substring(4, 6), 10);
|
|
50
|
+
const day = parseInt(input.substring(6, 8), 10);
|
|
51
|
+
|
|
52
|
+
// 檢查年月日範圍是否合理
|
|
53
|
+
if (year < 1900 || year > 2100 || month < 1 || month > 12 || day < 1) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
// 使用 Date 對象檢查日期是否合法
|
|
57
|
+
const date = new Date(year, month - 1, day);
|
|
58
|
+
return date.getFullYear() === year && date.getMonth() + 1 === month && date.getDate() === day;
|
|
59
|
+
}}
|
|
@@ -3037,7 +3037,6 @@ export class CheckoutIndex {
|
|
|
3037
3037
|
dialog.dataLoading({ visible: true });
|
|
3038
3038
|
PayNow.checkout().then((response) => {
|
|
3039
3039
|
dialog.dataLoading({ visible: false });
|
|
3040
|
-
console.log('response -- ', response);
|
|
3041
3040
|
if (response.error) {
|
|
3042
3041
|
dialog.errorMessage({
|
|
3043
3042
|
text: response.error.message,
|
|
@@ -3291,7 +3291,6 @@ export class CheckoutIndex {
|
|
|
3291
3291
|
dialog.dataLoading({ visible: true });
|
|
3292
3292
|
PayNow.checkout().then((response: any) => {
|
|
3293
3293
|
dialog.dataLoading({ visible: false });
|
|
3294
|
-
console.log('response -- ', response);
|
|
3295
3294
|
if (response.error) {
|
|
3296
3295
|
dialog.errorMessage({
|
|
3297
3296
|
text: response.error.message,
|