需求修改

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

View File

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

View File

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

View File

@ -113,7 +113,7 @@
<NavMenu />
<!-- 轮播图 -->
<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">
<!-- <h3 text="2xl" justify="center">{{ item }}</h3> -->
<el-image