|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<template> |
|
|
|
|
<view class="page-bottom-fixed backcor9" > |
|
|
|
|
<view class="page-bottom-fixed backcor9"> |
|
|
|
|
<form @submit="form_submit" class="form-container"> |
|
|
|
|
<view class="pd-main border-box height100" :style="'overflow-y: auto;transform: translateY(-0px);'" > |
|
|
|
|
<view class="pd-main border-box height100" :style="'overflow-y: auto;transform: translateY(-0px);'"> |
|
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
|
<view class="dis-flex"> |
|
|
|
|
<view class="form-gorup-title marRight10">收货人: |
|
|
|
@ -28,7 +28,8 @@ |
|
|
|
|
|
|
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
|
<view class=""> |
|
|
|
|
<pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion"> |
|
|
|
|
<pick-regions @failureRegion="failureRegion" :defaultRegion="defaultRegionCode" |
|
|
|
|
@getRegion="handleGetRegion"> |
|
|
|
|
<view class="dis-flex "> |
|
|
|
|
<view class=" form-gorup-title">所在地区:</view> |
|
|
|
|
<view class="dis-flex flex-1 flex-end"> |
|
|
|
@ -47,26 +48,29 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <view style="clear: both;"> --> |
|
|
|
|
<view class="dis-flex scrol-t mart10"> |
|
|
|
|
<view class="form-gorup-title marRight10 align-self" style="padding: 0;">详细地址:</view> |
|
|
|
|
|
|
|
|
|
<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="text1 name"> |
|
|
|
|
{{item.name}} |
|
|
|
|
</view> |
|
|
|
|
<view class="text1 address mart5"> |
|
|
|
|
{{item.address}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</uni-combox> |
|
|
|
|
<!-- <input type="text" name="address" v-model="userAddress.address" maxlength="40" |
|
|
|
|
<view class="dis-flex scrol-t mart10"> |
|
|
|
|
<view class="form-gorup-title marRight10 align-self" style="padding: 0;">详细地址:</view> |
|
|
|
|
|
|
|
|
|
<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="text1 name"> |
|
|
|
|
{{item.name}} |
|
|
|
|
</view> |
|
|
|
|
<view class="text1 address mart5"> |
|
|
|
|
{{item.address}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</uni-combox> |
|
|
|
|
<!-- <input type="text" name="address" v-model="userAddress.address" maxlength="40" |
|
|
|
|
placeholder-class="corf6" :class="'fcor666 bs-bb flex-1'" placeholder="详细地址1~40个字符"> --> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- </view> --> |
|
|
|
|
|
|
|
|
@ -77,7 +81,7 @@ |
|
|
|
|
<text class="font18">设为默认地址</text> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="bottom-fixed "> |
|
|
|
@ -91,7 +95,7 @@ |
|
|
|
|
<script> |
|
|
|
|
import pickRegions from '@/components/pick-regions/pick-regions.vue' |
|
|
|
|
import UniCombox from '@/components/uni-combox/components/uni-combox/uni-combox.vue' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
insertDeliveryAddress, |
|
|
|
|
findDeliveryAddressById, |
|
|
|
@ -108,7 +112,7 @@ |
|
|
|
|
region: '', |
|
|
|
|
address: "", |
|
|
|
|
is_default: false, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
dataParams: null, |
|
|
|
|
// |
|
|
|
@ -117,15 +121,15 @@ |
|
|
|
|
//没用上 |
|
|
|
|
// defaultRegion: ['北京市', '市辖区', '东城区'], |
|
|
|
|
defaultRegionCode: '', |
|
|
|
|
|
|
|
|
|
candidates:[ |
|
|
|
|
|
|
|
|
|
candidates: [ |
|
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",}, |
|
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",}, |
|
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",} |
|
|
|
|
], |
|
|
|
|
top:0, |
|
|
|
|
top1:0, |
|
|
|
|
height:0, |
|
|
|
|
top: 0, |
|
|
|
|
top1: 0, |
|
|
|
|
height: 0, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
@ -133,7 +137,7 @@ |
|
|
|
|
|
|
|
|
|
components: { |
|
|
|
|
pickRegions, |
|
|
|
|
"uni-combox":UniCombox |
|
|
|
|
"uni-combox": UniCombox |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -177,49 +181,48 @@ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
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: { |
|
|
|
|
|
|
|
|
|
focusMethod(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
focusMethod() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
blurMethod(){ |
|
|
|
|
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(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
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) { |
|
|
|
|
let params = { |
|
|
|
|
id: id |
|
|
|
@ -251,7 +254,7 @@ |
|
|
|
|
|
|
|
|
|
// 获取选择的地区 |
|
|
|
|
handleGetRegion(region) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let region = JSON.parse(JSON.stringify(reg)) |
|
|
|
|
this.region = region; |
|
|
|
|
this.regionId = this.region[2].code; |
|
|
|
@ -267,59 +270,71 @@ |
|
|
|
|
init() { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //监听详细地址的onInput事件 |
|
|
|
|
// location(n){ |
|
|
|
|
// // this.userAddress.address = this.userAddress.address.replace(/\s+/g, "") |
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baiduApiMap(query){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baiduApiMap(query) { |
|
|
|
|
query = query.replace(/\s+/g, "") |
|
|
|
|
let params={ |
|
|
|
|
query:query |
|
|
|
|
let params = { |
|
|
|
|
query: query |
|
|
|
|
} |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask:true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// console.log(params,"params") |
|
|
|
|
baiduApiMapSearch(params).then(res=>{ |
|
|
|
|
baiduApiMapSearch(params).then(res => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
console.log(res) |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
|
|
if(res.return_data&&res.return_data.length>0){ |
|
|
|
|
|
|
|
|
|
if (res.return_data && res.return_data.length > 0) { |
|
|
|
|
this.candidates = res.return_data; |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
this.candidates=[] |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.candidates = [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
this.candidates=[] |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.return_msg, |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.candidates = [] |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.return_msg, |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 点击获取的详细地址 |
|
|
|
|
getSelect(desc){ |
|
|
|
|
|
|
|
|
|
getSelect(desc) { |
|
|
|
|
|
|
|
|
|
// console.log(desc) |
|
|
|
|
this.defaultRegionCode = desc.adcode ; |
|
|
|
|
this.userAddress.address =desc.name + desc.address; |
|
|
|
|
this.defaultRegionCode = desc.adcode; |
|
|
|
|
this.userAddress.address = desc.name + desc.address; |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon:'none', |
|
|
|
|
title:"所在地区同步修改" |
|
|
|
|
icon: 'none', |
|
|
|
|
title: "所在地区同步修改", |
|
|
|
|
duration:2000 |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
failureRegion() { |
|
|
|
|
this.defaultRegionCode = ""; |
|
|
|
|
this.regionId =""; |
|
|
|
|
this.userAddress.region = ""; |
|
|
|
|
this.region = []; |
|
|
|
|
uni.hideToast(); |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: 'none', |
|
|
|
|
title: "地区同步修改失败,请手动选择", |
|
|
|
|
duration:3000 |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 默认地址设置改变 |
|
|
|
|
defaultChange(e) { |
|
|
|
|
this.userAddress.is_default = !this.userAddress.is_default |
|
|
|
@ -500,6 +515,7 @@ |
|
|
|
|
/*表单*/ |
|
|
|
|
.form-container { |
|
|
|
|
height: 100%; |
|
|
|
|
|
|
|
|
|
/* display: flex; |
|
|
|
|
flex-direction: column; */ |
|
|
|
|
.form-gorup { |
|
|
|
@ -542,31 +558,32 @@ |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #f00; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.selector-item { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
font-size: 16px; |
|
|
|
|
text-align: center; |
|
|
|
|
border-bottom: solid 1px #DDDDDD; |
|
|
|
|
padding: 10px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
text-align: left; |
|
|
|
|
.name{ |
|
|
|
|
|
|
|
|
|
.name { |
|
|
|
|
height: 18px; |
|
|
|
|
line-height: 18px; |
|
|
|
|
color: #3da7e7; |
|
|
|
|
font-size: 16px; |
|
|
|
|
font-weight: bold; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
.address{ |
|
|
|
|
|
|
|
|
|
.address { |
|
|
|
|
font-size: 14px; |
|
|
|
|
height: 16px; |
|
|
|
|
line-height: 16px; |
|
|
|
|
color: #666666; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|