|
@@ -14,21 +14,28 @@
|
|
<view class="">
|
|
<view class="">
|
|
<u--form labelPosition="left" :model="addressInfo" ref="form1" labelWidth='100'>
|
|
<u--form labelPosition="left" :model="addressInfo" ref="form1" labelWidth='100'>
|
|
<u-form-item label="所属区域" ref="item1" borderBottom>
|
|
<u-form-item label="所属区域" ref="item1" borderBottom>
|
|
- <view style='width:100%;flex-direction:row-reverse;' class='flex align-center' @click='toMap' :class="addressInfo.area?'':'select-color'">
|
|
|
|
- <image src="../../static/right.png" style="width: 12px;height: 12px;margin-top: 2px;"></image>
|
|
|
|
- <view>{{addressInfo.area?(addressInfo.province+addressInfo.city+addressInfo.area):'选择所属区域 '}}</view>
|
|
|
|
|
|
+ <view style='width:100%;flex-direction:row-reverse;' class='flex align-center' @click='toMap'
|
|
|
|
+ :class="addressInfo.area?'':'select-color'">
|
|
|
|
+ <image src="../../static/right.png" style="width: 12px;height: 12px;margin-top: 2px;">
|
|
|
|
+ </image>
|
|
|
|
+ <view>
|
|
|
|
+ {{addressInfo.area?(addressInfo.province+addressInfo.city+addressInfo.area):'选择所属区域 '}}
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</u-form-item>
|
|
</u-form-item>
|
|
<u-form-item label="详细地址" prop="addressInfo.detailedAddress" ref="item1" borderBottom>
|
|
<u-form-item label="详细地址" prop="addressInfo.detailedAddress" ref="item1" borderBottom>
|
|
<!-- <u--input v-model="addressInfo.detailedAddress" border="none" inputAlign="left" placeholder="详细地址"></u--input> -->
|
|
<!-- <u--input v-model="addressInfo.detailedAddress" border="none" inputAlign="left" placeholder="详细地址"></u--input> -->
|
|
- <u--textarea v-model="addressInfo.detailedAddress" border="none" inputAlign="left" placeholder="请输入详细地址" autoHeight maxlength="15"></u--textarea>
|
|
|
|
|
|
+ <u--textarea v-model="addressInfo.detailedAddress" border="none" inputAlign="left"
|
|
|
|
+ placeholder="请输入详细地址" autoHeight maxlength="15"></u--textarea>
|
|
<!-- <u--input v-model="addressInfo.detailedAddress" border="none" placeholder="详细地址"></u--input> -->
|
|
<!-- <u--input v-model="addressInfo.detailedAddress" border="none" placeholder="详细地址"></u--input> -->
|
|
</u-form-item>
|
|
</u-form-item>
|
|
<u-form-item label="联系人" prop="addressInfo.contacts" ref="item1" borderBottom>
|
|
<u-form-item label="联系人" prop="addressInfo.contacts" ref="item1" borderBottom>
|
|
- <u--input v-model="addressInfo.contacts" maxlength="10" inputAlign="right" border="none" placeholder="请输入联系人">></u--input>
|
|
|
|
|
|
+ <u--input v-model="addressInfo.contacts" maxlength="10" inputAlign="right" border="none"
|
|
|
|
+ placeholder="请输入联系人">></u--input>
|
|
</u-form-item>
|
|
</u-form-item>
|
|
<u-form-item label="联系电话" prop="addressInfo.contactPhone" ref="item1">
|
|
<u-form-item label="联系电话" prop="addressInfo.contactPhone" ref="item1">
|
|
- <u--input v-model="addressInfo.contactPhone" inputAlign="right" border="none" placeholder="请输入联系电话" maxlength="11">>
|
|
|
|
|
|
+ <u--input v-model="addressInfo.contactPhone" inputAlign="right" border="none"
|
|
|
|
+ placeholder="请输入联系电话" maxlength="11">>
|
|
</u--input>
|
|
</u--input>
|
|
</u-form-item>
|
|
</u-form-item>
|
|
</u--form>
|
|
</u--form>
|
|
@@ -60,7 +67,8 @@
|
|
contacts: "",
|
|
contacts: "",
|
|
contactPhone: "",
|
|
contactPhone: "",
|
|
longitude: "",
|
|
longitude: "",
|
|
- latitude: ""
|
|
|
|
|
|
+ latitude: "",
|
|
|
|
+ adCode:"",
|
|
},
|
|
},
|
|
// rules: {
|
|
// rules: {
|
|
// // 'addressInfo.name': {
|
|
// // 'addressInfo.name': {
|
|
@@ -120,10 +128,10 @@
|
|
// this.isShowMap = true
|
|
// this.isShowMap = true
|
|
uni.getLocation({
|
|
uni.getLocation({
|
|
type: 'gcj02',
|
|
type: 'gcj02',
|
|
- geocode:true,
|
|
|
|
- altitude:true,
|
|
|
|
- isHighAccuracy:true,
|
|
|
|
- success: function (res) {
|
|
|
|
|
|
+ geocode: true,
|
|
|
|
+ altitude: true,
|
|
|
|
+ isHighAccuracy: true,
|
|
|
|
+ success: function(res) {
|
|
console.log('当前位置的经度:' + res.longitude);
|
|
console.log('当前位置的经度:' + res.longitude);
|
|
console.log('当前位置的纬度:' + res.latitude);
|
|
console.log('当前位置的纬度:' + res.latitude);
|
|
uni.chooseLocation({
|
|
uni.chooseLocation({
|
|
@@ -136,8 +144,6 @@
|
|
console.log('纬度:' + res.latitude);
|
|
console.log('纬度:' + res.latitude);
|
|
console.log('经度:' + res.longitude);
|
|
console.log('经度:' + res.longitude);
|
|
let _address = that.$helper.formatLocation(res.address)
|
|
let _address = that.$helper.formatLocation(res.address)
|
|
- console.log('----------------------------')
|
|
|
|
- console.log(_address)
|
|
|
|
that.addressInfo.latitude = res.latitude
|
|
that.addressInfo.latitude = res.latitude
|
|
that.addressInfo.longitude = res.longitude
|
|
that.addressInfo.longitude = res.longitude
|
|
that.addressInfo.detailedAddress = _address.Village
|
|
that.addressInfo.detailedAddress = _address.Village
|
|
@@ -145,6 +151,18 @@
|
|
that.addressInfo.city = _address.City
|
|
that.addressInfo.city = _address.City
|
|
that.addressInfo.area = _address.Country
|
|
that.addressInfo.area = _address.Country
|
|
that.addressInfo.commonId = that.userInfo.id
|
|
that.addressInfo.commonId = that.userInfo.id
|
|
|
|
+ uni.request({
|
|
|
|
+ url: 'https://restapi.amap.com/v3/config/district?key=d29a9d10160efaca0dd616bbec936d7f&subdistrict=1&keywords=' +
|
|
|
|
+ _address.City,
|
|
|
|
+ success: (res) => {
|
|
|
|
+ for(let i = 0 ; i < res.data.districts[0].districts.length ; i++){
|
|
|
|
+ if(res.data.districts[0].districts[i].name == _address.Country){
|
|
|
|
+ that.addressInfo.adCode = res.data.districts[0].districts[i].adcode
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
that.$forceUpdate()
|
|
that.$forceUpdate()
|
|
},
|
|
},
|
|
fail(err) {
|
|
fail(err) {
|
|
@@ -156,21 +174,21 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
// console.log(123)
|
|
// console.log(123)
|
|
// uni.$u.route('/pages/release/map', {
|
|
// uni.$u.route('/pages/release/map', {
|
|
// id: 1,
|
|
// id: 1,
|
|
// });
|
|
// });
|
|
},
|
|
},
|
|
validate() {
|
|
validate() {
|
|
- if (this.addressInfo.contacts.length<2||this.addressInfo.contacts.length>10) {
|
|
|
|
|
|
+ if (this.addressInfo.contacts.length < 2 || this.addressInfo.contacts.length > 10) {
|
|
this.$refs.uToast.show({
|
|
this.$refs.uToast.show({
|
|
type: 'error',
|
|
type: 'error',
|
|
message: "联系人姓名长度2-10个字符!",
|
|
message: "联系人姓名长度2-10个字符!",
|
|
})
|
|
})
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
- if (this.addressInfo.contactPhone.length<7) {
|
|
|
|
|
|
+ if (this.addressInfo.contactPhone.length < 7) {
|
|
this.$refs.uToast.show({
|
|
this.$refs.uToast.show({
|
|
type: 'error',
|
|
type: 'error',
|
|
message: "联系人电话输入错误!",
|
|
message: "联系人电话输入错误!",
|
|
@@ -184,7 +202,7 @@
|
|
})
|
|
})
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
- if (this.addressInfo.detailedAddress.length<4||this.addressInfo.detailedAddress.length>15) {
|
|
|
|
|
|
+ if (this.addressInfo.detailedAddress.length < 4 || this.addressInfo.detailedAddress.length > 15) {
|
|
this.$refs.uToast.show({
|
|
this.$refs.uToast.show({
|
|
type: 'error',
|
|
type: 'error',
|
|
message: "详细地址4-15个字符!",
|
|
message: "详细地址4-15个字符!",
|
|
@@ -237,14 +255,17 @@
|
|
right: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
margin: auto;
|
|
}
|
|
}
|
|
- /deep/input{
|
|
|
|
- word-break:break-all;
|
|
|
|
|
|
+
|
|
|
|
+ /deep/input {
|
|
|
|
+ word-break: break-all;
|
|
}
|
|
}
|
|
- /deep/.u-textarea{
|
|
|
|
- padding:9px 0;
|
|
|
|
|
|
+
|
|
|
|
+ /deep/.u-textarea {
|
|
|
|
+ padding: 9px 0;
|
|
}
|
|
}
|
|
- /deep/.u-textarea__field{
|
|
|
|
- color:#000;
|
|
|
|
- text-align:right;
|
|
|
|
|
|
+
|
|
|
|
+ /deep/.u-textarea__field {
|
|
|
|
+ color: #000;
|
|
|
|
+ text-align: right;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|