Browse Source

经纪人增加地图定位

linwu 1 year ago
parent
commit
d1b9fdd14b
1 changed files with 21 additions and 1 deletions
  1. 21 1
      pages/broker/brokerform.vue

+ 21 - 1
pages/broker/brokerform.vue

@@ -29,6 +29,13 @@
 				<view class="title">区域</view>
 				<view class="title">区域</view>
 				<input placeholder="请输入区域" data-val="region" @input="bindInput"></input>
 				<input placeholder="请输入区域" data-val="region" @input="bindInput"></input>
 			</view>
 			</view>
+			<view class="cu-form-group">
+				<view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 工作地点</view>
+				<view style="flex: 1; font-size: 30rpx; color: #AAAAAA; line-height: 100rpx;">
+					<input placeholder="详细地址" disabled :value="address" v-if="address"></input>
+					<button class="cu-btn bg-blue margin-tb-sm lg" style="width: 100%;" @tap="gpsmap()">地图选位置</button>
+				</view>
+			</view>
 			<view class="padding flex flex-direction bg-white">
 			<view class="padding flex flex-direction bg-white">
 				<button class="cu-btn bg-blue margin-tb-sm lg" @tap="submit">立即提交</button>
 				<button class="cu-btn bg-blue margin-tb-sm lg" @tap="submit">立即提交</button>
 			</view>
 			</view>
@@ -43,11 +50,14 @@
 		data() {
 		data() {
 			return {
 			return {
 				isRotate: false,
 				isRotate: false,
+				address: '',
 				userinfo: {},
 				userinfo: {},
 				forminfo: {
 				forminfo: {
 					title: '',
 					title: '',
 					mobile: '',
 					mobile: '',
 					region: '',
 					region: '',
+					latitude: 0,
+					longitude: 0,
 				},
 				},
 				agentArray: [],
 				agentArray: [],
 				agentIndex: 0,
 				agentIndex: 0,
@@ -120,6 +130,16 @@
 			RegionChange(e) {
 			RegionChange(e) {
 				this.region = e.detail.value
 				this.region = e.detail.value
 			},
 			},
+			//打开地图
+			gpsmap:function(){
+				uni.chooseLocation({
+				    success: function (res) {
+						_this.address=res.address;
+						_this.forminfo.latitude=res.latitude;
+						_this.forminfo.longitude=res.longitude;			
+				    }
+				});
+			},
 			submit() {
 			submit() {
 				if (_this.isRotate) {
 				if (_this.isRotate) {
 					return false;
 					return false;
@@ -127,7 +147,7 @@
 				_this.isRotate = true;
 				_this.isRotate = true;
 				
 				
 				let data = _this.forminfo;
 				let data = _this.forminfo;
-				let validate = {"title":"姓名","mobile":"手机号","region":"区域"};
+				let validate = {"title":"姓名","mobile":"手机号","region":"区域","latitude":"请点击地图选择位置"};
 				for (var i in validate) {
 				for (var i in validate) {
 					if (data[i] == "") {
 					if (data[i] == "") {
 						uni.showModal({
 						uni.showModal({