|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view class="page" :style="{'height':(h-th)+'px','padding-top':mt+'px'}">
|
|
|
- <c-nav-bar title="房间列表" :showIcon="false" :titleStyle="titleStyle"></c-nav-bar>
|
|
|
+ <c-nav-bar title="房型信息" :showIcon="false" :titleStyle="titleStyle"></c-nav-bar>
|
|
|
<view class="body">
|
|
|
<!-- 房型信息 -->
|
|
|
|
|
@@ -22,27 +22,24 @@
|
|
|
<text style="font-size: 30rpx; " >是否上架</text>
|
|
|
</view>
|
|
|
<view style="margin-right: 30rpx;">
|
|
|
- <u-switch v-model="checked" size="50" @change="change(status)" 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">
|
|
|
<!-- 图片 -->
|
|
|
- <view v-show="false" >
|
|
|
- <u-upload :action="action" :file-list="fileList" >
|
|
|
- <!-- <img src="https://img.51miz.com/Element/00/77/24/47/cd39208d_E772447_a1d65d72.png" style="width: 190rpx; height: 120rpx;" /> -->
|
|
|
- </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,34 +146,29 @@
|
|
|
<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">
|
|
|
+ <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: 50rpx;" v-model="form.roomFloor[0].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: 50rpx;" v-model="form.roomFloor[0].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;">
|
|
|
+ <view style="display: flex; margin-top: 10rpx;" @click="delRoom(index)">
|
|
|
<u-icon name="trash"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
-
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- 添加按钮 -->
|
|
|
- <view class="submit">
|
|
|
+ </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>
|
|
@@ -189,16 +181,18 @@
|
|
|
export default{
|
|
|
data(){
|
|
|
return{
|
|
|
- checked:false,
|
|
|
+
|
|
|
weekedChecked:false,
|
|
|
- action: '',//图片服务器地址
|
|
|
+ action: 'https://i.ringzle.com/island-cloud-server',//图片服务器地址
|
|
|
fileList: [
|
|
|
{
|
|
|
url: '',
|
|
|
}
|
|
|
],
|
|
|
-
|
|
|
+ id:'',//houseBaseId
|
|
|
+ checked:true,
|
|
|
form:{
|
|
|
+ isPutAway:'',
|
|
|
homestayId:'',
|
|
|
mondayPrice:'',
|
|
|
tuesdayPrice:'',
|
|
@@ -220,27 +214,82 @@
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- onLoad({id}){
|
|
|
+ onLoad({id,houseBaseId}){
|
|
|
this.form.homestayId=id
|
|
|
- console.log(this.form.homestayId)
|
|
|
+ // console.log(houseBaseId)
|
|
|
+ this.id=houseBaseId
|
|
|
+ // console.log(this.id)
|
|
|
+ this.getTypeInfo()
|
|
|
+
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
|
|
|
},
|
|
|
methods:{
|
|
|
- // change(status) {
|
|
|
- // console.log(status);
|
|
|
- // },
|
|
|
+ change(status) {
|
|
|
+ console.log(status);
|
|
|
+ },
|
|
|
+ // 添加&编辑房屋
|
|
|
addNewRoom(){
|
|
|
- this.$api.post('/merchant/hotel/mine/addHouseBase',this.form).then(res=>{
|
|
|
- console.log(res)
|
|
|
+ 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)
|
|
|
+ if(res.data.code===0){
|
|
|
+ this.$showToast('添加成功');
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.reLaunch({
|
|
|
+ url:'/pages/my/roomType'
|
|
|
+ })
|
|
|
+ },1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('这是')
|
|
|
+ }else{
|
|
|
+ // console.log('这是修改')
|
|
|
+ // if(this.)
|
|
|
+ this.$api.put('/merchant/hotel/mine/updHouseBase',this.form).then(res=>{
|
|
|
+ // console.log('修改成功')
|
|
|
+ if(res.data.code===0){
|
|
|
+ this.$showToast('添加成功')
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.reLaunch({
|
|
|
+ url:'/pages/my/roomType'
|
|
|
+ })
|
|
|
+ },1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加房间
|
|
|
+ addRoom(){
|
|
|
+ const newRoom = {floor:'',roomNumber:''}
|
|
|
+ this.form.roomFloor.push(newRoom)
|
|
|
+ },
|
|
|
+ // 删除房间
|
|
|
+ delRoom(index){
|
|
|
+ this.form.roomFloor.splice(index,1)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取当前房型信息
|
|
|
+ getTypeInfo(){
|
|
|
+ if(this.id){
|
|
|
+ this.$api.get(`/merchant/hotel/mine/getHouseBaseInfo/${this.id}`).then((res)=>{
|
|
|
+ // console.log(res)
|
|
|
if(res.data.code===0){
|
|
|
- this.$showToast('添加成功');
|
|
|
- setTimeout(()=>{
|
|
|
- uni.reLaunch({
|
|
|
- url:'/pages/my/roomType'
|
|
|
- })
|
|
|
- },1500)
|
|
|
+ this.form=res.data.data
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ }else{
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -314,7 +363,7 @@
|
|
|
margin-top: 20rpx;
|
|
|
width: 190rpx;
|
|
|
height: 120rpx;
|
|
|
- background-color: pink;
|
|
|
+ // background-color: pink;
|
|
|
}
|
|
|
// .custom-upload-button{
|
|
|
// width: 190rpx;
|
|
@@ -410,4 +459,11 @@
|
|
|
background-color: #1372FF;
|
|
|
border-radius: 48rpx;
|
|
|
}
|
|
|
+ .uploadPicPic{
|
|
|
+ position: relative;
|
|
|
+ top: -96rpx;
|
|
|
+ }
|
|
|
+ .u-upload__deletable[data-v-69e2a36e] {
|
|
|
+ width: 0 !important;
|
|
|
+ }
|
|
|
</style>
|