Files
jjx-web/pages/yellowPage/list.vue
T
2026-10-08 18:14:56 +08:00

625 lines
23 KiB
Vue

<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="carousel">
<el-carousel height="500px">
<common-swiper page="yellowPage"/>
</el-carousel>
</view>
<view class="filter-outer">
<el-form @submit.native.prevent label-width="80px">
<el-form-item label="关键词:" class="border-bottom pb-30">
<el-input @keyup.enter.native="search()" clearable placeholder="输入关键字搜索"
v-model="keyword">
<i slot="prefix" class="el-input__icon el-icon-getCompany"></i>
<el-button @click="search()" type="primary" slot="append" style="border-radius: 0">搜索
</el-button>
</el-input>
</el-form-item>
<!-- <el-form-item label="行业类型:" class="border-bottom pb-30">-->
<!-- </el-form-item>-->
<el-form-item label="主营类目:" class="border-bottom pb-30">
<view class="flex justify-start items-center flex-wrap">
<text @click="clickedCateIndex = -1" class="pointer mr-25"
:class="[clickedCateIndex === -1 ? 'text-main selected-cate' : '']">全部
</text>
<view v-for="(item, index) in categoryTreeData" :key="index">
<text @click="clickedCateIndex = index" class="pointer mr-25"
:class="[clickedCateIndex === index ? 'text-main selected-cate' : '']"
v-if="index < 10">
{{ item.name }}
</text>
</view>
</view>
<view class="child-cate flex justify-start items-center flex-wrap" v-if="clickedCateIndex !== null">
<template v-if="clickedCateIndex === -1">
<text class="pointer mr-25" @click="selectCate(item._id)"
:class="[checkCategoryList.includes(item._id) ? 'text-main' : '']"
v-for="(item, index) in allChildCate" :key="index">{{ item.name }}
</text>
</template>
<template v-else>
<text class="pointer mr-25" @click="selectCate(item._id)"
:class="[checkCategoryList.includes(item._id) ? 'text-main' : '']"
v-for="(item, index) in categoryTreeData[clickedCateIndex].children" :key="index">
{{ item.name }}
</text>
</template>
</view>
</el-form-item>
<el-form-item label="行业分类" class="border-bottom pb-30">
<view class="flex justify-start items-center flex-wrap">
<text @click="selectIndustry(-1)" class="pointer mr-25 flex-grow-0"
:class="[selectedIndustryList.length === 0 ? 'text-main selected-cate' : '']">全部
</text>
<view v-for="(item, index) in industryList" :key="index" class="flex-grow-0 pointer mr-25">
<text @click="selectIndustry(item.name)"
:class="[selectedIndustryList.includes(item.name)? 'text-main selected-cate' : '']"
v-if="index < 10 || showAllIndustry">
{{ item.name }}
</text>
</view>
<!-- <text @click="showAllIndustry = !showAllIndustry" class="pointer mr-25">查看更多-->
<!-- </text>-->
</view>
</el-form-item>
<el-form-item label="城市" class="border-bottom pb-30">
<view class="flex justify-start items-center flex-wrap">
<text @click="selectProvince(-1)" class="pointer mr-25 flex-grow-0"
:class="[checkProvinceList.length === 0 ? 'text-main selected-cate' : '']">全国
</text>
<view v-for="(item, index) in provinceData" :key="index" class="flex-grow-0 pointer mr-25">
<text @click="selectProvince(item.code)"
:class="[checkProvinceList.includes(item.code)? 'text-main selected-cate' : '']"
v-if="index < 10 || showAllProvince">
{{ item.name }}
</text>
</view>
<!-- <text @click="showAllProvince = !showAllProvince" class="pointer mr-25">查看更多-->
<!-- </text>-->
</view>
</el-form-item>
<!-- <el-form-item label="其他" class="border-bottom pb-30">-->
<!-- <el-checkbox v-model="factoryFilter" @change="factoryFilterChange">筛选加工商</el-checkbox>-->
<!-- </el-form-item>-->
<el-form-item label="已选择">
<view class="tags">
<el-tag v-for="(item, index) in checkCategoryArr" :key="index">{{ item.name }}</el-tag>
</view>
</el-form-item>
</el-form>
</view>
<view class="w-1200 flex justify-start items-start flex-wrap m-a">
<view v-for="(item, index) in companyList.filter((_, i) => hasAuth ? true : i < 6)" :key="index"
class="w-50p company-item">
<view class="p-40">
<view class="rounded shadow p-50 bg-white flex flex-col justify-start items-start pointer"
style="height: 700rpx" @click="showInfo(item._id)">
<view class="flex justify-between items-center w-100p">
<view class="flex justify-start items-center">
<image :src="item.businessCard.logo" class="logo" v-if="item.businessCard"
mode="aspectFill"/>
<image v-else src="/static/images/no-logo.jpg" class="logo" mode="aspectFill"/>
<view class="ml-35 flex flex-col justify-start items-start">
<div class="flex justify-start items-center font-bold">
<text>{{ item.name }}</text>
<!-- <text v-if="item.factoryStatus === 1" class="text-main">[加工商]</text>-->
<i class="el-icon-star-off text-main ml-20"/>
</div>
<view class="flex justify-start items-center">
<i class="el-icon-user"/>
<text class="ml-10" v-if="item.manager">{{ item.manager.personName }}</text>
<text class="ml-20 text-28" v-if="item.businessCard">{{
item.businessCard.position
}}
</text>
</view>
</view>
</view>
<view class="flex flex-col justify-end items-end">
<image class="authed" src="/static/images/authed.png" mode="aspectFit"
v-if="item.authStatus === 1"/>
<el-button type="primary">查看详情</el-button>
</view>
</view>
<view class="flex justify-start items-center mt-20">
<i class="el-icon-map-location mr-15"/>
<view class="flex-col justify-start items-center">
<text>地址:</text>
<text
v-if="item.company && item.company.addressRegion && item.company.addressRegion.province && item.company.addressRegion.city && item.company.addressRegion.area">
{{
item.company.addressRegion.province.name
}}{{ item.company.addressRegion.city.name }}{{
item.company.addressRegion.area.name
}}{{
item.company.addressDetail
}}
</text>
</view>
</view>
<view class="flex justify-start items-center mt-20">
<view class="flex justify-start items-center ">
<i class="el-icon-mobile mr-15"/>
<view class="flex-col justify-start items-center">
<text>手机:</text>
<text v-if="item.manager">{{
item.manager.mobile ? item.manager.mobile : '商家暂未填写'
}}
</text>
</view>
</view>
<view class="flex justify-start items-center ml-25">
<i class="el-icon-phone mr-15"/>
<view class="flex-col justify-start items-center">
<text>电话:</text>
<text v-if="item.businessCard">{{
item.businessCard.companyMobile ? item.businessCard.companyMobile : '商家暂未填写'
}}
</text>
</view>
</view>
</view>
<view class="mt-20 flex justify-between items-center w-100p">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center ">
<i class="el-icon-message mr-15"/>
<view class="flex-col justify-start items-center">
<text>邮箱:</text>
<text v-if="item.businessCard">
{{ item.businessCard.email ? item.businessCard.email : '商家暂未填写' }}
</text>
</view>
</view>
<view class="flex justify-start items-center mt-20" v-if="item.userLevel > 1">
<i class="el-icon-data-board mr-15"/>
<view class="flex-col justify-start items-center">
<text>网址:</text>
<text v-if="item.businessCard">
{{ item.businessCard.website ? item.businessCard.website : '商家暂未填写' }}
</text>
</view>
</view>
</view>
<el-image v-if="item.businessCard && item.businessCard.companyWechat"
:src="item.businessCard.companyWechat" class="wechat" fix="cover"/>
</view>
<view class="flex justify-between items-center w-100p">
<view class="flex justify-start items-center mt-20">
<text class="text-main" style="width: 140rpx">主营业务:</text>
<text class="ml-20 flex-1" v-if="item.mainSpotCategory.length">{{ item.mainSpotCategory.join() }}</text>
<text class="ml-20 flex-1" v-if="!item.mainSpotCategory.length && item.company.mainSpotCategorySelf">{{ item.company.mainSpotCategorySelf }}</text>
</view>
</view>
<!-- <view class="flex justify-end items-center w-100p">-->
<!-- <el-button type="primary" plain @click="showFactoryInfo(item._id)"-->
<!-- v-if="item.factoryStatus === 1">查看加工商详情-->
<!-- </el-button>-->
<!-- </view>-->
</view>
</view>
</view>
</view>
<div class="flex justify-between items-center w-1200 m-a">
<template v-if="ad23.length">
<el-carousel :height="`100px`" :style="{width: ad24.length ? '50%' : '100%'}" class="m-a">
<el-carousel-item v-for="(item, index) in ad23" :key="index" :style="{width: '100%'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer carousel-img" :src="item.swiper" mode="aspectFill"
:style="{width: '100%'}"/>
</el-carousel-item>
</el-carousel>
</template>
<template v-if="ad24.length">
<el-carousel :height="`100px`" :style="{width: ad23.length ? '50%' : '100%'}" class="m-a">
<el-carousel-item v-for="(item, index) in ad24" :key="index" :style="{width: '100%'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer carousel-img" :src="item.swiper" mode="aspectFill"
:style="{width: '100%'}"/>
</el-carousel-item>
</el-carousel>
</template>
</div>
<div class="flex justify-between items-center w-1200 m-a">
<template v-if="ad25.length">
<el-carousel :height="`100px`" :style="{width: ad26.length ? '50%' : '100%'}" class="m-a">
<el-carousel-item v-for="(item, index) in ad25" :key="index" :style="{width: '100%'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer carousel-img" :src="item.swiper" mode="aspectFill"
:style="{width: '100%'}"/>
</el-carousel-item>
</el-carousel>
</template>
<template v-if="ad26.length">
<el-carousel :height="`100px`" :style="{width: ad25.length ? '50%' : '100%'}" class="m-a">
<el-carousel-item v-for="(item, index) in ad26" :key="index" :style="{width: '100%'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer carousel-img" :src="item.swiper" mode="aspectFill"
:style="{width: '100%'}"/>
</el-carousel-item>
</el-carousel>
</template>
</div>
<right-bar></right-bar>
<common-footer></common-footer>
</view>
</template>
<script>
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import Gap from "../../components/gap/gap.vue";
export default {
name: "list",
components: {Gap},
data() {
return {
categoryTreeData: [],
allChildCate: [],
clickedCateIndex: -1,
checkCategoryList: [],
keyword: '',
provinceData: provinces,
checkProvinceList: [],
showAllProvince: true,
companyList: [],
factoryFilter: false,
industryList: [],
selectedIndustryList: [],
showAllIndustry: true,
ad23: [],
ad24: [],
ad25: [],
ad26: [],
hasAuth: true
}
},
methods: {
getCategoryTreeData() {
vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...',
data: {},
success: (data) => {
this.categoryTreeData = data.rows
this.allChildCate = []
this.categoryTreeData.forEach(item => {
item.children.forEach(child => {
this.allChildCate.push(child)
})
})
this.getCompany()
}
});
},
selectCate(id) {
const index = this.checkCategoryList.indexOf(id)
if (index === -1) this.checkCategoryList = [id]
else this.checkCategoryList = []
this.getCompany()
},
selectProvince(code) {
if (code === -1) this.checkProvinceList = []
else {
// const index = this.checkProvinceList.indexOf(code)
// if (index === -1) this.checkProvinceList.push(code)
// else this.checkProvinceList.splice(index, 1)
this.checkProvinceList = [code]
}
this.getCompany()
},
selectIndustry(name) {
if (name === -1) this.selectedIndustryList = []
else {
const index = this.selectedIndustryList.indexOf(name)
if (index === -1) this.selectedIndustryList = [name]
else this.selectedIndustryList = []
}
this.getCompany()
},
search() {
if (!vk.getVuex('$user.userInfo.fadadaConfirm') || [-1, 2].includes(vk.getVuex('$user.userInfo.authStatus'))) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
} else {
this.getCompany()
}
},
getCompany() {
vk.callFunction({
url: 'client/user/pub/getCompany',
title: '请求中...',
data: {
province: this.checkProvinceList,
keyword: this.keyword,
mainSpotCategoryIds: this.checkCategoryList,
showInYellow: 1,
// factoryFilter: this.factoryFilter,
industryList: this.selectedIndustryList
},
success: (data) => {
this.companyList = data.rows.map(item => {
item.name = item.company.companyName
item.mainSpotCategory = []
if (item.company && item.company.mainSpotCategoryIds) {
this.allChildCate.forEach(child => {
if (item.company.mainSpotCategoryIds.includes(child._id)) {
item.mainSpotCategory.push(child.name)
}
})
}
return item
})
this.getAd23()
this.getAd24()
this.getAd25()
this.getAd26()
}
});
},
showInfo(id) {
vk.navigateTo({
url: `/pages/yellowPage/info?id=${id}`
})
},
showFactoryInfo(id) {
vk.navigateTo({
url: `/pages/yellowPage/factory?userId=${id}`
})
},
factoryFilterChange(val) {
this.factoryFilter = val
this.getCompany()
},
async getIndustryList() {
const {rows} = await vk.callFunction({
url: 'client/industry/pub/getList'
})
this.industryList = rows
},
async getAd23() {
this.ad23 = []
// if (this.checkProvinceList.length === 0) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 23,
region: this.checkProvinceList.length > 0 ? this.checkProvinceList[0] : null
}
})
if (res.data) this.ad23 = res.data
// } else {
// const {rows} = await vk.callFunction({
// url: 'client/user/pub/getCompany',
// data: {
// pageIndex: 1,
// pageSize: 5,
// isCoop: 1,
// province: this.checkProvinceList
// }
// })
// rows.forEach(item => {
// if (item.businessCard.album && item.businessCard.album.length > 0) {
// this.ad23.push({
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
// companyId: item._id
// })
// }
// })
// }
},
async getAd24() {
this.ad24 = []
// if (this.checkProvinceList.length === 0) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 24,
region: this.checkProvinceList.length > 0 ? this.checkProvinceList[0] : null
}
})
if (res.data) this.ad24 = res.data
// } else {
// const {rows} = await vk.callFunction({
// url: 'client/user/pub/getCompany',
// data: {
// pageIndex: 2,
// pageSize: 5,
// isCoop: 1,
// province: this.checkProvinceList
// }
// })
// rows.forEach(item => {
// if (item.businessCard.album && item.businessCard.album.length > 0) {
// this.ad24.push({
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
// companyId: item._id
// })
// }
// })
// }
},
async getAd25() {
this.ad25 = []
// if (this.checkProvinceList.length === 0) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 25,
region: this.checkProvinceList.length > 0 ? this.checkProvinceList[0] : null
}
})
if (res.data) this.ad25 = res.data
// } else {
// const {rows} = await vk.callFunction({
// url: 'client/user/pub/getCompany',
// data: {
// pageIndex: 3,
// pageSize: 5,
// isCoop: 1,
// province: this.checkProvinceList
// }
// })
// rows.forEach(item => {
// if (item.businessCard.album && item.businessCard.album.length > 0) {
// this.ad25.push({
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
// companyId: item._id
// })
// }
// })
// }
},
async getAd26() {
this.ad26 = []
// if (this.checkProvinceList.length === 0) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 26,
region: this.checkProvinceList.length > 0 ? this.checkProvinceList[0] : null
}
})
if (res.data) this.ad26 = res.data
// } else {
// const {rows} = await vk.callFunction({
// url: 'client/user/pub/getCompany',
// data: {
// pageIndex: 4,
// pageSize: 5,
// isCoop: 1,
// province: this.checkProvinceList
// }
// })
// rows.forEach(item => {
// if (item.businessCard.album && item.businessCard.album.length > 0) {
// this.ad26.push({
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
// companyId: item._id
// })
// }
// })
// }
},
},
onShow() {
this.getCategoryTreeData()
this.getIndustryList()
this.hasAuth = (vk.getVuex('$user.userInfo.fadadaConfirm') && vk.getVuex('$user.userInfo.authStatus') === 1)
},
computed: {
checkCategoryArr() {
const arr = []
this.allChildCate.forEach(item => {
if (this.checkCategoryList.includes(item._id)) arr.push(item)
})
this.provinceData.forEach(item => {
if (this.checkProvinceList.includes(item.code)) {
arr.push(item)
}
})
this.selectedIndustryList.forEach(item => {
arr.push({name: item})
})
return arr
}
}
}
</script>
<style lang="scss" scoped>
.carousel {
width: 1200px;
margin: 20px auto;
}
.carousel-img {
width: 100%;
height: 100%;
}
.goods-options {
background-color: #FFFFFF;
padding: 20px;
}
.filter-outer {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 20px;
}
.tags {
display: flex;
.el-tag {
margin-right: 10px;
}
}
.paginatio {
float: none;
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
}
.post-btn {
background: none;
}
.post-btn:hover {
background: #f6eae9;
color: #A92924;
}
.selected-cate {
border-bottom: 2px solid #BD3124;
line-height: 40rpx;
}
.child-cate {
background-color: #DB8382;
color: white;
margin-top: 10rpx;
border-radius: 15rpx;
padding: 0 20rpx;
}
.company-item {
font-size: 16px;
.authed {
height: 40px;
width: 60px;
}
.logo {
width: 100px;
height: 100px;
}
}
.wechat {
width: 60px;
height: 60px;
}
</style>