需求修改

This commit is contained in:
wlikett 2023-12-09 18:34:56 +08:00
parent 1ac52e029e
commit ea5cc974cf
5 changed files with 180 additions and 76 deletions

View File

@ -2,7 +2,10 @@ import { post, get, put } from '../index'
// 获取装备列表 // 获取装备列表
export const getList = (params = {}) => { export const getList = (params = {}) => {
return post('/zlpt-equip/dev/list', params) return post('/zlpt-equip/dev/list', {
...params,
maStatus:16
})
} }
//获取装备详情 //获取装备详情
@ -12,7 +15,10 @@ export const getDetail = (id = '') => {
//获取 推荐装备列表 //获取 推荐装备列表
export const getHotList = (params) => { export const getHotList = (params) => {
return get('/zlpt-equip/dev/hotList', params) return get('/zlpt-equip/dev/hotList', {
...params,
maStatus:16
})
} }
//装备收藏 取消收藏 //装备收藏 取消收藏

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' import {createRouter, createWebHashHistory, RouteRecordRaw, useRouter} from 'vue-router'
import test from './module/test' import test from './module/test'
import myInfo from './module/myInfo' import myInfo from './module/myInfo'
@ -116,6 +116,10 @@ const routes: Array<RouteRecordRaw> = [
{ {
path: '/collect', path: '/collect',
name: 'collect', name: 'collect',
meta: {
title: '我的收藏',
isLogin:true
},
component: () => import('views/collect/index.vue') component: () => import('views/collect/index.vue')
}, },
// 个人中心 // 个人中心
@ -139,7 +143,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '基础信息', title: '基础信息',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
@ -151,7 +156,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单管理(求租)', title: '订单管理(求租)',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
/* 订单管理(退租) */ /* 订单管理(退租) */
@ -162,7 +168,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单管理(退租)', title: '订单管理(退租)',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
/* 订单管理(续租) */ /* 订单管理(续租) */
@ -173,7 +180,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单管理(续租)', title: '订单管理(续租)',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -183,7 +191,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '子账号管理', title: '子账号管理',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -193,7 +202,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单管理(承租)', title: '订单管理(承租)',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
/* 订单管理(结算) */ /* 订单管理(结算) */
@ -204,7 +214,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单管理(结算)', title: '订单管理(结算)',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -214,7 +225,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '基础信息', title: '基础信息',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -224,7 +236,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '基础信息', title: '基础信息',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -234,7 +247,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '基础信息', title: '基础信息',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -244,7 +258,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单详情', title: '订单详情',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
}, },
{ {
@ -254,7 +269,8 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '订单确认', title: '订单确认',
keepAlive: true, keepAlive: true,
AuthFlag: false AuthFlag: false,
isLogin:true
}, },
} }
] ]
@ -276,7 +292,16 @@ const router = createRouter({
// 使页面跳转后滚动条恢复至顶部 // 使页面跳转后滚动条恢复至顶部
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const store = useStore() const store = useStore()
if(to.meta.isLogin){
if(store.token){
next() next()
}else {
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`)
}
}else {
next()
}
// if (store.token || to.path == '/login' || to.path == '/' || to.path == '/home' || to.path == '/register' || to.path == '/equipList' || to.path == '/equipDetail') { // if (store.token || to.path == '/login' || to.path == '/' || to.path == '/home' || to.path == '/register' || to.path == '/equipList' || to.path == '/equipDetail') {

View File

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { loginApi } from 'http/api/login/index' import { loginApi } from 'http/api/login/index'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router' import {useRoute, useRouter} from 'vue-router'
import { useStore } from 'store/main' import { useStore } from 'store/main'
const userStore = useStore() const userStore = useStore()
const router = useRouter() const router = useRouter()
const route = useRoute()
const loginForm = ref({ const loginForm = ref({
username: '', username: '',
password: '' password: ''
@ -22,8 +23,13 @@
} }
userStore.setToken(res.data.access_token) userStore.setToken(res.data.access_token)
// //
if(route.query && route.query.redirect){
router.push(decodeURIComponent(route.query.redirect))
}else {
router.push('/home') router.push('/home')
} }
}
</script> </script>
<template> <template>

View File

@ -11,17 +11,17 @@
<div class="title"> <div class="title">
<div class="name">{{ pageData.modelName }}{{ pageData.deviceName }}</div> <div class="name">{{ pageData.modelName }}{{ pageData.deviceName }}</div>
<div class="tag"> <div class="tag">
<div class="item">{{ pageData.maStatus == '16' ? '待租' : pageData.maStatus }}</div> <div class="item">{{ pageData.maStatusStr }}</div>
<div class="item otherItem" v-if="pageData.isAudit == 1">已审核</div> <div class="item otherItem" v-if="pageData.isAudit == 1">已审核</div>
</div> </div>
</div> </div>
<div class="viewNnum">浏览{{ pageData.searchNum || 1050 }}</div> <div class="viewNnum">浏览{{ pageData.searchNum }}</div>
<div class="infoBox"> <div class="infoBox">
<div class="item" v-for="(v, i) in equipBaseInfoList" :key="i"> <div class="item" v-for="(v, i) in equipBaseInfoList" :key="i">
<div class="label">{{ v.label }}</div> <div class="label">{{ v.label }}</div>
<div class="value">{{ <div class="value">{{
v.key.split(',').map(key => { v.key.split(',').map(key => {
return pageData[key] || v.default return pageData[key]
}).join('') }).join('')
}} }}
</div> </div>
@ -96,7 +96,7 @@
<div class="publicTitle"> <div class="publicTitle">
<div>为您推荐</div> <div>为您推荐</div>
<div class="change" @click="gethotList">换一批</div> <div class="change" @click="randomHotList">换一批</div>
</div> </div>
<div class="content"> <div class="content">
<equip-card class="item" <equip-card class="item"
@ -105,7 +105,7 @@
:key="i" :key="i"
:url="v.picUrl" :url="v.picUrl"
:name="`${v.modelName}${v.deviceName}`" :name="`${v.modelName}${v.deviceName}`"
:tags="[v.maStatus=='16' ? '待租' : v.maStatus,v.location]" :tags="[v.maStatus,v.location]"
:company="v.companyName" :company="v.companyName"
:price="v.monthLeasePrice" :price="v.monthLeasePrice"
timeUnit="月" timeUnit="月"
@ -133,7 +133,7 @@
<el-row> <el-row>
<el-col :span="15"> <el-col :span="15">
<el-form-item label="设备进场地址" prop="address"> <el-form-item label="设备进场地址" prop="address">
<el-cascader :props="addressCascader" v-model="ruleForm.address" /> <el-cascader :props="addressCascader" v-model="ruleForm.address"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -159,8 +159,14 @@
<el-row> <el-row>
<el-col :span="15"> <el-col :span="15">
<el-form-item label="工期时长" prop="duration"> <el-form-item label="工期时长" prop="duration">
<el-input v-model="ruleForm.duration" type="number" placeholder="请输入工期时长"> <el-input v-model.number="ruleForm.duration" type="number" placeholder="请输入工期时长">
<template #append></template> <template #append>
<el-select v-model="ruleForm.durationUnit" placeholder="Select"
style="width: 85px" @change="priceChange">
<el-option label="天" value="0"/>
<el-option label="月" value="1"/>
</el-select>
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -205,7 +211,7 @@
</el-form> </el-form>
</el-config-provider> </el-config-provider>
<equipDetailTable <equipDetailTable
:price="pageData.monthLeasePrice" :price="`${priceChange}元`"
:name="`${pageData.modelName}${pageData.deviceName}`" :name="`${pageData.modelName}${pageData.deviceName}`"
:company="pageData.companyName" :company="pageData.companyName"
:url="pageData.picUrl" :url="pageData.picUrl"
@ -215,7 +221,7 @@
:position="pageData.location" :position="pageData.location"
:specifications="pageData.specification" :specifications="pageData.specification"
:type="pageData.typeName" :type="pageData.typeName"
unit="" unit=""
></equipDetailTable> ></equipDetailTable>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@ -232,7 +238,7 @@
width="30%" width="30%"
> >
<div style="font-size: 16px;font-weight: 600;"> <div style="font-size: 16px;font-weight: 600;">
{{ pageData.authPhone || '18815622887' }} {{ pageData.authPhone }}
</div> </div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@ -246,9 +252,9 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import ShowImg from './comoonents/showImg.vue' import ShowImg from './comoonents/showImg.vue'
import {reactive, ref} from 'vue' import {computed, reactive, ref} from 'vue'
import EquipCard from 'components/equipCard.vue' import EquipCard from 'components/equipCard.vue'
import {getDetail,getHotList,equipCollect,apiSubmitLease,apiGetAddressList} from "@/http/api/equip" import {getDetail, getHotList, equipCollect, apiSubmitLease, apiGetAddressList} from "@/http/api/equip"
import {useRoute, useRouter} from "vue-router"; import {useRoute, useRouter} from "vue-router";
import Navmenu from '@/components/Navmenu/index.vue' import Navmenu from '@/components/Navmenu/index.vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
@ -264,13 +270,11 @@ const pageParams = route.params
const equipBaseInfoList = reactive([ const equipBaseInfoList = reactive([
{ {
label: '设备规格', label: '设备规格',
key: 'specification', key: 'specification'
default:'起重量5吨'
}, },
{ {
label: '设备单位', label: '设备位置',
key: 'companyName', key: 'provinceStr,cityStr,areaStr'
default: '滁州公司'
}, },
{ {
label: '配备机手', label: '配备机手',
@ -390,14 +394,26 @@ const isCollect = ref(false)
// //
const hotList = ref([]) const hotList = ref([])
//
const showHotList = ref([])
const checkDuration = (rule, value, callback) => {
if ((value == '' || value == null) && value !== 0) {
return callback(new Error('请输入工期时长'))
} else if (value <= 0) {
return callback(new Error('工期时长需大于0'))
} else {
return callback()
}
}
// //
const ruleForm = ref({ const ruleForm = ref({
address: [],// address: [],//
detailAddress: '',// detailAddress: '',//
entryTime: '',// entryTime: '',//
duration: '',// duration: null,//
durationUnit: '0',// 0 > 1 ->
machinist: 0,// machinist: 0,//
invoiceType: '',// invoiceType: '',//
projectDescription: ''// projectDescription: ''//
@ -410,10 +426,11 @@ const rules = reactive({
{required: true, message: '请输入详细地址', trigger: 'blur'} {required: true, message: '请输入详细地址', trigger: 'blur'}
], ],
entryTime: [ entryTime: [
{required: true, message: '请选择进场时间', trigger: 'blur'} {required: true, message: '请选择进场时间', trigger: 'blur'},
], ],
duration: [ duration: [
{required: true, message: '请输入工期时长', trigger: 'blur'} {validator: checkDuration, trigger: 'blur'}
], ],
machinist: [ machinist: [
{required: true, message: '请输入进场地址', trigger: 'blur'} {required: true, message: '请输入进场地址', trigger: 'blur'}
@ -425,6 +442,8 @@ const rules = reactive({
{required: true, message: '请输入项目说明', trigger: 'blur'} {required: true, message: '请输入项目说明', trigger: 'blur'}
], ],
}) })
// //
const openLease = () => { const openLease = () => {
dialoglease.value = true dialoglease.value = true
@ -433,19 +452,48 @@ const openLease = () => {
const collectChange = async () => { const collectChange = async () => {
isCollect.value = !isCollect.value isCollect.value = !isCollect.value
const params = { const params = {
maId:pageData.value.maId, maId: pageData.value.maId,
isCollect:isCollect.value isCollect: isCollect.value
} }
const res = await equipCollect(params) const res = await equipCollect(params)
if(res.code == '200'){ if (res.code == '200') {
ElMessage({ ElMessage({
type:'success', type: 'success',
duration:1000, duration: 1000,
message:`装备${isCollect.value ? '收藏' : '取消收藏'}成功` message: `装备${isCollect.value ? '收藏' : '取消收藏'}成功`
}) })
} }
} }
//
const priceChange = computed(() => {
//
let count = 0
//
let unitPrice = 0
//
let jsPrice = 0
//
let duration = 0
if (ruleForm.value.durationUnit == '0') {
unitPrice = Number(pageData.value.dayLeasePrice)
jsPrice = Number(pageData.value.jsDayPrice)
} else {
unitPrice = Number(pageData.value.monthLeasePrice)
jsPrice = Number(pageData.value.jsMonthPrice)
}
if (!ruleForm.value.machinist) {
jsPrice = 0
}
duration = Number(ruleForm.value.duration)
count = unitPrice * duration + jsPrice * duration
return Math.round(count * 100) / 100
})
// //
const openPhone = () => { const openPhone = () => {
dialogPhone.value = !dialogPhone.value dialogPhone.value = !dialogPhone.value
@ -454,7 +502,7 @@ const openPhone = () => {
// pdf // pdf
const openPdf = (name) => { const openPdf = (name) => {
if(name){ if (name) {
window.open(name) window.open(name)
} }
} }
@ -464,23 +512,23 @@ const that = {
const addressCascader = { const addressCascader = {
lazy:true, lazy: true,
label:'name', label: 'name',
value:'id', value: 'id',
lazyLoad: async (node,resolve) =>{ lazyLoad: async (node, resolve) => {
const { level,data } = node const {level, data} = node
let nodes = [] let nodes = []
if(level == 0){ if (level == 0) {
const arr = await getAddressData() const arr = await getAddressData()
nodes = arr nodes = arr
}else if(level == 1){ } else if (level == 1) {
const arr = await getAddressData(data.code) const arr = await getAddressData(data.code)
nodes = arr nodes = arr
}else if(level == 2){ } else if (level == 2) {
const arr = await getAddressData(data.code) const arr = await getAddressData(data.code)
nodes = arr.map((item) => ({ nodes = arr.map((item) => ({
...item, ...item,
leaf:true leaf: true
})) }))
} }
resolve(nodes) resolve(nodes)
@ -491,8 +539,8 @@ const addressCascader = {
// //
const getAddressData = async (code = '') => { const getAddressData = async (code = '') => {
let params = {} let params = {}
if(code){ if (code) {
params = { code } params = {code}
} }
const res = await apiGetAddressList(params) const res = await apiGetAddressList(params)
@ -520,23 +568,37 @@ const getData = async () => {
// //
const gethotList = async () => { const gethotList = async () => {
const params = { const params = {
pageNum:1, pageNum: 1,
pageSize:3 pageSize: 10
} }
const res = await getHotList(params) const res = await getHotList(params)
hotList.value = res.rows hotList.value = res.rows
randomHotList()
}
const randomHotList = () => {
showHotList.value = random().map(key => {
return hotList.value[key]
})
}
const random = () => {
let numbers = new Set();
while (numbers.size < 3) {
numbers.add(Math.floor(Math.random() * 10));
}
return Array.from(numbers);
} }
// //
const goDetail = (val) => { const goDetail = (val) => {
router.push({ router.push({
path:`/equipDetail/${val.id}` path: `/equipDetail/${val.id}`
}) })
} }
// //
const submit = async() => { const submit = async () => {
console.log(pageData.value)
const params = { const params = {
addressId: ruleForm.value.address[2], addressId: ruleForm.value.address[2],
address: ruleForm.value.detailAddress, address: ruleForm.value.detailAddress,
@ -545,16 +607,17 @@ const submit = async() => {
isMachinist: ruleForm.value.machinist, isMachinist: ruleForm.value.machinist,
invoiceType: ruleForm.value.invoiceType, invoiceType: ruleForm.value.invoiceType,
description: ruleForm.value.projectDescription, description: ruleForm.value.projectDescription,
maId:pageData.value.maId durationType: ruleForm.value.durationUnit,
cost: priceChange.value
} }
const res = await apiSubmitLease(params) const res = await apiSubmitLease(params)
if(res.code == '200'){ if (res.code == '200') {
ElMessage({ ElMessage({
message:'提交租赁申请成功', message: '提交租赁申请成功',
type:'success', type: 'success',
duration:1500 duration: 1500
}) })
} }
dialoglease.value = false dialoglease.value = false
@ -567,12 +630,12 @@ const init = async () => {
init() init()
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.dialoglease){ :deep(.dialoglease) {
margin: 10px auto 0 !important; margin: 10px auto 0 !important;
min-width: 855px !important; min-width: 855px !important;
} }
:deep(.el-form-item){ :deep(.el-form-item) {
display: flex; display: flex;
width: 100%; width: 100%;
@ -601,34 +664,38 @@ init()
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
overflow: hidden;
.equipInfo { .equipInfo {
display: flex; display: flex;
.left { .left {
margin-right: 5px; margin-right: 5px;
width: 62%;
.title { .title {
display: flex;
align-items: center;
.name { .name {
font-size: 24px; font-size: 24px;
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 600; font-weight: 600;
color: #000000; color: #000000;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.tag { .tag {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 10px;
.item { .item {
font-size: 13px; font-size: 13px;
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 400; font-weight: 400;
color: #005af2; color: #005af2;
margin-left: 15px; margin-right: 15px;
padding: 2px 10px; padding: 2px 10px;
border: 1px solid #005af2; border: 1px solid #005af2;
border-radius: 4px; border-radius: 4px;

View File

@ -113,7 +113,7 @@
<NavMenu /> <NavMenu />
<!-- 轮播图 --> <!-- 轮播图 -->
<div class="swpier-img"> <div class="swpier-img">
<el-carousel :interval="5000" arrow="always" height="437px" :autoplay="false"> <el-carousel :interval="5000" arrow="always" height="437px">
<el-carousel-item v-for="(item,index) in loopList" :key="index"> <el-carousel-item v-for="(item,index) in loopList" :key="index">
<!-- <h3 text="2xl" justify="center">{{ item }}</h3> --> <!-- <h3 text="2xl" justify="center">{{ item }}</h3> -->
<el-image <el-image