hookehuyr

fix

1 <!-- 1 <!--
2 * @Date: 2023-06-13 13:26:46 2 * @Date: 2023-06-13 13:26:46
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-08-24 15:03:44 4 + * @LastEditTime: 2023-08-25 16:04:15
5 - * @FilePath: /front/src/App.vue 5 + * @FilePath: /bieyuan/src/App.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
...@@ -56,7 +56,16 @@ onMounted(async () => { ...@@ -56,7 +56,16 @@ onMounted(async () => {
56 wx.error((err) => { 56 wx.error((err) => {
57 console.warn(err); 57 console.warn(err);
58 });*/ 58 });*/
59 - // TODO: 进入后先查询有没有订单,有订单直接跳转最终页面 59 + // 进入后先查询有没有订单,有订单直接跳转最终页面
60 + const { data } = await orderInfoAPI()
61 + if (data?.id) {
62 + $router.push({
63 + path: '/result',
64 + query: {
65 + id: data.id
66 + }
67 + })
68 + }
60 }) 69 })
61 </script> 70 </script>
62 71
......
1 <!-- 1 <!--
2 * @Date: 2023-08-22 14:13:07 2 * @Date: 2023-08-22 14:13:07
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-08-24 17:02:52 4 + * @LastEditTime: 2023-08-25 15:15:29
5 * @FilePath: /bieyuan/src/views/next.vue 5 * @FilePath: /bieyuan/src/views/next.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
22 </van-radio-group> 22 </van-radio-group>
23 </template> 23 </template>
24 </van-field> 24 </van-field>
25 - <van-field v-model="item.id_number" label="身份证:" type="text" placeholder="请输入身份证号" :border="false" 25 + <van-field v-if="item.id_type === 'id_card'" v-model="item.id_number" label="身份证:" type="text" placeholder="请输入身份证号" :border="false"
26 :rules="[{ validator: validatorId, message: '请填写正确身份证号' }]" label-width="4em" class="input-text" /> 26 :rules="[{ validator: validatorId, message: '请填写正确身份证号' }]" label-width="4em" class="input-text" />
27 + <van-field v-else v-model="item.id_number" label="护照:" type="text" placeholder="请输入护照号" :border="false"
28 + :rules="[{ required: true, message: '请填写正确护照号' }]" label-width="4em" class="input-text" />
27 </div> 29 </div>
28 <div style="padding: 2rem;"> 30 <div style="padding: 2rem;">
29 <van-button block type="primary" color="#93663D" native-type="submit"> 31 <van-button block type="primary" color="#93663D" native-type="submit">
......
...@@ -81,7 +81,10 @@ function getDaysInMonth(year, month) { ...@@ -81,7 +81,10 @@ function getDaysInMonth(year, month) {
81 } 81 }
82 82
83 onMounted(async () => { 83 onMounted(async () => {
84 - const dates = $route.query.dates && JSON.parse($route.query.dates); 84 + let dates = $route.query.dates && JSON.parse($route.query.dates);
85 + if (localStorage.getItem('save_selected_dates')) { // 如果缓存过以缓存为先
86 + dates = JSON.parse(localStorage.getItem('save_selected_dates'));
87 + }
85 const { data } = await orderRestCountAPI({ dates: dates.join(',')}); 88 const { data } = await orderRestCountAPI({ dates: dates.join(',')});
86 shortcut.value = data; 89 shortcut.value = data;
87 // 上一页选择的预约人数 90 // 上一页选择的预约人数
...@@ -105,6 +108,13 @@ const shortcut = ref([]); ...@@ -105,6 +108,13 @@ const shortcut = ref([]);
105 108
106 const handleCheck = (value) => { 109 const handleCheck = (value) => {
107 value.checked = !value.checked; 110 value.checked = !value.checked;
111 + // 同步日历显示
112 + defaultDate.value = [];
113 + shortcut.value.forEach((item) => {
114 + if (item.checked) {
115 + defaultDate.value.push(dayjs(item.date).toDate())
116 + }
117 + });
108 } 118 }
109 119
110 const num = ref(1); 120 const num = ref(1);
...@@ -219,14 +229,18 @@ const clickNext = () => { // 点击下一步按钮 ...@@ -219,14 +229,18 @@ const clickNext = () => { // 点击下一步按钮
219 // 选中的日期集合 229 // 选中的日期集合
220 const selected_dates = selected_item.map(item => item.date); 230 const selected_dates = selected_item.map(item => item.date);
221 // 跳转更多确认页 231 // 跳转更多确认页
222 - $router.push({ 232 + localStorage.setItem('save_selected_dates', JSON.stringify(selected_dates));
223 - path: '/next', 233 + setTimeout(() => {
224 - query: { 234 + $router.push({
225 - dates: JSON.stringify(selected_dates), 235 + path: '/next',
226 - count: num.value, 236 + query: {
227 - page: 'multiple' 237 + dates: JSON.stringify(selected_dates),
228 - } 238 + count: num.value,
229 - }); 239 + page: 'multiple'
240 + }
241 + });
242 +
243 + }, 100);
230 } 244 }
231 245
232 </script> 246 </script>
......
...@@ -116,6 +116,7 @@ const onConfirm = async () => { ...@@ -116,6 +116,7 @@ const onConfirm = async () => {
116 $router.push('/'); 116 $router.push('/');
117 // 取消预约成功 清理预约信息列表缓存 117 // 取消预约成功 清理预约信息列表缓存
118 store.changeUserInfo([]); 118 store.changeUserInfo([]);
119 + localStorage.setItem('save_selected_dates', '');
119 } 120 }
120 } 121 }
121 122
......