|
|
@ -1,33 +1,27 @@ |
|
|
|
<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 height100"> |
|
|
|
<view class="pd-main border-box height100" style="overflow-y: auto;"> |
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
<!-- <view class="form-gorup-item-left"> |
|
|
|
<view class="dis-flex"> |
|
|
|
<view class="form-gorup-title marb10">联系人<text class="form-group-tips-must">*</text></view> |
|
|
|
<view class="form-gorup-title marRight10">收货人: |
|
|
|
<input type="text" name="name" v-model="userAddress.name" maxlength="5" |
|
|
|
|
|
|
|
placeholder-class="corf6" class="fcor666 " placeholder="联系人2~5个字符"> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="form-gorup-item-right"> |
|
|
|
<input type="text" name="name" v-model="userAddress.name" placeholder-class="corf6" |
|
|
|
<view class="form-gorup-title marb10">联系电话<text class="form-group-tips-must">*</text></view> |
|
|
|
class="fcor666 flex-1 bs-bb" placeholder="名字"> |
|
|
|
<input type="number" name="tel" v-model="userAddress.tel" maxlength="11" |
|
|
|
|
|
|
|
placeholder-class="corf6" class="fcor666" placeholder="手机号"> |
|
|
|
|
|
|
|
</view> --> |
|
|
|
|
|
|
|
<!-- --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="form-gorup-title">联系人<text class="form-group-tips-must">*</text> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<input type="text" name="name" v-model="userAddress.name" |
|
|
|
|
|
|
|
placeholder-class="corf6" class="fcor666 bs-bb" placeholder="联系人2~5个字符"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="width100 mart10 border-b"> |
|
|
|
<view class="width100 mart10 border-b"> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="form-gorup-title">联系电话<text class="form-group-tips-must">*</text> |
|
|
|
<view class="dis-flex"> |
|
|
|
|
|
|
|
<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" placeholder="手机号"> |
|
|
|
placeholder-class="corf6" class="fcor666 flex-1" placeholder="手机号"> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- --> |
|
|
|
<!-- --> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -35,16 +29,16 @@ |
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
<view class="form-gorup backcolorfff"> |
|
|
|
<view class=""> |
|
|
|
<view class=""> |
|
|
|
<pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion"> |
|
|
|
<pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion"> |
|
|
|
<view class="dis-flex flex-sp form-gorup-title"> |
|
|
|
<view class="dis-flex "> |
|
|
|
<view class=" flex-1">点击选择省市区<text class="form-group-tips-must">必选</text></view> |
|
|
|
<view class=" form-gorup-title">所在地区:</view> |
|
|
|
|
|
|
|
<view class="dis-flex flex-1 flex-end"> |
|
|
|
<view class="icon-ymt to-right font14 fcor666"> |
|
|
|
<view class=" pickRes fcor666">{{userAddress.region || '请选择'}}</view> |
|
|
|
|
|
|
|
<view class="icon-ymt to-right font14 fcor666"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</pick-regions> |
|
|
|
</pick-regions> |
|
|
|
<view class=" pickRes fcor666" >{{userAddress.region || '请选择'}}</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="width100 mart10 border-b"> |
|
|
|
<view class="width100 mart10 border-b"> |
|
|
@ -52,15 +46,30 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view style="clear: both;"> |
|
|
|
<!-- <view style="clear: both;"> --> |
|
|
|
<view class="form-gorup-title">详细地址<text class="form-group-tips-must">*</text> |
|
|
|
<view class="dis-flex"> |
|
|
|
|
|
|
|
<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"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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> |
|
|
|
<input type="text" name="address" v-model="userAddress.address" maxlength="40" |
|
|
|
</view> |
|
|
|
placeholder-class="corf6" :class="'fcor666 bs-bb '" placeholder="详细地址1~40个字符"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</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> --> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="default-checkbox " @click="defaultChange"> |
|
|
|
<view class="default-checkbox " @click="defaultChange"> |
|
|
@ -80,10 +89,16 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
|
|
import pickRegions from '@/components/pick-regions/pick-regions.vue' |
|
|
|
import pickRegions from '@/components/pick-regions/pick-regions.vue' |
|
|
|
|
|
|
|
import UniCombox from '@/components/uni-combox/components/uni-combox/uni-combox.vue' |
|
|
|
import {insertDeliveryAddress,findDeliveryAddressById,updateDeliveryAddress } from '@/Utils/physicalObject.js' |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
insertDeliveryAddress, |
|
|
|
|
|
|
|
findDeliveryAddressById, |
|
|
|
|
|
|
|
updateDeliveryAddress, |
|
|
|
|
|
|
|
baiduApiMapSearch |
|
|
|
|
|
|
|
} from '@/Utils/physicalObject.js' |
|
|
|
|
|
|
|
let app = getApp(); |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -99,19 +114,27 @@ |
|
|
|
region: [], |
|
|
|
region: [], |
|
|
|
regionId: '', |
|
|
|
regionId: '', |
|
|
|
//没用上 |
|
|
|
//没用上 |
|
|
|
defaultRegion: ['北京市', '市辖区', '东城区'], |
|
|
|
// defaultRegion: ['北京市', '市辖区', '东城区'], |
|
|
|
defaultRegionCode: '110101', |
|
|
|
defaultRegionCode: '', |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
candidates:[ |
|
|
|
|
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",}, |
|
|
|
|
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",}, |
|
|
|
|
|
|
|
// {"name": "重庆国贸中心-东北门","address": "重庆市渝中区中华路189号",} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
components: { |
|
|
|
components: { |
|
|
|
pickRegions |
|
|
|
pickRegions, |
|
|
|
|
|
|
|
"uni-combox":UniCombox |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onLoad(params) { |
|
|
|
onLoad(params) { |
|
|
|
|
|
|
|
console.log(params) |
|
|
|
this.dataParams = params |
|
|
|
this.dataParams = params |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -135,10 +158,16 @@ |
|
|
|
// } |
|
|
|
// } |
|
|
|
}, |
|
|
|
}, |
|
|
|
onReady() { |
|
|
|
onReady() { |
|
|
|
|
|
|
|
let str = "" |
|
|
|
|
|
|
|
if (this.dataParams && this.dataParams.id) { |
|
|
|
|
|
|
|
str = "地址编辑" |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
str = "地址添加" |
|
|
|
|
|
|
|
} |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: '地址'+(((this.dataParams.id || null) == null) ? '添加' : '编辑') |
|
|
|
title: str, |
|
|
|
}); |
|
|
|
}); |
|
|
|
if(this.dataParams.id){ |
|
|
|
if (this.dataParams && this.dataParams.id) { |
|
|
|
this.findAddressById(this.dataParams.id) |
|
|
|
this.findAddressById(this.dataParams.id) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -178,6 +207,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
// 获取选择的地区 |
|
|
|
// 获取选择的地区 |
|
|
|
handleGetRegion(region) { |
|
|
|
handleGetRegion(region) { |
|
|
|
|
|
|
|
|
|
|
|
// let region = JSON.parse(JSON.stringify(reg)) |
|
|
|
// let region = JSON.parse(JSON.stringify(reg)) |
|
|
|
this.region = region; |
|
|
|
this.region = region; |
|
|
|
this.regionId = this.region[2].code; |
|
|
|
this.regionId = this.region[2].code; |
|
|
@ -194,9 +224,70 @@ |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//点击了定位图标 |
|
|
|
|
|
|
|
location(){ |
|
|
|
|
|
|
|
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{ |
|
|
|
|
|
|
|
uni.getLocation({ |
|
|
|
|
|
|
|
type: 'wgs84', |
|
|
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baiduApiMapSearch(params).then(res=>{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(res.return_data&&res.return_data.length>0){ |
|
|
|
|
|
|
|
this.candidates = res.return_data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.candidates=[] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.candidates=[] |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: res.return_msg, |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getSelect(desc){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(desc) |
|
|
|
|
|
|
|
this.defaultRegionCode = desc.adcode ; |
|
|
|
|
|
|
|
this.userAddress.address = desc.address; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 默认地址设置改变 |
|
|
|
// 默认地址设置改变 |
|
|
|
defaultChange(e) { |
|
|
|
defaultChange(e) { |
|
|
|
this.userAddress.is_default = !this.userAddress.is_default |
|
|
|
this.userAddress.is_default = !this.userAddress.is_default |
|
|
@ -206,6 +297,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
// 数据提交 |
|
|
|
// 数据提交 |
|
|
|
form_submit() { |
|
|
|
form_submit() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.userAddress.name = this.userAddress.name.replace(/\s+/g, "") |
|
|
|
|
|
|
|
this.userAddress.tel = this.userAddress.tel.replace(/\s+/g, "") |
|
|
|
|
|
|
|
this.userAddress.address = this.userAddress.address.replace(/\s+/g, "") |
|
|
|
// 数据校验 |
|
|
|
// 数据校验 |
|
|
|
var validation = [{ |
|
|
|
var validation = [{ |
|
|
|
fields: "name", |
|
|
|
fields: "name", |
|
|
@ -350,6 +445,7 @@ |
|
|
|
width: 80%; |
|
|
|
width: 80%; |
|
|
|
box-sizing: border-box; |
|
|
|
box-sizing: border-box; |
|
|
|
z-index: 2; |
|
|
|
z-index: 2; |
|
|
|
|
|
|
|
|
|
|
|
.btn { |
|
|
|
.btn { |
|
|
|
height: 60px; |
|
|
|
height: 60px; |
|
|
|
border-radius: 30px; |
|
|
|
border-radius: 30px; |
|
|
@ -364,8 +460,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
.page-bottom-fixed { |
|
|
|
.page-bottom-fixed { |
|
|
|
height: calc(100vh - var(--window-top)); |
|
|
|
height: calc(100vh - var(--window-top)); |
|
|
|
padding-bottom: 100px; |
|
|
|
padding-bottom: 75px; |
|
|
|
box-sizing: border-box; |
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
overflow-y: auto; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*表单*/ |
|
|
|
/*表单*/ |
|
|
@ -376,9 +473,10 @@ |
|
|
|
padding: 20rpx; |
|
|
|
padding: 20rpx; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
border-radius: 20rpx; |
|
|
|
border-radius: 20rpx; |
|
|
|
overflow: auto; |
|
|
|
// overflow: auto; |
|
|
|
|
|
|
|
|
|
|
|
.pickRes , input { |
|
|
|
.pickRes, |
|
|
|
|
|
|
|
input { |
|
|
|
border-radius: 0; |
|
|
|
border-radius: 0; |
|
|
|
box-sizing: border-box; |
|
|
|
box-sizing: border-box; |
|
|
|
font-size: 18px; |
|
|
|
font-size: 18px; |
|
|
@ -395,6 +493,9 @@ |
|
|
|
margin-bottom: 5rpx; |
|
|
|
margin-bottom: 5rpx; |
|
|
|
font-weight: 500; |
|
|
|
font-weight: 500; |
|
|
|
font-size: 18px; |
|
|
|
font-size: 18px; |
|
|
|
|
|
|
|
width: 74px; |
|
|
|
|
|
|
|
white-space: nowrap; |
|
|
|
|
|
|
|
text-align: right; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -409,4 +510,30 @@ |
|
|
|
color: #f00; |
|
|
|
color: #f00; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.selector-item { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
font-size: 16px; |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
border-bottom: solid 1px #DDDDDD; |
|
|
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
text-align: left; |
|
|
|
|
|
|
|
.name{ |
|
|
|
|
|
|
|
height: 18px; |
|
|
|
|
|
|
|
line-height: 18px; |
|
|
|
|
|
|
|
color: #3da7e7; |
|
|
|
|
|
|
|
font-size: 16px; |
|
|
|
|
|
|
|
font-weight: bold; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.address{ |
|
|
|
|
|
|
|
font-size: 14px; |
|
|
|
|
|
|
|
height: 16px; |
|
|
|
|
|
|
|
line-height: 16px; |
|
|
|
|
|
|
|
color: #666666; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
</style> |
|
|
|