no message
Showing
6 changed files
with
167 additions
and
42 deletions
| ... | @@ -12,13 +12,11 @@ export function getHotelById(id) { | ... | @@ -12,13 +12,11 @@ export function getHotelById(id) { |
| 12 | method: 'get' | 12 | method: 'get' |
| 13 | }) | 13 | }) |
| 14 | } | 14 | } |
| 15 | export function getHotelRooms(id) { | 15 | export function getHotelRooms(params) { |
| 16 | return request({ | 16 | return request({ |
| 17 | url: `/ota/activityRoom/list`, | 17 | url: `/ota/activityRoom/list`, |
| 18 | method: 'get', | 18 | method: 'get', |
| 19 | params: { | 19 | params: params |
| 20 | hotelId:id | ||
| 21 | } | ||
| 22 | }) | 20 | }) |
| 23 | } | 21 | } |
| 24 | 22 | ... | ... |
| ... | @@ -35,7 +35,7 @@ | ... | @@ -35,7 +35,7 @@ |
| 35 | </el-col> | 35 | </el-col> |
| 36 | <el-col :span="8" class="text-right"> | 36 | <el-col :span="8" class="text-right"> |
| 37 | <div class="price">¥<span>{{ h.price }}</span><i v-if="language==0">起</i></div> | 37 | <div class="price">¥<span>{{ h.price }}</span><i v-if="language==0">起</i></div> |
| 38 | <el-button class="btn-lineG w200px" round type="primary" size="large">{{ language==0?'立即预约':'Book Now' }} ⇀</el-button> | 38 | <el-button class="btn-lineG w200px" round type="primary" size="large">{{ language==0?'立即预约':'Select' }} ⇀</el-button> |
| 39 | </el-col> | 39 | </el-col> |
| 40 | </el-row> | 40 | </el-row> |
| 41 | </el-card> | 41 | </el-card> | ... | ... |
| ... | @@ -53,11 +53,11 @@ | ... | @@ -53,11 +53,11 @@ |
| 53 | <el-card class="mt30 mb60"> | 53 | <el-card class="mt30 mb60"> |
| 54 | <div class="lineHead"> | 54 | <div class="lineHead"> |
| 55 | <ul> | 55 | <ul> |
| 56 | <li>{{ language == 0 ? '房型选择' : 'Room Type' }}</li> | 56 | <li>{{ language == 0 ? '房型选择' : 'Available Rooms' }}</li> |
| 57 | </ul> | 57 | </ul> |
| 58 | </div> | 58 | </div> |
| 59 | <div> | 59 | <div> |
| 60 | <div v-for="(r,index) in roomList" :key="index" class="room" @click="goOrder(r)"> | 60 | <div v-for="(r,index) in roomList" :key="index" class="room"> |
| 61 | <el-row :gutter="30" align="middle"> | 61 | <el-row :gutter="30" align="middle"> |
| 62 | <el-col :span="4"> | 62 | <el-col :span="4"> |
| 63 | <div class="roomImg"> | 63 | <div class="roomImg"> |
| ... | @@ -68,26 +68,32 @@ | ... | @@ -68,26 +68,32 @@ |
| 68 | <h3 class="name">{{ r.roomType }}</h3> | 68 | <h3 class="name">{{ r.roomType }}</h3> |
| 69 | <el-row :gutter="10"> | 69 | <el-row :gutter="10"> |
| 70 | <el-col :span="8">{{ r.area }}m²</el-col> | 70 | <el-col :span="8">{{ r.area }}m²</el-col> |
| 71 | <el-col :span="8" v-show="r.windowFlag==1"> 有窗</el-col> | 71 | <el-col :span="8" v-show="r.windowFlag==1"> {{ language==0?'有窗':'With windows' }}</el-col> |
| 72 | <el-col :span="8" v-show="r.windowFlag==0"> 无窗</el-col> | 72 | <el-col :span="8" v-show="r.windowFlag==0"> {{ language==0?'无窗':'Windowless' }}</el-col> |
| 73 | <el-col :span="8" v-show="r.bathroomFlag==1"> 热水洗浴</el-col> | 73 | <el-col :span="8" v-show="r.bathroomFlag==1"> {{ language==0?'热水洗浴':'Shower' }}</el-col> |
| 74 | <!-- <text v-show="r.bathroomFlag==0"> </text> --> | 74 | <!-- <text v-show="r.bathroomFlag==0"> </text> --> |
| 75 | <el-col :span="8" v-show="r.addBedFlag==1"> 允许加床 </el-col> | 75 | <el-col :span="8" v-show="r.addBedFlag==1"> {{ language==0?'允许加床':'Extra bed' }} </el-col> |
| 76 | <el-col :span="8" v-if="r.breakfastNum&&r.breakfastNum > '0'">{{ r.breakfastNum }}份早餐</el-col> | 76 | <el-col :span="8" v-if="r.breakfastNum&&r.breakfastNum > '0'"> |
| 77 | <el-col :span="8" v-else>无早餐</el-col> | 77 | {{ r.breakfastNum }}{{ language==0?'份早餐':' breakfasts' }} |
| 78 | </el-col> | ||
| 79 | <el-col :span="8" v-else>{{ language==0?'无早餐':'No breakfast' }}</el-col> | ||
| 78 | </el-row> | 80 | </el-row> |
| 79 | </el-col> | 81 | </el-col> |
| 80 | <el-col :span="3"> | 82 | <el-col :span="3"> |
| 81 | <div class="price">¥<span>{{r.roomPrice}}</span></div> | 83 | <div class="price">{{ language==0?'¥':'€' }}<span>{{r.roomPrice}}</span></div> |
| 82 | </el-col> | 84 | </el-col> |
| 83 | <el-col :span="3"> | 85 | <el-col :span="3"> |
| 84 | 86 | <div class="bg-lineg" v-if="language==0" @click="goOrder(r)"> | |
| 85 | <div class="bg-lineg"> | ||
| 86 | 订 | 87 | 订 |
| 87 | <div>在线付</div> | 88 | <div>{{ language==0?'在线付':'Online' }}</div> |
| 88 | </div> | 89 | </div> |
| 89 | <div class="text-center text-primary mt10 fontsize14"> 剩余 {{(r.roomCount - (r.useCount||0)).toFixed()}} 间</div> | 90 | <el-button v-else class="btn-lineG w100" round type="primary" @click="goOrder(r)">Select</el-button> |
| 90 | 91 | <div class="text-center text-primary mt10 fontsize14 pointer" v-if="language == 0"> | |
| 92 | 剩余 {{(r.roomCount - (r.useCount||0)).toFixed()}} 间 | ||
| 93 | </div> | ||
| 94 | <div class="text-center text-primary mt10 fontsize14" v-else> | ||
| 95 | {{(r.roomCount - (r.useCount||0)).toFixed()}} Remaining rooms | ||
| 96 | </div> | ||
| 91 | </el-col> | 97 | </el-col> |
| 92 | </el-row> | 98 | </el-row> |
| 93 | </div> | 99 | </div> |
| ... | @@ -110,6 +116,9 @@ const language = useStorage('language', 0) | ... | @@ -110,6 +116,9 @@ const language = useStorage('language', 0) |
| 110 | const router = useRouter() | 116 | const router = useRouter() |
| 111 | const route = useRoute() | 117 | const route = useRoute() |
| 112 | const form = ref({}) | 118 | const form = ref({}) |
| 119 | const query = ref({ | ||
| 120 | hotelId: route.params.id | ||
| 121 | }) | ||
| 113 | const loading = ref(false) | 122 | const loading = ref(false) |
| 114 | const roomList = ref([]) | 123 | const roomList = ref([]) |
| 115 | const map = ref(null) | 124 | const map = ref(null) |
| ... | @@ -126,7 +135,8 @@ function getData() { | ... | @@ -126,7 +135,8 @@ function getData() { |
| 126 | }).catch(err => { | 135 | }).catch(err => { |
| 127 | console.log(err) | 136 | console.log(err) |
| 128 | }) | 137 | }) |
| 129 | getHotelRooms(route.query.id).then(res => { | 138 | console.log('params',route.params) |
| 139 | getHotelRooms(query.value).then(res => { | ||
| 130 | roomList.value = res.rows | 140 | roomList.value = res.rows |
| 131 | }) | 141 | }) |
| 132 | } | 142 | } |
| ... | @@ -200,7 +210,7 @@ function goOrder(room) { | ... | @@ -200,7 +210,7 @@ function goOrder(room) { |
| 200 | span{font-size: 36px;font-family: "DIN Alternate"} | 210 | span{font-size: 36px;font-family: "DIN Alternate"} |
| 201 | } | 211 | } |
| 202 | .bg-lineg{margin: auto;border-radius: 10px;text-align: center;padding: 7px 2px 2px; | 212 | .bg-lineg{margin: auto;border-radius: 10px;text-align: center;padding: 7px 2px 2px; |
| 203 | font-size: 24px;width:66px; | 213 | font-size: 24px;width:66px;cursor: pointer; |
| 204 | div{background: #fff;font-size: 13px;border-radius: 20px;padding: 0 10px; | 214 | div{background: #fff;font-size: 13px;border-radius: 20px;padding: 0 10px; |
| 205 | color: #453DEA;font-weight: 500;} | 215 | color: #453DEA;font-weight: 500;} |
| 206 | } | 216 | } | ... | ... |
| ... | @@ -10,42 +10,48 @@ | ... | @@ -10,42 +10,48 @@ |
| 10 | <el-col :span="14" > | 10 | <el-col :span="14" > |
| 11 | <div class="border-info"> | 11 | <div class="border-info"> |
| 12 | <h3>{{hotelName}}</h3> | 12 | <h3>{{hotelName}}</h3> |
| 13 | <!-- <div class="roomType">{{room.roomType}}</div>--> | 13 | <div class="roomType">{{room.roomType}}</div> |
| 14 | <div class="room"> | 14 | <div class="room"> |
| 15 | <span>{{room.bedType}}</span> | 15 | <span>{{room.bedType}}</span> |
| 16 | <span>{{ ' | ' + room.area}}m²</span> | 16 | <span>{{ ' | ' + room.area}}m²</span> |
| 17 | <span>{{ ' | ' + room.occupantsNum}}人入住</span> | 17 | <span>{{ ' | ' + room.occupantsNum}}{{ language==0?'人入住':' people' }}</span> |
| 18 | <span v-show="room.breakfastFlag=='1'">{{ ' | ' + room.breakfastNum}} 份早餐</span> | 18 | <span v-show="room.breakfastFlag=='1'">{{ ' | ' + room.breakfastNum}} {{ language==0?'份早餐':'breakfasts' }}</span> |
| 19 | <span v-show="room.breakfastFlag=='0'"> | 无早餐</span> | 19 | <span v-show="room.breakfastFlag=='0'"> | {{ language==0?'无早餐':'No breakfast' }}</span> |
| 20 | <span v-show="room.bathroomFlag=='1'"> | 独立卫生间</span> | 20 | <span v-show="room.bathroomFlag=='1'"> | {{ language==0?'热水洗浴':'Shower' }}</span> |
| 21 | <span v-show="room.windowFlag=='1'"> | 有窗</span> | 21 | <span v-show="room.windowFlag=='1'"> | {{ language==0?'有窗':'With windows' }}</span> |
| 22 | <span v-show="room.addBedFlag=='1'"> | 允许加床</span> | 22 | <span v-show="room.addBedFlag=='1'"> | {{ language==0?'允许加床':'Extra bed' }}</span> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | 25 | ||
| 26 | <div class="leftboderTT">{{ language == 0 ? '预约信息' : 'Reservation information' }}</div> | 26 | <div class="leftboderTT">{{ language == 0 ? '预约信息' : 'Reservation information' }}</div> |
| 27 | <div class="border-rr mt20 pd20"> | 27 | <div class="border-rr mt20 pd20"> |
| 28 | <el-form :model="form" label-width="100px"> | 28 | <el-form :model="form" :label-width="language == 0 ?'100':'150'"> |
| 29 | <el-form-item label="入住日期"> | 29 | <el-form-item :label="language==0?'入住日期':'Check-in date'"> |
| 30 | <el-date-picker | 30 | <el-date-picker @change="getDaysBetween" |
| 31 | v-model="rzRange" | 31 | v-model="rzRange" |
| 32 | type="daterange" | 32 | type="daterange" |
| 33 | placeholder="选择日期" | 33 | :placeholder="language==0?'选择日期':'Select date'" format="YYYY-MM-DD" value-format="YYYY-MM-DD"/> |
| 34 | value-format="yyyy-MM-dd" | 34 | <!-- :picker-options="pickerOptions"--> |
| 35 | :picker-options="pickerOptions" | ||
| 36 | /> | ||
| 37 | </el-form-item> | 35 | </el-form-item> |
| 38 | <el-form-item label="房间数"> | 36 | <el-form-item :label="language==0?'房间数':'Rooms'"> |
| 39 | <el-input-number v-model="form.roomNum" :min="0" :max="canOrderNum" @change="changeRoomNum" /> | 37 | <el-input-number v-model="form.roomNum" :min="0" :max="canOrderNum" @change="changeRoomNum" /> |
| 40 | <div class="red" v-if="rzRange[1]" style="margin:0 8px;display: block;width: 8em;"> | 38 | <div class="red" v-if="rzRange[1]" style="margin:0 8px;display: block;width: 8em;"> |
| 41 | <span>剩余房间数:{{canOrderNum}}</span> | 39 | <span v-if="language == 0">剩余房间数:{{canOrderNum}}</span> |
| 40 | <span v-else>{{canOrderNum}} Remaining rooms</span> | ||
| 42 | </div> | 41 | </div> |
| 43 | </el-form-item> | 42 | </el-form-item> |
| 44 | <el-form-item v-for="(n,index) in form.roomNum" :key="index" :label="`入住人${index+1}`"> | 43 | <el-form-item v-for="(n,index) in form.roomNum" :key="index" :label="`入住人${index+1}`"> |
| 45 | <el-input v-model="rzUserArr[index]" placeholder="每间填一位住客姓名"/> | 44 | <el-input v-model="rzUserArr[index]" placeholder="每间填一位住客姓名"/> |
| 46 | </el-form-item> | 45 | </el-form-item> |
| 47 | <el-form-item label="预计到店"> | 46 | <el-form-item label="预计到店"> |
| 48 | 47 | <el-select v-model="form.ddDate" placeholder="请选择预计到店时间"> | |
| 48 | <el-option | ||
| 49 | v-for="item in ddDateArr" | ||
| 50 | :key="item.value" | ||
| 51 | :label="item.label" | ||
| 52 | :value="item.value" | ||
| 53 | /> | ||
| 54 | </el-select> | ||
| 49 | </el-form-item> | 55 | </el-form-item> |
| 50 | <el-form-item label="联系电话"> | 56 | <el-form-item label="联系电话"> |
| 51 | <el-input v-model="form.phone"/> | 57 | <el-input v-model="form.phone"/> |
| ... | @@ -120,6 +126,76 @@ const rzRange = ref([]) | ... | @@ -120,6 +126,76 @@ const rzRange = ref([]) |
| 120 | const rzUserArr = ref([]) | 126 | const rzUserArr = ref([]) |
| 121 | const money = ref(0) | 127 | const money = ref(0) |
| 122 | const choseRooms = ref([]) | 128 | const choseRooms = ref([]) |
| 129 | const ddDateArr = ref([ | ||
| 130 | { | ||
| 131 | value: '08:00', | ||
| 132 | label: '08:00' | ||
| 133 | }, | ||
| 134 | { | ||
| 135 | value: '09:00', | ||
| 136 | label: '09:00' | ||
| 137 | }, | ||
| 138 | { | ||
| 139 | value: '10:00', | ||
| 140 | label: '10:00' | ||
| 141 | }, | ||
| 142 | { | ||
| 143 | value: '11:00', | ||
| 144 | label: '11:00' | ||
| 145 | }, | ||
| 146 | { | ||
| 147 | value: '12:00', | ||
| 148 | label: '12:00' | ||
| 149 | }, | ||
| 150 | { | ||
| 151 | value: '13:00', | ||
| 152 | label: '13:00' | ||
| 153 | }, | ||
| 154 | { | ||
| 155 | value: '14:00', | ||
| 156 | label: '14:00' | ||
| 157 | }, | ||
| 158 | { | ||
| 159 | value: '15:00', | ||
| 160 | label: '15:00' | ||
| 161 | }, | ||
| 162 | { | ||
| 163 | value: '16:00', | ||
| 164 | label: '16:00' | ||
| 165 | }, | ||
| 166 | { | ||
| 167 | value: '17:00', | ||
| 168 | label: '17:00' | ||
| 169 | }, | ||
| 170 | { | ||
| 171 | value: '18:00', | ||
| 172 | label: '18:00' | ||
| 173 | }, | ||
| 174 | { | ||
| 175 | value: '19:00', | ||
| 176 | label: '19:00' | ||
| 177 | }, | ||
| 178 | { | ||
| 179 | value: '20:00', | ||
| 180 | label: '20:00' | ||
| 181 | }, | ||
| 182 | { | ||
| 183 | value: '21:00', | ||
| 184 | label: '21:00' | ||
| 185 | }, | ||
| 186 | { | ||
| 187 | value: '22:00', | ||
| 188 | label: '22:00' | ||
| 189 | }, | ||
| 190 | { | ||
| 191 | value: '23:00', | ||
| 192 | label: '23:00' | ||
| 193 | }, | ||
| 194 | { | ||
| 195 | value: '00:00', | ||
| 196 | label: '00:00' | ||
| 197 | } | ||
| 198 | ]) | ||
| 123 | let usedays = 0 | 199 | let usedays = 0 |
| 124 | onMounted(()=>{ | 200 | onMounted(()=>{ |
| 125 | console.log(route.query) | 201 | console.log(route.query) |
| ... | @@ -136,6 +212,8 @@ function changeRoomNum(e) { | ... | @@ -136,6 +212,8 @@ function changeRoomNum(e) { |
| 136 | if (form.value.addNum > e) { | 212 | if (form.value.addNum > e) { |
| 137 | form.value.addNum = e | 213 | form.value.addNum = e |
| 138 | } | 214 | } |
| 215 | console.log(e) | ||
| 216 | rzUserArr.value.length = e | ||
| 139 | countMoney() | 217 | countMoney() |
| 140 | } | 218 | } |
| 141 | function changeBed() { | 219 | function changeBed() { |
| ... | @@ -151,6 +229,47 @@ function checkreRooms() { | ... | @@ -151,6 +229,47 @@ function checkreRooms() { |
| 151 | canOrderNum.value = res.data.useCount | 229 | canOrderNum.value = res.data.useCount |
| 152 | }) | 230 | }) |
| 153 | } | 231 | } |
| 232 | function getDaysBetween(e) { | ||
| 233 | console.log('入住时间arr',e,rzRange.value) | ||
| 234 | var d1 = Date.parse(e[0]) | ||
| 235 | var d2 = Date.parse(e[1]) | ||
| 236 | if (d1 == d2) { | ||
| 237 | usedays = 0 | ||
| 238 | ElMessage.error('入住时间跨度需大于一天') | ||
| 239 | // console.trace() | ||
| 240 | rzRange.value = [] | ||
| 241 | return | ||
| 242 | } else { | ||
| 243 | var days = (d2 - d1) / (1 * 24 * 60 * 60 * 1000); | ||
| 244 | usedays = days | ||
| 245 | } | ||
| 246 | countMoney() | ||
| 247 | var startTime = getDate(rzRange.value[0]); | ||
| 248 | var endTime = getDate(rzRange.value[1]); | ||
| 249 | var dateArr = []; | ||
| 250 | while ((endTime.getTime() - startTime.getTime()) > 0) { | ||
| 251 | var year = startTime.getFullYear(); | ||
| 252 | var month = (startTime.getMonth() + 1).toString().length === 1 ? "0" + (parseInt(startTime.getMonth() | ||
| 253 | .toString(), 10) + 1) : (startTime.getMonth() + 1); | ||
| 254 | var day = startTime.getDate().toString().length === 1 ? "0" + startTime.getDate() : startTime.getDate(); | ||
| 255 | dateArr.push(year + "-" + month + "-" + day); | ||
| 256 | startTime.setDate(startTime.getDate() + 1); | ||
| 257 | } | ||
| 258 | choseRooms.value = dateArr; | ||
| 259 | checkreRooms() | ||
| 260 | } | ||
| 261 | function getDate(datestr) { | ||
| 262 | var temp = datestr.split("-"); | ||
| 263 | if (temp[1] === '01') { | ||
| 264 | temp[0] = parseInt(temp[0], 10) - 1; | ||
| 265 | temp[1] = '12'; | ||
| 266 | } else { | ||
| 267 | temp[1] = parseInt(temp[1], 10) - 1; | ||
| 268 | } | ||
| 269 | //new Date()的月份入参实际都是当前值-1 | ||
| 270 | var date = new Date(temp[0], temp[1], temp[2]); | ||
| 271 | return date | ||
| 272 | } | ||
| 154 | function countMoney() { | 273 | function countMoney() { |
| 155 | money.value = ((room.value.roomPrice * form.value.roomNum * usedays) + (room.value.bedPrice * form.value | 274 | money.value = ((room.value.roomPrice * form.value.roomNum * usedays) + (room.value.bedPrice * form.value |
| 156 | .addNum * usedays)).toFixed(2) | 275 | .addNum * usedays)).toFixed(2) | ... | ... |
| ... | @@ -91,9 +91,7 @@ | ... | @@ -91,9 +91,7 @@ |
| 91 | <template #footer> | 91 | <template #footer> |
| 92 | <div class="dialog-footer text-center"> | 92 | <div class="dialog-footer text-center"> |
| 93 | <el-button type="primary" class="btn-lineG w200px" round @click="submitForm"> | 93 | <el-button type="primary" class="btn-lineG w200px" round @click="submitForm"> |
| 94 | {{ | 94 | {{language == 0 ? '确定' : 'Save' }} |
| 95 | language == 0 ? '确定' : 'Save' | ||
| 96 | }} | ||
| 97 | </el-button> | 95 | </el-button> |
| 98 | </div> | 96 | </div> |
| 99 | </template> | 97 | </template> | ... | ... |
| ... | @@ -46,7 +46,7 @@ | ... | @@ -46,7 +46,7 @@ |
| 46 | </div> | 46 | </div> |
| 47 | </el-col> | 47 | </el-col> |
| 48 | <el-col :lg="4" :md="8" :sm="12" :xs="12"> | 48 | <el-col :lg="4" :md="8" :sm="12" :xs="12"> |
| 49 | <div class="funcBtn" @click="building"> | 49 | <div class="funcBtn" @click="goBooking(1)"> |
| 50 | <img src="@/assets/dance/btn01.png"/> | 50 | <img src="@/assets/dance/btn01.png"/> |
| 51 | <h4>Hotel Reservation</h4> | 51 | <h4>Hotel Reservation</h4> |
| 52 | </div> | 52 | </div> | ... | ... |
-
Please register or sign in to post a comment