城市
This commit is contained in:
@@ -286,10 +286,19 @@ export function getCarDealerList() {
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
//获取省级联动 api/front/city
|
||||
//获取省级联动 /api/front/city/list/tree
|
||||
export function getAddress() {
|
||||
return request({
|
||||
'url': '/api/front/city/list/tree',
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//获取省级联动 /api/front/city/list
|
||||
export function getAddressList(params) {
|
||||
return request({
|
||||
'url': '/api/front/city/list',
|
||||
'method': 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
import {getAddress} from "@/api/system/config.js"
|
||||
// import {getAddress,getAddressList} from "@/api/system/config.js"
|
||||
|
||||
class address{
|
||||
// class address{
|
||||
|
||||
constructor(){
|
||||
getAddress().then(res=>{
|
||||
this.address = res.data
|
||||
})
|
||||
// constructor(){
|
||||
// getAddress().then(res=>{
|
||||
// this.address = res.data
|
||||
// })
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
||||
export default new address();
|
||||
|
||||
// export default new address();
|
||||
|
||||
@@ -284,7 +284,8 @@
|
||||
color="#13AFA8">立即订车</u-button>
|
||||
</view>
|
||||
</view>
|
||||
<u-picker keyName="carDealerName" :visibleItemCount="keyName == 'city' ? 3 : 5" @change="changeHandler"
|
||||
<!-- :visibleItemCount="keyName == 'city' ? 3 : 5" -->
|
||||
<u-picker keyName="regionName" @change="changeHandler"
|
||||
@cancel="show = false" @confirm="confirm" confirmColor="#13AFA8" :title="title" :show="show" round="16"
|
||||
:columns="columns" ref="uPicker"></u-picker>
|
||||
|
||||
@@ -371,6 +372,7 @@
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
import { paymentFn , wxpayPaymentFn } from "@/utils/index.js"
|
||||
import { getAddressList } from "@/api/system/config.js"
|
||||
import {
|
||||
postOrderCreate,
|
||||
frontPayCarSell,
|
||||
@@ -417,7 +419,16 @@
|
||||
city: '',
|
||||
IDType: ''
|
||||
},
|
||||
columns: [],
|
||||
// columns: [
|
||||
// [],
|
||||
// []
|
||||
// ],
|
||||
columns:[],
|
||||
columnData:[],
|
||||
// columnData: [
|
||||
// [],
|
||||
// []
|
||||
// ],
|
||||
carType: [
|
||||
['营运', '非营运', '预约出租车']
|
||||
],
|
||||
@@ -428,7 +439,10 @@
|
||||
[],
|
||||
[]
|
||||
],
|
||||
columnData: [],
|
||||
cityObj:{
|
||||
parentId:110000,
|
||||
regionType:2,
|
||||
},
|
||||
IDType: [
|
||||
['身份证', '护照']
|
||||
],
|
||||
@@ -646,10 +660,12 @@
|
||||
},
|
||||
//确认
|
||||
confirm(e) {
|
||||
// console.log(e,'queren --- 111');
|
||||
console.log(e,'queren --- 111');
|
||||
if (this.keyName == 'city') {
|
||||
this.form[this.keyName] = e.value[1]
|
||||
this.form.province = e.value[0]
|
||||
// this.form.province=e.value[0].regionName
|
||||
// this.form.city=e.value[0].regionName+e.value[1].regionName
|
||||
this.form[this.keyName] = e.value[1].regionName
|
||||
this.form.province = e.value[0].regionName
|
||||
} else {
|
||||
this.form[this.keyName] = e.value[0]
|
||||
}
|
||||
@@ -664,6 +680,7 @@
|
||||
},
|
||||
//
|
||||
openPopup(e) {
|
||||
console.log(e,'打开');
|
||||
this.keyName = e
|
||||
this.columns = this[e]
|
||||
this.show = true
|
||||
@@ -676,6 +693,7 @@
|
||||
changeHandler(e) {
|
||||
// console.log(e,'eeeeeee');
|
||||
// console.log(this.$refs.uPicker,'refs');
|
||||
|
||||
if (this.keyName == 'city') {
|
||||
const {
|
||||
columnIndex,
|
||||
@@ -687,7 +705,17 @@
|
||||
this.loading = true
|
||||
// 模拟网络请求
|
||||
uni.$u.sleep(100).then(() => {
|
||||
picker.setColumnValues(1, this.columnData[index])
|
||||
// let parentId1 = this.columns[0][index].regionId
|
||||
let parentId1 = this.city[0][index].regionId
|
||||
// console.log(parentId1,'parentId1');
|
||||
getAddressList({parentId:parentId1,regionType:2}).then(res1=>{
|
||||
// console.log(res1,'数据变化');
|
||||
this.columnData[index]=res1.data
|
||||
// this.columns[1]=res1.data
|
||||
this.city[1]=res1.data
|
||||
picker.setColumnValues(1, this.columnData[index])
|
||||
})
|
||||
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
@@ -696,23 +724,17 @@
|
||||
},
|
||||
onLoad(optons) {
|
||||
this.orderType = optons.type
|
||||
if(this.$address.address){
|
||||
let arr =this.$address.address
|
||||
// console.log(this.$address,'8888888888');
|
||||
arr.forEach((item, index) => {
|
||||
this.city[0].push(item.regionName)
|
||||
item.child.forEach(i => {
|
||||
if (!this.columnData[index]) this.columnData[index] = []
|
||||
this.columnData[index].push(i.regionName)
|
||||
})
|
||||
})
|
||||
}
|
||||
getAddressList({parentId:1,regionType:1}).then(res=>{
|
||||
// console.log(res,'省');
|
||||
// this.columns[0]=res.data
|
||||
this.city[0]=res.data
|
||||
this.city[1]=[ { regionId: 110100, parentId: 110000, regionName: '北京市', regionType: 2,isChild: true } ]
|
||||
})
|
||||
|
||||
this.city[1] = this.columnData[0]
|
||||
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
eventChannel.on('form', (data) => {
|
||||
console.log(data,'1111133333');
|
||||
// console.log(data,'1111133333');
|
||||
this.formProductData = data
|
||||
this.monthRent = String(data.monthRent)
|
||||
// this.formProductData.monthRent = String(data.monthRent)
|
||||
|
||||
Reference in New Issue
Block a user