Browse Source

feat: 统计

2912631854@qq.com 1 year ago
parent
commit
5a5625e797
3 changed files with 197 additions and 146 deletions
  1. 170 130
      pages/home/index.vue
  2. 15 7
      pages/house/orderInfo.vue
  3. 12 9
      pagesMy/orderList/orderList.vue

+ 170 - 130
pages/home/index.vue

@@ -58,9 +58,14 @@
 			<view class="card" v-for="(item,index) in list" :key="index" @tap="handleDetail(item)">
 				<view class="c_top">
 					<text>订单号:{{item.orderCode}}</text>
-					<text v-if='item.orderStatus==-1&&item.status==1' class="orange">待确认</text>
-					<text v-else-if='item.status==0&&item.orderStatus==-1' class="red">待支付</text>
-					<text v-else-if='item.orderStatus==1&&item.status==1' class="green">已预订</text>
+
+					<text v-if='item.orderStatus==-1' class="orange">待确认</text>
+					<text v-else-if='item.orderStatus==-2' class="red">待支付</text>
+					<text v-else-if='item.orderStatus==1' class="green">已预订</text>
+					<text v-else-if='item.orderStatus==5' class="green">已退款</text>
+					<text v-else-if='item.orderStatus==4' class="green">已取消</text>
+					<text v-else-if='item.orderStatus==2' class="green">已入住</text>
+					<text v-else-if='item.orderStatus==3' class="green">已退房</text>
 					<text v-else :class="statusClass[item.orderStatus]">{{status[item.orderStatus]}}</text>
 				</view>
 				<view class="c_middle">
@@ -74,11 +79,15 @@
 					<view class="cm_price">¥{{item.orderAmount?item.orderAmount.toFixed(2):''}}</view>
 				</view>
 				<view class="c_bottom">
-					<view class="btn" v-if="item.orderStatus==-1" :class="item.orderStatus==-1?'btn_jj':''" @tap="cancle(item)">拒绝</view>
+					<view class="btn" v-if="item.orderStatus==-1" :class="item.orderStatus==-1?'btn_jj':''"
+						@tap="cancle(item)">拒绝</view>
 					<view class="btn" v-if="item.orderStatus==-1" @tap="toConfrimOrder(item)">确认订单</view>
 					<view class="btn" v-if="item.orderStatus==1&&item.istoday" @tap="checkIn(2,item)">办理入住</view>
 					<view class="btn" v-if="item.orderStatus==2" @tap="toBltf(item)">办理退房</view>
-					<view class="btn" v-if="item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday)" :class="(item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday))?'btn_xq':''" @tap="handleDetail(item)">详情</view>
+					<view class="btn"
+						v-if="item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday)"
+						:class="(item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday))?'btn_xq':''"
+						@tap="handleDetail(item)">详情</view>
 				</view>
 			</view>
 		</block>
@@ -88,7 +97,8 @@
 			</view>
 		</block>
 		<Tabbar :tabbarIndex="0"></Tabbar>
-		<u-picker :show="shShow" :columns="nameList" @close="shShow=false" @cancel="shShow=false" @confirm="confirm"></u-picker>
+		<u-picker :show="shShow" :columns="nameList" @close="shShow=false" @cancel="shShow=false"
+			@confirm="confirm"></u-picker>
 		<!-- 取消订单 -->
 		<u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
 			<view class="slot-content">
@@ -96,10 +106,12 @@
 			</view>
 		</u-modal>
 		<!-- 确认订单 -->
-		<u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true" @cancel="show2=false">
+		<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 :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
+			@cancel="show3=false">
 		</u-modal>
 	</view>
 </template>
@@ -109,18 +121,18 @@
 		data() {
 			return {
 				homestayId: this.$store.state.moduleHouse.homestayId,
-				name:'',
-				shList:[],
-				nameList:[],
-				shShow:false,
-				item:null,
-				list:[],
+				name: '',
+				shList: [],
+				nameList: [],
+				shShow: false,
+				item: null,
+				list: [],
 				statusClass: ['', 'green', 'blue', 'grey', 'grey'],
 				status: ['', '已预订', '已入住', '已退房', '已取消'],
-				page:1,
-				limit:10,
-				finished:false,
-				
+				page: 1,
+				limit: 10,
+				finished: false,
+
 				show: false,
 				show2: false,
 				show3: false,
@@ -140,57 +152,57 @@
 			this.getList();
 		},
 		onReachBottom() {
-			if(this.finished) return
+			if (this.finished) return
 			this.getList();
 		},
 		onPullDownRefresh() {
-			setTimeout(()=>{
+			setTimeout(() => {
 				this.getType();
 				this.getDetails();
 				this.init();
 				uni.stopPullDownRefresh();
-			},1000);
+			}, 1000);
 		},
 		methods: {
-			getType(){
-				this.$api.post('/merchant/register/getMerchantStoreList').then(res=>{
-					if(res.data.code===0){
+			getType() {
+				this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
+					if (res.data.code === 0) {
 						this.shList = res.data.data;
 						let shs = [];
-						this.shList.forEach(d=>shs.push(d.merchantName));
+						this.shList.forEach(d => shs.push(d.merchantName));
 						this.nameList = [shs];
-						let t = this.shList.find(d=>d.merchantId==uni.getStorageSync('homestayId'));
-						this.name = t?t.merchantName:''
-					}else this.$showToast(res.data.msg);
+						let t = this.shList.find(d => d.merchantId == uni.getStorageSync('homestayId'));
+						this.name = t ? t.merchantName : ''
+					} else this.$showToast(res.data.msg);
 				})
 			},
-			confirm(e){
+			confirm(e) {
 				this.name = e.value[0];
 				this.shShow = false;
-				let t = this.shList.find(d=>d.merchantName==this.name);
-				if(t){
-					if(t.merchantType==2){//酒店民宿
-						uni.setStorageSync('homestayId',t.merchantId);
+				let t = this.shList.find(d => d.merchantName == this.name);
+				if (t) {
+					if (t.merchantType == 2) { //酒店民宿
+						uni.setStorageSync('homestayId', t.merchantId);
 						this.getDetails();
 						this.page = 1;
 						this.finished = false;
 						this.list = [];
 						this.getList();
-					} else{
+					} else {
 						this.item = null;
 						this.list = [];
-						uni.setStorageSync('merchantId',t.merchantId);
-					} 
+						uni.setStorageSync('merchantId', t.merchantId);
+					}
 				}
 			},
-			getDetails(){
-				this.$api.get('/merchant/hotel/home/getHotelHomeInfo/'+this.homestayId).then(res=>{
-					if(res.data.code===0){
+			getDetails() {
+				this.$api.get('/merchant/hotel/home/getHotelHomeInfo/' + this.homestayId).then(res => {
+					if (res.data.code === 0) {
 						this.item = res.data.data;
-					}else this.$showToast(res.data.msg);
+					} else this.$showToast(res.data.msg);
 				})
 			},
-			getList(){
+			getList() {
 				this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
 					homestayId: uni.getStorageSync('homestayId'),
 					limit: this.limit,
@@ -198,30 +210,32 @@
 					orderStatus: '',
 					// orderTime:new Date().Format('yyyy-MM-dd')
 				}).then(res => {
-					if(res.data.code===0){
-						this.list = [...this.list,...res.data.data.list];
-						this.list.forEach(l=>{
-							l.date = new Date(l.arriveDate).Format('MM/dd')+" - "+new Date(l.leaveDate).Format('MM/dd');
-							l.istoday = new Date().Format('yyyy-MM-dd')==new Date(l.arriveDate).Format('yyyy-MM-dd')?true:false;
+					if (res.data.code === 0) {
+						this.list = [...this.list, ...res.data.data.list];
+						this.list.forEach(l => {
+							l.date = new Date(l.arriveDate).Format('MM/dd') + " - " + new Date(l.leaveDate)
+								.Format('MM/dd');
+							l.istoday = new Date().Format('yyyy-MM-dd') == new Date(l.arriveDate).Format(
+								'yyyy-MM-dd') ? true : false;
 						})
 						if (res.data.data.list.length == 0) this.finished = true;
 						else this.page++;
-					}else this.$showToast(res.data.msg);
+					} else this.$showToast(res.data.msg);
 				})
 			},
 			handleDetail(item) {
 				uni.navigateTo({
-					url: '/pages/house/orderInfo?orderId='+item.id
+					url: '/pages/house/orderInfo?orderId=' + item.id
 				})
 			},
-			toAll(){
+			toAll() {
 				uni.navigateTo({
-					url:'/pagesMy/orderList/orderList'
+					url: '/pagesMy/orderList/orderList'
 				})
 			},
-			toTurn(){
+			toTurn() {
 				uni.navigateTo({
-					url:'/pages/home/condition'
+					url: '/pages/home/condition'
 				})
 			},
 			cancle(item) {
@@ -231,61 +245,61 @@
 			//取消订单
 			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(() => {
-						this.init();
-					}, 1500)
-				});
+					.then((res) => {
+						if (res.data.code !== 0) {
+							return this.$showToast(res.data.msg);
+						}
+						this.show = false;
+						this.$showToast('操作成功');
+						setTimeout(() => {
+							this.init();
+						}, 1500)
+					});
 			},
-			toConfrimOrder(item){
+			toConfrimOrder(item) {
 				this.orderInfo = item;
 				this.show2 = true;
 			},
 			// 确认订单
 			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(() => {
-						this.init();
-					}, 1500)
-				});
+					.then((res) => {
+						if (res.data.code !== 0) {
+							return this.$showToast(res.data.msg);
+						}
+						this.show2 = false;
+						this.$showToast('操作成功');
+						setTimeout(() => {
+							this.init();
+						}, 1500)
+					});
 			},
 			//办理入住
-			checkIn(orderStatus,item) {
+			checkIn(orderStatus, item) {
 				this.orderInfo = item;
 				uni.redirectTo({
 					url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
 				})
 			},
-			toBltf(item){
+			toBltf(item) {
 				this.orderInfo = item;
 				this.show3 = true;
 			},
 			//办理退房
 			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.show3 = false;
-					this.$showToast('操作成功');
-					setTimeout(() => {
-						this.init();
-					}, 1500)
-				});
+					.then((res) => {
+						if (res.data.code !== 0) {
+							return this.$showToast(res.data.msg);
+						}
+						this.show3 = false;
+						this.$showToast('操作成功');
+						setTimeout(() => {
+							this.init();
+						}, 1500)
+					});
 			},
-			init(){
+			init() {
 				this.page = 1;
 				this.finished = false;
 				this.list = [];
@@ -296,26 +310,30 @@
 </script>
 
 <style scoped lang="less">
-	.page{
+	.page {
 		background: #F3F4F4;
 		padding-bottom: 40rpx;
 		box-sizing: border-box;
-		.bg{
+
+		.bg {
 			width: 100%;
 			height: 743rpx;
 			background: url(https://i.ringzle.com/file/20240107/8bc656fc64fd4386a6b336a7dc8c86d0.png) no-repeat;
-			background-size: 100%  100%;
+			background-size: 100% 100%;
 			box-sizing: border-box;
-			.b_money{
+
+			.b_money {
 				display: flex;
 				flex-direction: column;
 				align-items: center;
-				text{
+
+				text {
 					font-size: 56rpx;
 					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
 					font-weight: bold;
 					color: #FFFFFF;
-					&:last-child{
+
+					&:last-child {
 						font-size: 32rpx;
 						font-family: PingFang SC, PingFang SC;
 						font-weight: 400;
@@ -323,23 +341,27 @@
 					}
 				}
 			}
-			.b_items{
+
+			.b_items {
 				margin-top: 20rpx;
 				display: flex;
 				justify-content: space-around;
 				flex-wrap: wrap;
-				&>view{
+
+				&>view {
 					width: 25%;
 					margin-top: 40rpx;
 					display: flex;
 					flex-direction: column;
 					align-items: center;
-					text{
+
+					text {
 						font-size: 40rpx;
 						font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
 						font-weight: bold;
 						color: #FFFFFF;
-						&:last-child{
+
+						&:last-child {
 							font-size: 26rpx;
 							font-family: PingFang SC, PingFang SC;
 							font-weight: 400;
@@ -349,24 +371,27 @@
 				}
 			}
 		}
-		
-		.title{
+
+		.title {
 			width: 100%;
 			padding: 30rpx 30rpx 10rpx;
 			box-sizing: border-box;
 			display: flex;
 			align-items: center;
 			justify-content: space-between;
-			&>text{
+
+			&>text {
 				font-size: 32rpx;
 				font-family: PingFang SC, PingFang SC;
 				font-weight: 800;
 				color: #333333;
 			}
-			&>view{
+
+			&>view {
 				display: flex;
 				align-items: center;
-				text{
+
+				text {
 					font-size: 24rpx;
 					font-family: PingFang SC, PingFang SC;
 					font-weight: 400;
@@ -375,13 +400,14 @@
 				}
 			}
 		}
-	
-		.card{
+
+		.card {
 			width: calc(100% - 60rpx);
 			background: #FFFFFF;
 			border-radius: 20rpx 20rpx 20rpx 20rpx;
 			margin: 20rpx 30rpx 0;
-			.c_top{
+
+			.c_top {
 				width: 100%;
 				padding: 30rpx;
 				border-bottom: 1rpx solid #F1F1F1;
@@ -389,40 +415,47 @@
 				display: flex;
 				align-items: center;
 				justify-content: space-between;
-				text{
+
+				text {
 					font-size: 28rpx;
 					font-family: PingFang SC, PingFang SC;
 					font-weight: bold;
 					color: #333333;
-					&:last-child{
+
+					&:last-child {
 						font-size: 24rpx;
 						font-family: PingFang SC, PingFang SC;
 						font-weight: 400;
 					}
 				}
 			}
-			.c_middle{
+
+			.c_middle {
 				width: 100%;
 				padding: 30rpx;
 				border-bottom: 1rpx solid #F1F1F1;
 				box-sizing: border-box;
 				display: flex;
 				position: relative;
-				image{
+
+				image {
 					width: 180rpx;
 					height: 180rpx;
 					border-radius: 20rpx;
 				}
-				.cm_info{
+
+				.cm_info {
 					padding-left: 20rpx;
-					.cmi_title{
+
+					.cmi_title {
 						font-size: 28rpx;
 						font-family: PingFang SC, PingFang SC;
 						font-weight: bold;
 						color: #333333;
 						padding-bottom: 11rpx;
 					}
-					.cmi_pre{
+
+					.cmi_pre {
 						margin-top: 10rpx;
 						display: flex;
 						align-items: center;
@@ -430,12 +463,14 @@
 						font-family: PingFang SC, PingFang SC;
 						font-weight: 400;
 						color: #777777;
-						span{
+
+						span {
 							margin-left: 20rpx;
 						}
 					}
 				}
-				.cm_price{
+
+				.cm_price {
 					font-size: 32rpx;
 					font-family: PingFang SC, PingFang SC;
 					font-weight: bold;
@@ -446,14 +481,15 @@
 					right: 30rpx;
 				}
 			}
-			
-			.c_bottom{
+
+			.c_bottom {
 				width: 100%;
 				padding: 30rpx;
 				box-sizing: border-box;
 				display: flex;
 				justify-content: flex-end;
-				.btn{
+
+				.btn {
 					width: 160rpx;
 					height: 56rpx;
 					background: #1372FF;
@@ -464,26 +500,29 @@
 					font-family: PingFang SC, PingFang SC;
 					font-weight: 400;
 					color: #FFFFFF;
-					&.btn_xq{
+
+					&.btn_xq {
 						background: #FFFFFF;
 						border: 1rpx solid #D1D1D1;
 						font-size: 24rpx;
 						color: #999999;
 					}
-					&.btn_jj{
+
+					&.btn_jj {
 						background: #FFFFFF;
 						border: 1rpx solid #F9423A;
 						font-size: 24rpx;
 						color: #FA6760;
 					}
-					&:last-child{
+
+					&:last-child {
 						margin-left: 20rpx;
 					}
 				}
 			}
 		}
-		
-		.empty{
+
+		.empty {
 			width: 100%;
 			text-align: center;
 			padding-top: 100rpx;
@@ -492,36 +531,37 @@
 			font-weight: 400;
 			color: #999999;
 		}
-		
+
 		.red {
 			color: #F9423A !important;
 		}
-		
+
 		.green {
 			color: #39CE77 !important;
 		}
-		
+
 		.blue {
 			color: #1372FF !important;
 		}
-		
+
 		.grey {
 			color: #4C5F76 !important;
 		}
-		
+
 		.orange {
 			color: #FF9100 !important;
 		}
 	}
-	
-	/deep/.u-nav-slot{
-		&>text{
+
+	/deep/.u-nav-slot {
+		&>text {
 			font-size: 34rpx;
 			font-family: PingFang SC, PingFang SC;
 			font-weight: bold;
 			color: #FFFFFF;
 		}
-		.u-icon{
+
+		.u-icon {
 			margin: 8rpx 0 0 20rpx;
 		}
 	}

+ 15 - 7
pages/house/orderInfo.vue

@@ -24,7 +24,9 @@
 				<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>
+						<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>
@@ -101,10 +103,12 @@
 			</view>
 		</u-modal>
 		<!-- 确认订单 -->
-		<u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true" @cancel="show2=false">
+		<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 :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
+			@cancel="show3=false">
 		</u-modal>
 	</view>
 </template>
@@ -117,12 +121,12 @@
 					fontSize: '34rpx',
 					fontWeight: "bold",
 				},
-				h:uni.getSystemInfoSync().windowHeight - 87,
+				h: uni.getSystemInfoSync().windowHeight - 87,
 				mt: uni.getSystemInfoSync().statusBarHeight + 44,
 				show: false,
 				show2: false,
 				show3: false,
-				
+
 				check: {
 					initiator: 1,
 					refundReason: "",
@@ -145,7 +149,7 @@
 				this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
 					if (res.data.code == 0) {
 						this.orderInfo = res.data.data
-						
+
 					}
 				})
 			},
@@ -157,10 +161,14 @@
 					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 '状态异常'
 				}
@@ -172,7 +180,7 @@
 					url: '/pages/house/stayCheck?orderInfo=' + list,
 					events: {
 						addSuccess: data => {
-							this.orderInfo.detailFormList[0].checkInPersonList=data.data||[];
+							this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
 							console.log(this.orderInfo.detailFormList[0].checkInPersonList)
 						}
 					},

+ 12 - 9
pagesMy/orderList/orderList.vue

@@ -13,9 +13,13 @@
 			<view v-if="dataList.length>0" class="card" v-for="item,index  in dataList" :key="index">
 				<view class="header">
 					<span style="font-weight: 700;">订单号:{{item.orderCode}}</span>
-					<text v-if='item.orderStatus==-1&&item.status==1' class="orange">待确认</text>
-					<text v-else-if='item.status==0&&item.orderStatus==-1' class="red">待支付</text>
-					<text v-else-if='item.orderStatus==1&&item.status==1' class="green">已预订</text>
+					<text v-if='item.orderStatus==-1' class="orange">待确认</text>
+					<text v-else-if='item.orderStatus==-2' class="red">待支付</text>
+					<text v-else-if='item.orderStatus==1' class="green">已预订</text>
+					<text v-else-if='item.orderStatus==5' class="green">已退款</text>
+					<text v-else-if='item.orderStatus==4' class="green">已取消</text>
+					<text v-else-if='item.orderStatus==2' class="green">已入住</text>
+					<text v-else-if='item.orderStatus==3' class="green">已退房</text>
 					<text v-else :class="statusClass[item.orderStatus]">{{status[item.orderStatus]}}</text>
 				</view>
 				<view class="mainContent">
@@ -112,7 +116,7 @@
 						name: '已预订'
 					},
 					{
-						name: '已取消'
+						name: '已退款'
 					},
 				],
 			}
@@ -143,7 +147,7 @@
 							this.dataList[index].arriveDate = i.arriveDate.slice(0, 10)
 							this.dataList[index].leaveDate = i.leaveDate.slice(0, 10)
 						})
-						console.log(this.dataList,'this.dataList');
+						console.log(this.dataList, 'this.dataList');
 					} else {
 						uni.showToast({
 							title: res.data.msg,
@@ -173,8 +177,6 @@
 							icon: 'none'
 						})
 					}
-
-
 				}))
 			},
 			handleDetail(item) {
@@ -193,13 +195,14 @@
 						this.getOrderList(-1)
 						break
 					case 2:
-						this.getOrderByStatusList()
+						// this.getOrderByStatusList(-2)
+						this.getOrderList(-2)
 						break
 					case 3:
 						this.getOrderList(1)
 						break
 					case 4:
-						this.getOrderList(4)
+						this.getOrderList(5)
 						break
 				}
 			},