|
|
|
@ -5,12 +5,15 @@ |
|
|
|
</view> |
|
|
|
<view class="address_info"> |
|
|
|
<view class="address_info_item address_info_item1"> |
|
|
|
<view class="info_item_title"> |
|
|
|
<view> |
|
|
|
<view class="info_item_title" > |
|
|
|
|
|
|
|
<picker @change="bindPickerChange" :value="index" :range="countryList" range-key="region_name" class="info_item_title_pick"> |
|
|
|
<text>*Country/Region</text> |
|
|
|
<view class="info_item_title_span">United States</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_title_span">{{countryText}}</view> |
|
|
|
</picker> |
|
|
|
<image src="../../static/img/right1.png" mode=""></image> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -21,7 +24,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
<input type="text" v-model="query.consignee.consignee"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="address_info_item"> |
|
|
|
@ -31,17 +34,17 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
<input type="number" v-model="query.consignee.mobile"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="address_info_item"> |
|
|
|
<view class="info_item_title"> |
|
|
|
<view> |
|
|
|
<text>*Stree adderss or P.O.Box</text> |
|
|
|
<text>*Stree adderss or P.O.Box</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
<input type="text" v-model="query.consignee.address"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="address_info_item"> |
|
|
|
@ -51,34 +54,63 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
<input type="text" v-model="query.consignee.sign_building"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="address_info_item"> |
|
|
|
<view class="info_item_title"> |
|
|
|
<view class="address_info_item address_info_item1"> |
|
|
|
|
|
|
|
<view class="info_item_title" v-if="isSelect1"> |
|
|
|
<picker @change="bindPickerChange2" :value="cityIndex" :range="cityList" range-key="region_name" class="info_item_title_pick"> |
|
|
|
<text >*City/Town</text> |
|
|
|
<view class="info_item_title_span">{{cityText}}</view> |
|
|
|
</picker> |
|
|
|
<image src="../../static/img/right1.png" mode=""></image> |
|
|
|
</view> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
<view class="info_item_title" > |
|
|
|
<text >*City/Town</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text" v-model="city"> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<!-- <view class="info_item_title"> |
|
|
|
<view> |
|
|
|
<text>*City/Town</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
</view> |
|
|
|
<input type="text" v-model="city"> |
|
|
|
</view> --> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="address_info"> |
|
|
|
<view class="address_info_item"> |
|
|
|
<view class="info_item_title"> |
|
|
|
<view> |
|
|
|
<text class="info_item_title_span">State/Province</text> |
|
|
|
</view> |
|
|
|
<image src="../../static/img/bottom.png" mode=""></image> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
<view class="address_info_item address_info_item1"> |
|
|
|
<view class="info_item_title" v-if="isSelect"> |
|
|
|
<picker @change="bindPickerChange1" :value="provinceIndex" :range="provinceList" range-key="region_name" class="info_item_title_pick"> |
|
|
|
<text >State/Province</text> |
|
|
|
<view class="info_item_title_span">{{provinceText}}</view> |
|
|
|
</picker> |
|
|
|
<image src="../../static/img/right1.png" mode=""></image> |
|
|
|
</view> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
<view class="info_item_title" > |
|
|
|
<text >State/Province</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text" v-model="province"> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="address_info_item"> |
|
|
|
@ -88,38 +120,149 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info_item_input"> |
|
|
|
<input type="text"> |
|
|
|
<input type="text" v-model="query.consignee.zipcode"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="address_switch"> |
|
|
|
<text>Make this my default address</text> |
|
|
|
<switch checked="true" color="#B22234"/> |
|
|
|
<switch :checked="query.is_default==1" color="#B22234" @change="isDefault"/> |
|
|
|
</view> |
|
|
|
<view class="address_submit"> |
|
|
|
<button>FINISH</button> |
|
|
|
<button @click="save">FINISH</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import {defaultRequest2} from '../../api/index.js' |
|
|
|
import {defaultRequest2,defaultRequest3} from '../../api/index.js' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
|
|
|
|
isSelect:false, |
|
|
|
isSelect1:false, |
|
|
|
countryList:[], |
|
|
|
index:0, |
|
|
|
countryText:'', |
|
|
|
provinceList:[], |
|
|
|
provinceIndex:0, |
|
|
|
provinceText:'', |
|
|
|
cityList:[], |
|
|
|
cityIndex:0, |
|
|
|
cityText:'', |
|
|
|
query:{ |
|
|
|
_action:'saveconsignee', |
|
|
|
consignee:{ |
|
|
|
address_id:0, |
|
|
|
consignee:'', |
|
|
|
country:0, |
|
|
|
province:0, |
|
|
|
city:0, |
|
|
|
district:1, |
|
|
|
address:'', |
|
|
|
zipcode:'', |
|
|
|
email:'', |
|
|
|
tel:'', |
|
|
|
mobile:'', |
|
|
|
sign_building:'', |
|
|
|
best_time:'' |
|
|
|
}, |
|
|
|
is_default:0 |
|
|
|
}, |
|
|
|
province:'', |
|
|
|
city:'' |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
|
|
|
|
// 保存 |
|
|
|
save(){ |
|
|
|
if(!this.isSelect1){ |
|
|
|
this.query.consignee.address=this.city+this.query.consignee.address |
|
|
|
} |
|
|
|
if(!this.isSelect){ |
|
|
|
this.query.consignee.address=this.province+this.query.consignee.address |
|
|
|
} |
|
|
|
console.info(this.query) |
|
|
|
defaultRequest3(this.query).then(res=>{ |
|
|
|
console.info(res) |
|
|
|
if(res.error==0){ |
|
|
|
uni.showToast({ |
|
|
|
icon:'none', |
|
|
|
title:res.message |
|
|
|
}) |
|
|
|
uni.navigateBack() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 切换是否默认地址 |
|
|
|
isDefault(e){ |
|
|
|
console.info(e) |
|
|
|
if(e.detail.value){ |
|
|
|
this.query.is_default=1 |
|
|
|
}else{ |
|
|
|
this.query.is_default=0 |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取国家数据 |
|
|
|
getCountry(){ |
|
|
|
let data={_action:'getregions',parent_region_id:0} |
|
|
|
defaultRequest2(data).then(res=>{ |
|
|
|
console.info(res) |
|
|
|
if(res.error==0){ |
|
|
|
this.countryList=res.data |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 选择国家 |
|
|
|
bindPickerChange(e){ |
|
|
|
this.index=e.detail.value |
|
|
|
if(this.countryList[this.index].regions){ |
|
|
|
this.isSelect=true |
|
|
|
this.provinceList=this.countryList[this.index].regions |
|
|
|
}else{ |
|
|
|
this.isSelect=false |
|
|
|
this.isSelect1=false |
|
|
|
this.provinceText='' |
|
|
|
this.cityText='' |
|
|
|
} |
|
|
|
this.query.consignee.country=this.countryList[this.index].region_id |
|
|
|
this.countryText=this.countryList[this.index].region_name |
|
|
|
}, |
|
|
|
// 选择省份 |
|
|
|
bindPickerChange1(e){ |
|
|
|
console.info(e.detail.value) |
|
|
|
this.provinceIndex=e.detail.value |
|
|
|
|
|
|
|
if(this.provinceList[this.provinceIndex].regions){ |
|
|
|
this.isSelect1=true |
|
|
|
this.cityList=this.provinceList[this.index].regions |
|
|
|
}else{ |
|
|
|
this.isSelect1=false |
|
|
|
this.cityText='' |
|
|
|
} |
|
|
|
this.query.consignee.province=this.provinceList[this.provinceIndex].region_id |
|
|
|
this.provinceText=this.provinceList[this.provinceIndex].region_name |
|
|
|
}, |
|
|
|
// 选择城市 |
|
|
|
bindPickerChange2(e){ |
|
|
|
this.cityIndex=e.detail.value |
|
|
|
this.query.consignee.city=this.cityList[this.cityIndex].region_id |
|
|
|
this.cityText=this.cityList[this.cityIndex].region_name |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.getCountry() |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style> |
|
|
|
page{ |
|
|
|
background-color: #F6F5FA; |
|
|
|
padding-bottom: 20rpx; |
|
|
|
} |
|
|
|
</style> |
|
|
|
<style lang="scss" scoped> |
|
|
|
|
|
|
|
.address_serch{ |
|
|
|
background-color: white; |
|
|
|
padding: 26.67rpx 24rpx; |
|
|
|
@ -160,6 +303,10 @@ |
|
|
|
align-items: center; |
|
|
|
font-weight: bold; |
|
|
|
margin-bottom: 10rpx; |
|
|
|
|
|
|
|
.info_item_title_pick{ |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
.info_item_title_span{ |
|
|
|
color: black; |
|
|
|
margin-top: 15.33rpx; |
|
|
|
|