|
|
@ -1,13 +1,13 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<view class="page-bottom-fixed backcor9"> |
|
|
|
<view class="page-bottom-fixed backcor9" > |
|
|
|
<form @submit="form_submit" class="form-container"> |
|
|
|
<form @submit="form_submit" class="form-container"> |
|
|
|
<view class="pd-main border-box height100" style="overflow-y: auto;"> |
|
|
|
<view class="pd-main border-box height100" :style="'overflow-y: auto;transform: translateY(-0px);'" > |
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
<view class="dis-flex"> |
|
|
|
<view class="dis-flex"> |
|
|
|
<view class="form-gorup-title marRight10">收货人: |
|
|
|
<view class="form-gorup-title marRight10">收货人: |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<input type="text" name="name" v-model="userAddress.name" placeholder-class="corf6" |
|
|
|
<input type="text" name="name" v-model="userAddress.name" placeholder-class="corf6" |
|
|
|
class="fcor666 flex-1 bs-bb" placeholder="名字"> |
|
|
|
class=" flex-1 bs-bb" placeholder="名字"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +19,7 @@ |
|
|
|
<view class="form-gorup-title marRight10">手机号码: |
|
|
|
<view class="form-gorup-title marRight10">手机号码: |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<input type="number" name="tel" v-model="userAddress.tel" maxlength="11" |
|
|
|
<input type="number" name="tel" v-model="userAddress.tel" maxlength="11" |
|
|
|
placeholder-class="corf6" class="fcor666 flex-1" placeholder="手机号"> |
|
|
|
placeholder-class="corf6" class=" flex-1" placeholder="手机号"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -32,7 +32,7 @@ |
|
|
|
<view class="dis-flex "> |
|
|
|
<view class="dis-flex "> |
|
|
|
<view class=" form-gorup-title">所在地区:</view> |
|
|
|
<view class=" form-gorup-title">所在地区:</view> |
|
|
|
<view class="dis-flex flex-1 flex-end"> |
|
|
|
<view class="dis-flex flex-1 flex-end"> |
|
|
|
<view class=" pickRes fcor666">{{userAddress.region || '请选择'}}</view> |
|
|
|
<view class=" pickRes ">{{userAddress.region || '请选择'}}</view> |
|
|
|
<view class="icon-ymt to-right font14 fcor666"></view> |
|
|
|
<view class="icon-ymt to-right font14 fcor666"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -47,10 +47,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <view style="clear: both;"> --> |
|
|
|
<!-- <view style="clear: both;"> --> |
|
|
|
<view class="dis-flex"> |
|
|
|
<view class="dis-flex scrol-t mart10"> |
|
|
|
<view class="form-gorup-title marRight10">详细地址:</view> |
|
|
|
<view class="form-gorup-title marRight10">详细地址:</view> |
|
|
|
|
|
|
|
|
|
|
|
<uni-combox @location="location" placeholderClass="corf6" :candidates="candidates" class="flex-1" :isAddress="true" :isShowIcon="false" placeholder="请输入详细地址" v-model="userAddress.address"> |
|
|
|
<uni-combox :height="height" @focus="focusMethod" @blur="blurMethod" :cursorSpacing="50" placeholderClass="corf6" :candidates="candidates" class="flex-1" :isAddress="true" :isShowIcon="false" placeholder="请输入详细地址" v-model="userAddress.address"> |
|
|
|
|
|
|
|
|
|
|
|
<view class="selector-item" v-for="(item,index) in candidates" :key="index" @click="getSelect(item)"> |
|
|
|
<view class="selector-item" v-for="(item,index) in candidates" :key="index" @click="getSelect(item)"> |
|
|
|
<view class="text1 name"> |
|
|
|
<view class="text1 name"> |
|
|
@ -77,12 +77,12 @@ |
|
|
|
<text class="font18">设为默认地址</text> |
|
|
|
<text class="font18">设为默认地址</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="bottom-fixed "> |
|
|
|
|
|
|
|
<button class="btn " type="default" form-type="submit">保存</button> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="bottom-fixed "> |
|
|
|
|
|
|
|
<button class="btn " type="default" form-type="submit">保存</button> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</form> |
|
|
|
</form> |
|
|
|
|
|
|
|
|
|
|
@ -108,6 +108,7 @@ |
|
|
|
region: '', |
|
|
|
region: '', |
|
|
|
address: "", |
|
|
|
address: "", |
|
|
|
is_default: false, |
|
|
|
is_default: false, |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
dataParams: null, |
|
|
|
dataParams: null, |
|
|
|
// |
|
|
|
// |
|
|
@ -122,6 +123,9 @@ |
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",}, |
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",}, |
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",} |
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",} |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
top:0, |
|
|
|
|
|
|
|
top1:0, |
|
|
|
|
|
|
|
height:0, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
@ -134,7 +138,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onLoad(params) { |
|
|
|
onLoad(params) { |
|
|
|
console.log(params) |
|
|
|
// console.log(params) |
|
|
|
this.dataParams = params |
|
|
|
this.dataParams = params |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -173,9 +177,49 @@ |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async mounted() { |
|
|
|
|
|
|
|
await this.getRect('.scrol-t').then(res => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.top = res.top; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
await this.getRect('.bottom-fixed').then(res => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.top1 = res.top; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.height = this.top1 - this.top - 120; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(this.top1,this.top,this.height) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
focusMethod(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
blurMethod(){ |
|
|
|
|
|
|
|
this.baiduApiMap(this.userAddress.address) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getRect(selector, all) { |
|
|
|
|
|
|
|
return new Promise(resolve => { |
|
|
|
|
|
|
|
uni.createSelectorQuery() |
|
|
|
|
|
|
|
.in(this) |
|
|
|
|
|
|
|
[all ? 'selectAll' : 'select'](selector) |
|
|
|
|
|
|
|
.boundingClientRect(rect => { |
|
|
|
|
|
|
|
if (all && Array.isArray(rect) && rect.length) { |
|
|
|
|
|
|
|
resolve(rect); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!all && rect) { |
|
|
|
|
|
|
|
resolve(rect); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.exec(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
findAddressById(id) { |
|
|
|
findAddressById(id) { |
|
|
|
let params = { |
|
|
|
let params = { |
|
|
|
id: id |
|
|
|
id: id |
|
|
@ -217,48 +261,32 @@ |
|
|
|
this.userAddress.region = this.region.map(item => item.name).join(','); |
|
|
|
this.userAddress.region = this.region.map(item => item.name).join(','); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log(this.userAddress.region, "获取选择的地区", this.regionId, this.region) |
|
|
|
// console.log(this.userAddress.region, "获取选择的地区", this.regionId, this.region) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取数据 |
|
|
|
// 获取数据 |
|
|
|
init() { |
|
|
|
init() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//点击了定位图标 |
|
|
|
// //监听详细地址的onInput事件 |
|
|
|
location(){ |
|
|
|
// location(n){ |
|
|
|
this.userAddress.address = this.userAddress.address.replace(/\s+/g, "") |
|
|
|
// // this.userAddress.address = this.userAddress.address.replace(/\s+/g, "") |
|
|
|
|
|
|
|
// }, |
|
|
|
if(app.globalData.latitude&&app.globalData.longitude){ |
|
|
|
|
|
|
|
this.baiduApiMap(app.globalData.longitude,app.globalData.latitude,this.userAddress.address) |
|
|
|
|
|
|
|
}else{ |
|
|
|
baiduApiMap(query){ |
|
|
|
uni.getLocation({ |
|
|
|
query = query.replace(/\s+/g, "") |
|
|
|
type: 'wgs84', |
|
|
|
let params={ |
|
|
|
success: function(res) { |
|
|
|
query:query |
|
|
|
app.globalData.latitude = res.latitude; |
|
|
|
|
|
|
|
app.globalData.longitude = res.longitude; |
|
|
|
|
|
|
|
this.baiduApiMap(app.globalData.longitude,app.globalData.latitude,this.userAddress.address) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
baiduApiMap(lng,lat,query){ |
|
|
|
|
|
|
|
let params; |
|
|
|
|
|
|
|
if(query==""){ |
|
|
|
|
|
|
|
params={ |
|
|
|
|
|
|
|
lng,lat |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
params={ |
|
|
|
|
|
|
|
lng,lat,query |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
|
|
title: '加载中', |
|
|
|
|
|
|
|
mask:true, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(params,"params") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baiduApiMapSearch(params).then(res=>{ |
|
|
|
baiduApiMapSearch(params).then(res=>{ |
|
|
|
|
|
|
|
uni.hideLoading(); |
|
|
|
console.log(res) |
|
|
|
console.log(res) |
|
|
|
if (res.return_code == '000000') { |
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
|
|
|
@ -280,12 +308,16 @@ |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 点击获取的详细地址 |
|
|
|
getSelect(desc){ |
|
|
|
getSelect(desc){ |
|
|
|
|
|
|
|
|
|
|
|
console.log(desc) |
|
|
|
// console.log(desc) |
|
|
|
this.defaultRegionCode = desc.adcode ; |
|
|
|
this.defaultRegionCode = desc.adcode ; |
|
|
|
this.userAddress.address = desc.address; |
|
|
|
this.userAddress.address = desc.address; |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
icon:'none', |
|
|
|
|
|
|
|
title:"所在地区同步修改" |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 默认地址设置改变 |
|
|
|
// 默认地址设置改变 |
|
|
@ -468,7 +500,8 @@ |
|
|
|
/*表单*/ |
|
|
|
/*表单*/ |
|
|
|
.form-container { |
|
|
|
.form-container { |
|
|
|
height: 100%; |
|
|
|
height: 100%; |
|
|
|
|
|
|
|
/* display: flex; |
|
|
|
|
|
|
|
flex-direction: column; */ |
|
|
|
.form-gorup { |
|
|
|
.form-gorup { |
|
|
|
padding: 20rpx; |
|
|
|
padding: 20rpx; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
margin-bottom: 20rpx; |
|
|
|