|
@@ -1,35 +1,43 @@
|
|
|
<template>
|
|
|
- <view class="pages" :style="{'height':(h)+'px','padding-top':mt+'px'}">
|
|
|
- <c-nav-bar title="位置定位" :showIcon="true"></c-nav-bar>
|
|
|
+ <!-- <view class="pages" :style="{'height':(h)+'px','padding-top':mt+'px'}"> -->
|
|
|
+ <view class="pages">
|
|
|
+ <!-- <c-nav-bar title="位置定位" :showIcon="true"></c-nav-bar> -->
|
|
|
<view class="content">
|
|
|
<view class="card">
|
|
|
<view class="card1" @tap="open()">
|
|
|
- <text>所属城市
|
|
|
- <text style="margin-left: 30rpx;" v-if="str.name==undefined||str.name==''">请选择所属城市</text>
|
|
|
- <text style="margin-left: 30rpx;" v-else>{{str.name}}</text>
|
|
|
+ <text style="font-size: 30rpx; color: #333; font-weight: Regular; ">
|
|
|
+ <text>所属城市</text>
|
|
|
+ <text style="margin-left: 30rpx; text-align: right; width: 100%;"
|
|
|
+ v-if="str.name==undefined||str.name==''">请选择所属城市</text>
|
|
|
+ <text style="margin-left: 30rpx; text-align: right; width: 100%;" v-else>{{str.name}}</text>
|
|
|
</text>
|
|
|
<u-icon name="arrow-right" size="24"></u-icon>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="card">
|
|
|
<view class="card1">
|
|
|
- <text style="margin-right: 30rpx;">详细地址</text>
|
|
|
- <u--input placeholder="请输入您的地址" border="none" v-model="formData.areaDetail"></u--input>
|
|
|
+ <text style="margin-right: 30rpx; font-size: 30rpx; color: #333; font-weight: Regular; ">详细地址</text>
|
|
|
+ <u--input class="card-input" inputAlign="right" placeholder="请输入您的地址" border="none"
|
|
|
+ v-model="formData.areaDetail" style="text-align: right; font-size: Regular;"></u--input>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="card">
|
|
|
<view class="card1">
|
|
|
- <text>单元、门牌号</text>
|
|
|
+ <text class="label">联系电话</text>
|
|
|
+ <u--input inputAlign="right" placeholder="请输入内容" border="none" v-model="stayInfo.landlinePhone"
|
|
|
+ style="text-align: right;"></u--input>
|
|
|
</view>
|
|
|
- <view style="margin-top: 20rpx;">
|
|
|
- <span>
|
|
|
- <u--textarea border='none' :maxlength='300' count v-model="formData.introduction"
|
|
|
- placeholder="请输入单元、门牌号" height='250'></u--textarea>
|
|
|
- </span>
|
|
|
+ </view>
|
|
|
+ <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 class="card" style="padding-bottom: 180rpx;">
|
|
|
+ <view class="card" style="padding-bottom: 190rpx;">
|
|
|
<view class="card1">
|
|
|
<text>地图位置</text>
|
|
|
</view>
|
|
@@ -46,9 +54,7 @@
|
|
|
<cityPicker :column="column" :default-value="defaultValue" :mask-close-able="maskCloseAble"
|
|
|
@confirm="confirm" @cancel="cancel" :visible="visible" />
|
|
|
</view>
|
|
|
-
|
|
|
-
|
|
|
- <view class="bottom">
|
|
|
+ <view class="bottom" @click="save">
|
|
|
<view class="btn">
|
|
|
确定
|
|
|
</view>
|
|
@@ -68,7 +74,6 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
selectIndex: undefined,
|
|
|
selectAddr: {},
|
|
|
searchWords: "",
|
|
@@ -102,21 +107,18 @@
|
|
|
// defaultValue: ['河北省','唐山市','丰南区'],
|
|
|
column: 3,
|
|
|
address: '',
|
|
|
- formData: {}
|
|
|
+ formData: {},
|
|
|
+ stayInfo: {
|
|
|
+ picList: []
|
|
|
+ },
|
|
|
+ homestayId: uni.getStorageSync('homestayId') || 0,
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
cityPicker
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- if (option) {
|
|
|
- this.formData = JSON.parse(option.item)
|
|
|
- this.latitude = this.formData.lat
|
|
|
- this.longitude = this.formData.lon
|
|
|
- this.markers[0].latitude = this.formData.lat
|
|
|
- this.markers[0].longitude = this.formData.lon
|
|
|
- }
|
|
|
-
|
|
|
+ this.getStayInfo()
|
|
|
// var self = this;
|
|
|
// this.myPosition()
|
|
|
// uni.getLocation({
|
|
@@ -151,6 +153,92 @@
|
|
|
// });
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ getStayInfo() {
|
|
|
+ this.$api.get('/merchant/hotel/mine/getMerchantHomestayInfo/' + this.homestayId).then(res => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.stayInfo = res.data.data;
|
|
|
+ this.formData = this.stayInfo
|
|
|
+ this.latitude = this.formData.lat
|
|
|
+ this.longitude = this.formData.lon
|
|
|
+ this.markers[0].latitude = this.formData.lat
|
|
|
+ this.markers[0].longitude = this.formData.lon
|
|
|
+ this.stayInfo.picList.forEach((item) => {
|
|
|
+ this.imgUrlList.push({
|
|
|
+ url: item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 确定保存
|
|
|
+ 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)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除图片
|
|
|
+ deletePic(event) {
|
|
|
+ this.imgUrlList.splice(event.index, 1)
|
|
|
+ },
|
|
|
+ // 新增图片
|
|
|
+ async afterRead(event) {
|
|
|
+ let lists = [].concat(event.file)
|
|
|
+ let fileListLen = this.imgUrlList.length
|
|
|
+ lists.map((item) => {
|
|
|
+ this.imgUrlList.push({
|
|
|
+ ...item,
|
|
|
+ status: 'uploading',
|
|
|
+ message: '上传中'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ for (let i = 0; i < lists.length; i++) {
|
|
|
+ const result = await this.uploadFilePromise(lists[i].url)
|
|
|
+ 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) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let a = uni.uploadFile({
|
|
|
+ url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
|
|
|
+ filePath: url,
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ user: 'test'
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res)
|
|
|
+ let data = JSON.parse(res.data);
|
|
|
+ console.log(data)
|
|
|
+ resolve(data.data.url)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
changeBegin() {
|
|
|
this.visible = true
|
|
|
},
|
|
@@ -211,7 +299,17 @@
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+<style lang="less">
|
|
|
+ .u-upload__wrap__preview__image {
|
|
|
+ width: 190rpx !important;
|
|
|
+ height: 120rpx !important;
|
|
|
+ }
|
|
|
|
|
|
+ .u-upload__button {
|
|
|
+ width: 190rpx !important;
|
|
|
+ height: 120rpx !important;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
/deep/.u-cell__body {
|
|
|
padding: 0;
|
|
@@ -270,8 +368,21 @@
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
|
|
|
+ text {
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: #333;
|
|
|
+ font-weight: Regular;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card-input {
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: #333;
|
|
|
+ font-weight: Regular;
|
|
|
+ }
|
|
|
+
|
|
|
.as-content {
|
|
|
color: #a5a5a5;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|