|
|
@@ -119,28 +119,7 @@
|
|
|
</view>
|
|
|
|
|
|
<simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onCityConfirm"></simple-address>
|
|
|
- <app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
|
|
|
-
|
|
|
- <bottom-popup class="nearby-popup-wrap" :show="showNearbyPopup" @close="closeNearbyPopup">
|
|
|
- <view class="nearby-popup">
|
|
|
- <view class="nearby-popup-head">
|
|
|
- <text class="nearby-popup-title">选择附近地址</text>
|
|
|
- <app-close icon="iconguanbi" @close="closeNearbyPopup" />
|
|
|
- </view>
|
|
|
- <scroll-view class="nearby-list" scroll-y>
|
|
|
- <view
|
|
|
- v-for="(item, index) in nearbyList"
|
|
|
- :key="index"
|
|
|
- class="nearby-item"
|
|
|
- @click="selectNearbyAddress(item)"
|
|
|
- >
|
|
|
- <view class="nearby-item-name">{{ item.name }}</view>
|
|
|
- <view class="nearby-item-address">{{ item.address }}</view>
|
|
|
- </view>
|
|
|
- <view v-if="nearbyList.length === 0" class="nearby-empty">暂无附近地址,请手动填写</view>
|
|
|
- </scroll-view>
|
|
|
- </view>
|
|
|
- </bottom-popup>
|
|
|
+ <app-area-sel :show.sync="showRegion" :city="form.city" :initial-list="addressInitialList" @change="changeAreaFn" />
|
|
|
</form>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -149,8 +128,6 @@
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppAreaSel from "@/components/app-area-sel";
|
|
|
import SimpleAddress from "@/components/plugin/simple-address";
|
|
|
-import BottomPopup from '@/components/plugin/bottom-popup'
|
|
|
-import AppClose from '@/components/module/app-close'
|
|
|
import AppAvatarModule from "@/components/module/app-avatar";
|
|
|
import AppUploader from "@/components/app-uploader";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
@@ -177,8 +154,6 @@ export default {
|
|
|
TuiListCell,
|
|
|
AppAreaSel,
|
|
|
SimpleAddress,
|
|
|
- BottomPopup,
|
|
|
- AppClose,
|
|
|
AppAvatarModule,
|
|
|
AppUploader,
|
|
|
htzImageUpload
|
|
|
@@ -207,8 +182,7 @@ export default {
|
|
|
},
|
|
|
cityPickerValueDefault: [0, 0],
|
|
|
showRegion: false,
|
|
|
- showNearbyPopup: false,
|
|
|
- nearbyList: [],
|
|
|
+ addressInitialList: [],
|
|
|
locating: false,
|
|
|
hasMap: 0,
|
|
|
adminName: "",
|
|
|
@@ -308,9 +282,9 @@ export default {
|
|
|
requestLocation('gcj02')
|
|
|
})
|
|
|
},
|
|
|
- closeNearbyPopup() {
|
|
|
- this.showNearbyPopup = false
|
|
|
- },
|
|
|
+ modifyShow(){
|
|
|
+ this.form.showAddress = this.form.city + this.form.address + this.form.floor
|
|
|
+ },
|
|
|
applyNearbyAddress(item) {
|
|
|
if (!item) {
|
|
|
return false
|
|
|
@@ -327,18 +301,25 @@ export default {
|
|
|
this.form.address = item.name || item.address || ''
|
|
|
this.form.showAddress = item.showAddress || item.address || ''
|
|
|
if (item.location) {
|
|
|
- const parts = String(item.location).split(',').map(v => v.trim())
|
|
|
- if (parts.length >= 2) {
|
|
|
- this.form.longitude = parts[0]
|
|
|
- this.form.latitude = parts[1]
|
|
|
+ let lng = ''
|
|
|
+ let lat = ''
|
|
|
+ if (typeof item.location === 'object') {
|
|
|
+ lng = item.location.lng || item.location.longitude || ''
|
|
|
+ lat = item.location.lat || item.location.latitude || ''
|
|
|
+ } else {
|
|
|
+ const parts = String(item.location).split(',').map(v => v.trim())
|
|
|
+ if (parts.length >= 2) {
|
|
|
+ lng = parts[0]
|
|
|
+ lat = parts[1]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lng && lat) {
|
|
|
+ this.form.longitude = lng
|
|
|
+ this.form.latitude = lat
|
|
|
}
|
|
|
}
|
|
|
this.modifyShow()
|
|
|
},
|
|
|
- selectNearbyAddress(item) {
|
|
|
- this.applyNearbyAddress(item)
|
|
|
- this.closeNearbyPopup()
|
|
|
- },
|
|
|
async openNearbyAddress() {
|
|
|
if (this.locating) {
|
|
|
return false
|
|
|
@@ -357,8 +338,22 @@ export default {
|
|
|
this.$msg('未获取到附近地址,请手动填写')
|
|
|
return false
|
|
|
}
|
|
|
- this.nearbyList = res.data.list
|
|
|
- this.showNearbyPopup = true
|
|
|
+ const list = res.data.list
|
|
|
+ const first = list[0]
|
|
|
+ if (first) {
|
|
|
+ if (first.province) {
|
|
|
+ this.form.province = first.province
|
|
|
+ }
|
|
|
+ if (first.city) {
|
|
|
+ this.form.city = first.city
|
|
|
+ }
|
|
|
+ if (first.district) {
|
|
|
+ this.form.dist = first.district
|
|
|
+ }
|
|
|
+ this.modifyShow()
|
|
|
+ }
|
|
|
+ this.addressInitialList = list
|
|
|
+ this.showRegion = true
|
|
|
return true
|
|
|
} catch (err) {
|
|
|
console.log('openNearbyAddress fail', err)
|
|
|
@@ -471,6 +466,7 @@ export default {
|
|
|
onCityConfirm (e) {
|
|
|
this.form.province = e.provinceName;
|
|
|
this.form.city = e.cityName;
|
|
|
+ this.addressInitialList = []
|
|
|
this.modifyShow()
|
|
|
},
|
|
|
imgUploadSuccess(res) {
|
|
|
@@ -485,24 +481,13 @@ export default {
|
|
|
},
|
|
|
selectRegion() {
|
|
|
if (!this.form.city) {
|
|
|
- this.$msg('请先选择城市!')
|
|
|
+ this.$msg('请先选择城市或点击定位图标')
|
|
|
return false
|
|
|
}
|
|
|
this.showRegion = true
|
|
|
},
|
|
|
changeAreaFn(e) {
|
|
|
- let locationStr = e.location
|
|
|
- let fruits = locationStr.split(',').map(fruit => fruit.trim())
|
|
|
-
|
|
|
- this.form.latitude = fruits[1]
|
|
|
- this.form.longitude = fruits[0]
|
|
|
- this.form.showAddress = e.address
|
|
|
- this.form.address = e.name
|
|
|
-
|
|
|
- const districtStr = e.district || ''
|
|
|
- const cityIndex = districtStr.indexOf('市')
|
|
|
- this.form.dist = cityIndex !== -1 ? districtStr.substring(cityIndex + 1) : districtStr
|
|
|
- this.modifyShow()
|
|
|
+ this.applyNearbyAddress(e)
|
|
|
},
|
|
|
modifyShow(){
|
|
|
this.form.showAddress = this.form.city + this.form.address + this.form.floor
|
|
|
@@ -725,62 +710,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.nearby-popup-wrap {
|
|
|
- ::v-deep .tui-popup-class {
|
|
|
- border-top-left-radius: 20upx;
|
|
|
- border-top-right-radius: 20upx;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-popup {
|
|
|
- background: #fff;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-popup-head {
|
|
|
- position: relative;
|
|
|
- padding: 30upx 80upx 24upx;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-popup-title {
|
|
|
- color: #161819;
|
|
|
- font-size: 34upx;
|
|
|
- font-weight: 700;
|
|
|
- line-height: 48upx;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-list {
|
|
|
- max-height: 60vh;
|
|
|
- padding: 0 24upx 40upx;
|
|
|
- box-sizing: border-box;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-item {
|
|
|
- padding: 24upx 8upx;
|
|
|
- border-bottom: 1upx solid #f0f2f1;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-item-name {
|
|
|
- color: #161819;
|
|
|
- font-size: 30upx;
|
|
|
- font-weight: 600;
|
|
|
- line-height: 42upx;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-item-address {
|
|
|
- margin-top: 8upx;
|
|
|
- color: #8a9199;
|
|
|
- font-size: 26upx;
|
|
|
- line-height: 38upx;
|
|
|
-}
|
|
|
-
|
|
|
-.nearby-empty {
|
|
|
- padding: 60upx 0;
|
|
|
- text-align: center;
|
|
|
- color: #8a9199;
|
|
|
- font-size: 28upx;
|
|
|
-}
|
|
|
-
|
|
|
.line-cell {
|
|
|
.tui-title {
|
|
|
width: 180upx;
|