hookehuyr

控制可订房间数量的最大值

1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-27 14:20:17 4 + * @LastEditTime: 2023-12-27 15:11:58
5 * @FilePath: /meihuaApp/src/pages/confirm/index.vue 5 * @FilePath: /meihuaApp/src/pages/confirm/index.vue
6 * @Description: 确认订单页面 6 * @Description: 确认订单页面
7 --> 7 -->
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
24 <view style="font-weight: bold; color: #0B0B0B; font-size: 1rem;">预定房间数</view> 24 <view style="font-weight: bold; color: #0B0B0B; font-size: 1rem;">预定房间数</view>
25 </nut-col> 25 </nut-col>
26 <nut-col :span="8" style="text-align: center;"> 26 <nut-col :span="8" style="text-align: center;">
27 - <nut-input-number v-model="book_count" min="1" button-size="30" input-width="50" @blur="onBookCountBlur" @change="onBookCountChange" /> 27 + <nut-input-number v-model="book_count" min="1" :max="state.roomInfo.num" button-size="30" input-width="50" @blur="onBookCountBlur" @change="onBookCountChange" />
28 </nut-col> 28 </nut-col>
29 </nut-row> 29 </nut-row>
30 </view> 30 </view>
...@@ -193,19 +193,16 @@ const onBookCountChange = (count) => { ...@@ -193,19 +193,16 @@ const onBookCountChange = (count) => {
193 193
194 const use_type = ref('1'); // 本人入住或者帮别人订 194 const use_type = ref('1'); // 本人入住或者帮别人订
195 195
196 -const onChange = (v) => { 196 +const onChange = async (type) => {
197 - if (v === '2') { 197 + formData.name = type !== '2' ? formData.wxapp_user_name : '';
198 - formData = { 198 + formData.tel = type !== '2' ? formData.wxapp_user_phone : '';
199 - name: '',
200 - tel: '',
201 - note: ''
202 - }
203 - }
204 }; 199 };
205 200
206 const formData = reactive({ 201 const formData = reactive({
207 name: '', 202 name: '',
208 tel: '', 203 tel: '',
204 + wxapp_user_name: '',
205 + wxapp_user_phone: '',
209 note: '' 206 note: ''
210 }); 207 });
211 208
...@@ -254,6 +251,8 @@ onMounted(async () => { ...@@ -254,6 +251,8 @@ onMounted(async () => {
254 if (myInfoData.code) { 251 if (myInfoData.code) {
255 formData.name = myInfoData.data.wxapp_user_name; 252 formData.name = myInfoData.data.wxapp_user_name;
256 formData.tel = myInfoData.data.wxapp_user_phone; 253 formData.tel = myInfoData.data.wxapp_user_phone;
254 + formData.wxapp_user_name = myInfoData.data.wxapp_user_name;
255 + formData.wxapp_user_phone = myInfoData.data.wxapp_user_phone;
257 } 256 }
258 }); 257 });
259 258
...@@ -275,7 +274,7 @@ const goPay = async () => { ...@@ -275,7 +274,7 @@ const goPay = async () => {
275 } else { 274 } else {
276 let params = getCurrentPageParam(); 275 let params = getCurrentPageParam();
277 // 保存订房信息 276 // 保存订房信息
278 - const { code, data } = await addOrderAPI({ id: params.id, contact_name: formData.name, contact_phone: formData.tel, order_remark: formData.note, plan_in: params.start_date, plan_out: params.end_date, room_type: params.room_type }) 277 + const { code, data } = await addOrderAPI({ id: params.id, num: book_count.value, contact_name: formData.name, contact_phone: formData.tel, order_remark: formData.note, plan_in: params.start_date, plan_out: params.end_date, room_type: params.room_type })
279 if (code) { 278 if (code) {
280 show_pay.value = true; 279 show_pay.value = true;
281 payData.value.id = data.order_id; 280 payData.value.id = data.order_id;
......