|
@@ -41,8 +41,8 @@
|
|
|
<!-- 图片 -->
|
|
|
<u-upload :fileList="fileList" multiple :maxCount="1" :maxSize="1 * 1024 * 1024"
|
|
|
@afterRead="afterRead" @oversize="overSize" width="120" height="120">
|
|
|
-
|
|
|
</u-upload>
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
@@ -125,7 +125,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <view class="priceBoxWeek" v-if="weekedChecked">
|
|
|
+ <view class="priceBoxWeek" v-if="weekedChecked">
|
|
|
<view class="weekendBox">
|
|
|
<view>
|
|
|
<text style="font-size: 30rpx; margin-right: 90rpx; ">周五</text>
|
|
@@ -193,20 +193,24 @@
|
|
|
<u-icon name="plus-circle" color=" #1372FF"></u-icon>
|
|
|
<text style="color: #1372FF; font-size: 30rpx;">添加房间</text>
|
|
|
</view>
|
|
|
- <!-- 确定添加按钮 -->
|
|
|
- <view class="addSubmit" @click="addNewRoom">
|
|
|
- <text style="line-height: 96rpx; margin-left:310rpx; font-size: 32rpx; color: #fff;">确定</text>
|
|
|
+ <!-- 新增按钮 -->
|
|
|
+ <view class="btn-btn" @click="addNewRoom()">
|
|
|
+ <view class="btn">
|
|
|
+ 确定
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- 确定添加按钮 -->
|
|
|
- <view class="addSubmit" @click="addNewRoom">
|
|
|
-
|
|
|
- <text style="line-height: 96rpx; margin-left:310rpx; font-size: 32rpx; color: #fff;">确定</text>
|
|
|
- </view>
|
|
|
+ <!-- 新增按钮 -->
|
|
|
+ <view class="btn-btn" @click="addNewRoom()">
|
|
|
+ <view class="btn">
|
|
|
+ 确定
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
+ </view>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -219,7 +223,7 @@
|
|
|
fileList: [],
|
|
|
|
|
|
form: {
|
|
|
- price:'',
|
|
|
+ price: '',
|
|
|
homestayId: '',
|
|
|
mondayPrice: '',
|
|
|
tuesdayPrice: '',
|
|
@@ -230,7 +234,7 @@
|
|
|
sundayPrice: '',
|
|
|
name: '',
|
|
|
shortName: '',
|
|
|
- isPutaway:'',
|
|
|
+ isPutaway: '',
|
|
|
roomFloor: [{
|
|
|
floor: '',
|
|
|
roomNumber: ''
|
|
@@ -242,14 +246,17 @@
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- onLoad({id,houseBaseId}){
|
|
|
- this.form.homestayId=id
|
|
|
- // console.log(houseBaseId)
|
|
|
- this.id=houseBaseId
|
|
|
- // console.log(this.id)
|
|
|
- this.getTypeInfo()
|
|
|
-
|
|
|
- },
|
|
|
+ onLoad({
|
|
|
+ id,
|
|
|
+ houseBaseId
|
|
|
+ }) {
|
|
|
+ this.form.homestayId = id
|
|
|
+ // console.log(houseBaseId)
|
|
|
+ this.id = houseBaseId
|
|
|
+ // console.log(this.id)
|
|
|
+ this.getTypeInfo()
|
|
|
+
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 删除图片
|
|
|
deletePic(event) {
|
|
@@ -288,81 +295,123 @@
|
|
|
})
|
|
|
},
|
|
|
// 添加&编辑房屋
|
|
|
- addNewRoom(){
|
|
|
-
|
|
|
- // console.log(this.form)
|
|
|
- if(!this.id){
|
|
|
- if(this.checked===true){
|
|
|
- this.form.isPutaway=1
|
|
|
- }else{
|
|
|
- this.form.isPutaway=0
|
|
|
- }
|
|
|
- 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)
|
|
|
- }
|
|
|
+ addNewRoom() {
|
|
|
+
|
|
|
+ // console.log(this.form)
|
|
|
+ if (!this.id) {
|
|
|
+ if (this.checked === true) {
|
|
|
+ this.form.isPutaway = 1
|
|
|
+ } else {
|
|
|
+ this.form.isPutaway = 0
|
|
|
+ }
|
|
|
+ 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'
|
|
|
})
|
|
|
- console.log('这是')
|
|
|
- }else{
|
|
|
- // console.log('这是修改')
|
|
|
- // if(this.)
|
|
|
- if(this.checked===true){
|
|
|
- this.form.isPutaway=1
|
|
|
- }else{
|
|
|
- this.form.isPutaway=0
|
|
|
- }
|
|
|
- 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)
|
|
|
- }
|
|
|
+ }, 1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('这是')
|
|
|
+ } else {
|
|
|
+ // console.log('这是修改')
|
|
|
+ // if(this.)
|
|
|
+ if (this.checked === true) {
|
|
|
+ this.form.isPutaway = 1
|
|
|
+ } else {
|
|
|
+ this.form.isPutaway = 0
|
|
|
+ }
|
|
|
+ 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'
|
|
|
})
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- },
|
|
|
- // 添加房间
|
|
|
- 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.form=res.data.data
|
|
|
- }
|
|
|
+ }, 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.form = res.data.data
|
|
|
+ this.fileList.push({
|
|
|
+ url: res.data.data.cover
|
|
|
})
|
|
|
-
|
|
|
- }else{
|
|
|
- return
|
|
|
+ if (this.form.isPutaway == 1) {
|
|
|
+ this.checked = true
|
|
|
+ } else {
|
|
|
+ this.checked = false
|
|
|
}
|
|
|
}
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
+ .btn-btn {
|
|
|
+ width: 100%;
|
|
|
+ height: 136rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ padding: 30rpx 0 0;
|
|
|
+ // margin: 0 auto;
|
|
|
+ z-index: 999999;
|
|
|
+ // margin-top: 30rpx;
|
|
|
+ // margin-left: 30rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ margin: 0 auto;
|
|
|
+ width: 690rpx;
|
|
|
+ height: 96rpx;
|
|
|
+ background-color: #1372FF;
|
|
|
+ color: #fff;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 34rpx;
|
|
|
+ border-radius: 48rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .uicon-close {
|
|
|
+ font-size: 30rpx !important;
|
|
|
+ top: 8rpx !important;
|
|
|
+ }
|
|
|
+
|
|
|
.page {
|
|
|
background: #F3F4F4;
|
|
|
padding-bottom: 260rpx;
|
|
@@ -534,14 +583,16 @@
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
.addSubmit {
|
|
|
+ width: 100%;
|
|
|
position: fixed;
|
|
|
/* 固定定位 */
|
|
|
bottom: 20rpx;
|
|
|
/* 底部对齐 */
|
|
|
left: 0;
|
|
|
/* 可选:左对齐 */
|
|
|
- width: 690rpx;
|
|
|
+ // width: 690rpx;
|
|
|
/* 可选:宽度为 100% */
|
|
|
height: 96rpx;
|
|
|
margin-left: 30rpx;
|