hookehuyr

fix

1 <!-- 1 <!--
2 * @Date: 2024-01-16 10:06:47 2 * @Date: 2024-01-16 10:06:47
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-26 14:01:46 4 + * @LastEditTime: 2024-01-26 14:44:26
5 * @FilePath: /xysBooking/src/components/qrCodeSearch.vue 5 * @FilePath: /xysBooking/src/components/qrCodeSearch.vue
6 * @Description: 预约码卡组件 6 * @Description: 预约码卡组件
7 --> 7 -->
...@@ -55,8 +55,8 @@ const props = defineProps({ ...@@ -55,8 +55,8 @@ const props = defineProps({
55 }); 55 });
56 56
57 const formatDatetime = (data) => { // 格式化日期 57 const formatDatetime = (data) => { // 格式化日期
58 - let begin_time = data.begin_time.slice(0, -3); 58 + let begin_time = data.begin_time?.slice(0, -3);
59 - let end_time = data.end_time.slice(0, -3); 59 + let end_time = data.end_time?.slice(0, -3);
60 let str = begin_time + ' ' + end_time; 60 let str = begin_time + ' ' + end_time;
61 return `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; 61 return `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`;
62 } 62 }
...@@ -130,17 +130,16 @@ const formatStatus = (status) => { ...@@ -130,17 +130,16 @@ const formatStatus = (status) => {
130 130
131 onMounted(async () => { 131 onMounted(async () => {
132 if (props.id) { 132 if (props.id) {
133 - // 511522190103214279
134 const { code, data } = await queryQrCodeAPI({ id_number: props.id }); 133 const { code, data } = await queryQrCodeAPI({ id_number: props.id });
135 if (code) { 134 if (code) {
136 userinfo.value = { 135 userinfo.value = {
137 id: formatId(props.id), 136 id: formatId(props.id),
138 - name: data.name, 137 + name: data?.name,
139 - datetime: formatDatetime({ begin_time: data.begin_time, end_time: data.end_time }), 138 + datetime: formatDatetime({ begin_time: data?.begin_time, end_time: data?.end_time }),
140 - qr_code: data.qr_code, 139 + qr_code: data?.qr_code,
141 - qr_code_url: 'http://oa.onwall.cn/admin?m=srv&a=get_qrcode&key=' + data.qr_code, 140 + qr_code_url: 'http://oa.onwall.cn/admin?m=srv&a=get_qrcode&key=' + data?.qr_code,
142 } 141 }
143 - const { code: status_code, data: status_data } = await qrcodeStatusAPI({ qr_code: data.qr_code }); 142 + const { code: status_code, data: status_data } = await qrcodeStatusAPI({ qr_code: data?.qr_code });
144 if (status_code) { 143 if (status_code) {
145 useStatus.value = status_data.status; 144 useStatus.value = status_data.status;
146 } 145 }
......