123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <template>
- <view class="pages">
- <view class="content">
- <view class="card">
- <view class="card1" @click="goToPosition()">
- <text>位置定位</text>
- <text>></text>
- </view>
- </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>
- </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>
- </span>
- </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="环境照片" 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>
- </view>
- </view>
- <view class="bottom">
- <view class="btn">
- 确定
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- value: '',
- value1: '',
- fileList: [],
- fileList1: [],
- imgUrlList: [],
- fileList2: [],
- stayInfo: {
- picList: []
- }
- }
- },
- onLoad() {
- this.getStayInfo()
- },
- methods: {
- 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 => {
- if (res.data.code == 0) {
- this.stayInfo = res.data.data
- } else {
- uni.showToast({
- title: res.data.msg,
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 1500)
- }
- console.log(res, 'res------');
- })
- },
- change() {
- },
- close() {
- },
- open() {
- },
- // 删除图片
- deletePic(event) {
- console.log('jinlaile1');
- this[`stayInfo.picList{event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- console.log('jinlaile2', event);
- // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this.stayInfo.picList.length
- lists.map((item) => {
- this.stayInfo.picList.push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this.stayInfo.picList[fileListLen]
- this.stayInfo.picList.splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- console.log('jinlaile3');
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
- filePath: url,
- name: 'file',
- formData: {
- user: 'test'
- },
- success: (res) => {
- setTimeout(() => {
- resolve(res.data.data)
- }, 1000)
- }
- });
- })
- },
- // 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,
- // )
- // })
- // 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>
- <style lang="scss" scoped>
- /deep/.u-cell__body {
- padding: 0;
- }
- ::v-deep .u-cell__body {
- padding: 0;
- }
- .pages {
- height: 100vh;
- background: #F9FAFC;
- .content {
- padding: 20rpx;
- height: 100vh;
- .card {
- background: #fff;
- border-radius: 16rpx;
- padding: 30rpx 33rpx;
- margin-bottom: 20rpx;
- .upload {
- margin-top: 48rpx;
- width: 100%;
- height: 200rpx;
- border-radius: 16rpx;
- background-color: #F5F8FA;
- display: flex;
- align-items: center;
- text-align: center;
- .upload-one {
- margin: 0 245rpx;
- width: 200rpx;
- height: 200rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .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;
- bottom: 0;
- height: 9%;
- background: #fff;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 0 30rpx;
- box-sizing: border-box;
- flex-direction: column;
- .btn {
- background: #33AFFC;
- color: white;
- text-align: center;
- height: 73rpx;
- line-height: 73rpx;
- align-self: center;
- border-radius: 35rpx;
- width: 80%;
- }
- }
- }
- </style>
|