Browse Source

feat: 订单bug

2912631854@qq.com 1 year ago
parent
commit
38d9206cbb

+ 2 - 1
pages.json

@@ -276,7 +276,8 @@
 					"path": "stayInfo/stayInfo",
 					"style": {
 						"navigationBarTitleText": "酒店民宿信息 ",
-						"enablePullDownRefresh": false
+						"enablePullDownRefresh": false,
+						"navigationStyle": "custom"
 					}
 				}, {
 					"path": "stayInfo/roomPosition",

+ 3 - 7
pages/house/createOrder.vue

@@ -30,7 +30,7 @@
 		<view class="box">
 			<view class="tit tit2">入住登记<u-icon @click="goStayCheck()" name="plus-circle" label="添加入住人"
 					labelColor="#1372FF" labelSize="24" color="1372FF" size="30"></u-icon></view>
-			<view class="perItem" v-for="(item,index) in dataForm.detailFormList[0].checkInPersonList">
+			<view class="perItem" v-for="(item,index) in dataForm.detailFormList[0].checkInPersonList" :key="index">
 				<text>{{item.checkInName}}</text>
 				<text style="margin-left: 40px;">{{item.idCard}}</text>
 				<u-icon name="close-circle-fill" color="#ddd" size="30" @click="delPer(index)"></u-icon>
@@ -243,7 +243,6 @@
 				if (opt.orderStatus) {
 					this.orderStatus = opt.orderStatus;
 				}
-				console.log(this.orderStatus)
 				this.dataForm.id = opt.id;
 				this.getInfo2()
 			} else {
@@ -318,7 +317,6 @@
 					events: {
 						addSuccess: data => {
 							this.dataForm.detailFormList[0].checkInPersonList = data.data || [];
-							console.log(this.dataForm.detailFormList[0].checkInPersonList)
 						}
 					},
 				})
@@ -386,8 +384,8 @@
 					this.$showToast('请输入姓名');
 					return
 				}
-				if(!this.dataForm.guestPhone){
-					this.$showToast('请输入手机号');
+				if(!this.$u.test.mobile(this.dataForm.guestPhone)){
+					this.$showToast('请输入正确手机号');
 					return
 				}
 				if(!this.dataForm.guestSourceName){
@@ -451,7 +449,6 @@
 			},
 			getInfo2() { //详情信息
 				this.$api.get('/merchant/hotel/order/getOrderDetail/' + this.dataForm.id).then(res => {
-					console.log(res)
 					if (res.data.code == 0) {
 						this.dataForm = {
 							...this.dataForm,
@@ -469,7 +466,6 @@
 			// 房型列表
 			getInfo() {
 				this.$api.post('/merchant/hotel/order/getRoomInfoList', this.roomId).then(res => {
-					console.log(res)
 					if (res.data.code == 0) {
 						this.dataForm.detailFormList[0].roomIds = res.data.data.roomIds;
 						this.dataForm.detailFormList[0].roomNumber = res.data.data.roomNumber;

+ 0 - 3
pages/house/index.vue

@@ -221,7 +221,6 @@
 							obj = roomId[i];
 						}
 					}
-					console.log(obj)
 					//已预订,已入住 待确认 待支付
 					if (obj.status == 1 || obj.status == 2 || obj.status == -1 || obj.status == -2) {
 						let orderId = obj.orderId;
@@ -234,13 +233,11 @@
 						this.areaShow = true;
 						this.checkDataRoomId = [obj.id];
 						this.checkStatus = obj.status;
-						console.log(obj.id)
 					}
 				}
 			},
 			//确定关房
 			passengerConfirm(e) {
-				console.log(this.checkDataRoomId)
 				let status = this.area[e.indexs[0]].id;
 				this.$api.post('/merchant/hotel/room/state/updRoomState', {
 					roomIds: this.checkDataRoomId,

+ 15 - 11
pages/house/orderInfo.vue

@@ -70,11 +70,11 @@
 
 			</u-cell-group>
 			<!-- 按钮 -->
-			<view class="button">
+			<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" v-if="orderInfo.status==1">确认订单</button>
+					<button class="goRoom" @click="show2=true">确认订单</button>
 				</template>
 				<!-- 已预订 -->
 				<template v-if="orderInfo.orderStatus==1">
@@ -121,7 +121,7 @@
 					fontSize: '34rpx',
 					fontWeight: "bold",
 				},
-				h: uni.getSystemInfoSync().windowHeight - 87,
+				h: uni.getSystemInfoSync().windowHeight,
 				mt: uni.getSystemInfoSync().statusBarHeight + 44,
 				show: false,
 				show2: false,
@@ -133,9 +133,11 @@
 					status: -1,
 					orderCode: "",
 				},
-				showRuzhu:false,
+				showRuzhu: false,
 				orderId: '',
-				orderInfo: {}
+				orderInfo: {
+					detailFormList: []
+				}
 			}
 		},
 		onLoad(opt) {
@@ -150,8 +152,9 @@
 				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;
+						if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
+								'yyyy-MM-dd')) {
+							this.showRuzhu = true;
 						}
 					}
 				})
@@ -184,7 +187,6 @@
 					events: {
 						addSuccess: data => {
 							this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
-							console.log(this.orderInfo.detailFormList[0].checkInPersonList)
 						}
 					},
 				})
@@ -314,15 +316,17 @@
 
 	.button {
 		position: fixed;
-		bottom: 40rpx;
+		bottom: 0;
 		height: 96rpx;
-		width: 690rpx;
-		// background-color: teal;
+		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 {

+ 12 - 0
pages/house/stayCheck.vue

@@ -148,10 +148,22 @@
 				})
 			},
 			conform() {
+				this.checkInPersonList.forEach((item)=>{
+					console.log(1)
+					if(!this.$u.test.mobile(item.checkInPhone)){
+						this.$showToast('请输入正确手机号');
+						return
+					}
+					if(!this.$u.test.idCard(item.idCard)){
+						this.$showToast('请输入正确身份证号');
+						return
+					}
+				})
 				let list = this.checkInPersonList.filter((item) => item.idCard && item.checkInName);
 				this.getOpenerEventChannel().emit('addSuccess', {
 					'data': list
 				});
+				//
 				uni.navigateBack();
 				// this.$api.post('/merchant/hotel/order/updOrder', this.orderInfo).then(res => {
 				// 	if (res.data.code == 0) {

+ 1 - 0
pages/login/index.vue

@@ -49,6 +49,7 @@
 								that.$api.get('/sys/user/info').then(resu=>{
 									if(resu.data.code===0){
 										that.$showToast('登录成功');
+										uni.setStorageSync('userInfo',resu.data.data);
 										setTimeout(()=>{
 											uni.reLaunch({
 												url:'/pages/login/select?userInfo='+encodeURIComponent(JSON.stringify(resu.data.data))

+ 3 - 3
pages/login/select.vue

@@ -15,7 +15,7 @@
 	export default {
 		data() {
 			return {
-				userInfo: null,
+				//userInfo: null,
 				merchantId: '',
 				types: [],
 				list: []
@@ -25,7 +25,7 @@
 			this.getType();
 		},
 		onLoad(option) {
-			if (option.userInfo) this.userInfo = JSON.parse(decodeURIComponent(option.userInfo));
+			//if (option.userInfo) this.userInfo = JSON.parse(decodeURIComponent(option.userInfo));
 			this.getList();
 		},
 		methods: {
@@ -51,7 +51,7 @@
 				})
 			},
 			toHome(item) { //1711268640588517378   1721450548101648385
-				uni.setStorageSync('userInfo', JSON.stringify(this.userInfo));
+				//uni.setStorageSync('userInfo', JSON.stringify(this.userInfo));
 				if (item.merchantType == 2) {
 					uni.setStorageSync('homestayId', item.merchantId);
 					uni.setStorageSync('merchantId','');

+ 87 - 192
pagesMy/stayInfo/stayInfo.vue

@@ -1,92 +1,34 @@
 <template>
-	<view class="pages">
+<view class="pages" :style="{'height':(h)+'px','padding-top':mt+'px'}">
+		<c-nav-bar title="酒店民宿信息" :showIcon="true"></c-nav-bar>
 		<view class="content">
-			<view class="card">
-				<view class="card1" @click="goToPosition()">
-					<text>位置定位</text>
-					<u-icon name="arrow-right" size="24"></u-icon>
-				</view>
+			<view class="card" @click="goToPosition()">
+				<text class="label">位置定位</text>
+				<u-icon name="arrow-right" size="24"></u-icon>
 			</view>
 			<view class="card">
-				<view class="card1">
-					<text style="margin-right: 30rpx;">联系电话</text>
-					<u--input placeholder="请输入内容" border="none" v-model="stayInfo.landlinePhone"></u--input>
-				</view>
+				<text class="label">联系电话</text>
+				<u--input inputAlign="right" placeholder="请输入内容" border="none" v-model="stayInfo.landlinePhone" style="text-align: right;"></u--input>
 			</view>
-			<view class="card">
-				<view class="card1">
-					<text>酒店简介</text>
-				</view>
-				<view style="margin-top: 20rpx;">
-					<span>
-						<u--textarea border='none' :maxlength='300' count v-model="stayInfo.introduction"
-							placeholder="请输入酒店简介" height='250'>
-						</u--textarea>
-
-						<!-- <u-parse :content="stayInfo.introduction"></u-parse> -->
-
-					</span>
+			<view class="card c2">
+				<view class="tit">酒店简介</view>
+				<view>
+					<u--textarea customStyle="font-size:28rpx;line-height:28rpx" border='none' maxlength="300" count v-model="stayInfo.introduction" :value="stayInfo.introduction"
+						placeholder="请输入酒店简介" height='360' ></u--textarea>
 				</view>
 			</view>
-			<view class="card" style="padding: 0;">
-				<view>
-					<u-collapse :border='false' accordion @change="change" @close="close" @open="open">
-						<u-collapse-item title="环境\内饰照片(0/10)" name="Docs guide">
-							<text class="collapseTitle">至少上传1张,建议上传5-10张,需展示完整内饰</text>
-							<view class="upload" v-if="stayInfo.picList.length==0">
-								<u-upload :fileList="stayInfo.picList" multiple :maxCount="10"
-									:maxSize="10 * 1024 * 1024" @afterRead="afterRead" @delete="deletePic"
-									@oversize="overSize">
-									<view class="upload-one">
-										<image
-											src="https://i.ringzle.com/file/20240103/1d3cf8e7ad184d17a253b3b08dfd0c53.png"
-											mode="aspectFill"></image>
-									</view>
-								</u-upload>
-							</view>
-							<view class="uploads" v-else>
-								<u-upload :fileList="stayInfo.picList" multiple :maxCount="10"
-									:maxSize="10 * 1024 * 1024" @afterRead="afterRead" @delete="deletePic"
-									@oversize="overSize">
-									<view class="upload-image">
-										<image
-											src="https://i.ringzle.com/file/20240103/1d3cf8e7ad184d17a253b3b08dfd0c53.png"
-											mode="aspectFill"></image>
-									</view>
-								</u-upload>
-							</view>
-						</u-collapse-item>
-						<u-collapse-item title="环境照片(0/10)" name="Docs guide">
-							<text class="collapseTitle">至少上传1张,建议上传5-10张,需展示完整环境</text>
-							<view class="upload" v-if="fileList1.length==0">
-								<u-upload :fileList="fileList1" multiple :maxCount="10" :maxSize="10 * 1024 * 1024"
-									@afterRead="afterRead" @delete="deletePic" @oversize="overSize">
-									<view class="upload-one">
-										<image
-											src="https://i.ringzle.com/file/20240103/1d3cf8e7ad184d17a253b3b08dfd0c53.png"
-											mode="aspectFill">
-										</image>
-									</view>
-								</u-upload>
-							</view>
-							<view class="uploads" v-else>
-								<u-upload :fileList="fileList1" multiple :maxCount="10" :maxSize="10 * 1024 * 1024"
-									@afterRead="afterRead" @delete="deletePic" @oversize="overSize">
-									<view class="upload-image">
-										<image
-											src="https://i.ringzle.com/file/20240103/1d3cf8e7ad184d17a253b3b08dfd0c53.png"
-											mode="aspectFill"></image>
-									</view>
-								</u-upload>
-							</view>
-						</u-collapse-item>
-					</u-collapse>
+			<view class="card c2">
+				<view class="tit">内饰照片</view>
+				<view class="imgs">
+					<!-- <image src="" v-for="(item,index) in imgUrlList" :key="index"></image> -->
+					<u-upload ref="uUpload"  uploadText="上传图片" :fileList="imgUrlList" :maxSize="10 * 1024 * 1024" width="180" 
+						height="120" @afterRead="afterRead" @delete="deletePic">
+					</u-upload>
 				</view>
 			</view>
-
 		</view>
 		<view class="bottom">
-			<view class="btn">
+			<view class="btn" @click="save()">
 				确定
 			</view>
 		</view>
@@ -97,6 +39,7 @@
 	export default {
 		data() {
 			return {
+				homestayId: uni.getStorageSync('homestayId')||0,
 				value: '',
 				value1: '',
 				fileList: [],
@@ -104,9 +47,9 @@
 				imgUrlList: [],
 				fileList2: [],
 				stayInfo: {
-					// picList: []
+					picList: []
 				},
-				picList: []
+
 			}
 		},
 		onLoad() {
@@ -131,51 +74,32 @@
 
 			goToPosition() {
 				const qwe = JSON.stringify(this.stayInfo)
-				console.log(qwe, 'qweqweqweqwe');
 				uni.navigateTo({
 					url: '/pagesMy/stayInfo/roomPosition?item=' + JSON.stringify(this.stayInfo)
 				})
 			},
 			getStayInfo() {
-				this.$api.get('/merchant/hotel/mine/getMerchantHomestayInfo/' + '1711268640588517378').then(res => {
+				this.$api.get('/merchant/hotel/mine/getMerchantHomestayInfo/'+this.homestayId).then(res => {
 					if (res.data.code == 0) {
-						this.stayInfo = res.data.data
-						// this.stayInfo.introduction.forEach(item => {
-						// 	this.substrings1 = item.content.split('\n');
-						// })
-					} else {
-						uni.showToast({
-							title: res.data.msg,
+						this.stayInfo = res.data.data;
+						this.stayInfo.picList.forEach((item) => {
+							this.imgUrlList.push({
+								url: item
+							})
 						})
-						setTimeout(() => {
-							uni.navigateBack()
-						}, 1500)
 					}
-					console.log(res, 'res------');
 				})
-			},
-			change() {
-
-			},
-			close() {
-
-			},
-			open() {
-
 			},
 			// 删除图片
 			deletePic(event) {
-				console.log('jinlaile1');
-				this[`picList{event.name}`].splice(event.index, 1)
+				this.imgUrlList.splice(event.index, 1)
 			},
 			// 新增图片
 			async afterRead(event) {
-				console.log('jinlaile2', event);
-				// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
 				let lists = [].concat(event.file)
-				let fileListLen = this.picList.length
+				let fileListLen = this.imgUrlList.length
 				lists.map((item) => {
-					this.picList.push({
+					this.imgUrlList.push({
 						...item,
 						status: 'uploading',
 						message: '上传中'
@@ -183,20 +107,19 @@
 				})
 				for (let i = 0; i < lists.length; i++) {
 					const result = await this.uploadFilePromise(lists[i].url)
-					let item = this.picList[fileListLen]
-					this.picList.splice(fileListLen, 1, Object.assign(item, {
+					let item = this.imgUrlList[fileListLen]
+					this.imgUrlList.splice(fileListLen, 1, Object.assign(item, {
 						status: 'success',
 						message: '',
 						url: result
 					}))
 					fileListLen++
 				}
+				console.log(this.imgUrlList)
 			},
 			uploadFilePromise(url) {
-				console.log('jinlaile3');
 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
-						// url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
 						url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
 						filePath: url,
 						name: 'file',
@@ -204,61 +127,30 @@
 							user: 'test'
 						},
 						success: (res) => {
-							setTimeout(() => {
-								resolve(res.data.data)
-							}, 1000)
+							console.log(res)
+							let data = JSON.parse(res.data);
+							console.log(data)
+							resolve(data.data.url)
 						}
 					});
 				})
 			},
-			// 	deletePic(event) {
-			// 		this.fileList.splice(event.index, 1);
-			// 	},
-			// 	overSize(e) {
-			// 		uni.$u.toast('上传图片大小不能超过10MB!');
-			// 	},
-			// 	// 新增图片
-			// 	async afterRead(event) {
-			// 		console.log('jinlaile');
-			// 		// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
-			// 		let Lists = [].concat(event.file);
-			// 		let fileListLen = this.fileList.length;
-			// 		Lists.map((item) => {
-			// 			this.picList.push(
-			// 				item.url,
-			// 			)
-			// 		})
+			save(){
+				if(!this.$u.test.mobile(this.stayInfo.landlinePhone)){
+					this.$showToast('请输入正确手机号');
+					return
+				}
+				this.stayInfo.picList=[];
+				this.imgUrlList.forEach((i)=>{
+					if(i.url){
+						this.stayInfo.picList.push(i.url)
+					}
+				})
+				this.$api.post('/merchant/hotel/mine/updMHomestayInfo',this.stayInfo).then(res=>{
+					console.log(res)
+				})
+			}
 
-			// 		for (let i = 0; i < Lists.length; i++) {
-			// 			const result = await this.uploadFilePromise(Lists[i].url);
-			// 			wx.getImageInfo({
-			// 				src: Lists[i].url,
-			// 				success: res => {
-			// 					this.imgUrlList.push(result)
-			// 				}
-			// 			})
-			// 		}
-			// 	},
-			// 	//上传图片
-			// 	uploadFilePromise(url) {
-			// 		return new Promise((resolve, reject) => {
-			// 			let a = uni.uploadFile({
-			// 				url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload',
-			// 				filePath: url,
-			// 				name: 'file',
-			// 				header: {
-			// 					token: wx.getStorageSync('access_token')
-			// 				},
-			// 				success: (res) => {
-			// 					let data = JSON.parse(res.data);
-			// 					this.fileList.push({
-			// 						url: data.data.url
-			// 					})
-			// 					resolve(data.data.url);
-			// 				}
-			// 			});
-			// 		})
-			// 	},
 		}
 	}
 </script>
@@ -267,24 +159,46 @@
 	/deep/.u-cell__body {
 		padding: 0;
 	}
+	::v-deep .u-icon__icon{
+		font-size: 40rpx!important;
+		margin-bottom: 10rpx;
+	} 	
+	::v-deep .u-upload__button__text{
+		color:#B9C2D0!important;
+		font-size: 20rpx!important;
+	}
 
 	::v-deep .u-cell__body {
 		padding: 0;
 	}
 
 	.pages {
-		height: 100vh;
 		background: #F9FAFC;
 
 		.content {
-			padding: 20rpx;
+			padding: 20rpx 30rpx;
 			height: 100vh;
 
 			.card {
 				background: #fff;
 				border-radius: 16rpx;
-				padding: 30rpx 33rpx;
+				padding: 30rpx;
 				margin-bottom: 20rpx;
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				&.c2{
+					display: block;
+				}
+				.label {
+					font-size: 30rpx;
+				}
+
+				.tit {
+					font-size: 30rpx;
+					font-weight: bold;
+					margin-bottom: 20rpx;
+				}
 
 				.upload {
 					margin-top: 48rpx;
@@ -307,46 +221,27 @@
 						}
 					}
 				}
-
-				.collapseTitle {
-					font-size: 22rpx;
-					color: #a5a5a5;
-					margin-bottom: 20rpx;
-				}
-
-				.card1 {
-					display: flex;
-					flex-direction: row;
-					justify-content: space-between;
-					align-items: center;
-
-				}
 			}
 		}
 
 		.bottom {
-			position: absolute;
+			position: fixed;
 			bottom: 0;
-			height: 9%;
 			background: #fff;
 			width: 100%;
-			display: flex;
-			justify-content: center;
-			align-items: center;
-			padding: 0 30rpx;
+			padding: 20rpx 0 30rpx;
 			box-sizing: border-box;
-			flex-direction: column;
-
 			.btn {
 				background: #33AFFC;
 				color: white;
 				text-align: center;
-				height: 73rpx;
-				line-height: 73rpx;
+				height: 96rpx;
+				margin: 0 auto;
+				font-size: 34rpx;
+				line-height: 96rpx;
 				align-self: center;
-				border-radius: 35rpx;
-				width: 80%;
-
+				border-radius: 48rpx;
+				width: 690rpx;
 			}
 		}
 	}