需求修改
This commit is contained in:
parent
1ac52e029e
commit
ea5cc974cf
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
//装备收藏 取消收藏
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
next()
|
||||
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') {
|
||||
|
||||
|
|
|
|||
|
|
@ -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,7 +23,12 @@
|
|||
}
|
||||
userStore.setToken(res.data.access_token)
|
||||
// 跳转登录页面
|
||||
router.push('/home')
|
||||
|
||||
if(route.query && route.query.redirect){
|
||||
router.push(decodeURIComponent(route.query.redirect))
|
||||
}else {
|
||||
router.push('/home')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -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,34 +607,35 @@ 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
|
||||
}
|
||||
|
||||
const init = async () => {
|
||||
const init = async () => {
|
||||
await gethotList()
|
||||
await getData()
|
||||
}
|
||||
init()
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.dialoglease){
|
||||
margin: 10px auto 0 !important;
|
||||
min-width: 855px !important;
|
||||
: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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue