123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- <template>
- <view class="page" :style="{'height':(h)+'px','padding-top':mt+'px'}">
- <c-nav-bar title="订单详情" showIcon="true" :titleStyle="titleStyle"></c-nav-bar>
- <view class="body" v-if="orderInfo.detailFormList[0]">
- <!-- 个人信息 -->
- <view class="uname">
- <text style="margin-right: 20rpx;">{{orderInfo.guestName}}</text>
- <text>{{orderInfo.guestPhone}}</text>
- </view>
- <!-- 房间信息 -->
- <view class="room">
- <!-- 房间/预定信息 -->
- <view class="reservations">
- <text
- style="font-size: 30rpx; color: #333333; font-weight: 700;">{{orderInfo.houseBaseName}}-{{orderInfo.detailFormList[0].roomNumber}}</text>
- <text style="font-size: 24rpx; color: #39CE77;" v-if="isOrderPanding">{{getStatusText()}}</text>
- </view>
- <!-- 时间/价格 -->
- <view class="time-price">
- <text style="font-size: 30rpx; color: #777;">{{orderInfo.arriveDate}}入住 {{orderInfo.num}}晚</text>
- <text style="font-size: 30rpx; color: #245BED;">¥{{orderInfo.orderAmount}}</text>
- </view>
- <!-- 入住人数 -->
- <view class="house-person">
- <text style="font-size: 30rpx; color: #777;">入住人</text>
- <view class="right">
- <text
- style="font-size: 30rpx; color: #777; ">{{orderInfo.detailFormList[0].checkInPersonList.length}}人
- </text>
- <!-- <u-icon name="arrow-right" @click.native="goStayCheck"></u-icon> -->
- <!-- <u-icon name="arrow-right" ></u-icon> -->
- </view>
- </view>
- </view>
- <!-- 订单信息 -->
- <u-cell-group :border="false"
- customStyle="background-color: #fff;border-radius: 16rpx;width: 690rpx;margin:0 auto;">
- <u-cell>
- <text slot="icon" style="font-size: 30rpx; margin-right: 50rpx;">订单号</text>
- <view slot="title" class="title">
- <text>{{orderInfo.orderCode}}</text>
- </view>
- </u-cell>
- <u-cell>
- <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">创建时间</text>
- <view slot="title" class="title">
- <text>{{orderInfo.orderTime}}</text>
- </view>
- </u-cell>
- <!-- <u-cell>
- <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">办理员工</text>
- <view slot="title" class="title">
- <text>何伟婷</text>
- </view>
- </u-cell> -->
- <u-cell v-if="orderInfo.orderStatus==4">
- <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">取消原因</text>
- <view slot="title" class="title">
- <text>{{orderInfo.refundReason}}</text>
- </view>
- </u-cell>
- <u-cell>
- <text slot="icon" style="font-size: 30rpx; margin-right: 80rpx;">备注</text>
- <view slot="title" class="title">
- <text>{{orderInfo.remarks}}</text>
- </view>
- </u-cell>
- </u-cell-group>
- <!-- 按钮 -->
- <view class="button" v-if="orderInfo.orderStatus==-1||orderInfo.orderStatus==1||orderInfo.orderStatus==2">
- <!-- 待确认 -->
- <template v-if="orderInfo.orderStatus==-1">
- <button class="edit" @click="cancle()">取消订单</button>
- <button class="goRoom" @click="show2=true">确认订单</button>
- </template>
- <!-- 已预订 -->
- <template v-if="orderInfo.orderStatus==1">
- <button class="edit" @click="edit()">编辑订单</button>
- <button class="goRoom" @click="checkIn(2)" v-if="showRuzhu">办理入住</button>
- </template>
- <!-- 已入住 -->
- <template v-if="orderInfo.orderStatus==2">
- <button class="edit" @click="edit()">编辑订单</button>
- <button class="goRoom" @click="show3=true">办理退房</button>
- </template>
- </view>
- </view>
- <!-- 取消订单 -->
- <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
- <view class="slot-content">
- <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
- <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
- <u-cell>
- <view slot="title" class="title">
- <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
- placeholder="请输入原因" v-model="check.refundReason"></u--input>
- </view>
- </u-cell>
- </u-cell-group> -->
- </view>
- </u-modal>
- <!-- 确认订单 -->
- <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
- @cancel="show2=false">
- </u-modal>
- <!-- 办理退房 -->
- <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
- @cancel="show3=false">
- </u-modal>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- titleStyle: {
- fontSize: '34rpx',
- fontWeight: "bold",
- },
- h: uni.getSystemInfoSync().windowHeight,
- mt: uni.getSystemInfoSync().statusBarHeight + 44,
- show: false,
- show2: false,
- show3: false,
- check: {
- initiator: 1,
- refundReason: "",
- status: -1,
- orderCode: "",
- },
- showRuzhu: false,
- orderId: '',
- orderInfo: {
- detailFormList: []
- }
- }
- },
- onLoad(opt) {
- if (opt.orderId) {
- this.orderId = opt.orderId;
- this.getOrderInfo()
- }
- },
- methods: {
- // 获取数据
- getOrderInfo() {
- this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
- if (res.data.code == 0) {
- this.orderInfo = res.data.data
- if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
- 'yyyy-MM-dd')) {
- this.showRuzhu = true;
- }
- }
- })
- },
- // 客房状态
- getStatusText() {
- if (this.orderInfo.orderStatus === -1) {
- return '待确定'
- } else if (this.orderInfo.orderStatus === 1) {
- return '已预订'
- } else if (this.orderInfo.orderStatus === 2) {
- return '已入住'
- } else if (this.orderInfo.orderStatus === -2) {
- return '待支付'
- } else if (this.orderInfo.orderStatus === 3) {
- return '已退房'
- } else if (this.orderInfo.orderStatus === 4) {
- return '已取消'
- } else if (this.orderInfo.orderStatus === 5) {
- return '已退款'
- } else {
- return '状态异常'
- }
- },
- //添加入住人
- goStayCheck() {
- let list = JSON.stringify(this.orderInfo);
- uni.navigateTo({
- url: '/pages/house/stayCheck?orderInfo=' + list,
- events: {
- addSuccess: data => {
- this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
- }
- },
- })
- },
- // 确认订单
- confirmOrder() {
- this.$api
- .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
- .then((res) => {
- if (res.data.code !== 0) {
- return this.$showToast(res.data.msg);
- }
- this.show2 = false;
- this.$showToast('操作成功');
- setTimeout(() => {
- uni.reLaunch({
- url: '/pagesMy/orderList/orderList'
- })
- }, 1500)
- });
- },
- //取消订单
- cancle() {
- this.show = true;
- this.check.orderCode = this.orderInfo.orderCode;
- },
- //取消订单
- confirmCheck() {
- this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
- .then((res) => {
- if (res.data.code !== 0) {
- return this.$showToast(res.data.msg);
- }
- this.show = false;
- this.$showToast('操作成功');
- setTimeout(() => {
- uni.reLaunch({
- url: '/pagesMy/orderList/orderList'
- })
- }, 1500)
- });
- },
- //办理入住
- checkIn(orderStatus) {
- uni.redirectTo({
- url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
- })
- },
- // 编辑
- edit() {
- uni.redirectTo({
- url: "/pages/house/createOrder?id=" + this.orderInfo.id
- })
- },
- //办理退房
- checkoutRoom() {
- this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
- .then((res) => {
- if (res.data.code !== 0) {
- return this.$showToast(res.data.msg);
- }
- this.show = false;
- this.$showToast('操作成功');
- setTimeout(() => {
- uni.reLaunch({
- url: '/pagesMy/orderList/orderList'
- })
- }, 1500)
- });
- }
- },
- computed: {
- isOrderPanding() {
- return this.orderInfo.orderStatus === 1
- }
- }
- }
- </script>
- <style lang="scss">
- .page {
- background: #F3F4F4;
- padding-bottom: 260rpx;
- box-sizing: border-box;
- overflow-y: auto;
- overflow-x: auto;
- }
- .body {
- padding-top: 20rpx;
- padding-left: 30rpx;
- padding-right: 30rpx;
- }
- .uname {
- width: 100%;
- height: 100rpx;
- line-height: 100rpx;
- background-color: #fff;
- padding-left: 30rpx;
- font-size: 30rpx;
- border-radius: 10rpx;
- box-sizing: border-box;
- }
- .room {
- margin-top: 20rpx;
- width: 100%;
- height: 246rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- border-radius: 10rpx;
- padding: 30rpx;
- box-sizing: border-box;
- }
- .orderTip {
- padding: 30rpx;
- padding-top: 0;
- width: 690rpx;
- height: 514rpx;
- background-color: #fff;
- border-radius: 10rpx;
- }
- .button {
- position: fixed;
- bottom: 0;
- height: 96rpx;
- width: 100%;
- margin-top: 20rpx;
- display: flex;
- justify-content: space-between;
- border-radius: 10rpx;
- z-index: 9;
- background-color: #fff;
- left: 0;
- padding: 24rpx 0;
- }
- .goRoom {
- // border-radius: ;
- width: 330rpx;
- height: 96rpx;
- border-radius: 48rpx;
- font-size: 34rpx;
- background-color: #1372FF;
- color: #fff;
- }
- .edit {
- width: 330rpx;
- height: 96rpx;
- border-radius: 48rpx;
- font-size: 34rpx;
- background-color: #E2EDFC;
- color: #1372FF;
- }
- .reservations {
- display: flex;
- justify-content: space-between;
- }
- .time-price {
- display: flex;
- justify-content: space-between;
- margin-top: 30rpx;
- }
- .house-person {
- display: flex;
- justify-content: space-between;
- margin-top: 30rpx;
- }
- .right {
- display: flex;
- }
- </style>
|