425 lines
11 KiB
Vue
Raw Normal View History

2025-04-14 02:33:18 +01:00
<template>
<!-- <page-layout :menus="state.menus"> </page-layout>-->
<section>
<common>
<template #main>
<el-card shadow="never" style="border-radius: 14px; position: relative">
2025-06-24 16:43:55 +08:00
<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)"
2025-06-24 16:43:55 +08:00
>
{{ item }}
</div>
</div>
2025-06-24 16:43:55 +08:00
</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)"
2025-06-24 16:43:55 +08:00
>
{{ 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">
2025-08-07 17:11:06 +08:00
{{ item.title }}
</p>
<div class="center-text">
2025-08-07 17:11:06 +08:00
<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>
2025-06-24 16:43:55 +08:00
</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>
2025-04-14 02:33:18 +01:00
</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>
2025-06-24 16:43:55 +08:00
</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>
2025-04-14 02:33:18 +01:00
</template>
<script setup>
import { ref, reactive, watch, onMounted } from 'vue';
2025-04-14 02:33:18 +01:00
import { getAssetsFile } from '@/utils';
import { useRoute, useRouter } from 'vue-router';
import { getWarehouseInfo, warehouseList } from '@/apis/warehouseLogistics.js';
2025-04-14 02:33:18 +01:00
import warehouseLogisticsRoutes from '@/router/modules/warehouseLogistics';
import Common from '../components/common.vue';
import { useGetCommonData } from '@/store/modules/common.js';
2025-05-28 16:51:38 +08:00
import { storeToRefs } from 'pinia';
import { ElMessage } from 'element-plus';
2025-05-28 16:51:38 +08:00
const store = useGetCommonData();
const { data } = storeToRefs(store);
2025-04-14 02:33:18 +01:00
const route = useRoute();
const router = useRouter();
2025-07-01 18:50:35 +08:00
// const tab0 = reactive(['仓储服务', '仓储需求']);
const tab0 = reactive(['仓储服务']);
2025-08-07 17:11:06 +08:00
const tab1 = reactive(['全部', '常温仓储', '高标准冷库']);
2025-06-24 16:43:55 +08:00
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);
}
};
2025-06-24 16:43:55 +08:00
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';
2025-04-14 02:33:18 +01:00
const state = reactive({
menus: warehouseLogisticsRoutes[0].children,
query: {
current: {},
2025-04-14 02:33:18 +01:00
},
data: [
{
imageUrl: img1,
typeId: 1,
2025-08-07 17:11:06 +08:00
typeName: '常温仓储',
title: '孟定边贸仓储中心',
operationUnit: '耿马宏泰物流有限公司 ',
pricingUnit: '元/㎡·月',
storageArea: '8,600㎡',
usableArea: '2,300㎡',
location: '孟定镇中缅大道8号',
price: '¥12元/㎡/月',
2025-04-14 02:33:18 +01:00
rank: '1',
},
{
imageUrl: img2,
typeId: 2,
2025-08-07 17:11:06 +08:00
typeName: '常温仓储',
title: '绿色食品园区集散仓',
operationUnit: '耿马县供销集团',
pricingUnit: '元/吨·天',
storageArea: '12,000㎡',
usableArea: '4,500㎡',
location: '绿色食品园区二期',
price: '¥1.5元/吨/月',
2025-05-28 11:43:31 +08:00
rank: '2',
2025-04-14 02:33:18 +01:00
},
{
imageUrl: img4,
typeId: 4,
2025-08-07 17:11:06 +08:00
typeName: '高标准冷库',
title: '孟定果蔬冷链中心',
operationUnit: '临沧边境合作区管委会 ',
2025-08-15 16:13:54 +08:00
pricingUnit: '元/吨·天',
storageArea: '5,000㎡',
usableArea: '1,200㎡',
location: '孟定海关监管区旁',
2025-08-15 16:13:54 +08:00
price: '¥2.8元/吨/月',
rank: '4',
},
2025-04-14 02:33:18 +01:00
],
});
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');
2025-04-14 02:33:18 +01:00
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(',');
}
}
});
2025-04-14 02:33:18 +01:00
};
const setMockData = () => {
let testData = state.data;
console.log(testData);
if (testData.length === 0) return;
};
2025-04-14 02:33:18 +01:00
2025-07-01 18:50:35 +08:00
// 跳转详情页
2025-04-14 02:33:18 +01:00
const toLink = (row) => {
2025-05-30 17:30:23 +08:00
router.push({
name: 'warehouse-detail',
query: {
id: row?.id ?? '100',
typeId: row?.typeId ?? '1',
},
2025-05-30 17:30:23 +08:00
});
2025-04-14 02:33:18 +01:00
};
2025-07-01 18:50:35 +08:00
// 跳转申请仓储需求
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);
}
});
};
2025-04-14 02:33:18 +01:00
</script>
<style lang="scss" scoped>
.el-form-item--large {
--font-size: 20px;
}
.tabs {
2025-06-24 16:43:55 +08:00
//height: 160px;
line-height: 50px;
display: flex;
2025-06-24 16:43:55 +08:00
flex-direction: column;
font-size: 18px;
2025-06-24 16:43:55 +08:00
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;
2025-06-24 16:43:55 +08:00
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;
2025-06-24 16:43:55 +08:00
}
.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%;
}
}
2025-04-14 02:33:18 +01:00
</style>