From ea028383dfa8b73a5047ac351f1d2de21aa3b051 Mon Sep 17 00:00:00 2001 From: wlikett <2331964395@qq.com> Date: Fri, 8 Dec 2023 13:24:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9C=B0=E5=9D=80=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E5=92=8C=20=E7=B1=BB=E5=9E=8B=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/api/equip.ts | 19 +++- src/views/equip/list.vue | 205 +++++++++++++++------------------------ 2 files changed, 90 insertions(+), 134 deletions(-) diff --git a/src/http/api/equip.ts b/src/http/api/equip.ts index b63a9b8..07c099b 100644 --- a/src/http/api/equip.ts +++ b/src/http/api/equip.ts @@ -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) } diff --git a/src/views/equip/list.vue b/src/views/equip/list.vue index 0c203b3..6b49811 100644 --- a/src/views/equip/list.vue +++ b/src/views/equip/list.vue @@ -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()