416 lines
10 KiB
Vue
416 lines
10 KiB
Vue
<template>
|
||
<!-- <page-layout :menus="state.menus"> </page-layout>-->
|
||
<section>
|
||
<common>
|
||
<template #main>
|
||
<el-card shadow="none" style="border-radius: 14px">
|
||
<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>
|
||
</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">
|
||
<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">
|
||
<img src="@/assets/images/warehouseLogistics/img7.png" fit="cover" class="storage-image storage-image1" />
|
||
</div>
|
||
</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/img8.png" fit="cover" class="storage-image storage-image1" />
|
||
</div>
|
||
</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" />
|
||
</div>
|
||
</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" />
|
||
</div>
|
||
</div>
|
||
</el-card>
|
||
</el-col>
|
||
<div style="position: fixed; left: 50%; bottom: 7%">
|
||
<el-button style="padding: 10px 100px" size="large" type="primary">发布仓储{{ currentTab0 === 0 ? '服务' : '需求' }}</el-button>
|
||
</div>
|
||
<!-- <el-pagination
|
||
:size="'large'"
|
||
:page-size="paginations.size"
|
||
:current-page="paginations.page"
|
||
:total="paginations.total"
|
||
background
|
||
layout="prev, pager, next"
|
||
@current-change="currentChange"
|
||
/> -->
|
||
</el-row>
|
||
</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 tab1 = reactive(['全部', '普通仓储', '恒温仓储', '冷库', '气调仓储']);
|
||
const currentTab0 = ref(0);
|
||
const currentTab1 = ref(0);
|
||
const currentTab2 = ref(0);
|
||
const currentTab3 = ref(0);
|
||
|
||
const state = reactive({
|
||
menus: warehouseLogisticsRoutes[0].children,
|
||
query: {
|
||
current: {},
|
||
},
|
||
data: [
|
||
{
|
||
imageUrl: '/storage1.jpg',
|
||
title: '果蔬保鲜仓储',
|
||
description: '绿鲜蔬选果蔬仓储中心 ',
|
||
location: '临沧市-耿马县',
|
||
price: '600.0',
|
||
rank: '1',
|
||
},
|
||
{
|
||
imageUrl: '/storage2.jpg',
|
||
title: '果蔬保鲜仓储',
|
||
description: '绿鲜蔬选果蔬仓储中心',
|
||
location: '临沧市-耿马县',
|
||
price: '600.0',
|
||
rank: '2',
|
||
},
|
||
{
|
||
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: '',
|
||
},
|
||
],
|
||
});
|
||
const formData = reactive({});
|
||
const paginations = reactive({
|
||
page: 1,
|
||
size: 2,
|
||
total: 0,
|
||
});
|
||
|
||
const dialogFormVisible = ref(false);
|
||
const formLabelWidth = ref('120px');
|
||
|
||
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(',');
|
||
}
|
||
}
|
||
});
|
||
};
|
||
|
||
const toLink = (row) => {
|
||
router.push({
|
||
name: 'warehouse-detail',
|
||
query: { id: row?.id ?? '100' },
|
||
});
|
||
};
|
||
|
||
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;
|
||
}
|
||
.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);
|
||
}
|
||
.storage-card {
|
||
position: relative;
|
||
overflow: hidden;
|
||
margin-bottom: 20px;
|
||
border: 0;
|
||
border-radius: 24px;
|
||
}
|
||
.storage-content {
|
||
@include flex-column;
|
||
|
||
gap: 16px;
|
||
&-top {
|
||
@include flex-row;
|
||
|
||
align-items: center;
|
||
}
|
||
}
|
||
.storage-price-left {
|
||
text-align: left;
|
||
}
|
||
.storage-image {
|
||
margin-right: 16px;
|
||
width: 120px;
|
||
height: 120px;
|
||
border-radius: 8px;
|
||
object-fit: cover;
|
||
}
|
||
.storage-image1 {
|
||
margin-right: 0;
|
||
width: 100%;
|
||
height: auto;
|
||
border-radius: 0;
|
||
object-fit: cover;
|
||
}
|
||
.storage-info {
|
||
padding-right: 50px;
|
||
flex: 1;
|
||
cursor: pointer;
|
||
}
|
||
.storage-title,
|
||
.storage-desc,
|
||
.storage-tags,
|
||
.storage-location {
|
||
overflow: hidden;
|
||
margin: 10px 0;
|
||
width: 100%;
|
||
}
|
||
.storage-title {
|
||
font-size: 20px;
|
||
font-weight: 700;
|
||
color: #000000;
|
||
@include ellipsis;
|
||
}
|
||
.storage-desc {
|
||
font-size: 16px;
|
||
color: #999999;
|
||
@include ellipsis;
|
||
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;
|
||
color: #000000;
|
||
}
|
||
.storage-price {
|
||
display: flex;
|
||
align-items: center;
|
||
&-left {
|
||
flex: 1;
|
||
}
|
||
}
|
||
.price-label {
|
||
margin-right: 10px;
|
||
font-size: 16px;
|
||
color: #999999;
|
||
}
|
||
.price-amount {
|
||
font-size: 20px;
|
||
font-weight: 700;
|
||
color: #25bf82;
|
||
}
|
||
.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>
|