获取地址列表 和 类型列表

This commit is contained in:
wlikett 2023-12-08 13:24:09 +08:00
parent 40ab96b520
commit ea028383df
2 changed files with 90 additions and 134 deletions

View File

@ -7,18 +7,27 @@ export const getList = (params = {}) => {
//获取装备详情
export const getDetail = (id = '') => {
return get(`/dev/${id}`)
return get(`/zlpt-equip/dev/${id}`)
}
//获取 推荐装备列表
export const getHotList = (params) => {
return get('/dev/hotList', params)
return get('/zlpt-equip/dev/hotList', params)
}
//装备收藏 取消收藏
export const equipCollect = (params = {}) => {
return put('/collect', params)
return put('/zlpt-equip/collect', params)
}
//提交租赁申请
export const apiSubmitLease = (params = {}) => {
return post('/details', params)
return post('/zlpt-order/info', params)
}
//获取装备分类列表 (级联)
export const apiGetEquipTypeList = (params = {}) => {
return post('/zlpt-equip/type/list',params)
}
//获取省市区列表 (级联)
export const apiGetAddressList = (params = {}) => {
return post('/zlpt-company/baseAddress/selectAddress',params)
}

View File

@ -91,14 +91,12 @@
import {computed, onMounted, onUnmounted, reactive, ref} from "vue";
import EquipCard from "@/components/equipCard.vue";
import {useRoute, useRouter} from "vue-router";
import { getList } from "@/http/api/equip"
import {apiGetAddressList, apiGetEquipTypeList, getList} from "@/http/api/equip"
import $bus from "@/utils/bus"
import NavMenu from "@/components/Navmenu/index.vue"
import address from "@/assets/temporaryAddress.json"
const router = useRouter()
const addressData = reactive(address)
//
const screenChooseList = reactive([
@ -111,86 +109,13 @@ const screenChooseList = reactive([
name: '省份',
value: '',
parent: 'address',
select: [
{
id: 1,
name: '安徽'
}, {
id: 1,
name: '上海'
}, {
id: 1,
name: '北京'
}, {
id: 1,
name: '四川'
}, {
id: 1,
name: '河南'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
},
]
select: []
},
{
name: '城市',
value: '',
parent: 'address',
select: [
{
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
}, {
id: 1,
name: '安徽'
},
]
select: []
}
]
},
@ -203,43 +128,19 @@ const screenChooseList = reactive([
name: '类别',
value: '',
parent: 'type',
select: [
{
id: 1,
name: '挖掘机械'
}, {
id: 1,
name: '土方机械'
},
]
select: []
},
{
name: '组别',
value: '',
parent: 'type',
select: [
{
id: 1,
name: '组别1'
},
]
select: []
},
{
name: '产品名称',
value: '',
parent: 'type',
select: [
{
id: 1,
name: '产品1'
}, {
id: 1,
name: '产品2'
}, {
id: 1,
name: '产品3'
},
]
select: []
}
]
},
@ -254,16 +155,20 @@ const screenChooseList = reactive([
parent: 'rent',
select: [{
id: 1,
name: '5千元以下'
name: '5千元以下',
value:['',5000]
}, {
id: 1,
name: '5千-1万'
name: '5千-1万',
value:[5000,10000]
}, {
id: 1,
name: '1万-5万'
name: '1万-5万',
value: [10000,50000]
}, {
id: 1,
name: '5万-10万'
name: '5万-10万',
value: [50000,100000]
},]
}
]
@ -279,16 +184,20 @@ const screenChooseList = reactive([
parent: 'rent',
select: [{
id: 1,
name: '一年以下'
name: '一年以下',
value: ['',1]
}, {
id: 1,
name: '1年-3年'
name: '1年-3年',
value: [1,3]
}, {
id: 1,
name: '3年-6年'
name: '3年-6年',
value: [3,6]
}, {
id: 1,
name: '10年以上'
name: '10年以上',
value: [10,'']
}]
}
]
@ -332,11 +241,13 @@ const screenOptionList = reactive([
}, {
name: '更新时间',
id: '2',
sort: 'asc' //asc or desc
sort: 'asc', //asc or desc
key:'updateTimeOrderBy'
}, {
name: '月租金',
id: '3',
sort: 'asc'
sort: 'asc',
key:'monthLeasePriceOrderBy'
},
])
//
@ -400,6 +311,18 @@ const selectScreen = (parentIndex, val, index) => {
}
)
screenChooseList[parentIndex].index++
if(screenChooseList[parentIndex].index == screenChooseList[parentIndex].list.length){
return
}
switch (screenChooseList[parentIndex].name){
case 'address':
getAddressData(val.code)
break;
case 'type':
getTypeData(val.typeId)
break;
}
}
//card
@ -414,15 +337,45 @@ const pageChange = (val) => {
pageData.pageNum = val
getData()
}
//
const getAddressData = async (code = null) => {
let params = {}
if(code){
params = {
code
}
}
const res = await apiGetAddressList(params)
const index = screenChooseList.findIndex(key => key.name == 'address')
screenChooseList[index].list[ screenChooseList[index].index ].select = res.data
}
//
const getTypeData = async (typeId = null) => {
let params = {}
if(typeId){
params = {typeId}
}
const res = await apiGetEquipTypeList(params)
console.log('getTypeData ===============',res)
}
//
const getData = async (text = '') => {
//
const address = screenChooseList.find(key => key.name == 'address').select
//
const type = screenChooseList.find(key => key.name == 'type').select
const params = {
keyWord: text,
pageSize:pageData.pageSize,
pageNum:pageData.pageNum,
updateTimeOrderBy:'',
monthLeasePriceOrderBy:'',
typeId:'',
location: address && address.length > 0 ? address[address.length - 1] : '',
typeId: type && type.length > 0 ? type[address.length - 1] : '',
monthLeasePriceMin:0,
monthLeasePriceMax:'',
ageMin:'',
@ -431,6 +384,7 @@ const getData = async (text = '') => {
workingHoursMax:''
}
if(optionActive.value == '1'){
}else if(optionActive.value == '2'){
@ -438,7 +392,8 @@ const getData = async (text = '') => {
}
const res = await getList(params)
pageData.total = res.total
pageData.total = res.total || 0
equipList.value = res.rows
}
@ -453,23 +408,15 @@ const getParams = () => {
return params
}
const handelInitScreen = () => {
const index = screenChooseList.findIndex(key => key.name == 'address')
screenChooseList[index].list[0].select = addressData.province
screenChooseList[index].list[1].select = addressData.city
console.log(screenChooseList)
}
const init = () => {
const init = async () => {
const params = getParams()
if(params && params.keyWord){
$bus.emit('callBackText',params.keyWord)
$bus.off('callBackText')
}
handelInitScreen()
getData()
await getTypeData()
await getAddressData()
await getData()
}
init()