uu
This commit is contained in:
parent
e2c892ef55
commit
c7137718b7
@ -42,5 +42,9 @@ export const getAddressById = (data = {})=> {
|
|||||||
return coreRequest(url.getAddressById, data, {}, 'GET')
|
return coreRequest(url.getAddressById, data, {}, 'GET')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const parseAddress = (data = {})=> {
|
||||||
|
return coreRequest(url.parseAddress, data, {}, "GET")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ export default {
|
|||||||
addAddress: `/emis/emisCustomerAddress/addAddress`, // 新增地址
|
addAddress: `/emis/emisCustomerAddress/addAddress`, // 新增地址
|
||||||
editAddress: `/emis/emisCustomerAddress/editAddress`, // 编辑地址
|
editAddress: `/emis/emisCustomerAddress/editAddress`, // 编辑地址
|
||||||
getAddressById: `/emis/emisCustomerAddress/getAddressById`, // 查看地址
|
getAddressById: `/emis/emisCustomerAddress/getAddressById`, // 查看地址
|
||||||
|
parseAddress: `/emis/common/parseAddress`, // 智能地址解析(仅中国)
|
||||||
|
|
||||||
getTransLineList: `/emis/emisTransLine/listSimple`, // 获取路线列表
|
getTransLineList: `/emis/emisTransLine/listSimple`, // 获取路线列表
|
||||||
getTransProductList: `/emis/emisTransProduct/listSimple`, // 获取产品列表
|
getTransProductList: `/emis/emisTransProduct/listSimple`, // 获取产品列表
|
||||||
|
|||||||
@ -74,7 +74,7 @@ function handleResponse({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showToast(`网络错误`)
|
showToast(msg || `网络错误`)
|
||||||
}, 0)
|
}, 0)
|
||||||
reject({
|
reject({
|
||||||
code: {}
|
code: {}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { addressNameCodeMap } from "./enum"
|
||||||
|
|
||||||
function formatTime(time) {
|
function formatTime(time) {
|
||||||
if (typeof time !== 'number' || time < 0) {
|
if (typeof time !== 'number' || time < 0) {
|
||||||
return time
|
return time
|
||||||
@ -96,8 +98,30 @@ const numberToChinese = (num)=> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - 获取地址详情
|
// - 获取地址详情
|
||||||
const getAddressDetail = (item= {})=> {
|
const getAddressDetail = (item= {}, showDetail = true)=> {
|
||||||
return `${item.countryName||''}${item.provinceName||''}${item.cityName||''}${item.countyName||''}${item.townName||''}${item.address||''}`
|
let ary = []
|
||||||
|
addressNameCodeMap.map((t)=> {
|
||||||
|
ary.push(item[t.nameKey])
|
||||||
|
})
|
||||||
|
if(showDetail) {
|
||||||
|
ary.push(item.address)
|
||||||
|
}
|
||||||
|
return ary.join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
const setAddresModalParam = (data = {})=> {
|
||||||
|
let regIds = []
|
||||||
|
let regNames = []
|
||||||
|
addressNameCodeMap.map((t, index)=> {
|
||||||
|
let name = data[t.nameKey]
|
||||||
|
let code = data[t.codeKey]
|
||||||
|
name && (regIds[index] = code);
|
||||||
|
code && (regNames[index] = name);
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
regIds,
|
||||||
|
regNames
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - 转换list的key val
|
// - 转换list的key val
|
||||||
@ -147,6 +171,7 @@ const throttle = (fn, wait) => {
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
getAddressDetail,
|
getAddressDetail,
|
||||||
|
setAddresModalParam,
|
||||||
numberToChinese,
|
numberToChinese,
|
||||||
formatTime,
|
formatTime,
|
||||||
formatLocation,
|
formatLocation,
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
|
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
|
||||||
<view class="blcok-white radius-20">
|
<view class="blcok-white radius-20">
|
||||||
<u-textarea v-model="submitParam.otherDes" border="none" height="110" placeholder="粘贴或输入地址,点击“智能识别”自动拆分姓名、电话和地址" custom-style="border:0;padding: 0;"></u-textarea>
|
<u-textarea v-model="ansValue" border="none" height="110" placeholder="粘贴或输入地址,点击“智能识别”自动拆分姓名、电话和地址" custom-style="border:0;padding: 0;"></u-textarea>
|
||||||
<u-row justify="end">
|
<u-row justify="end">
|
||||||
<view class="mt-10">
|
<view class="mt-10">
|
||||||
<u-button @click="handleAnsText()" type="primary" size="mini" shape="circle" custom-style="width: 130rpx;font-size: 24rpx;padding:0;">智能识别</u-button>
|
<u-button @click="handleAnsText()" type="primary" size="mini" shape="circle" custom-style="width: 130rpx;font-size: 24rpx;padding:0;">智能识别</u-button>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-40 pos-rlt">
|
<view class="mt-40 pos-rlt">
|
||||||
<tpx-input :value="getAddressDetail(submitParam)" placeholder="所在地区"></tpx-input>
|
<tpx-input :value="getAddressDetail(submitParam, false)" placeholder="所在地区"></tpx-input>
|
||||||
<view @click="handleDialogClick(addressModal)" class="pos-abt-all"></view>
|
<view @click="handleDialogClick(addressModal)" class="pos-abt-all"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -83,7 +83,7 @@
|
|||||||
import { getAddressModels } from "./model"
|
import { getAddressModels } from "./model"
|
||||||
import * as apiService from "@/common/api"
|
import * as apiService from "@/common/api"
|
||||||
import { addressNameCodeMap } from "@/common/enum"
|
import { addressNameCodeMap } from "@/common/enum"
|
||||||
import { getAddressDetail } from "@/common/util"
|
import { getAddressDetail, setAddresModalParam } from "@/common/util"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -103,6 +103,7 @@
|
|||||||
regNames: []
|
regNames: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
ansValue: '',
|
||||||
submitParam: {
|
submitParam: {
|
||||||
...getAddressModels(),
|
...getAddressModels(),
|
||||||
}
|
}
|
||||||
@ -129,18 +130,17 @@
|
|||||||
if(res.data.blDefaultFlag) {
|
if(res.data.blDefaultFlag) {
|
||||||
res.data.blDefaultFlag = [true]
|
res.data.blDefaultFlag = [true]
|
||||||
}
|
}
|
||||||
this.submitParam = res.data
|
|
||||||
// 回显 国家-省市区组件数据
|
// 回显 国家-省市区组件数据
|
||||||
addressNameCodeMap.map((t, index)=> {
|
this.addressModal.values = setAddresModalParam(res.data);
|
||||||
let name = res.data[t.nameKey]
|
this.submitParam = res.data
|
||||||
let code = res.data[t.codeKey]
|
|
||||||
name && (this.addressModal.values.regIds[index] = code);
|
|
||||||
code && (this.addressModal.values.regNames[index] = name);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleAnsText(){
|
|
||||||
|
|
||||||
|
async handleAnsText(){
|
||||||
|
let res = await apiService.parseAddress({ content: this.ansValue, _loading: true })
|
||||||
|
let data = res.data || {}
|
||||||
|
this.addressModal.values = setAddresModalParam(data);
|
||||||
|
Object.assign(this.submitParam, data)
|
||||||
},
|
},
|
||||||
handleAddressChoose(data) {
|
handleAddressChoose(data) {
|
||||||
data.regIds.map((regId, index)=> {
|
data.regIds.map((regId, index)=> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user