425 lines
11 KiB
Vue
425 lines
11 KiB
Vue
<template>
|
||
<!-- <page-layout :menus="state.menus"> </page-layout>-->
|
||
<section>
|
||
<common>
|
||
<template #main>
|
||
<el-card shadow="never" style="border-radius: 14px; position: relative">
|
||
<div class="tabs tabs0">
|
||
<div class="tab cursor">
|
||
<div
|
||
v-for="(item, index) in tab0"
|
||
:key="index"
|
||
class="tab_list_li"
|
||
style="margin-left: 20px; margin-bottom: 10px"
|
||
:class="{ active: currentTab0 === index, tab_list_li0: currentTab0 === index }"
|
||
@click="handleClick(index)"
|
||
>
|
||
{{ item }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="tabs">
|
||
<div class="tab cursor">
|
||
<div
|
||
v-for="(item, index) in tab1"
|
||
:key="index"
|
||
class="tab_list_li"
|
||
:class="{ active: currentTab1 === index }"
|
||
@click="handleTab1Click(item, index)"
|
||
>
|
||
{{ item }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="position: absolute; right: 30px; top: 30px">
|
||
<el-button v-if="currentTab0 === 0" style="padding: 10px 50px" size="large" type="primary" @click="application">发布需求</el-button>
|
||
</div>
|
||
</el-card>
|
||
<div v-if="state.data == 0" class="warehouse-content-box no-data">暂无数据</div>
|
||
<div v-else style="padding-bottom: 20px">
|
||
<div v-for="(item, index) in state.data" :key="index" class="warehouse-content-box">
|
||
<div class="warehouse-content-box-left">
|
||
<img :src="item.imageUrl" fit="cover" draggable="false" />
|
||
</div>
|
||
<div class="warehouse-content-box-center">
|
||
<p class="center-title">
|
||
{{ item.title }}
|
||
</p>
|
||
<div class="center-text">
|
||
<div class="center-text-lable">仓储类型:</div>
|
||
<div class="flex-1">{{ item.typeName }}</div>
|
||
<div class="center-text-lable">计价单位:</div>
|
||
<div class="center-text-cont">{{ item.pricingUnit }}</div>
|
||
</div>
|
||
<div class="center-text">
|
||
<div class="center-text-lable">仓库面积:</div>
|
||
<div class="flex-1">{{ item.storageArea }}</div>
|
||
<div class="center-text-lable">可用面积:</div>
|
||
<div class="center-text-cont">{{ item.usableArea }}</div>
|
||
</div>
|
||
<p class="center-location">
|
||
<el-icon size="20px"><LocationFilled /></el-icon>{{ item.location }}
|
||
</p>
|
||
</div>
|
||
<div class="warehouse-content-box-right">
|
||
<p class="top-text">{{ item.price }}</p>
|
||
<el-button size="large" type="primary" class="right-button" @click="toLink(item)">预约</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <el-pagination
|
||
:size="'large'"
|
||
:page-size="paginations.size"
|
||
:current-page="paginations.page"
|
||
:total="paginations.total"
|
||
background
|
||
layout="prev, pager, next"
|
||
@current-change="currentChange"
|
||
/> -->
|
||
</template>
|
||
</common>
|
||
</section>
|
||
</template>
|
||
<script setup>
|
||
import { ref, reactive, watch, onMounted } from 'vue';
|
||
import { getAssetsFile } from '@/utils';
|
||
import { useRoute, useRouter } from 'vue-router';
|
||
import { getWarehouseInfo, warehouseList } from '@/apis/warehouseLogistics.js';
|
||
import warehouseLogisticsRoutes from '@/router/modules/warehouseLogistics';
|
||
import Common from '../components/common.vue';
|
||
import { useGetCommonData } from '@/store/modules/common.js';
|
||
import { storeToRefs } from 'pinia';
|
||
import { ElMessage } from 'element-plus';
|
||
const store = useGetCommonData();
|
||
const { data } = storeToRefs(store);
|
||
|
||
const route = useRoute();
|
||
const router = useRouter();
|
||
|
||
// const tab0 = reactive(['仓储服务', '仓储需求']);
|
||
const tab0 = reactive(['仓储服务']);
|
||
const tab1 = reactive(['全部', '常温仓储', '高标准冷库']);
|
||
const currentTab0 = ref(0);
|
||
const currentTab1 = ref(0);
|
||
const handleClick = (index) => {
|
||
currentTab0.value = index;
|
||
currentTab1.value = 0;
|
||
console.log(currentTab0.value);
|
||
};
|
||
const handleTab1Click = (item, index) => {
|
||
currentTab1.value = index;
|
||
console.log(currentTab1.value);
|
||
if (item === '全部') {
|
||
state.data = allData.value;
|
||
} else {
|
||
state.data = allData.value.filter((el) => el.typeName === item);
|
||
}
|
||
};
|
||
|
||
import img1 from './../images/普通仓储/1.jpg';
|
||
import img2 from './../images/普通仓储/2.jpg';
|
||
import img3 from './../images/恒温仓储/1.jpg';
|
||
import img4 from './../images/冷库/4.jpg';
|
||
import img5 from './../images/气调仓储/1.jpg';
|
||
const state = reactive({
|
||
menus: warehouseLogisticsRoutes[0].children,
|
||
query: {
|
||
current: {},
|
||
},
|
||
data: [
|
||
{
|
||
imageUrl: img1,
|
||
typeId: 1,
|
||
typeName: '常温仓储',
|
||
title: '孟定边贸仓储中心',
|
||
operationUnit: '耿马宏泰物流有限公司 ',
|
||
pricingUnit: '元/㎡·月',
|
||
storageArea: '8,600㎡',
|
||
usableArea: '2,300㎡',
|
||
location: '孟定镇中缅大道8号',
|
||
price: '¥12元/㎡/月',
|
||
rank: '1',
|
||
},
|
||
{
|
||
imageUrl: img2,
|
||
typeId: 2,
|
||
typeName: '常温仓储',
|
||
title: '绿色食品园区集散仓',
|
||
operationUnit: '耿马县供销集团',
|
||
pricingUnit: '元/吨·天',
|
||
storageArea: '12,000㎡',
|
||
usableArea: '4,500㎡',
|
||
location: '绿色食品园区二期',
|
||
price: '¥1.5元/吨/月',
|
||
rank: '2',
|
||
},
|
||
{
|
||
imageUrl: img4,
|
||
typeId: 4,
|
||
typeName: '高标准冷库',
|
||
title: '孟定果蔬冷链中心',
|
||
operationUnit: '临沧边境合作区管委会 ',
|
||
pricingUnit: '元/吨·天',
|
||
storageArea: '5,000㎡',
|
||
usableArea: '1,200㎡',
|
||
location: '孟定海关监管区旁',
|
||
price: '¥2.8元/吨/月',
|
||
rank: '4',
|
||
},
|
||
],
|
||
});
|
||
const allData = ref([...state.data]);
|
||
|
||
const formData = reactive({});
|
||
const paginations = reactive({
|
||
page: 1,
|
||
size: 2,
|
||
total: 0,
|
||
});
|
||
const currentChange = (current) => {
|
||
paginations.page = current;
|
||
getWarehouseList(currentTab.value + 1);
|
||
};
|
||
|
||
const dialogFormVisible = ref(false);
|
||
const formLabelWidth = ref('120px');
|
||
|
||
onMounted(() => {
|
||
// getWarehouseList('1');
|
||
|
||
setMockData();
|
||
});
|
||
|
||
const currentTab = ref(0);
|
||
|
||
const getWarehouseList = (type) => {
|
||
warehouseList({ type: type, current: paginations.page, size: paginations.size }).then((res) => {
|
||
state.data = [];
|
||
paginations.total = res.total;
|
||
if (res.code === 200) {
|
||
state.data = res.data.records;
|
||
for (let i in state.data) {
|
||
state.data[i].tag = state.data[i].tags.split(',');
|
||
}
|
||
}
|
||
});
|
||
};
|
||
const setMockData = () => {
|
||
let testData = state.data;
|
||
console.log(testData);
|
||
if (testData.length === 0) return;
|
||
};
|
||
|
||
// 跳转详情页
|
||
const toLink = (row) => {
|
||
router.push({
|
||
name: 'warehouse-detail',
|
||
query: {
|
||
id: row?.id ?? '100',
|
||
typeId: row?.typeId ?? '1',
|
||
},
|
||
});
|
||
};
|
||
// 跳转申请仓储需求
|
||
const application = () => {
|
||
router.push({
|
||
name: 'warehouse-application',
|
||
});
|
||
};
|
||
|
||
const contact = (id) => {
|
||
for (let i in state.data) {
|
||
if (state.data[i].id === id) {
|
||
state.query.current = state.data[i];
|
||
state.query.current.contactName = state.query.current.contactName.substring(0, 1);
|
||
}
|
||
}
|
||
formData.value = {
|
||
warehouseId: state.query.current.id,
|
||
type: 1,
|
||
demand: '',
|
||
surname: '',
|
||
sex: '',
|
||
phoneNum: '',
|
||
};
|
||
dialogFormVisible.value = true;
|
||
};
|
||
|
||
const priceConfirm = () => {
|
||
// 遍历 formData 的所有键
|
||
for (const key of Object.keys(formData.value)) {
|
||
if (formData.value[key] === '') {
|
||
ElMessage({
|
||
message: '请完整填写信息!',
|
||
type: 'warning',
|
||
});
|
||
return; // 这里 return 会直接退出整个函数
|
||
}
|
||
}
|
||
if (!/^1[3-9]\d{9}$/.test(formData.value.phoneNum)) {
|
||
ElMessage.warning('请填写正确的11位手机号码!');
|
||
return;
|
||
}
|
||
getWarehouseInfo(formData.value).then((res) => {
|
||
if (res.code === 200) {
|
||
ElMessage.success('询价成功,后续请关注手机信息,我们将第一时间联系您');
|
||
} else {
|
||
ElMessage.error(res.errmsg);
|
||
}
|
||
});
|
||
};
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
.el-form-item--large {
|
||
--font-size: 20px;
|
||
}
|
||
.tabs {
|
||
//height: 160px;
|
||
line-height: 50px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
font-size: 18px;
|
||
align-items: flex-start;
|
||
justify-content: space-between;
|
||
// padding: 0 20px;
|
||
}
|
||
.tabs0 {
|
||
padding: 0;
|
||
}
|
||
.tab {
|
||
// height: 100px;
|
||
width: 850px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
overflow-x: auto;
|
||
overflow: auto; /* 启用滚动 */
|
||
white-space: nowrap; /* 强制单行显示 */
|
||
-ms-overflow-style: none; /* IE/Edge 兼容 */
|
||
scrollbar-width: none; /* 隐藏滚动条 */
|
||
.tab_list {
|
||
color: #999999;
|
||
font-size: 20px;
|
||
font-weight: 400;
|
||
}
|
||
.tab_list_li {
|
||
margin-left: 40px;
|
||
color: #000000;
|
||
font-size: 20px;
|
||
font-weight: 400;
|
||
transition: color 0.3s ease;
|
||
}
|
||
.tab_list_li:first-child {
|
||
margin-left: 20px;
|
||
}
|
||
.tab_list_li.active {
|
||
color: rgba(37, 191, 130, 1);
|
||
}
|
||
.tab_list_li0 {
|
||
position: relative;
|
||
transition: color 0.3s ease;
|
||
}
|
||
.tab_list_li0::after {
|
||
content: '';
|
||
position: absolute;
|
||
left: 25%;
|
||
bottom: 0;
|
||
width: 50%;
|
||
height: 4px;
|
||
background: rgba(37, 191, 130, 1);
|
||
border-radius: 4px;
|
||
transition: all 0.3s ease;
|
||
}
|
||
}
|
||
.cursor {
|
||
cursor: pointer;
|
||
}
|
||
.active {
|
||
color: rgba(37, 191, 130, 1);
|
||
}
|
||
|
||
.warehouse-content-box {
|
||
min-height: 150px;
|
||
margin-top: 20px;
|
||
padding: 20px;
|
||
border-radius: 14px;
|
||
background-color: #fff;
|
||
display: flex;
|
||
gap: 20px;
|
||
}
|
||
.no-data {
|
||
flex-direction: row;
|
||
justify-content: center;
|
||
align-items: center;
|
||
font-size: 14px;
|
||
}
|
||
.warehouse-content-box-left {
|
||
height: 120px;
|
||
width: 120px;
|
||
border-radius: 14px;
|
||
position: relative;
|
||
overflow: hidden;
|
||
img {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
min-width: 100%;
|
||
min-height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
}
|
||
.warehouse-content-box-center {
|
||
flex: 1;
|
||
text-align: left;
|
||
.center-title {
|
||
font-size: 22px;
|
||
font-weight: bold;
|
||
text-align: left;
|
||
margin-bottom: 10px;
|
||
.highlight {
|
||
color: #25bf82;
|
||
}
|
||
}
|
||
.center-text {
|
||
font-size: 14px;
|
||
display: flex;
|
||
margin-bottom: 10px;
|
||
.center-text-lable {
|
||
color: #666;
|
||
width: 70px;
|
||
}
|
||
.flex-1 {
|
||
flex: 1;
|
||
}
|
||
.center-text-cont {
|
||
width: 120px;
|
||
}
|
||
}
|
||
.center-location {
|
||
font-size: 14px;
|
||
line-height: 20px;
|
||
.el-icon {
|
||
vertical-align: bottom;
|
||
}
|
||
}
|
||
}
|
||
.warehouse-content-box-right {
|
||
width: 160px;
|
||
font-size: 20px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
justify-content: space-between;
|
||
.top-text {
|
||
font-size: 22px;
|
||
color: #25bf82;
|
||
font-weight: bold;
|
||
}
|
||
.right-button {
|
||
width: 100%;
|
||
}
|
||
}
|
||
</style>
|