@pisell/private-materials 6.12.238 → 6.12.239
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.js +12 -12
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +10 -4
- package/es/components/wallet/utils.js +72 -115
- package/es/plus/walletPassGallery/components/passDetail/index.js +12 -4
- package/es/plus/walletPassGallery/components/passList/index.js +7 -4
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -3
- package/lib/components/wallet/utils.js +74 -115
- package/lib/plus/walletPassGallery/components/passDetail/index.js +11 -3
- package/lib/plus/walletPassGallery/components/passList/index.js +6 -3
- package/package.json +5 -5
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { getAvailableMaxAmount } from "../../utils.js";
|
|
3
|
-
import { formatDate, getUniqueId, isNumber, locales } from "@pisell/utils";
|
|
3
|
+
import { formatDate, getUniqueId, getWalletValidityRange, isNumber, locales } from "@pisell/utils";
|
|
4
4
|
import { globalConfig } from "@pisell/materials";
|
|
5
5
|
//#region src/components/pay/toC/PaymentMethods/WalletPass/utils.ts
|
|
6
6
|
const voucherTime = (data) => {
|
|
7
7
|
const config = globalConfig.getConfig();
|
|
8
|
-
|
|
8
|
+
const { endDate } = getWalletValidityRange(null, null, data);
|
|
9
|
+
if (endDate) return formatDate(endDate, (config === null || config === void 0 ? void 0 : config.locale) === "en" ? "DD/MM/YYYY" : "YYYY-MM-DD");
|
|
9
10
|
return locales.getText("tocPay.text.walletPassPermanent");
|
|
10
11
|
};
|
|
11
12
|
const formatMachineCodeServer2CardList = (data, selectId = []) => {
|
|
12
13
|
return (data || []).map((item) => {
|
|
13
|
-
var _item$shop, _item$unified_message, _item$custom_schedule, _item$
|
|
14
|
+
var _item$shop, _item$unified_message, _item$custom_schedule, _item$custom_schedule2;
|
|
14
15
|
return {
|
|
15
16
|
id: item.id,
|
|
16
17
|
name: item.product_name,
|
|
@@ -29,7 +30,12 @@ const formatMachineCodeServer2CardList = (data, selectId = []) => {
|
|
|
29
30
|
validDate: voucherTime(item),
|
|
30
31
|
originData: item,
|
|
31
32
|
scheduleList: ((_item$custom_schedule = item.custom_schedule_snapshot) === null || _item$custom_schedule === void 0 ? void 0 : _item$custom_schedule.data) || [],
|
|
32
|
-
validDateBySchedule: ((_item$
|
|
33
|
+
validDateBySchedule: Boolean((_item$custom_schedule2 = item.custom_schedule_snapshot) === null || _item$custom_schedule2 === void 0 || (_item$custom_schedule2 = _item$custom_schedule2.data) === null || _item$custom_schedule2 === void 0 ? void 0 : _item$custom_schedule2.length),
|
|
34
|
+
walletValidity: {
|
|
35
|
+
start_date: item.start_date,
|
|
36
|
+
expire_date: item.expire_date,
|
|
37
|
+
expire_time: item.expire_time
|
|
38
|
+
}
|
|
33
39
|
};
|
|
34
40
|
});
|
|
35
41
|
};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { getWalletValidityRange } from "@pisell/utils";
|
|
1
3
|
//#region src/components/wallet/utils.ts
|
|
2
4
|
function formatDateTime(dateTime, isAll = false, locale = "zh-CN") {
|
|
3
|
-
const date =
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const hours = date.getHours();
|
|
8
|
-
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
9
|
-
if (isAll) if (locale === "en") return `${day}/${month}/${year}`;
|
|
10
|
-
else return `${year}-${month}-${day}`;
|
|
11
|
-
if (locale === "en") {
|
|
12
|
-
const period = hours >= 12 ? "PM" : "AM";
|
|
13
|
-
return `${day}/${month}/${year} ${hours === 0 ? 12 : hours > 12 ? hours - 12 : hours}:${minutes} ${period}`;
|
|
14
|
-
} else return `${year}-${month}-${day} ${String(hours).padStart(2, "0")}:${minutes}`;
|
|
5
|
+
const date = dayjs(dateTime);
|
|
6
|
+
if (!date.isValid()) return "";
|
|
7
|
+
const dateFormat = locale === "en" ? "DD/MM/YYYY" : "YYYY-MM-DD";
|
|
8
|
+
return date.format(isAll ? dateFormat : `${dateFormat} ${locale === "en" ? "h:mm A" : "HH:mm"}`);
|
|
15
9
|
}
|
|
16
10
|
const textConfig = {
|
|
17
11
|
"zh-HK": {
|
|
@@ -36,6 +30,7 @@ const textConfig = {
|
|
|
36
30
|
year: "年",
|
|
37
31
|
available: "可用",
|
|
38
32
|
unlimited: "无限期",
|
|
33
|
+
noAvailableDates: "無可用日期",
|
|
39
34
|
weekPrefix: "周"
|
|
40
35
|
},
|
|
41
36
|
"zh-CN": {
|
|
@@ -60,6 +55,7 @@ const textConfig = {
|
|
|
60
55
|
year: "年",
|
|
61
56
|
available: "可用",
|
|
62
57
|
unlimited: "无限期",
|
|
58
|
+
noAvailableDates: "无可用日期",
|
|
63
59
|
weekPrefix: "周"
|
|
64
60
|
},
|
|
65
61
|
"en": {
|
|
@@ -84,12 +80,13 @@ const textConfig = {
|
|
|
84
80
|
year: "year",
|
|
85
81
|
available: "available",
|
|
86
82
|
unlimited: "unlimited",
|
|
83
|
+
noAvailableDates: "No available dates",
|
|
87
84
|
weekPrefix: ""
|
|
88
85
|
}
|
|
89
86
|
};
|
|
90
87
|
function getWeekdayText(dayNumbers, locale) {
|
|
91
88
|
const config = textConfig[locale];
|
|
92
|
-
return dayNumbers.map((day) => config.weekdays[day]).join(config.separator);
|
|
89
|
+
return [...new Set(dayNumbers)].sort((a, b) => a - b).map((day) => config.weekdays[day]).join(config.separator);
|
|
93
90
|
}
|
|
94
91
|
function getRepeatFrequencyText(repeatType, frequency, locale) {
|
|
95
92
|
const config = textConfig[locale];
|
|
@@ -108,124 +105,84 @@ function getRepeatFrequencyText(repeatType, frequency, locale) {
|
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
107
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @param scheduleList 日程列表
|
|
113
|
-
* @returns 格式化后的文案结果数组,每个日程对应一个结果
|
|
108
|
+
* 格式化日程与卡有效期的交集。仅生成展示文案,不修改原日程。
|
|
114
109
|
*/
|
|
115
|
-
function formatScheduleText(scheduleList, locale = "en") {
|
|
116
|
-
const
|
|
117
|
-
const config = textConfig[
|
|
118
|
-
|
|
110
|
+
function formatScheduleText(scheduleList, locale = "en", validity) {
|
|
111
|
+
const displayLocale = locale === "zh-CN" || locale === "zh-HK" ? locale : "en";
|
|
112
|
+
const config = textConfig[displayLocale];
|
|
113
|
+
if (!Array.isArray(scheduleList) || !scheduleList.length) return [];
|
|
114
|
+
const formatRange = (start, end, isAllDay = true, collapseSingleDate = false) => {
|
|
115
|
+
const range = getWalletValidityRange(start, end, validity);
|
|
116
|
+
if (range.isEmpty) return "";
|
|
117
|
+
const effectiveStart = range.startDate === getWalletValidityRange(start).startDate ? start : `${range.startDate} 00:00:00`;
|
|
118
|
+
const effectiveEnd = range.endDate === getWalletValidityRange(null, end).endDate ? end : `${range.endDate} 23:59:59`;
|
|
119
|
+
const startText = range.startDate ? formatDateTime(effectiveStart, isAllDay, displayLocale) : "";
|
|
120
|
+
const endText = range.endDate ? formatDateTime(effectiveEnd, isAllDay, displayLocale) : config.unlimited;
|
|
121
|
+
if (!startText) return endText;
|
|
122
|
+
if (collapseSingleDate && startText === endText) return startText;
|
|
123
|
+
return `${startText}${config.rangeSeparator}${endText}`;
|
|
124
|
+
};
|
|
125
|
+
const formatExceptions = (dates = []) => dates.filter((item) => {
|
|
126
|
+
const range = getWalletValidityRange(item.start, item.end);
|
|
127
|
+
return range.startDate && range.endDate;
|
|
128
|
+
}).map((item) => formatRange(item.start, item.end, true, true)).filter(Boolean);
|
|
129
|
+
const results = scheduleList.map((schedule) => {
|
|
119
130
|
var _schedule$repeat_rule, _schedule$repeat_rule2;
|
|
120
131
|
const validityTexts = [];
|
|
121
|
-
const excluded_date = [];
|
|
122
|
-
const included_date = [];
|
|
123
|
-
if ((_schedule$repeat_rule = schedule.repeat_rule) === null || _schedule$repeat_rule === void 0 ? void 0 : _schedule$repeat_rule.excluded_date) schedule.repeat_rule.excluded_date.forEach((excludeItem) => {
|
|
124
|
-
const startDate = formatDateTime(excludeItem.start, true, locale);
|
|
125
|
-
const endDate = formatDateTime(excludeItem.end, true, locale);
|
|
126
|
-
if (excludeItem.start === excludeItem.end) excluded_date.push(startDate);
|
|
127
|
-
else excluded_date.push(`${startDate}${config.rangeSeparator}${endDate}`);
|
|
128
|
-
});
|
|
129
|
-
if ((_schedule$repeat_rule2 = schedule.repeat_rule) === null || _schedule$repeat_rule2 === void 0 ? void 0 : _schedule$repeat_rule2.included_date) schedule.repeat_rule.included_date.forEach((includeItem) => {
|
|
130
|
-
const startDate = formatDateTime(includeItem.start, true, locale);
|
|
131
|
-
const endDate = formatDateTime(includeItem.end, true, locale);
|
|
132
|
-
if (includeItem.start === includeItem.end) included_date.push(startDate);
|
|
133
|
-
else included_date.push(`${startDate}${config.rangeSeparator}${endDate}`);
|
|
134
|
-
});
|
|
132
|
+
const excluded_date = formatExceptions(((_schedule$repeat_rule = schedule.repeat_rule) === null || _schedule$repeat_rule === void 0 ? void 0 : _schedule$repeat_rule.excluded_date) || []);
|
|
133
|
+
const included_date = formatExceptions(((_schedule$repeat_rule2 = schedule.repeat_rule) === null || _schedule$repeat_rule2 === void 0 ? void 0 : _schedule$repeat_rule2.included_date) || []);
|
|
135
134
|
const isAllDay = schedule.is_all === 1;
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
if (schedule.type === "designation" && schedule.designation) schedule.designation.forEach((item) => {
|
|
136
|
+
const allDay = isAllDay || item.start_time === "00:00" && item.end_time === "23:59";
|
|
137
|
+
const text = formatRange(`${item.start_date} ${item.start_time}`, `${item.end_date} ${item.end_time}`, allDay);
|
|
138
|
+
if (text) validityTexts.push(text);
|
|
139
|
+
});
|
|
140
|
+
else if (schedule.repeat_type === "none") {
|
|
141
|
+
var _schedule$time_slot;
|
|
138
142
|
if (schedule.type === "standard") {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const designationTexts = schedule.designation.map((item) => {
|
|
148
|
-
if (isAllDay || item.start_time === "00:00" && item.end_time === "23:59") {
|
|
149
|
-
const startDate = formatDateTime(item.start_date, true, locale);
|
|
150
|
-
const endDate = formatDateTime(item.end_date, true, locale);
|
|
151
|
-
return `${startDate}${config.rangeSeparator}${endDate}`;
|
|
152
|
-
} else return `${formatDateTime(item.start_date, true, locale)} ${item.start_time}${config.timeSeparator}${item.end_time}`;
|
|
153
|
-
});
|
|
154
|
-
validityTexts.push(...designationTexts);
|
|
143
|
+
const text = formatRange(schedule.start_time, schedule.end_time, isAllDay);
|
|
144
|
+
if (text) validityTexts.push(text);
|
|
145
|
+
} else if (schedule.type === "time-slots" && ((_schedule$time_slot = schedule.time_slot) === null || _schedule$time_slot === void 0 ? void 0 : _schedule$time_slot.length)) {
|
|
146
|
+
const dateText = formatRange(schedule.start_time, schedule.start_time, true, true);
|
|
147
|
+
if (dateText) {
|
|
148
|
+
const slots = isAllDay ? "" : schedule.time_slot.map((slot) => `${slot.start_time}${config.timeSeparator}${slot.end_time}`).join(config.timeSlotSeparator);
|
|
149
|
+
validityTexts.push([dateText, slots].filter(Boolean).join(" "));
|
|
150
|
+
}
|
|
155
151
|
}
|
|
156
152
|
} else if (schedule.repeat_rule) {
|
|
157
|
-
const { frequency, frequency_date } = schedule.repeat_rule;
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
else validityText = `${startText}${config.rangeSeparator}${endDateText},${frequencyText}${config.available}`;
|
|
167
|
-
} else {
|
|
168
|
-
const startTime = formatDateTime(schedule.start_time, false, locale);
|
|
169
|
-
const endTime = formatDateTime(schedule.end_time, false, locale);
|
|
170
|
-
const timeRange = locale === "en" ? `${startTime.split(" ")[1]} ${startTime.split(" ")[2]}${config.timeSeparator}${endTime.split(" ")[1]} ${endTime.split(" ")[2]}` : `${startTime.split(" ")[1]}${config.timeSeparator}${endTime.split(" ")[1]}`;
|
|
171
|
-
const frequencyText = getRepeatFrequencyText("daily", frequency, locale);
|
|
172
|
-
const dateRange = locale === "en" ? `${startTime.split(" ")[0]}${config.rangeSeparator}${endDateText}` : `${startText.split(" ")[0]}${config.rangeSeparator}${endDateText}`;
|
|
173
|
-
if (locale === "en") validityText = `${dateRange}, ${config.available} ${frequencyText} ${timeRange}`;
|
|
174
|
-
else validityText = `${dateRange},${frequencyText} ${timeRange} ${config.available}`;
|
|
175
|
-
}
|
|
176
|
-
else if (schedule.repeat_type === "weekly") {
|
|
177
|
-
const weekdaysText = getWeekdayText(frequency_date, locale);
|
|
178
|
-
if (isAllDay) if (locale === "en") {
|
|
179
|
-
const frequencyText = frequency === 1 ? "every week" : `every ${frequency} weeks`;
|
|
180
|
-
validityText = `${startText}${config.rangeSeparator}${endDateText}, ${frequencyText} on ${weekdaysText} `;
|
|
181
|
-
} else {
|
|
182
|
-
const frequencyText = frequency === 1 ? "每周" : `每${frequency}周的`;
|
|
183
|
-
validityText = `${startText}${config.rangeSeparator}${endDateText},${frequencyText}${config.weekPrefix}${weekdaysText}${config.available}`;
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
const startTime = formatDateTime(schedule.start_time, false, locale);
|
|
187
|
-
const endTime = formatDateTime(schedule.end_time, false, locale);
|
|
188
|
-
const timeRange = locale === "en" ? `${startTime.split(" ")[1]} ${startTime.split(" ")[2]}${config.timeSeparator}${endTime.split(" ")[1]} ${endTime.split(" ")[2]}` : `${startTime.split(" ")[1]}${config.timeSeparator}${endTime.split(" ")[1]}`;
|
|
189
|
-
const dateRange = locale === "en" ? `${startTime.split(" ")[0]}${config.rangeSeparator}${endDateText}` : `${startText.split(" ")[0]}${config.rangeSeparator}${endDateText}`;
|
|
190
|
-
if (locale === "en") validityText = `${dateRange}, ${frequency === 1 ? "every week" : `every ${frequency} weeks`} on ${weekdaysText} ${timeRange}`;
|
|
191
|
-
else validityText = `${dateRange},${frequency === 1 ? "每周" : `每${frequency}周的`}${config.weekPrefix}${weekdaysText} ${timeRange}`;
|
|
153
|
+
const { frequency, frequency_date, end } = schedule.repeat_rule;
|
|
154
|
+
const dateText = formatRange(schedule.start_time, end.type === "never" ? null : end.end_date);
|
|
155
|
+
if (dateText) {
|
|
156
|
+
let timeText = "";
|
|
157
|
+
if (!isAllDay) {
|
|
158
|
+
if (schedule.type === "time-slots") timeText = (schedule.time_slot || []).map((slot) => `${slot.start_time}${config.timeSeparator}${slot.end_time}`).join(config.timeSlotSeparator);
|
|
159
|
+
else if (schedule.start_time && schedule.end_time) {
|
|
160
|
+
const timeFormat = displayLocale === "en" ? "h:mm A" : "HH:mm";
|
|
161
|
+
timeText = `${dayjs(schedule.start_time).format(timeFormat)}${config.timeSeparator}${dayjs(schedule.end_time).format(timeFormat)}`;
|
|
192
162
|
}
|
|
193
163
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const weekdaysText = getWeekdayText(frequency_date, locale);
|
|
203
|
-
if (locale === "en") {
|
|
204
|
-
const frequencyText = frequency === 1 ? "every week" : `every ${frequency} weeks`;
|
|
205
|
-
validityText = `${baseDate}${config.rangeSeparator}${endDateText}, ${frequencyText} on ${weekdaysText} ${timeSlotsText}`;
|
|
206
|
-
} else {
|
|
207
|
-
const frequencyText = frequency === 1 ? "每周" : `每${frequency}周的`;
|
|
208
|
-
validityText = `${baseDate}${config.rangeSeparator}${endDateText},${frequencyText}${config.weekPrefix}${weekdaysText} ${timeSlotsText} ${config.available}`;
|
|
209
|
-
}
|
|
164
|
+
const frequencyText = getRepeatFrequencyText(schedule.repeat_type, frequency, displayLocale);
|
|
165
|
+
if (schedule.repeat_type === "weekly") {
|
|
166
|
+
const weekdays = getWeekdayText(frequency_date, displayLocale);
|
|
167
|
+
const repeatText = displayLocale === "en" ? `${frequencyText} on ${weekdays}` : `${frequencyText}${weekdays}${config.available}`;
|
|
168
|
+
validityTexts.push(`${dateText}${config.timeSlotSeparator}${[repeatText, timeText].filter(Boolean).join(" ")}`);
|
|
169
|
+
} else if (schedule.repeat_type === "daily") {
|
|
170
|
+
const repeatText = displayLocale === "en" ? `${config.available} ${frequencyText}` : `${frequencyText}${config.available}`;
|
|
171
|
+
validityTexts.push(`${dateText}${config.timeSlotSeparator}${[repeatText, timeText].filter(Boolean).join(" ")}`);
|
|
210
172
|
}
|
|
211
173
|
}
|
|
212
|
-
} else if (schedule.type === "designation" && schedule.designation) {
|
|
213
|
-
const designationTexts = schedule.designation.map((item) => {
|
|
214
|
-
if (isAllDay || item.start_time === "00:00" && item.end_time === "23:59") {
|
|
215
|
-
const startDate = formatDateTime(item.start_date, true, locale);
|
|
216
|
-
const endDate = formatDateTime(item.end_date, true, locale);
|
|
217
|
-
return `${startDate}${config.rangeSeparator}${endDate}`;
|
|
218
|
-
} else return `${formatDateTime(item.start_date, true, locale)} ${item.start_time}${config.timeSeparator}${item.end_time}`;
|
|
219
|
-
});
|
|
220
|
-
validityTexts.push(...designationTexts);
|
|
221
174
|
}
|
|
222
|
-
|
|
223
|
-
results.push({
|
|
175
|
+
return {
|
|
224
176
|
validityTexts,
|
|
225
177
|
excluded_date,
|
|
226
178
|
included_date
|
|
227
|
-
}
|
|
179
|
+
};
|
|
228
180
|
});
|
|
181
|
+
if (!results.some((item) => item.validityTexts.length || item.included_date.length)) return [{
|
|
182
|
+
validityTexts: [config.noAvailableDates],
|
|
183
|
+
excluded_date: [],
|
|
184
|
+
included_date: []
|
|
185
|
+
}];
|
|
229
186
|
return results;
|
|
230
187
|
}
|
|
231
188
|
//#endregion
|
|
@@ -22,7 +22,7 @@ import { formatScheduleText } from "../../../../components/wallet/utils.js";
|
|
|
22
22
|
import dayjs from "dayjs";
|
|
23
23
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
24
24
|
import { Button, Empty, Typography } from "antd";
|
|
25
|
-
import { getUniqueId, locales } from "@pisell/utils";
|
|
25
|
+
import { getUniqueId, getWalletValidityRange, locales } from "@pisell/utils";
|
|
26
26
|
import { PisellStatisticList, PisellToast, usePisellConfig, useToast } from "@pisell/materials";
|
|
27
27
|
import classNames from "classnames";
|
|
28
28
|
import { useRequest } from "ahooks";
|
|
@@ -50,7 +50,7 @@ const PassDetail = (props) => {
|
|
|
50
50
|
var _context$appHelper4;
|
|
51
51
|
request.setRequest((_context$appHelper4 = context.appHelper) === null || _context$appHelper4 === void 0 || (_context$appHelper4 = _context$appHelper4.utils) === null || _context$appHelper4 === void 0 ? void 0 : _context$appHelper4.request);
|
|
52
52
|
}
|
|
53
|
-
const { id = "", code = "", tag = "", product_title = "", product_name = "", encoded = "", balance, expire_date = "", product = {}, custom_schedule_snapshot, customer_id, limit_status } = dataSource || {};
|
|
53
|
+
const { id = "", code = "", tag = "", product_title = "", product_name = "", encoded = "", balance, start_date, expire_date = "", expire_time, product = {}, custom_schedule_snapshot, customer_id, limit_status } = dataSource || {};
|
|
54
54
|
const mobileWalletPassType = normalizeMobileWalletPassType(tag);
|
|
55
55
|
const { description = "", extension_data = [], customer_order_behavior_count = 0 } = product || {};
|
|
56
56
|
const _getDetail = useRequest(() => getDetailApi({
|
|
@@ -108,8 +108,16 @@ const PassDetail = (props) => {
|
|
|
108
108
|
}, []);
|
|
109
109
|
const descs = useMemo(() => {
|
|
110
110
|
var _context$engine2;
|
|
111
|
-
const detail = formatScheduleText(scheduleList, context === null || context === void 0 || (_context$engine2 = context.engine) === null || _context$engine2 === void 0 || (_context$engine2 = _context$engine2.props) === null || _context$engine2 === void 0 ? void 0 : _context$engine2.locale
|
|
112
|
-
|
|
111
|
+
const detail = formatScheduleText(scheduleList, context === null || context === void 0 || (_context$engine2 = context.engine) === null || _context$engine2 === void 0 || (_context$engine2 = _context$engine2.props) === null || _context$engine2 === void 0 ? void 0 : _context$engine2.locale, {
|
|
112
|
+
start_date,
|
|
113
|
+
expire_date,
|
|
114
|
+
expire_time
|
|
115
|
+
});
|
|
116
|
+
const { endDate } = getWalletValidityRange(null, null, {
|
|
117
|
+
expire_date,
|
|
118
|
+
expire_time
|
|
119
|
+
});
|
|
120
|
+
let expireText = endDate ? dayjs(endDate).format(locale === "en" ? "DD/MM/YYYY" : "YYYY-MM-DD") : locales.getText("wallet-pass-gallery.expireDate");
|
|
113
121
|
if (scheduleList.length > 0) {
|
|
114
122
|
let validityTexts = "";
|
|
115
123
|
let excludedText = "";
|
|
@@ -6,7 +6,7 @@ import { isEntitlementPass, resolveEntitlementUsage } from "../../entitlementPas
|
|
|
6
6
|
import { formatWalletPassAmount } from "../../utils.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { Button, List } from "antd";
|
|
9
|
-
import { locales } from "@pisell/utils";
|
|
9
|
+
import { getWalletValidityRange, locales } from "@pisell/utils";
|
|
10
10
|
import { PisellWalletPassCard, usePisellConfig } from "@pisell/materials";
|
|
11
11
|
//#region src/plus/walletPassGallery/components/passList/index.tsx
|
|
12
12
|
const _excluded = [
|
|
@@ -17,7 +17,6 @@ const _excluded = [
|
|
|
17
17
|
"balance",
|
|
18
18
|
"code",
|
|
19
19
|
"encoded",
|
|
20
|
-
"expire_date",
|
|
21
20
|
"shop",
|
|
22
21
|
"limit_status",
|
|
23
22
|
"product_cover",
|
|
@@ -53,7 +52,8 @@ const PassList = (props) => {
|
|
|
53
52
|
loadMore: _loadMore,
|
|
54
53
|
loading,
|
|
55
54
|
renderItem: (item, index) => {
|
|
56
|
-
|
|
55
|
+
var _item$custom_schedule, _item$custom_schedule2;
|
|
56
|
+
const { id, tag, product_title = "", product_name = "", balance = 0, code = "", encoded = "", shop = { name: "" }, limit_status, product_cover = "", par_value = "", unified_available_status, unified_messages = {}, holder, currency_display, virtual_currency_display } = item, rest = _objectWithoutProperties(item, _excluded);
|
|
57
57
|
const itemValue = item === null || item === void 0 ? void 0 : item[valuePropName];
|
|
58
58
|
const { title: disabledReason = "" } = unified_messages;
|
|
59
59
|
const { name: storeName = "" } = shop;
|
|
@@ -111,7 +111,10 @@ const PassList = (props) => {
|
|
|
111
111
|
discount: isDiscountCard ? Number(par_value) : void 0,
|
|
112
112
|
showDiscount: isDiscountCard,
|
|
113
113
|
code: encoded,
|
|
114
|
-
validDate:
|
|
114
|
+
validDate: getWalletValidityRange(null, null, item).endDate || "",
|
|
115
|
+
validDateBySchedule: Boolean((_item$custom_schedule = item.custom_schedule_snapshot) === null || _item$custom_schedule === void 0 || (_item$custom_schedule = _item$custom_schedule.data) === null || _item$custom_schedule === void 0 ? void 0 : _item$custom_schedule.length),
|
|
116
|
+
scheduleList: ((_item$custom_schedule2 = item.custom_schedule_snapshot) === null || _item$custom_schedule2 === void 0 ? void 0 : _item$custom_schedule2.data) || [],
|
|
117
|
+
walletValidity: item,
|
|
115
118
|
holder,
|
|
116
119
|
onSetHolder: isTerminalEnv ? void 0 : () => {
|
|
117
120
|
var _holder$metadata;
|
|
@@ -6,12 +6,13 @@ let _pisell_materials = require("@pisell/materials");
|
|
|
6
6
|
//#region src/components/pay/toC/PaymentMethods/WalletPass/utils.ts
|
|
7
7
|
const voucherTime = (data) => {
|
|
8
8
|
const config = _pisell_materials.globalConfig.getConfig();
|
|
9
|
-
|
|
9
|
+
const { endDate } = (0, _pisell_utils.getWalletValidityRange)(null, null, data);
|
|
10
|
+
if (endDate) return (0, _pisell_utils.formatDate)(endDate, (config === null || config === void 0 ? void 0 : config.locale) === "en" ? "DD/MM/YYYY" : "YYYY-MM-DD");
|
|
10
11
|
return _pisell_utils.locales.getText("tocPay.text.walletPassPermanent");
|
|
11
12
|
};
|
|
12
13
|
const formatMachineCodeServer2CardList = (data, selectId = []) => {
|
|
13
14
|
return (data || []).map((item) => {
|
|
14
|
-
var _item$shop, _item$unified_message, _item$custom_schedule, _item$
|
|
15
|
+
var _item$shop, _item$unified_message, _item$custom_schedule, _item$custom_schedule2;
|
|
15
16
|
return {
|
|
16
17
|
id: item.id,
|
|
17
18
|
name: item.product_name,
|
|
@@ -30,7 +31,12 @@ const formatMachineCodeServer2CardList = (data, selectId = []) => {
|
|
|
30
31
|
validDate: voucherTime(item),
|
|
31
32
|
originData: item,
|
|
32
33
|
scheduleList: ((_item$custom_schedule = item.custom_schedule_snapshot) === null || _item$custom_schedule === void 0 ? void 0 : _item$custom_schedule.data) || [],
|
|
33
|
-
validDateBySchedule: ((_item$
|
|
34
|
+
validDateBySchedule: Boolean((_item$custom_schedule2 = item.custom_schedule_snapshot) === null || _item$custom_schedule2 === void 0 || (_item$custom_schedule2 = _item$custom_schedule2.data) === null || _item$custom_schedule2 === void 0 ? void 0 : _item$custom_schedule2.length),
|
|
35
|
+
walletValidity: {
|
|
36
|
+
start_date: item.start_date,
|
|
37
|
+
expire_date: item.expire_date,
|
|
38
|
+
expire_time: item.expire_time
|
|
39
|
+
}
|
|
34
40
|
};
|
|
35
41
|
});
|
|
36
42
|
};
|