(1)
(2)
(3)
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:- 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:- "requiredPrivateInfos": [
- "getLocation",
- "chooseLocation"
- ],
- "permission": {
- "scope.userLocation": {
- "desc": "获取用户位置信息用于填写收货地址"
- }
- },
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!qidao123.com:ToB企服之家,中国第一个企服评测及软件市场,开放入驻,技术点评得现金 |