lifanzai 9 months ago
parent
commit
077970261a
2 changed files with 54 additions and 38 deletions
  1. 53 37
      pages/my/houseList.vue
  2. 1 1
      pages/my/roomType.vue

+ 53 - 37
pages/my/houseList.vue

@@ -22,27 +22,24 @@
 					<text style="font-size: 30rpx; " >是否上架</text>
 				</view>
 				<view style="margin-right: 30rpx;">
-					<u-switch v-model="checked" size="50" active-color="#07C160" ></u-switch>
+					<u-switch v-model="checked" size="50" active-color="#07C160"> </u-switch>
 				</view>
 			</view>
 			<!-- 图片上传
 			 -->
 			 <view class="uploadPic">
 			 	<view style=" margin-left: 30rpx;">
-					<text style="font-size: 32rpx; font-weight: 700; ">封面图片(0/1)</text>
-			 		
+					<text style="font-size: 32rpx; font-weight: 700; ">封面图片(0/1)</text>		 		
 			 	</view>
 				<view style="margin-top: 20rpx; margin-left: 30rpx; color: #777; font-size: 24rpx;">
 					<text>仅能上传1张,需展示房间内容</text>
 				</view>
 				<view class="pic">
 					<!-- 图片 -->
-							<img @click="handelUpload" ref="pic-upload" src="https://img.51miz.com/Element/00/77/24/47/cd39208d_E772447_a1d65d72.png" style="width: 190rpx; height: 120rpx;" />
-					<view v-show="false" >
-						<u-upload :action="action" :file-list="fileList" >
-						</u-upload>
+					<u-upload>
 						
-					</view>
+							<img  src="https://img.51miz.com/Element/00/77/24/47/cd39208d_E772447_a1d65d72.png" style="width: 190rpx; height: 120rpx;" />			
+					</u-upload>
 				</view>
 				
 			 </view>
@@ -149,15 +146,15 @@
 			 	 <view class="HouseListTitleInfo" >
 			 	 	<text style="font-size: 32rpx; font-weight: 700;">房间列表</text>
 					<text style="font-size: 24rpx; color: #777;">共8个房间</text>
-			 	 </view>
+			 	</view>
 				 <!-- 房间号 -->
 				 <view class="priceBoxWeek" v-for="(room,index) in form.roomFloor" :key="index">
 				 	<view class="weekendBox" style="display: flex; justify-content: space-between;">						
 						<view style="display: flex;">
-							<text> 楼层:</text><input style="width: 70rpx;" v-model="room.floor" type="text" />
+							<text style="font-size: 30rpx;"> 楼层:</text><input style="width: 70rpx; margin-bottom: 5rpx; font-size: 28rpx;" v-model="room.floor" type="text" />
 						</view>
 						<view style="display: flex;">
-								<text > 房间号:</text><input style="width: 70rpx;"  v-model="room.roomNumber" type="text" />
+								<text style="font-size: 30rpx;" > 房间号:</text><input style="width: 70rpx; margin-bottom: 5rpx; font-size: 28rpx;"  v-model="room.roomNumber" type="text" />
 						</view>
 						
 				 		<view style="display: flex; margin-top: 10rpx;" @click="delRoom(index)">
@@ -165,18 +162,13 @@
 				 		</view>
 				 	</view>
 				 </view>
-				 
-				
-			 </view>
-			 
-			 <!-- 添加按钮 -->
-			 <view class="submit" @click="addRoom">
+			 </view>		 
+			<view class="submit" @click="addRoom">
 			 	<u-icon name="plus-circle" color=" #1372FF"></u-icon>
 				<text style="color: #1372FF; font-size: 30rpx;">添加房间</text>
-			 </view>
-			 
+			 </view>					 
 			 <!-- 确定添加按钮 -->
-			 <view class="addSubmit" @click="addNewRoom">
+			<view class="addSubmit" @click="addNewRoom">
 				 
 			 	<text style="line-height: 96rpx; margin-left:310rpx; font-size: 32rpx; color: #fff;">确定</text>
 			 </view>
@@ -191,18 +183,16 @@
 			return{
 				
 				weekedChecked:false,
-				action: '',//图片服务器地址
+				action: 'https://i.ringzle.com/island-cloud-server',//图片服务器地址
 							fileList: [
 								{
 									url: '',
 								}
 							],
-							id:'',
-							// roomTypeInfo:{},
-				
+							id:'',//houseBaseId				
 					checked:true,
 				form:{
-					isPutAway:1,
+					isPutAway:'',
 					homestayId:'',
 					mondayPrice:'',
 					tuesdayPrice:'',
@@ -231,17 +221,25 @@
 			// console.log(this.id)
 			this.getTypeInfo()
 			
+		},
+		computed:{
+			
 		},
 		methods:{
-			// change(status) {
-			// 				console.log(status);
-			// 			},
+			change(status) {
+							console.log(status);
+						},
 			// 添加&编辑房屋
 			addNewRoom(){
-			
+					if(this.checked===true){
+						this.form.isPutAway=1
+					}else{
+						this.form.isPutAway=0
+					}
+					// console.log(this.form)
 				if(!this.id){
 					this.$api.post('/merchant/hotel/mine/addHouseBase',this.form).then(res=>{
-						console.log(res)
+						// console.log(res)
 						if(res.data.code===0){
 							this.$showToast('添加成功');
 							setTimeout(()=>{
@@ -254,8 +252,17 @@
 					console.log('这是')
 				}else{
 					// console.log('这是修改')
+					// if(this.)
 					this.$api.put('/merchant/hotel/mine/updHouseBase',this.form).then(res=>{
-						console.log('修改成功')
+						// console.log('修改成功')
+						if(res.data.code===0){
+							this.$showToast('添加成功')
+							setTimeout(()=>{
+								uni.reLaunch({
+									url:'/pages/my/roomType'
+								})
+							},1500)
+						}
 					})
 					
 				}
@@ -269,18 +276,20 @@
 			delRoom(index){
 				this.form.roomFloor.splice(index,1)
 			},
-			handelUpload(){
-				 this.$refs['pic-upload'].click() 
-			},
+		
 			// 获取当前房型信息
 			getTypeInfo(){
+				if(this.id){
 				this.$api.get(`/merchant/hotel/mine/getHouseBaseInfo/${this.id}`).then((res)=>{
 					// console.log(res)
 					if(res.data.code===0){
-						this.form=res.data.data
-						// console.log(this.roomTypeInfo)
+						this.form=res.data.data				
 					}
 				})
+					
+				}else{
+					return
+				}
 			}
 		}
 		
@@ -354,7 +363,7 @@
 		margin-top: 20rpx;
 		width: 190rpx;
 		height: 120rpx;
-		background-color: pink;
+		// background-color: pink;
 	}
 	// .custom-upload-button{
 	// 	width: 190rpx;
@@ -450,4 +459,11 @@
 		    background-color: #1372FF;
 			border-radius: 48rpx;
 	}
+	.uploadPicPic{
+		position: relative;
+		top: -96rpx;
+	}
+	.u-upload__deletable[data-v-69e2a36e] {
+		width: 0 !important;
+	}
 </style>

+ 1 - 1
pages/my/roomType.vue

@@ -64,7 +64,7 @@
 				uni.navigateTo({
 					url:`/pages/my/houseList?houseBaseId=${houseBaseId}`
 				})
-				// console.log(houseBaseId)
+				console.log(houseBaseId)
 			}
 		}
 	}