uu
This commit is contained in:
parent
307654abf3
commit
7744c81745
@ -170,8 +170,16 @@ const pageEventNames = {
|
||||
chooseAddress: "chooseAddress", // 地址选择
|
||||
}
|
||||
|
||||
const addressNameCodeMap = [
|
||||
{ nameKey: 'countryName', codeKey: 'country' },
|
||||
{ nameKey: 'provinceName', codeKey: 'province' },
|
||||
{ nameKey: 'cityName', codeKey: 'city' },
|
||||
{ nameKey: 'countyName', codeKey: 'county' },
|
||||
{ nameKey: 'townName', codeKey: 'town' }
|
||||
]
|
||||
|
||||
export {
|
||||
addressNameCodeMap,
|
||||
ordStaEnum,
|
||||
ordStatusList,
|
||||
payTypeEnum,
|
||||
|
||||
@ -97,7 +97,7 @@ const numberToChinese = (num)=> {
|
||||
|
||||
// - 获取地址详情
|
||||
const getAddressDetail = (item= {})=> {
|
||||
return `${item.countryName||''}${item.provinceName||''}${item.cityName||''}${item.countyName||''}${item.address||''}`
|
||||
return `${item.countryName||''}${item.provinceName||''}${item.cityName||''}${item.countyName||''}${item.townName||''}${item.address||''}`
|
||||
}
|
||||
|
||||
// - 转换list的key val
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
</view>
|
||||
|
||||
<view class="mt-40 pos-rlt">
|
||||
<tpx-input v-model:value="_area" placeholder="所在地区"></tpx-input>
|
||||
<tpx-input :value="getAddressDetail(submitParam)" placeholder="所在地区"></tpx-input>
|
||||
<view @click="handleDialogClick(addressModal)" class="pos-abt-all"></view>
|
||||
</view>
|
||||
|
||||
@ -82,6 +82,8 @@
|
||||
<script>
|
||||
import { getAddressModels } from "./model"
|
||||
import * as apiService from "@/common/api"
|
||||
import { addressNameCodeMap } from "@/common/enum"
|
||||
import { getAddressDetail } from "@/common/util"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -120,6 +122,7 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
getAddressDetail,
|
||||
async initData() {
|
||||
if(this.queryOption.id) {
|
||||
let res = await apiService.getAddressById({ id: this.queryOption.id, _loading: true })
|
||||
@ -127,16 +130,24 @@
|
||||
res.data.blDefaultFlag = [true]
|
||||
}
|
||||
this.submitParam = res.data
|
||||
// 回显 国家-省市区组件数据
|
||||
addressNameCodeMap.map((t, index)=> {
|
||||
let name = res.data[t.nameKey]
|
||||
let code = res.data[t.codeKey]
|
||||
name && (this.addressModal.values.regIds[index] = name);
|
||||
code && (this.addressModal.values.regNames[index] = code);
|
||||
})
|
||||
}
|
||||
},
|
||||
handleAnsText(){
|
||||
|
||||
},
|
||||
handleAddressChoose(data) {
|
||||
this.submitParam.country = data.regIds[0]
|
||||
this.submitParam.province = data.regIds[1]
|
||||
this.submitParam.city = data.regIds[2]
|
||||
this.submitParam.county = data.regIds[3]
|
||||
data.regIds.map((regId, index)=> {
|
||||
let nameCodeMap = addressNameCodeMap[index]
|
||||
this.submitParam[nameCodeMap.codeKey] = regId
|
||||
this.submitParam[nameCodeMap.nameKey] = data.regNames[index]
|
||||
})
|
||||
},
|
||||
handleReset(){
|
||||
this.submitParam = getAddressModels()
|
||||
|
||||
@ -4,9 +4,15 @@ export const getAddressModels = () => {
|
||||
"name": "", // 姓名
|
||||
"phone": "", // 手机号
|
||||
"country": "", // 国家代码
|
||||
"countryName": "", // 国家名称
|
||||
"province": "", // 省份code
|
||||
"provinceName": "", // 省份名称
|
||||
"city": "", // 城市code
|
||||
"county": "", // 区 code
|
||||
"cityName": "", // 城市名称
|
||||
"county": "", // 城镇 code
|
||||
"countyName": "", // 城镇名称
|
||||
"town": "", // 街道编号
|
||||
"townName": "", // 街道名称
|
||||
"address": "", // 详细地址
|
||||
"postCode": "", // 邮编
|
||||
"email": null,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user