(1)
(2)
(3)
html:
html
<view class="titleTwo" style="border: none;">
<view class="fontSize30 invoiceTile">企业地址</view>
<view class="invoiceRight" bind:tap="tapChooseAddress" data-maptype="2">
<view class="inputRight fontSize30" style="{{detailedAddress=='请选择企业地址'?'color:#777;':''}} height: auto;" >
{{detailedAddress || '请选择企业地址'}}
</view>
</view>
<view class="clearBoth"></view>
</view>
js:
javascript
tapChooseAddress(e) {
let that = this;
let maptype = e.currentTarget.dataset.maptype;
// 地图选点
wx.chooseLocation({
success: function (res) {
if(maptype == "1"){
that.setData({
detailedAddress: res.name,
xxdzLongitude: res.longitude,
xxdzLatitude: res.latitude,
});
}else{
that.setData({
detailedAddress: res.name,
xxdzLongitude: res.longitude,//经度
xxdzLatitude: res.latitude,//纬度
});
}
},
fail: function (err) {
console.log(err)
wx.showToast({
title: '地图位置获取错误',
icon: "none"
})
}
})
},
// res.longitude,//经度
//latitude,//纬度
app.json:
javascript
"requiredPrivateInfos": [
"getLocation",
"chooseLocation"
],
"permission": {
"scope.userLocation": {
"desc": "获取用户位置信息用于填写收货地址"
}
},