|
@@ -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;
|
|
|
}
|
|
|
}
|
|
|
}
|