Commit 523ed85a authored by 黄媛媛's avatar 黄媛媛

地址的智能识别

parent f7cf2a11
...@@ -28,18 +28,32 @@ ...@@ -28,18 +28,32 @@
</view> </view>
</view> </view>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/> <view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<!-- TODO 定位地址 --> <view class="addcenter_item2" style="align-items: flex-start;">
<!-- <view class="addcenter_item">
<Text>定位地址</Text>
<view style="display: flex;flex-direction: row;align-items: center;">
<Text style='#303133'>{{msg.address}}</Text>
<u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon>
</view>
</view> -->
<view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<view class="addcenter_item2">
<Text>详细地址</Text> <Text>详细地址</Text>
<input class="uni-input inputM" v-model="msg.Address" /> <textarea
style="height: 50px;"
class="inputM"
v-model="msg.Address"
/>
</view>
</view>
<!-- 智能识别 -->
<view class="smart">
<view>
<span>智能识别</span>
<textarea
placeholder="请粘贴或输入你的地址"
placeholder-style="font-size:13px"
:value="identifyinput"
@input='identifybtn'
class="inputsmart"
/>
<view style="display: flex;flex-direction: row;justify-content: flex-end;">
<view class="btn_smart" :style="{'background':mainColor}" @click="addidentify">
<Text>识别</Text>
</view>
</view>
</view> </view>
</view> </view>
<view class="btn" @click="preserve" :style="{'background':mainColor}"> <view class="btn" @click="preserve" :style="{'background':mainColor}">
...@@ -53,7 +67,7 @@ ...@@ -53,7 +67,7 @@
<script> <script>
import pickerAddress from './liudx-pickerAddress/index.vue' import pickerAddress from './liudx-pickerAddress/index.vue'
import AddressParse from './zh-address-parse.min.js'
export default { export default {
components: { components: {
pickerAddress pickerAddress
...@@ -75,6 +89,7 @@ ...@@ -75,6 +89,7 @@
address:'', address:'',
Pickershwo:false, Pickershwo:false,
addressShow: false, addressShow: false,
identifyinput:'',
} }
}, },
...@@ -161,6 +176,39 @@ ...@@ -161,6 +176,39 @@
} }
}, },
identifybtn(val){
this.identifyinput = val.detail.value
},
addidentify(){
let parseResult = AddressParse(this.identifyinput, 0)
console.log(parseResult)
this.msg.Name = parseResult.name;
this.msg.Mobile = parseResult.phone;
this.msg.Address = parseResult.detail;
let nameList = [parseResult.province, parseResult.city, parseResult.area];
this.getDestination(nameList);
},
getDestination(nameList) {
this.request2(
{
url: '/api/AppletUser/GetDestinationListByNames',
data: {
area: nameList
}
},
res => {
console.log('res', res);
this.msg.Province = res.data[0].ID;
this.msg.City = res.data[1].ID;
this.msg.District = res.data[2].ID;
this.address = nameList[0]+','+nameList[1]+','+nameList[2]
}
);
},
} }
} }
</script> </script>
...@@ -215,9 +263,33 @@ ...@@ -215,9 +263,33 @@
margin-top: 46rpx; margin-top: 46rpx;
border-radius: 40rpx; border-radius: 40rpx;
} }
.AddaddressStyle .btn_smart{
width: 60px;
height: 50rpx;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
margin-top: 10rpx;
border-radius: 25rpx;
}
.AddaddressStyle .inputM{ .AddaddressStyle .inputM{
margin-left: 20rpx; margin-left: 20rpx;
width: 70%; width: 70%;
text-align: right; text-align: right;
} }
.AddaddressStyle .inputsmart{
width: 100%;
height: 100px;
margin-top: 10px;
}
.AddaddressStyle .smart{
width: 100%;
padding: 20rpx 28rpx;
background: #FFFFFF;
margin-top: 20px;
}
</style> </style>
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment