Merge commit 'd69b2fe1' into dev
Showing
5 changed files
with
189 additions
and
35 deletions
| ... | @@ -82,6 +82,8 @@ | ... | @@ -82,6 +82,8 @@ |
| 82 | booking.getHotelList(query.value).then(res=>{ | 82 | booking.getHotelList(query.value).then(res=>{ |
| 83 | list.value = res.rows | 83 | list.value = res.rows |
| 84 | loading.value = false | 84 | loading.value = false |
| 85 | console.log(list.value) | ||
| 86 | |||
| 85 | }).catch(e=>{ | 87 | }).catch(e=>{ |
| 86 | loading.value = false | 88 | loading.value = false |
| 87 | }) | 89 | }) | ... | ... |
| ... | @@ -59,7 +59,19 @@ | ... | @@ -59,7 +59,19 @@ |
| 59 | <el-card class="mt30 mb60"> | 59 | <el-card class="mt30 mb60"> |
| 60 | <div class="lineHead"> | 60 | <div class="lineHead"> |
| 61 | <ul> | 61 | <ul> |
| 62 | <li>{{ language == 0 ? '房型选择' : 'Available Rooms' }}</li> | 62 | <li> |
| 63 | {{ language == 0 ? '房型选择' : 'Available Rooms' }} | ||
| 64 | <span style="margin-left: 100px"> | ||
| 65 | <el-date-picker | ||
| 66 | @change="getDaysBetween" | ||
| 67 | v-model="hotTime" | ||
| 68 | type="daterange" | ||
| 69 | :disabled-date="disabledDateRZ" | ||
| 70 | :placeholder="language==0?'选择日期':'Select date'" | ||
| 71 | format="YYYY-MM-DD" | ||
| 72 | value-format="YYYY-MM-DD"/> | ||
| 73 | </span> | ||
| 74 | </li> | ||
| 63 | </ul> | 75 | </ul> |
| 64 | </div> | 76 | </div> |
| 65 | <div> | 77 | <div> |
| ... | @@ -89,11 +101,13 @@ | ... | @@ -89,11 +101,13 @@ |
| 89 | <div class="price">{{ language==0?'¥':'€' }}<span>{{language==0?r.roomPrice:r.roomPriceEn}}</span></div> | 101 | <div class="price">{{ language==0?'¥':'€' }}<span>{{language==0?r.roomPrice:r.roomPriceEn}}</span></div> |
| 90 | </el-col> | 102 | </el-col> |
| 91 | <el-col :span="3"> | 103 | <el-col :span="3"> |
| 92 | <div class="bg-lineg" v-if="language==0" @click="goOrder(r)"> | 104 | <el-button v-if="language==0" :disabled="!r.useCount" :class="{'forbid':!r.useCount}" @click="goOrder(r)" class="bg-lineg button"> |
| 93 | 订 | 105 | 订 |
| 94 | <div>{{ language==0?'在线付':'Online' }}</div> | 106 | <div>{{ language==0?'在线付':'Online' }}</div> |
| 95 | </div> | 107 | </el-button> |
| 96 | <el-button v-else class="btn-lineG w100" round type="primary" @click="goOrder(r)">Select</el-button> | 108 | |
| 109 | |||
| 110 | <el-button v-else :disabled="!r.useCount" class="btn-lineG w100" :class="{'forbid':!r.useCount}" round type="pri mary" @click="goOrder(r)">Select</el-button> | ||
| 97 | <!-- <div class="text-center text-primary mt10 fontsize14 pointer" v-if="language == 0">--> | 111 | <!-- <div class="text-center text-primary mt10 fontsize14 pointer" v-if="language == 0">--> |
| 98 | <!-- 剩余 {{(r.roomCount - (r.useCount||0)).toFixed()}} 间--> | 112 | <!-- 剩余 {{(r.roomCount - (r.useCount||0)).toFixed()}} 间--> |
| 99 | <!-- </div>--> | 113 | <!-- </div>--> |
| ... | @@ -111,11 +125,14 @@ | ... | @@ -111,11 +125,14 @@ |
| 111 | </div> | 125 | </div> |
| 112 | </template> | 126 | </template> |
| 113 | 127 | ||
| 114 | <script setup lang="ts"> | 128 | <script setup > |
| 115 | import {useRouter} from "vue-router"; | 129 | import {useRouter} from "vue-router"; |
| 116 | import {ref, reactive, onMounted} from "vue"; | 130 | import {ref, reactive, onMounted,getCurrentInstance} from "vue"; |
| 117 | import {useRoute} from "vue-router"; | 131 | import {useRoute} from "vue-router"; |
| 132 | import {dayjs} from 'element-plus' | ||
| 118 | import {getHotelById, getHotelRooms,checkRoomPayByUserId} from "@/apiPc/booking" | 133 | import {getHotelById, getHotelRooms,checkRoomPayByUserId} from "@/apiPc/booking" |
| 134 | import {getBaseInfoByActiveId} from "@/apiPc/booking"; | ||
| 135 | const { proxy } = getCurrentInstance() | ||
| 119 | 136 | ||
| 120 | import {useStorage} from "@vueuse/core/index"; | 137 | import {useStorage} from "@vueuse/core/index"; |
| 121 | import useUserStore from "@/store/modules/user"; | 138 | import useUserStore from "@/store/modules/user"; |
| ... | @@ -129,12 +146,34 @@ const form = ref({}) | ... | @@ -129,12 +146,34 @@ const form = ref({}) |
| 129 | const query = ref({ | 146 | const query = ref({ |
| 130 | hotelId: route.query.id | 147 | hotelId: route.query.id |
| 131 | }) | 148 | }) |
| 149 | const hotTime=ref([]) | ||
| 132 | const showAll = ref(false) | 150 | const showAll = ref(false) |
| 133 | const loading = ref(false) | 151 | const loading = ref(false) |
| 134 | const roomList = ref([]) | 152 | const roomList = ref([]) |
| 135 | const map = ref(null) | 153 | const map = ref(null) |
| 154 | const formTime=ref({}) | ||
| 136 | onMounted(() => { | 155 | onMounted(() => { |
| 137 | getData() | 156 | console.log(route.params) |
| 157 | getBaseInfoByActiveId(route.params.cptId).then(res=>{ | ||
| 158 | formTime.value = res.data || null | ||
| 159 | }).catch(err=>{ | ||
| 160 | console.log(err) | ||
| 161 | formTime.value = null | ||
| 162 | }).finally(()=>{ | ||
| 163 | console.log(formTime.value) | ||
| 164 | if (formTime.value){ | ||
| 165 | if (dayjs().isBefore(dayjs(formTime.value.hqStart))){ | ||
| 166 | hotTime.value[0]=dayjs(formTime.value.hqStart).format('YYYY-MM-DD') | ||
| 167 | hotTime.value[1]=dayjs(formTime.value.hqEnd).add(1,'day').format('YYYY-MM-DD') | ||
| 168 | } else{ | ||
| 169 | hotTime.value[0]=dayjs().format('YYYY-MM-DD') | ||
| 170 | hotTime.value[1]=dayjs().add(1,'day').format('YYYY-MM-DD') | ||
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 174 | getData() | ||
| 175 | }) | ||
| 176 | |||
| 138 | }) | 177 | }) |
| 139 | 178 | ||
| 140 | function getData() { | 179 | function getData() { |
| ... | @@ -147,13 +186,15 @@ function getData() { | ... | @@ -147,13 +186,15 @@ function getData() { |
| 147 | console.log(err) | 186 | console.log(err) |
| 148 | }) | 187 | }) |
| 149 | query.value.hotelId = route.query.id | 188 | query.value.hotelId = route.query.id |
| 189 | query.value.rzStart=hotTime.value?hotTime.value[0]:null | ||
| 190 | query.value.rzEnd=hotTime.value?hotTime.value[1]:null | ||
| 150 | getHotelRooms(query.value).then(res => { | 191 | getHotelRooms(query.value).then(res => { |
| 151 | roomList.value = res.rows | 192 | roomList.value = res.rows |
| 152 | }) | 193 | }) |
| 153 | } | 194 | } |
| 154 | 195 | ||
| 155 | function initMap() { | 196 | function initMap() { |
| 156 | const TMap = (window as any).TMap | 197 | // const TMap = (window as any).TMap |
| 157 | var center = new TMap.LatLng(form.value.latitude, form.value.longitude);//设置中心点坐标' | 198 | var center = new TMap.LatLng(form.value.latitude, form.value.longitude);//设置中心点坐标' |
| 158 | var map = new TMap.Map("map", { | 199 | var map = new TMap.Map("map", { |
| 159 | center: center,//设置地图中心点坐标 | 200 | center: center,//设置地图中心点坐标 |
| ... | @@ -208,7 +249,7 @@ function goOrder(room) { | ... | @@ -208,7 +249,7 @@ function goOrder(room) { |
| 208 | ).then((res) => { | 249 | ).then((res) => { |
| 209 | console.log(res) | 250 | console.log(res) |
| 210 | router.push({ | 251 | router.push({ |
| 211 | name:'myReservation' | 252 | name:'myReservation', |
| 212 | }) | 253 | }) |
| 213 | }) | 254 | }) |
| 214 | // .catch((res) => { | 255 | // .catch((res) => { |
| ... | @@ -230,10 +271,41 @@ function goNext(room) { | ... | @@ -230,10 +271,41 @@ function goNext(room) { |
| 230 | query:{ | 271 | query:{ |
| 231 | room:encodeURIComponent(JSON.stringify(room)), | 272 | room:encodeURIComponent(JSON.stringify(room)), |
| 232 | hotelName:form.value.name, | 273 | hotelName:form.value.name, |
| 233 | checkInTime:form.value.checkInTime | 274 | checkInTime:form.value.checkInTime, |
| 275 | start:hotTime.value[0], | ||
| 276 | end:hotTime.value[1], | ||
| 234 | } | 277 | } |
| 235 | }) | 278 | }) |
| 236 | } | 279 | } |
| 280 | |||
| 281 | function getDaysBetween(e){ | ||
| 282 | console.log(hotTime.value) | ||
| 283 | if (hotTime.value && hotTime.value.length==2){ | ||
| 284 | const d1=dayjs(hotTime.value[0]).format('YYYY-MM-DD') | ||
| 285 | const d2=dayjs(hotTime.value[1]).format('YYYY-MM-DD') | ||
| 286 | if (d1==d2){ | ||
| 287 | hotTime.value=[] | ||
| 288 | return proxy.$modal.msgError(language.value==0?'入住时间跨度需要大于一天':'The duration of the stay must be more than one day.') | ||
| 289 | }else{ | ||
| 290 | getData() | ||
| 291 | } | ||
| 292 | } | ||
| 293 | } | ||
| 294 | |||
| 295 | // function disabledDateRZ(date) { | ||
| 296 | // //判读今天大与form.value.hqStart | ||
| 297 | // console.log(date) | ||
| 298 | // if (formTime.value.hqStart) { | ||
| 299 | // const today = dayjs().format('YYYY-MM-DD') | ||
| 300 | // if (formTime.value.hqStart < today) { | ||
| 301 | // return !((date.getTime() >= dayjs(today).valueOf())&&(date.getTime() <= dayjs(formTime.value.hqEnd).valueOf())) | ||
| 302 | // } else { | ||
| 303 | // return !((date.getTime() >= dayjs(formTime.value.hqStart).valueOf())&&(date.getTime() <= dayjs(formTime.value.hqEnd).valueOf())) | ||
| 304 | // } | ||
| 305 | // } | ||
| 306 | // // return true | ||
| 307 | // } | ||
| 308 | |||
| 237 | function goMap() { | 309 | function goMap() { |
| 238 | return | 310 | return |
| 239 | // var tencentMapUrl = "https://map.qq.com/"; | 311 | // var tencentMapUrl = "https://map.qq.com/"; |
| ... | @@ -242,6 +314,7 @@ function goMap() { | ... | @@ -242,6 +314,7 @@ function goMap() { |
| 242 | var mapUrl_tx = "http://apis.map.qq.com/uri/v1/marker?marker=coord:"+form.value.latitude+","+form.value.longitude+"&referer=yellowpage"; | 314 | var mapUrl_tx = "http://apis.map.qq.com/uri/v1/marker?marker=coord:"+form.value.latitude+","+form.value.longitude+"&referer=yellowpage"; |
| 243 | window.open(url, "_blank") | 315 | window.open(url, "_blank") |
| 244 | } | 316 | } |
| 317 | |||
| 245 | </script> | 318 | </script> |
| 246 | 319 | ||
| 247 | <style scoped lang="scss"> | 320 | <style scoped lang="scss"> |
| ... | @@ -296,6 +369,19 @@ function goMap() { | ... | @@ -296,6 +369,19 @@ function goMap() { |
| 296 | } | 369 | } |
| 297 | } | 370 | } |
| 298 | } | 371 | } |
| 372 | :deep(.button) { | ||
| 373 | display: block; | ||
| 374 | height: 55px; | ||
| 375 | width: auto; | ||
| 376 | color: #fff; | ||
| 377 | span{ | ||
| 378 | display: block !important; | ||
| 379 | div{ | ||
| 380 | margin-top: 3px; | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | } | ||
| 299 | 385 | ||
| 300 | .starBox { | 386 | .starBox { |
| 301 | img { | 387 | img { |
| ... | @@ -363,4 +449,9 @@ function goMap() { | ... | @@ -363,4 +449,9 @@ function goMap() { |
| 363 | .el-icon{margin-right: 5px;} | 449 | .el-icon{margin-right: 5px;} |
| 364 | } | 450 | } |
| 365 | .oddmb:nth-child(2){margin-bottom: 20px;} | 451 | .oddmb:nth-child(2){margin-bottom: 20px;} |
| 452 | .forbid{ | ||
| 453 | cursor:not-allowed !important; | ||
| 454 | color: #a8abb2; | ||
| 455 | filter:grayscale(1); | ||
| 456 | } | ||
| 366 | </style> | 457 | </style> | ... | ... |
| ... | @@ -29,19 +29,21 @@ | ... | @@ -29,19 +29,21 @@ |
| 29 | <div class="border-rr mt20 pd20"> | 29 | <div class="border-rr mt20 pd20"> |
| 30 | <el-form :model="form" :label-width="language == 0 ?'100':'160'" :rules="rules" ref="formRef"> | 30 | <el-form :model="form" :label-width="language == 0 ?'100':'160'" :rules="rules" ref="formRef"> |
| 31 | <el-form-item :label="language==0?'入住日期':'Check-in&Check-out'" required> | 31 | <el-form-item :label="language==0?'入住日期':'Check-in&Check-out'" required> |
| 32 | 32 | <el-date-picker | |
| 33 | <el-date-picker @change="getDaysBetween" | 33 | @change="getDaysBetween" |
| 34 | v-model="rzRange" | 34 | v-model="rzRange" |
| 35 | type="daterange" :disabled-date="disabledDateRZ" | 35 | type="daterange" |
| 36 | :placeholder="language==0?'选择日期':'Select date'" format="YYYY-MM-DD" | 36 | :disabled-date="disabledDateRZ" |
| 37 | value-format="YYYY-MM-DD"/> | 37 | :placeholder="language==0?'选择日期':'Select date'" |
| 38 | format="YYYY-MM-DD" | ||
| 39 | value-format="YYYY-MM-DD"/> | ||
| 38 | <div class="tip" v-if="lform.hqStart">{{ language==0?'可订日期':'Available date' }}:{{ lform.hqStart.slice(0, 10) }} ~ {{ lform.hqEnd.slice(0, 10) }}</div> | 40 | <div class="tip" v-if="lform.hqStart">{{ language==0?'可订日期':'Available date' }}:{{ lform.hqStart.slice(0, 10) }} ~ {{ lform.hqEnd.slice(0, 10) }}</div> |
| 39 | 41 | ||
| 40 | <!-- :picker-options="pickerOptions"--> | 42 | <!-- :picker-options="pickerOptions"--> |
| 41 | </el-form-item> | 43 | </el-form-item> |
| 42 | <el-form-item :label="language==0?'房间数':'Rooms'" required prop="roomNum"> | 44 | <el-form-item :label="language==0?'房间数':'Rooms'" required prop="roomNum"> |
| 43 | <el-input-number v-model="form.roomNum" :min="0" :max="canOrderNum" @change="changeRoomNum"/> | 45 | <el-input-number v-model="form.roomNum" :min="0" :max="canOrderNum" @change="changeRoomNum"/> |
| 44 | <div class="red ml20" v-if="rzRange[1]"> | 46 | <div class="red ml20" v-if="rzRange?.[1]"> |
| 45 | <span v-if="language == 0">剩余房间数:{{ canOrderNum }}</span> | 47 | <span v-if="language == 0">剩余房间数:{{ canOrderNum }}</span> |
| 46 | <span v-else>{{ canOrderNum }} Remaining rooms</span> | 48 | <span v-else>{{ canOrderNum }} Remaining rooms</span> |
| 47 | </div> | 49 | </div> |
| ... | @@ -249,7 +251,9 @@ const ddDateArr = ref([ | ... | @@ -249,7 +251,9 @@ const ddDateArr = ref([ |
| 249 | label: '02:00' | 251 | label: '02:00' |
| 250 | } | 252 | } |
| 251 | ]) | 253 | ]) |
| 252 | const rules = ref({}) | 254 | const rules = ref({ |
| 255 | phone: { required: true, message: language.value==0? '请输入联系电话':"Please enter a contact number", trigger: 'blur' } | ||
| 256 | }) | ||
| 253 | 257 | ||
| 254 | let usedays = 0 | 258 | let usedays = 0 |
| 255 | onMounted(() => { | 259 | onMounted(() => { |
| ... | @@ -258,7 +262,11 @@ onMounted(() => { | ... | @@ -258,7 +262,11 @@ onMounted(() => { |
| 258 | console.log(room.value) | 262 | console.log(room.value) |
| 259 | hotelName.value = route.query.hotelName | 263 | hotelName.value = route.query.hotelName |
| 260 | money.value = 0 | 264 | money.value = 0 |
| 265 | rzRange.value=[] | ||
| 266 | rzRange.value=[route.query.start,route.query.end] | ||
| 261 | initDays() | 267 | initDays() |
| 268 | getDaysBetween() | ||
| 269 | // checkreRooms() | ||
| 262 | }) | 270 | }) |
| 263 | function initDays() { | 271 | function initDays() { |
| 264 | getBaseInfoByActiveId(route.params.cptId).then(res=>{ | 272 | getBaseInfoByActiveId(route.params.cptId).then(res=>{ |
| ... | @@ -318,9 +326,11 @@ function checkreRooms() { | ... | @@ -318,9 +326,11 @@ function checkreRooms() { |
| 318 | } | 326 | } |
| 319 | 327 | ||
| 320 | function getDaysBetween(e) { | 328 | function getDaysBetween(e) { |
| 321 | console.log('入住时间arr', e, rzRange.value) | 329 | // console.log('入住时间arr', e, rzRange.value) |
| 322 | var d1 = Date.parse(e[0]) | 330 | // console.log(e) |
| 323 | var d2 = Date.parse(e[1]) | 331 | // console.log(Date.parse(rzRange.value[0])) |
| 332 | var d1 = Date.parse(rzRange.value?rzRange.value[0]:null) | ||
| 333 | var d2 = Date.parse(rzRange.value?rzRange.value[1]:null) | ||
| 324 | if (d1 == d2) { | 334 | if (d1 == d2) { |
| 325 | usedays = 0 | 335 | usedays = 0 |
| 326 | ElMessage.error(language == 0 ? '入住时间跨度需大于一天' :'The duration of the stay must be more than one day.') | 336 | ElMessage.error(language == 0 ? '入住时间跨度需大于一天' :'The duration of the stay must be more than one day.') |
| ... | @@ -332,9 +342,10 @@ function getDaysBetween(e) { | ... | @@ -332,9 +342,10 @@ function getDaysBetween(e) { |
| 332 | usedays = days | 342 | usedays = days |
| 333 | } | 343 | } |
| 334 | countMoney() | 344 | countMoney() |
| 335 | var startTime = getDate(rzRange.value[0]); | 345 | var startTime = getDate(rzRange.value?rzRange.value[0]:null); |
| 336 | var endTime = getDate(rzRange.value[1]); | 346 | var endTime = getDate(rzRange.value?rzRange.value[1]:null); |
| 337 | var dateArr = []; | 347 | var dateArr = []; |
| 348 | if (!startTime||!endTime)return; | ||
| 338 | while ((endTime.getTime() - startTime.getTime()) > 0) { | 349 | while ((endTime.getTime() - startTime.getTime()) > 0) { |
| 339 | var year = startTime.getFullYear(); | 350 | var year = startTime.getFullYear(); |
| 340 | var month = (startTime.getMonth() + 1).toString().length === 1 ? "0" + (parseInt(startTime.getMonth() | 351 | var month = (startTime.getMonth() + 1).toString().length === 1 ? "0" + (parseInt(startTime.getMonth() |
| ... | @@ -348,6 +359,7 @@ function getDaysBetween(e) { | ... | @@ -348,6 +359,7 @@ function getDaysBetween(e) { |
| 348 | } | 359 | } |
| 349 | 360 | ||
| 350 | function getDate(datestr) { | 361 | function getDate(datestr) { |
| 362 | if (!datestr) return | ||
| 351 | var temp = datestr.split("-"); | 363 | var temp = datestr.split("-"); |
| 352 | if (temp[1] === '01') { | 364 | if (temp[1] === '01') { |
| 353 | temp[0] = parseInt(temp[0], 10) - 1; | 365 | temp[0] = parseInt(temp[0], 10) - 1; |
| ... | @@ -364,12 +376,12 @@ function countMoney() { | ... | @@ -364,12 +376,12 @@ function countMoney() { |
| 364 | if (language.value == 0) { | 376 | if (language.value == 0) { |
| 365 | money.value = ((room.value.roomPrice * form.value.roomNum * usedays) + (room.value.bedPrice * form.value | 377 | money.value = ((room.value.roomPrice * form.value.roomNum * usedays) + (room.value.bedPrice * form.value |
| 366 | .addNum * usedays)).toFixed(2) | 378 | .addNum * usedays)).toFixed(2) |
| 367 | |||
| 368 | } else { | 379 | } else { |
| 369 | money.value = ((room.value.roomPriceEn * form.value.roomNum * usedays) + (room.value.bedPriceEn * form.value | 380 | money.value = ((room.value.roomPriceEn * form.value.roomNum * usedays) + (room.value.bedPriceEn * form.value |
| 370 | .addNum * usedays)).toFixed(2) | 381 | .addNum * usedays)).toFixed(2) |
| 382 | |||
| 371 | } | 383 | } |
| 372 | // console.log(usedays,money.value) | 384 | if (money.value == 'NaN') money.value=0.00 |
| 373 | } | 385 | } |
| 374 | 386 | ||
| 375 | function submit() { | 387 | function submit() { |
| ... | @@ -377,7 +389,7 @@ function submit() { | ... | @@ -377,7 +389,7 @@ function submit() { |
| 377 | useUserStore().setReLogin() | 389 | useUserStore().setReLogin() |
| 378 | return | 390 | return |
| 379 | } | 391 | } |
| 380 | 392 | if(!rzRange.value)return ElMessage.warning(language.value == 0 ? '请选择入住时间' : 'Please select check-in time') | |
| 381 | if (usedays == 0) { | 393 | if (usedays == 0) { |
| 382 | ElMessage.warning(language.value == 0 ? '入住时间跨度需大于一天' : 'Check-in time must be greater than one day') | 394 | ElMessage.warning(language.value == 0 ? '入住时间跨度需大于一天' : 'Check-in time must be greater than one day') |
| 383 | return | 395 | return |
| ... | @@ -390,6 +402,7 @@ function submit() { | ... | @@ -390,6 +402,7 @@ function submit() { |
| 390 | ElMessage.warning(language.value == 0 ? '请填写手机号' : 'Please fill in the phone number') | 402 | ElMessage.warning(language.value == 0 ? '请填写手机号' : 'Please fill in the phone number') |
| 391 | return | 403 | return |
| 392 | } | 404 | } |
| 405 | |||
| 393 | form.value.rzStart = rzRange.value[0] | 406 | form.value.rzStart = rzRange.value[0] |
| 394 | form.value.rzEnd = rzRange.value[1] | 407 | form.value.rzEnd = rzRange.value[1] |
| 395 | 408 | ... | ... |
| ... | @@ -603,7 +603,7 @@ const unsubscribe = () => { | ... | @@ -603,7 +603,7 @@ const unsubscribe = () => { |
| 603 | return cancelOrder(orderId.value).then(res=>{ | 603 | return cancelOrder(orderId.value).then(res=>{ |
| 604 | getData() | 604 | getData() |
| 605 | ElMessage({ | 605 | ElMessage({ |
| 606 | message: language.value == 0?'操作成功':'Successful operation!', | 606 | message: language.value == 0?'已提交退款,请等待审核!':'Refund has been submitted, please wait for review!', |
| 607 | type: 'success' | 607 | type: 'success' |
| 608 | }) | 608 | }) |
| 609 | }) | 609 | }) | ... | ... |
| ... | @@ -32,7 +32,7 @@ | ... | @@ -32,7 +32,7 @@ |
| 32 | </div> | 32 | </div> |
| 33 | 33 | ||
| 34 | <el-row class="pd20 mt10" justify="space-between" align="middle"> | 34 | <el-row class="pd20 mt10" justify="space-between" align="middle"> |
| 35 | <el-col :lg="10"> | 35 | <el-col :lg="9"> |
| 36 | <div v-if="b.orderType == 0"> | 36 | <div v-if="b.orderType == 0"> |
| 37 | <h3 class="name">{{b.name}}</h3> | 37 | <h3 class="name">{{b.name}}</h3> |
| 38 | <p v-if="language==0">{{b.messageObj?.roomStayDate}}</p> | 38 | <p v-if="language==0">{{b.messageObj?.roomStayDate}}</p> |
| ... | @@ -78,23 +78,29 @@ | ... | @@ -78,23 +78,29 @@ |
| 78 | <p>{{ b.extJsonObj.packageName }}</p> | 78 | <p>{{ b.extJsonObj.packageName }}</p> |
| 79 | </div> | 79 | </div> |
| 80 | </el-col> | 80 | </el-col> |
| 81 | <el-col :lg="4" class="text-center"> | 81 | <el-col :lg="3" class="text-center"> |
| 82 | <span class="text-warning"> {{ language==0?'¥':'€' }} | 82 | <span class="text-warning"> {{ language==0?'¥':'€' }} |
| 83 | <span class="bigMoney">{{language==0?b.total:b.totalEn}}</span> | 83 | <span class="bigMoney">{{language==0?b.total:b.totalEn}}</span> |
| 84 | </span> | 84 | </span> |
| 85 | </el-col> | 85 | </el-col> |
| 86 | 86 | ||
| 87 | <el-col :lg="4" > | 87 | <el-col :lg="6" > |
| 88 | <div class="text-right mb20 text-danger"> | 88 | <div class="text-right mb20 text-danger"> |
| 89 | <el-countdown value-style="color:#E60012;font-size:16px;" v-if="b.status == '0'&&(b.surplus!='0,0'&&b.surplus!='0')" format="mm:ss" :value="b.countdown" @finish="finish(b)"/> | 89 | <el-countdown value-style="color:#E60012;font-size:16px;" v-if="b.status == '0'&&(b.surplus!='0,0'&&b.surplus!='0')" format="mm:ss" :value="b.countdown" @finish="finish(b)"/> |
| 90 | </div> | 90 | </div> |
| 91 | 91 | ||
| 92 | <div class="text-right"> | 92 | <div class="text-right"> |
| 93 | <el-button v-if="b.orderType == 0" class="mb10" plain round type="success" @click="Rebook(b)"> | ||
| 94 | {{ language==0?'再次预订':'Rebook' }}</el-button> | ||
| 93 | <el-button class="mb10" plain round type="primary" @click="goDetail(b)"> | 95 | <el-button class="mb10" plain round type="primary" @click="goDetail(b)"> |
| 94 | {{ language==0?'详情':'Detail' }}</el-button> | 96 | {{ language==0?'详情':'Detail' }}</el-button> |
| 95 | <el-button v-if="b.status == '0'&&(b.surplus!='0,0'&&b.surplus!='0')" @click="goDetail(b)" | 97 | <el-button v-if="b.status == '0'&&(b.surplus!='0,0'&&b.surplus!='0')" @click="goDetail(b)" |
| 96 | class="mb10" plain round type="primary" > | 98 | class="mb10" plain round type="primary" > |
| 97 | {{ language==0?'支付':'Pay' }}</el-button> | 99 | {{ language==0?'支付':'Pay' }}</el-button> |
| 100 | <el-button v-if="b.viewStatus==0" @click="cancel(b)" class="mb10" plain round type="warning" > | ||
| 101 | {{ language==0?'取消订单':'Cancel Order' }}</el-button> | ||
| 102 | <el-button v-if="b.viewStatus==5" @click="unsubscribe(b)" class="mb10" plain round type="" > | ||
| 103 | {{ language==0?'退订':'Unsubscribe' }}</el-button> | ||
| 98 | </div> | 104 | </div> |
| 99 | </el-col> | 105 | </el-col> |
| 100 | </el-row> | 106 | </el-row> |
| ... | @@ -107,15 +113,18 @@ | ... | @@ -107,15 +113,18 @@ |
| 107 | </template> | 113 | </template> |
| 108 | 114 | ||
| 109 | <script setup> | 115 | <script setup> |
| 110 | import {onMounted} from "@vue/runtime-core"; | 116 | import {onMounted,getCurrentInstance} from "@vue/runtime-core"; |
| 111 | import {useStorage} from "@vueuse/core/index"; | 117 | import {useStorage} from "@vueuse/core/index"; |
| 112 | import {newbilllist} from "@/apiPc/common"; | 118 | import {newbilllist} from "@/apiPc/common"; |
| 113 | import useUserStore from "@/store/modules/user"; | 119 | import useUserStore from "@/store/modules/user"; |
| 114 | import dayjs from 'dayjs' | 120 | import dayjs from 'dayjs' |
| 121 | import {cancelOrder2,cancelOrder} from "/@/apiPc/booking"; | ||
| 122 | |||
| 115 | const router = useRouter() | 123 | const router = useRouter() |
| 116 | const language= useStorage('language',0) | 124 | const language= useStorage('language',0) |
| 117 | const list = ref([]) | 125 | const list = ref([]) |
| 118 | const user = useUserStore().user | 126 | const user = useUserStore().user |
| 127 | const {proxy} = getCurrentInstance() | ||
| 119 | 128 | ||
| 120 | onMounted(()=>{ | 129 | onMounted(()=>{ |
| 121 | getList() | 130 | getList() |
| ... | @@ -132,10 +141,8 @@ function getList() { | ... | @@ -132,10 +141,8 @@ function getList() { |
| 132 | b.extJsonObj = JSON.parse(b.extJson) || {} | 141 | b.extJsonObj = JSON.parse(b.extJson) || {} |
| 133 | if(b.surplus&&b.status == '0'&&(b.surplus!='0,0'&&b.surplus!='0')){ | 142 | if(b.surplus&&b.status == '0'&&(b.surplus!='0,0'&&b.surplus!='0')){ |
| 134 | b.countdown = Date.now() + Number((b.surplus.split(',')[0]*60 + b.surplus.split(',')[1])*10) | 143 | b.countdown = Date.now() + Number((b.surplus.split(',')[0]*60 + b.surplus.split(',')[1])*10) |
| 135 | console.log(b.countdown) | ||
| 136 | } | 144 | } |
| 137 | } | 145 | } |
| 138 | console.log(list.value) | ||
| 139 | }) | 146 | }) |
| 140 | } | 147 | } |
| 141 | function goDetail(b) { | 148 | function goDetail(b) { |
| ... | @@ -147,6 +154,47 @@ function goDetail(b) { | ... | @@ -147,6 +154,47 @@ function goDetail(b) { |
| 147 | } | 154 | } |
| 148 | }) | 155 | }) |
| 149 | } | 156 | } |
| 157 | |||
| 158 | function Rebook(row){ | ||
| 159 | console.log(row) | ||
| 160 | router.push({ | ||
| 161 | name:'hotelDetail', | ||
| 162 | params:{ | ||
| 163 | cptId:row.activeId, | ||
| 164 | hotelId:row.hotelId | ||
| 165 | }, | ||
| 166 | query:{ | ||
| 167 | id:row.extId | ||
| 168 | } | ||
| 169 | }) | ||
| 170 | } | ||
| 171 | |||
| 172 | const cancel = (row) => { | ||
| 173 | //取消订单 | ||
| 174 | proxy.$modal.confirm(language.value == 0 ? '确定取消订单吗 ?' :`Are you sure to cancel the order?`).then(() => { | ||
| 175 | return cancelOrder2(row.id).then(res=>{ | ||
| 176 | getList() | ||
| 177 | ElMessage({ | ||
| 178 | message: language.value == 0?'操作成功':'Successful operation!', | ||
| 179 | type: 'success' | ||
| 180 | }) | ||
| 181 | }) | ||
| 182 | }) | ||
| 183 | } | ||
| 184 | |||
| 185 | const unsubscribe = (row) => { | ||
| 186 | proxy.$modal.confirm(language.value == 0 ?`确定退款吗 ?`:'Are you sure to refund?').then(() => { | ||
| 187 | return cancelOrder(row.id).then(res=>{ | ||
| 188 | getList() | ||
| 189 | ElMessage({ | ||
| 190 | message: language.value == 0?'已提交退款,请等待审核!':'Refund has been submitted, please wait for review!', | ||
| 191 | type: 'success' | ||
| 192 | }) | ||
| 193 | }) | ||
| 194 | }) | ||
| 195 | } | ||
| 196 | |||
| 197 | |||
| 150 | function toInvoice(){ | 198 | function toInvoice(){ |
| 151 | router.push({ | 199 | router.push({ |
| 152 | name: 'invoice' | 200 | name: 'invoice' | ... | ... |
-
Please register or sign in to post a comment