地图选点

master
lion 9 months ago
parent 467f1b4b20
commit e227cf02ad

@ -20,7 +20,8 @@
</u-radio-group>
</u-form-item>
<u-form-item label="地址" prop="address" required>
<u-input v-model="form.address" placeholder="请输入地址" />
<u-input v-model="form.address" placeholder="请输入地址" type="textarea" />
<view style="color:blue" @click="openMap"></view>
</u-form-item>
<u-form-item label="备注" prop="remark">
<u-input v-model="form.remark" placeholder="请输入备注" />
@ -113,7 +114,31 @@
onReady() {
this.$refs.uForm1.setRules(this.rules);
},
methods: {
methods: {
//
openMap(){
console.log("chooseLocation")
let that = this
uni.chooseLocation({
success(res){
console.log("chooseLocationres",res)
if (res.errMsg === 'chooseLocation:ok') {
that.form.address = res.address
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
}
},
fail(err){
uni.showToast({
title:'打开地图失败',
icon:'none'
})
console.log("err",err)
}
});
},
save() {
this.$refs.uForm1.validate(valid => {

@ -62,10 +62,13 @@
"desc" : "需要获取您的定位"
},
"scope.chooseAddress" : {
"desc" : "需要获取您的收获地址"
}
"desc" : "需要获取您的收货地址"
},
"scope.chooseLocation" : {
"desc" : "需要获取您的详细地址"
}
},
"requiredPrivateInfos" : [ "getLocation", "chooseAddress" ],
"requiredPrivateInfos" : [ "getLocation", "chooseAddress","chooseLocation" ],
"optimization" : {
"subPackages" : true
},

@ -202,8 +202,10 @@
<u-input
v-model="form.city"
:disabled="!!orderId"
placeholder="请填写详细地址"
placeholder="请填写详细地址"
type="textarea"
/>
<view style="text-align: right;color:blue" @click="openMap"></view>
</u-form-item>
<u-form-item label="预约人" prop="appoint_name" required>
<u-input
@ -988,8 +990,30 @@ export default {
this.getUserArchive();
}
},
//
openMap(){
console.log("chooseLocation")
let that = this
uni.chooseLocation({
success(res){
console.log("chooseLocationres",res)
if (res.errMsg === 'chooseLocation:ok') {
that.form.city = res.address
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
}
},
fail(err){
uni.showToast({
title:'打开地图失败',
icon:'none'
})
console.log("err",err)
}
});
},
pay() {
if (!this.orderId) {
if(!this.form.site_id){

@ -70,7 +70,10 @@
</view>
</u-form-item>
<u-form-item label="详细地址" prop="city" v-if="form.type == 2">
<u-input v-model="form.city" placeholder="请填写详细地址" />
<u-input v-model="form.city" placeholder="请填写详细地址"
type="textarea"
/>
<view style="text-align: right;color:blue" @click="openMap"></view>
</u-form-item>
<u-form-item label="预约人" prop="appoint_name" required>
<u-input v-model="form.appoint_name" placeholder="请填写预约人" />
@ -529,7 +532,30 @@
}
},
//
openMap(){
console.log("chooseLocation")
let that = this
uni.chooseLocation({
success(res){
console.log("chooseLocationres",res)
if (res.errMsg === 'chooseLocation:ok') {
that.form.city = res.address
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
}
},
fail(err){
uni.showToast({
title:'打开地图失败',
icon:'none'
})
console.log("err",err)
}
});
},
pay() {
this.$refs.uForm.validate(async (valid) => {
if (valid) {

@ -33,7 +33,7 @@
site_id: i.hospital?i.hospital.site_id:''
}
})">
<view class="info__item">
<view class="info__item flex100">
<text>{{i.type == 1 ? '被服务人' : '被服务人'}}</text>
<text>{{ i.user_archive ? i.user_archive.name : i.user_archive_id }}</text>
</view>
@ -41,7 +41,7 @@
<text>{{(i.type == 1 ? '就诊' : '服务') + '时间'}}</text>
<text>{{ i.time ? $moment(i.time).format('YYYY年MM月DD日 HH:mm') : '' }}</text>
</view>
<view class="info__item" v-if="i.type==2">
<view class="info__item flex100" v-if="i.type==2">
<text>详细地址</text>
<text>{{ i.city || " " }}</text>
</view>

@ -43,7 +43,7 @@
site_id: i.hospital?i.hospital.site_id:''
}
})">
<view class="info__item">
<view class="info__item flex100">
<text>{{i.type == 1 ? '被服务人' : '被服务人'}}</text>
<text>{{ i.user_archive ? i.user_archive.name : i.user_archive_id }}</text>
</view>
@ -51,7 +51,7 @@
<text>{{(i.type == 1 ? '就诊' : '服务') + '时间'}}</text>
<text>{{ i.time ? $moment(i.time).format('YYYY年MM月DD日 HH:mm') : '' }}</text>
</view>
<view class="info__item" v-if="i.type==2">
<view class="info__item flex100" v-if="i.type==2">
<text>详细地址</text>
<text>{{ i.city || " " }}</text>
</view>

Loading…
Cancel
Save