<template> <view> <u-tabs :list="tab" active-color="#c74547" :is-scroll="false" :current="current" @change="change"></u-tabs> <view class="list"> <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)"> <view class="order_title" @click.stop="go(item)"> <text>{{ item.shopName }}</text> <text class="icon"></text> <view class="zhu"> <text v-if="item.state == 0" style="color:#67c23a;">待酒店方确认</text> <text v-if="item.state == 1" style="color:#67c23a;">预定确认</text> <text v-if="item.state == 2" style="color:orange;">预定取消</text> </view> </view> <view class="r_item"> <image :src="ip + item.shopRoom.pic" mode="aspectFill" class="pic"></image> <view class="con"> <view class="title omit">{{ item.shopRoom.title }}</view> <view class="ms" style="padding-top:7px;"> <text class="rmb">¥</text> <text class="price">{{ item.shopRoom.price }}</text> <text class="qi">起</text> </view> <view class="btn" @click.stop="call(item.bossPhone)" style="margin:8px 4px 0px 0px">电话</view> </view> <view class="clear"></view> </view> <view class="hj">{{ item.createTime }}</view> <view class="clear"></view> <view class="tk" v-if="item.state == 2">抱歉,入住的时间段酒店客房已满,无法安排入住。</view> </view> <view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view> </view> <!--预订订单信息--> <u-popup v-model="popup_show" :mask-close-able="false" mode="center" border-radius="14" width="90%" height="auto" :closeable="true"> <view class="u-popup"> <view class="tttt" style="font-weight: bolder;">预订信息</view> <u-steps :list="numList" mode="number" :current="-1" active-color="#c74547" style="margin: 20px 0px 20px 0px;"></u-steps> <view class="form_group hr"> <view class="lable">我的姓名</view> <input v-model="book.name" :disabled="true" style="margin-left: -9px;" /> </view> <view class="form_group hr"> <view class="lable">联系方式</view> <input type="number" v-model="book.phone" :disabled="true" style="margin-left: -9px;" /> </view> <view class="form_group hr"> <view class="lable">入住日期</view> <input v-model="book.day" :disabled="true" style="margin-left: -9px;flex: 0.67;" /> </view> <view class="form_group"> <view class="lable">入住天数</view> <input :value="book.days + '天'" :disabled="true" style="margin-left: -9px;" /> </view> <button class="btn" @click="op()" v-if="book.state==0">取消预定</button> </view> </u-popup> </view> </template> <script> export default { data() { return { ip: this.$http.urls.ip, tab: [{ name: '所有预订', state: '' }, { name: '待确认', state: 0 }, { name: '成功', state: 1 }, { name: '已退订', state: 2 }], numList: [{ name: '我的信息' }, { name: '订单确认' }, { name: '登记入住' }], current: 0, list: [], param: { pageNum: 1, state: '', role: 'member'}, loadMore: true, popup_show: false, book: {} }; }, onLoad() { this.getData(); }, methods: { //获取数据 getData() { this.$http.request({ url: this.$http.urls.order, data: this.param, loading: 'false', success: res => { this.loadMore = res.data.pages > this.param.pageNum ? true : false; res.data.rows.forEach(item => { item.createTime = this.$u.timeFrom(new Date(item.createTime.replace(/\-/g, '/')).getTime()); this.list.push(item); }); } }); }, change(index) { this.current = index; this.param.state = this.tab[index].state; this.refresh(); }, go(item) { uni.navigateTo({ url: '/pages/shop/detail?shopId=' + item.shopId }); }, detail(item) { this.book = item; this.book.day = item.min + ' 至 ' + item.max; this.popup_show = true; }, //拨打电话 call(phoneNumber) { uni.makePhoneCall({ phoneNumber: phoneNumber }); }, //取消预约 op() { uni.showModal({ title: '提示', content: '是否取消预约?', success: res => { if (res.confirm) { this.$http.request({ url: this.$http.urls.orderDelete, data: { id: this.book.id}, success: res => { uni.showToast({ title: '取消成功' }); this.popup_show = false; this.refresh(); } }); } } }); }, //刷新数据 refresh() { this.loadMore = true; this.param.pageNum = 1; this.list = []; this.getData(); } }, //下拉刷新 onPullDownRefresh() { setTimeout(() => { uni.stopPullDownRefresh(); this.refresh(); }, 1000); }, //上拉加载 onReachBottom() { if (this.loadMore) { this.param.pageNum++; this.getData(); } } }; </script> <style lang="scss"> page { background-color: $page; } .list { padding: 0px 10px 25px 10px; .item { background-color: white; padding: 5px 13px 13px 13px; margin-top: 10px; border-radius: 4px; .hj { text-align: right; padding-top: 13px; color: $dar2; } } } </style>