425 lines
10 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="none" style="border-radius: 14px">
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.stop="
currentTab0 = index;
currentTab1 = 0;
currentTab2 = 0;
"
>
{{ 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.stop="currentTab1 = index"
>
{{ item }}
</div>
</div>
</div>
</el-card>
<el-row :gutter="20" style="margin-top: 10px">
2025-06-24 16:43:55 +08:00
<el-col v-if="currentTab0 === 0" :span="24">
<el-card class="storage-card" shadow="hover" body-style="padding: 0">
<div class="storage-content">
<div class="storage-content-top">
2025-07-01 18:50:35 +08:00
<img src="@/assets/images/warehouseLogistics/img7.png" fit="cover" class="storage-image storage-image1" @click="toLink" />
2025-06-24 16:43:55 +08:00
</div>
</div>
</el-card>
<el-card class="storage-card" shadow="hover" body-style="padding: 0">
<div class="storage-content">
2025-06-24 16:43:55 +08:00
<div class="storage-content-top">
2025-07-01 18:50:35 +08:00
<img src="@/assets/images/warehouseLogistics/img8.png" fit="cover" class="storage-image storage-image1" @click="toLink" />
2025-04-14 02:33:18 +01:00
</div>
2025-06-24 16:43:55 +08:00
</div>
</el-card>
</el-col>
<el-col v-else :span="24">
<el-card class="storage-card" shadow="hover" body-style="padding: 0">
<div class="storage-content">
<div class="storage-content-top">
<img src="@/assets/images/warehouseLogistics/img9.png" fit="cover" class="storage-image storage-image1" />
2025-04-14 02:33:18 +01:00
</div>
2025-06-24 16:43:55 +08:00
</div>
</el-card>
<el-card class="storage-card" shadow="hover" body-style="padding: 0">
<div class="storage-content">
<div class="storage-content-top">
<img src="@/assets/images/warehouseLogistics/img10.png" fit="cover" class="storage-image storage-image1" />
2025-04-14 02:33:18 +01:00
</div>
</div>
</el-card>
</el-col>
2025-06-24 16:43:55 +08:00
<div style="position: fixed; left: 50%; bottom: 7%">
2025-07-01 18:50:35 +08:00
<el-button v-if="currentTab0 === 0" style="padding: 10px 100px" size="large" type="primary" @click="application">申请仓储</el-button>
2025-06-24 16:43:55 +08:00
</div>
<!-- <el-pagination
:size="'large'"
:page-size="paginations.size"
:current-page="paginations.page"
:total="paginations.total"
background
layout="prev, pager, next"
@current-change="currentChange"
2025-06-24 16:43:55 +08:00
/> -->
</el-row>
</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-06-24 16:43:55 +08:00
const tab1 = reactive(['全部', '普通仓储', '恒温仓储', '冷库', '气调仓储']);
const currentTab0 = ref(0);
const currentTab1 = ref(0);
const currentTab2 = ref(0);
const currentTab3 = ref(0);
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: '/storage1.jpg',
title: '果蔬保鲜仓储',
description: '绿鲜蔬选果蔬仓储中心 ',
location: '临沧市-耿马县',
price: '600.0',
rank: '1',
},
{
imageUrl: '/storage2.jpg',
title: '果蔬保鲜仓储',
description: '绿鲜蔬选果蔬仓储中心',
location: '临沧市-耿马县',
price: '600.0',
2025-05-28 11:43:31 +08:00
rank: '2',
2025-04-14 02:33:18 +01:00
},
{
imageUrl: '/storage3.jpg',
title: '果蔬保鲜仓储',
description: '绿鲜蔬选果蔬仓储中心 ',
location: '临沧市-耿马县',
price: '600.0',
rank: '3',
},
{
imageUrl: '/storage3.jpg',
title: '果蔬保鲜仓储',
description: '绿鲜蔬选果蔬仓储中心 ',
location: '临沧市-耿马县',
price: '600.0',
rank: '',
},
{
imageUrl: '/storage3.jpg',
title: '果蔬保鲜仓储',
description: '绿鲜蔬选果蔬仓储中心 ',
location: '临沧市-耿马县',
price: '600.0',
rank: '',
},
{
imageUrl: '/storage3.jpg',
title: '果蔬保鲜仓储',
description: '绿鲜蔬选果蔬仓储中心 ',
location: '临沧市-耿马县',
price: '600.0',
rank: '',
},
2025-04-14 02:33:18 +01:00
],
});
const formData = reactive({});
const paginations = reactive({
page: 1,
size: 2,
total: 0,
});
const dialogFormVisible = ref(false);
const formLabelWidth = ref('120px');
2025-04-14 02:33:18 +01:00
onMounted(() => {
getWarehouseList('1');
});
const currentTab = ref(0);
const currentChange = (current) => {
paginations.page = current;
getWarehouseList(currentTab.value + 1);
};
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
};
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' },
});
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;
}
.tab_list_li:first-child {
margin-left: 20px;
}
.tab_list_li.active {
color: rgba(37, 191, 130, 1);
}
.tab_list_li0 {
border-bottom: 2px solid rgba(37, 191, 130, 1);
}
}
.cursor {
cursor: pointer;
}
.active {
color: rgba(37, 191, 130, 1);
}
2025-04-14 02:33:18 +01:00
.storage-card {
position: relative;
overflow: hidden;
margin-bottom: 20px;
border: 0;
2025-05-20 13:05:37 +08:00
border-radius: 24px;
2025-04-14 02:33:18 +01:00
}
.storage-content {
2025-05-20 13:05:37 +08:00
@include flex-column;
2025-04-14 02:33:18 +01:00
2025-05-20 13:05:37 +08:00
gap: 16px;
2025-04-14 02:33:18 +01:00
&-top {
2025-05-20 13:05:37 +08:00
@include flex-row;
2025-04-14 02:33:18 +01:00
align-items: center;
}
}
.storage-price-left {
text-align: left;
}
2025-04-14 02:33:18 +01:00
.storage-image {
2025-05-20 13:05:37 +08:00
margin-right: 16px;
2025-04-14 02:33:18 +01:00
width: 120px;
height: 120px;
border-radius: 8px;
object-fit: cover;
2025-07-01 18:50:35 +08:00
cursor: pointer;
2025-04-14 02:33:18 +01:00
}
2025-06-24 16:43:55 +08:00
.storage-image1 {
margin-right: 0;
width: 100%;
height: auto;
border-radius: 0;
object-fit: cover;
}
2025-04-14 02:33:18 +01:00
.storage-info {
padding-right: 50px;
flex: 1;
cursor: pointer;
}
.storage-title,
.storage-desc,
.storage-tags,
.storage-location {
overflow: hidden;
2025-05-20 13:05:37 +08:00
margin: 10px 0;
width: 100%;
2025-04-14 02:33:18 +01:00
}
.storage-title {
font-size: 20px;
font-weight: 700;
2025-05-20 13:05:37 +08:00
color: #000000;
@include ellipsis;
2025-04-14 02:33:18 +01:00
}
.storage-desc {
font-size: 16px;
2025-05-20 13:05:37 +08:00
color: #999999;
@include ellipsis;
2025-04-14 02:33:18 +01:00
i {
display: inline-block;
width: 20px;
height: 20px;
}
}
.storage-tags {
span {
margin-right: 10px;
}
}
.storage-location {
display: flex;
align-items: center;
font-size: 16px;
font-weight: 400;
2025-05-20 13:05:37 +08:00
color: #000000;
2025-04-14 02:33:18 +01:00
}
.storage-price {
display: flex;
align-items: center;
&-left {
flex: 1;
}
}
.price-label {
margin-right: 10px;
2025-05-20 13:05:37 +08:00
font-size: 16px;
color: #999999;
2025-04-14 02:33:18 +01:00
}
.price-amount {
font-size: 20px;
font-weight: 700;
color: #25bf82;
2025-04-14 02:33:18 +01:00
}
.contact-btn {
width: 152px;
height: 48px;
font-size: 20px;
border-radius: 8px;
background: #25bf82 !important;
:deep(.el-icon) {
margin-right: 10px;
}
}
.rank-badge {
position: absolute;
top: 0;
right: 20px;
width: 80px;
height: 80px;
}
</style>