|
@@ -127,44 +127,75 @@ export default {
|
|
|
clickMap() {
|
|
|
uni.showLoading({
|
|
|
title: '加载中'
|
|
|
- });
|
|
|
- let obj = this;
|
|
|
- openMap().then(() => {
|
|
|
- uni.hideLoading();
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
- success(e) {
|
|
|
- uni.chooseLocation({
|
|
|
- latitude: e.latitude,
|
|
|
- longitude: e.longitude,
|
|
|
- success(e) {
|
|
|
- obj.addressLocation = e;
|
|
|
- },
|
|
|
- fail(e) {
|
|
|
- uni.showModal({
|
|
|
- title:'地址选择错误',
|
|
|
- content:JSON.parse(e)
|
|
|
- })
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
- });
|
|
|
- },fail(e) {
|
|
|
- uni.showModal({
|
|
|
- title:'定位错误',
|
|
|
- content:JSON.parse(e)
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
+ });
|
|
|
+ let obj = this;
|
|
|
+ // #ifndef APP-PLUS
|
|
|
+ openMap().then(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ success(e) {
|
|
|
+ uni.chooseLocation({
|
|
|
+ latitude: e.latitude,
|
|
|
+ longitude: e.longitude,
|
|
|
+ success(e) {
|
|
|
+ obj.addressLocation = e;
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ uni.showModal({
|
|
|
+ title:'地址选择错误',
|
|
|
+ content:JSON.parse(e)
|
|
|
+ })
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },fail(e) {
|
|
|
+ uni.showModal({
|
|
|
+ title:'定位错误',
|
|
|
+ content:JSON.parse(e)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
.catch(e => {
|
|
|
- console.log(e)
|
|
|
- uni.hideLoading();
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '您未授权无法调用地图定位功能!',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- });
|
|
|
+ console.log(e)
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '您未授权无法调用地图定位功能!',
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ success(e) {
|
|
|
+ uni.chooseLocation({
|
|
|
+ latitude: e.latitude,
|
|
|
+ longitude: e.longitude,
|
|
|
+ success(e) {
|
|
|
+ obj.addressLocation = e;
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ uni.showModal({
|
|
|
+ title:'地址选择错误',
|
|
|
+ content:JSON.parse(e)
|
|
|
+ })
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },fail(e) {
|
|
|
+ uni.showModal({
|
|
|
+ title:'定位错误',
|
|
|
+ content:JSON.parse(e)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // uni.chooseLocation()
|
|
|
+ // #endif
|
|
|
+
|
|
|
},
|
|
|
// 选中城市切换
|
|
|
onCityClick({ data }) {
|
|
@@ -229,14 +260,11 @@ export default {
|
|
|
city: data.address.city,
|
|
|
district: data.address.district
|
|
|
},
|
|
|
- // detail: obj.addressLocation.name + ',' + data.area,
|
|
|
- detail: "北京市东城区东长安街" + ',' + data.area,
|
|
|
+ detail: obj.addressLocation.name + ',' + data.area,
|
|
|
is_default: data.default,
|
|
|
id: data.id || '',
|
|
|
- // longitude: obj.addressLocation.longitude,121.430479
|
|
|
- // latitude: obj.addressLocation.latitude,28.644847
|
|
|
- longitude: '116.397827',
|
|
|
- latitude: '39.90374'
|
|
|
+ longitude: obj.addressLocation.longitude,
|
|
|
+ latitude: obj.addressLocation.latitude,
|
|
|
}).then(function(e) {
|
|
|
uni.showToast({
|
|
|
title: '提交成功',
|