hookehuyr

fix

1 <!-- 1 <!--
2 * @Date: 2023-06-21 10:23:09 2 * @Date: 2023-06-21 10:23:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-08-25 10:36:50 4 + * @LastEditTime: 2023-08-25 15:07:53
5 * @FilePath: /bieyuan/src/views/index.vue 5 * @FilePath: /bieyuan/src/views/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 <div @click="selectIndex(0)" :class="['today', 'item', index === 0 ? 'selected' : '']"> 14 <div @click="selectIndex(0)" :class="['today', 'item', index === 0 ? 'selected' : '']">
15 <div class="datetime" style="padding: 1rem 0;"> 15 <div class="datetime" style="padding: 1rem 0;">
16 <div style="font-size: 2rem;">今天</div> 16 <div style="font-size: 2rem;">今天</div>
17 - <div>{{ shortcut[0]?.date }}</div> 17 + <div>{{ formatDateShow(shortcut[0]?.date) }}</div>
18 </div> 18 </div>
19 <div class="remain"> 19 <div class="remain">
20 <div>剩余名额</div> 20 <div>剩余名额</div>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
27 <div @click="selectIndex(1)" :class="['tomorrow', 'item', index === 1 ? 'selected' : '']"> 27 <div @click="selectIndex(1)" :class="['tomorrow', 'item', index === 1 ? 'selected' : '']">
28 <div class="datetime" style="padding: 1rem 0;"> 28 <div class="datetime" style="padding: 1rem 0;">
29 <div style="font-size: 1.5rem;">明天</div> 29 <div style="font-size: 1.5rem;">明天</div>
30 - <div>{{ shortcut[1]?.date }}</div> 30 + <div>{{ formatDateShow(shortcut[1]?.date) }}</div>
31 </div> 31 </div>
32 <div class="remain"> 32 <div class="remain">
33 <div>剩余名额</div> 33 <div>剩余名额</div>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 <div @click="selectIndex(2)" :class="['after', 'item', index === 2 ? 'selected' : '']"> 40 <div @click="selectIndex(2)" :class="['after', 'item', index === 2 ? 'selected' : '']">
41 <div class="datetime" style="padding: 0.5rem 0;"> 41 <div class="datetime" style="padding: 0.5rem 0;">
42 <div style="font-size: 1.25rem;">后天</div> 42 <div style="font-size: 1.25rem;">后天</div>
43 - <div style="font-size: 0.85rem;">{{ shortcut[2]?.date }}</div> 43 + <div style="font-size: 0.85rem;">{{ formatDateShow(shortcut[2]?.date) }}</div>
44 </div> 44 </div>
45 <div class="remain" style="font-size: 0.85rem; padding: 0.4rem 0;"> 45 <div class="remain" style="font-size: 0.85rem; padding: 0.4rem 0;">
46 <div>剩余名额</div> 46 <div>剩余名额</div>
...@@ -72,10 +72,10 @@ ...@@ -72,10 +72,10 @@
72 <van-icon size="0.85rem" name="https://cdn.ipadbiz.cn/bieyuan/-@2x.png" /> 72 <van-icon size="0.85rem" name="https://cdn.ipadbiz.cn/bieyuan/-@2x.png" />
73 </div> 73 </div>
74 </van-col> 74 </van-col>
75 - <van-col span="14" style="text-align: center;"> 75 + <van-col span="12" style="text-align: center;">
76 <input v-model="num" type="number" class="input_num"> 76 <input v-model="num" type="number" class="input_num">
77 </van-col> 77 </van-col>
78 - <van-col span="2" style="text-align: center;"> 78 + <van-col span="4" style="text-align: center;">
79 <span>人</span> 79 <span>人</span>
80 </van-col> 80 </van-col>
81 <van-col span="4" style="text-align: center;"> 81 <van-col span="4" style="text-align: center;">
...@@ -150,13 +150,24 @@ const selectedDates = ref([]); ...@@ -150,13 +150,24 @@ const selectedDates = ref([]);
150 const index = ref(0); 150 const index = ref(0);
151 const shortcut = ref([]); 151 const shortcut = ref([]);
152 152
153 +watch(
154 + () => num.value,
155 + (val) => {
156 + // 控制输入值为 3 位
157 + const maxLength = 3;
158 + if (val.toString().length > maxLength) {
159 + num.value = num.value.toString().slice(0, maxLength);
160 + }
161 + }
162 +);
163 +
153 const asyncData = ref(); 164 const asyncData = ref();
154 const showMore = async () => { 165 const showMore = async () => {
155 show.value = true; 166 show.value = true;
156 const { data } = await orderRestCountAPI({ start_date: dayjs().format('YYYY-MM-DD'), end_date: dayjs(maxDate.value).format('YYYY-MM-DD') }); 167 const { data } = await orderRestCountAPI({ start_date: dayjs().format('YYYY-MM-DD'), end_date: dayjs(maxDate.value).format('YYYY-MM-DD') });
157 asyncData.value = data; 168 asyncData.value = data;
158 asyncData.value.forEach(item => { 169 asyncData.value.forEach(item => {
159 - item.format = item.date.split('-') 170 + item.format = item.date.split('-');
160 }); 171 });
161 } 172 }
162 173
...@@ -174,6 +185,7 @@ const formatter = computed(() => { ...@@ -174,6 +185,7 @@ const formatter = computed(() => {
174 if (year === +arr[0] && month === +arr[1] && date === +arr[2]) { 185 if (year === +arr[0] && month === +arr[1] && date === +arr[2]) {
175 // day.topInfo = '剩余'; 186 // day.topInfo = '剩余';
176 day.bottomInfo = item.rest_count; 187 day.bottomInfo = item.rest_count;
188 + day.className = 'abc'
177 } 189 }
178 }); 190 });
179 return day; 191 return day;
...@@ -188,6 +200,7 @@ const onConfirm = (dates) => { // 选择日历确定回调 ...@@ -188,6 +200,7 @@ const onConfirm = (dates) => { // 选择日历确定回调
188 dates.forEach((date) => { 200 dates.forEach((date) => {
189 selectedDates.value.push(dayjs(date).format('YYYY-MM-DD')); 201 selectedDates.value.push(dayjs(date).format('YYYY-MM-DD'));
190 }); 202 });
203 + clickNext();
191 }; 204 };
192 205
193 const selectIndex = (idx) => { // 保存手动点击的索引值 206 const selectIndex = (idx) => { // 保存手动点击的索引值
...@@ -236,6 +249,15 @@ const clickNext = () => { // 点击下一步按钮 ...@@ -236,6 +249,15 @@ const clickNext = () => { // 点击下一步按钮
236 } 249 }
237 } 250 }
238 251
252 +const formatDateShow = (date) => {
253 + if (date) {
254 + const arr = date.split('-');
255 + let month = arr[1];
256 + let day = arr[2];
257 + return `${month}月${day}日`;
258 + }
259 +}
260 +
239 // 最大日期默认为6个月 261 // 最大日期默认为6个月
240 const getFutureDate = () => { 262 const getFutureDate = () => {
241 const currentDate = new Date(); 263 const currentDate = new Date();
...@@ -302,7 +324,7 @@ const isMinValue = (array, value) => { // 判断输入值是否小于数组中 ...@@ -302,7 +324,7 @@ const isMinValue = (array, value) => { // 判断输入值是否小于数组中
302 324
303 .remain { 325 .remain {
304 color: #93663D; 326 color: #93663D;
305 - font-size: 1.15rem; 327 + font-size: 0.85rem;
306 padding: 1rem 0; 328 padding: 1rem 0;
307 329
308 div:first-child { 330 div:first-child {
...@@ -374,8 +396,8 @@ const isMinValue = (array, value) => { // 判断输入值是否小于数组中 ...@@ -374,8 +396,8 @@ const isMinValue = (array, value) => { // 判断输入值是否小于数组中
374 .input_num { 396 .input_num {
375 border: 0; 397 border: 0;
376 background-color: #F7F7F7; 398 background-color: #F7F7F7;
377 - height: 2.5rem; 399 + height: 2rem;
378 - width: 6.5rem; 400 + width: 4em;
379 color: #976C46; 401 color: #976C46;
380 text-align: center; 402 text-align: center;
381 font-weight: bold; 403 font-weight: bold;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
19 </div> 19 </div>
20 </div> 20 </div>
21 21
22 - <div style="height: 4rem;"></div>
23 -
24 <div class="bookingBox"> 22 <div class="bookingBox">
25 <van-row> 23 <van-row>
26 <van-col span="6" class="text">预约人数</van-col> 24 <van-col span="6" class="text">预约人数</van-col>
...@@ -31,10 +29,10 @@ ...@@ -31,10 +29,10 @@
31 <van-icon size="0.85rem" name="https://cdn.ipadbiz.cn/bieyuan/-@2x.png" /> 29 <van-icon size="0.85rem" name="https://cdn.ipadbiz.cn/bieyuan/-@2x.png" />
32 </div> 30 </div>
33 </van-col> 31 </van-col>
34 - <van-col span="14" style="text-align: center;"> 32 + <van-col span="12" style="text-align: center;">
35 <input v-model="num" type="number" class="input_num"> 33 <input v-model="num" type="number" class="input_num">
36 </van-col> 34 </van-col>
37 - <van-col span="2" style="text-align: center;"> 35 + <van-col span="4" style="text-align: center;">
38 <span>人</span> 36 <span>人</span>
39 </van-col> 37 </van-col>
40 <van-col span="4" style="text-align: center;"> 38 <van-col span="4" style="text-align: center;">
...@@ -84,7 +82,7 @@ function getDaysInMonth(year, month) { ...@@ -84,7 +82,7 @@ function getDaysInMonth(year, month) {
84 82
85 onMounted(async () => { 83 onMounted(async () => {
86 const dates = $route.query.dates && JSON.parse($route.query.dates); 84 const dates = $route.query.dates && JSON.parse($route.query.dates);
87 - const { data } = await orderRestCountAPI({ dates }); 85 + const { data } = await orderRestCountAPI({ dates: dates.join(',')});
88 shortcut.value = data; 86 shortcut.value = data;
89 // 上一页选择的预约人数 87 // 上一页选择的预约人数
90 num.value = $route.query.count ? +$route.query.count : 1; 88 num.value = $route.query.count ? +$route.query.count : 1;
...@@ -113,6 +111,17 @@ const num = ref(1); ...@@ -113,6 +111,17 @@ const num = ref(1);
113 const show = ref(false); 111 const show = ref(false);
114 const selectedDates = ref([]); 112 const selectedDates = ref([]);
115 113
114 +watch(
115 + () => num.value,
116 + (val) => {
117 + // 控制输入值为 3 位
118 + const maxLength = 3;
119 + if (val.toString().length > maxLength) {
120 + num.value = num.value.toString().slice(0, maxLength);
121 + }
122 + }
123 +);
124 +
116 const asyncData = ref(); 125 const asyncData = ref();
117 const showMore = async () => { 126 const showMore = async () => {
118 show.value = true; 127 show.value = true;
...@@ -151,7 +160,7 @@ const onConfirm = async (dates) => { ...@@ -151,7 +160,7 @@ const onConfirm = async (dates) => {
151 defaultDate.value.push(dayjs(date).toDate()) 160 defaultDate.value.push(dayjs(date).toDate())
152 }); 161 });
153 // 后台请求数据 162 // 后台请求数据
154 - const { data } = await orderRestCountAPI({ dates : selectedDates.value }); 163 + const { data } = await orderRestCountAPI({ dates : selectedDates.value.join(',') });
155 shortcut.value = data; 164 shortcut.value = data;
156 shortcut.value.forEach(item => { 165 shortcut.value.forEach(item => {
157 item.checked = true; 166 item.checked = true;
...@@ -305,7 +314,7 @@ const clickNext = () => { // 点击下一步按钮 ...@@ -305,7 +314,7 @@ const clickNext = () => { // 点击下一步按钮
305 border: 0; 314 border: 0;
306 background-color: #F7F7F7; 315 background-color: #F7F7F7;
307 height: 2.5rem; 316 height: 2.5rem;
308 - // width: 6.5rem; 317 + // width: 4em;
309 width: 70%; 318 width: 70%;
310 color: #976C46; 319 color: #976C46;
311 text-align: center; 320 text-align: center;
......
...@@ -105,6 +105,9 @@ const toggleItem = (item) => { ...@@ -105,6 +105,9 @@ const toggleItem = (item) => {
105 const show = ref(false); 105 const show = ref(false);
106 const cancelApp = () => { 106 const cancelApp = () => {
107 show.value = true; 107 show.value = true;
108 + nextTick(() => {
109 + $('.van-popup.van-popup--center.van-dialog').css('width', '320px')
110 + })
108 } 111 }
109 const onConfirm = async () => { 112 const onConfirm = async () => {
110 const { code } = await orderCancelAPI({ id: $route.query.id }); 113 const { code } = await orderCancelAPI({ id: $route.query.id });
......
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-23 14:47:02 4 + * @LastEditTime: 2023-08-25 14:14:26
5 - * @FilePath: /front/vite.config.js 5 + * @FilePath: /bieyuan/vite.config.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 import vue from '@vitejs/plugin-vue'; 8 import vue from '@vitejs/plugin-vue';
......