Jelajahi Sumber

opt:完善订单页面和订单详情页面显示的信息

LiChengjin 2 bulan lalu
induk
melakukan
33abddbdbe
2 mengubah file dengan 22 tambahan dan 8 penghapusan
  1. 6 6
      pages/order/order.vue
  2. 16 2
      subpkg/orderDetail/orderDetail.vue

+ 6 - 6
pages/order/order.vue

@@ -7,14 +7,14 @@
 		</view>
 		<view class="order-item" v-for="(order,index) in orderList" :key="index">
 			<view class="one-order">
-				<view class="order--no" @click="gotoOrderDetail(order.orderId)">
+				<view class="order--no" @click="gotoOrderDetail(order.orderId,order.roomTypeName)">
 					<view class="order--no__no">
 						<view>订单号:</view>
 						<view>{{ order.orderId.toUpperCase() }}</view>
 					</view>
 					<view class="order--no__status"></view>
 				</view>
-				<view class="order--room" @click="gotoOrderDetail(order.orderId)">
+				<view class="order--room" @click="gotoOrderDetail(order.orderId,order.roomTypeName)">
 					<view class="order--room__pic">
 						<u-image :src="getPicPath(order.roomPicPath)" width="180rpx" height="180rpx"></u-image>
 					</view>
@@ -25,7 +25,7 @@
 						{{ "¥"+ order.price }}
 					</view>
 				</view>
-				<view class="order--duration" @click="gotoOrderDetail(order.orderId)">
+				<view class="order--duration" @click="gotoOrderDetail(order.orderId,order.roomTypeName)">
 					<view class="order--duration__start">
 						<view class="order--duration__start-title">入住日期</view>
 						<view class="order--duration__start-date">
@@ -146,7 +146,7 @@
 					orderStatus: this.status[index],
 					hotelId: this.currentHotel.hotelId
 				}
-				
+
 				let res = await uni.$http.post(`/order/status`, condition)
 				this.orderList = [...this.orderList, ...res.data.data.records]
 				this.total = res.data.data.total
@@ -196,9 +196,9 @@
 			getPicPath(path) {
 				return IMG_BASE_URL + '/' + path
 			},
-			gotoOrderDetail(orderId) {
+			gotoOrderDetail(orderId, roomTypeName) {
 				uni.navigateTo({
-					url: '/subpkg/orderDetail/orderDetail?orderId=' + orderId
+					url: `/subpkg/orderDetail/orderDetail?orderId=${orderId}&roomTypeName=${roomTypeName}`
 				})
 			}
 		},

+ 16 - 2
subpkg/orderDetail/orderDetail.vue

@@ -23,11 +23,11 @@
 		</view>
 		<view class="info-item">
 			<u-text text="酒店:"></u-text>
-			<u-text :text="orderInfo.hotelName" align="right"></u-text>
+			<u-text :text="currentHotel.name" align="right"></u-text>
 		</view>
 		<view class="info-item">
 			<u-text text="房间类型:"></u-text>
-			<u-text :text="orderInfo.roomTypeName" align="right"></u-text>
+			<u-text :text="roomTypeName" align="right"></u-text>
 		</view>
 		<view class="info-item">
 			<u-text text="楼栋:"></u-text>
@@ -82,6 +82,10 @@
 <script>
 	import moment from "moment"
 	import NavigateBar from "../../components/navigateBar/navigate-bar.vue";
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex'
 	export default {
 		components: {
 			NavigateBar
@@ -90,6 +94,7 @@
 			return {
 				orderId: '',
 				orderInfo: {},
+				roomTypeName: '',
 				paymentStatus: {
 					UNPAID: '待支付',
 					PAID: '已支付'
@@ -100,9 +105,16 @@
 					ROOM_SELECTED: "已选房",
 					CHECK_IN: "已入住",
 					FINISHED: "已完成"
+				},
+				paymentMethod: {
+					WECHAT: '微信',
+					ALIPAY: '支付宝'
 				}
 			};
 		},
+		computed: {
+			...mapState('m_business', ['currentHotel']),
+		},
 		methods: {
 			async queryOrder() {
 				let res = await uni.$http.get(`/order/orderId/${this.orderId}`, )
@@ -118,6 +130,7 @@
 				this.orderInfo.paymentStatus = this.paymentStatus[this.orderInfo.paymentStatus]
 				this.orderInfo.breakfastNum = this.orderInfo.breakfastNum === undefined ? 0 : this.orderInfo
 					.breakfastNum
+				this.orderInfo.paymentMethod = this.paymentMethod[this.orderInfo.platform]
 			},
 			async deleteOrder() {
 				let res = await uni.$http.delete('/hotelOrder/' + this.orderInfo.id)
@@ -137,6 +150,7 @@
 		async onLoad(options) {
 			console.log(options.orderId)
 			this.orderId = options.orderId
+			this.roomTypeName = options.roomTypeName
 			await this.queryOrder()
 		},
 		// #ifdef MP-WEIXIN