123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <view class="container">
- <view class="sticky">
- <!-- #ifdef MP-WEIXIN -->
- <NavigateBar title="房间选择" control="back" bgcolor="#a09cc4"></NavigateBar>
- <!-- #endif -->
- <!-- #ifdef MP-ALIPAY -->
- <NavigateBar title="房间选择" bgcolor="#a09cc4"></NavigateBar>
- <!-- #endif -->
- </view>
- <u-modal :show="modalShow" :title="modalTitle" :showCancelButton="true" @confirm="confirmSelectRoom"
- @cancel="modalShow=false"></u-modal>
- <view class="select-room">
- <view class="room-item" v-for="(item,index) in roomList" :key=item.room @click="select(item)">
- <view class="room-item-inner">
- <text>{{item.room}}</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
- import NavigateBar from "../../components/navigateBar/navigate-bar.vue";
- export default {
- components: {
- NavigateBar
- },
- data() {
- return {
- room: ',',
- building: '',
- floor: '',
- roomList: [],
- modalShow: false,
- modalTitle: '',
- roomType: ''
- };
- },
- computed: {
- ...mapState('m_business', ['currentHotel', 'order']),
- },
- methods: {
- ...mapMutations('m_business', ['updateOrder']),
- async getRoomInfo() {
- let res = await uni.$http.post('/hotel/room', {
- hotelId: this.currentHotel.hotelId,
- roomType: this.roomType,
- startTime: this.order.startTime,
- endTime: this.order.endTime,
- pageNo: 1,
- pageSize: 10
- })
- this.roomList = res.data.data.records
- },
- select(item) {
- if (item.text === '不可预订') {
- uni.$showMsg('该房间不可预订!')
- } else {
- this.modalTitle = "确认选择" + item.room + '房间?'
- this.building = item.building
- this.floor = item.floor
- this.room = item.room
- this.modalShow = true
- }
- },
- confirmSelectRoom() {
- let info = {
- building: this.building,
- floor: this.floor,
- room: this.room,
- status: 'ROOM_SELECTED'
- }
- if (this.order.orderSource === 'MINI_APP') {
- info.isResv = false
- }
- let order = {
- ...this.order,
- ...info
- }
- console.log("confirm order:", order)
- this.updateOrder(order)
- uni.navigateTo({
- url: '/subpkg_checkin/addGuest/addGuest'
- })
- this.modalShow = false;
- }
- },
- async onLoad(options) {
- //获取从选择房间类型页面传过来的房间类型
- this.roomType = options.roomType
- //查询该房间类型在订单时间段内可用的所有房间
- await this.getRoomInfo();
- if (this.roomList.length === 0) {
- uni.showModal({
- title: '该房型无可用房间可供选择,请选择其它房型',
- showCancel: false,
- success() {
- uni.navigateBack()
- }
- })
- }
- },
- // #ifdef MP-WEIXIN
- onShareAppMessage(info) {
- return {
- title: '源享住',
- path: 'pages/login/login',
- imageUrl: "/static/logo.png"
- }
- }
- // #endif
- }
- </script>
- <style lang="scss">
- page {
- background: #EFEFF4;
- width: 100%;
- display: flex;
- flex-direction: column;
- .container {
- .sticky {
- position: sticky;
- background-color: #fff;
- width: 100%;
- top: 0;
- z-index: 999;
- }
- .select-room {
- display: flex;
- flex-wrap: wrap;
- width: 600rpx;
- margin: 0 auto;
- .room-item {
- width: 180rpx;
- height: 180rpx;
- margin: 10rpx 10rpx;
- text-align: center;
- color: #FFFFFF;
- background-color: #a09cc4;
- border-radius: 15rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- }
- </style>
|