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

422 lines
17 KiB
Vue

<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<view class="page-nav">
<el-breadcrumb separator=">">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>
<navigator style="display: inline-block;" url="/pages/yellowPage/list">金久信黄页</navigator>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-main">{{ info.company.companyName }}</el-breadcrumb-item>
</el-breadcrumb>
</view>
<view class="mt-40 bg-white company">
<view class="p-50 flex justify-between items-center pb-30 border-bottom w-100p">
<view class="flex justify-start items-center w-100p">
<image class="logo" :src="info.businessCard.logo" v-if="info.businessCard"/>
<view class="ml-35 flex flex-col justify-start items-start w-100p">
<view class="flex justify-between items-center w-100p">
<text class="text-40 font-bold flex-1">{{ info.company.companyName }}</text>
<view class="flex justify-end items-start">
<view class="flex justify-center items-center">
<protect theme="filled" size="24" fill="#d0021b" strokeLinecap="square"/>
<view class="text-gray mx-15">平台累计交易</view>
</view>
<text class="text-main font-bold text-50">{{ info.transactionAmount.toFixed(2) }}</text>
<view class="flex justify-end items-start " v-if="info.paidEnsure && info.paidEnsure > 0" style="margin-left: 60rpx">
<view class="flex justify-center items-center">
<exchange-three theme="filled" size="24" fill="#d0021b" strokeLinecap="square"/>
<view class="text-gray mx-15">已缴纳交易保证金</view>
</view>
<text class="text-main font-bold text-50">{{ info.paidEnsure.toFixed(2) }}</text>
</view>
</view>
</view>
<text class="text-gray text-28 mt-40" v-if="info.company.mainSpotCategory && info.company.mainSpotCategory.length">
主营业务:{{ info.company.mainSpotCategory.join() }}
</text>
<text class="text-gray text-28 mt-40" v-else>
主营业务:{{ info.company.mainSpotCategorySelf }}
</text>
</view>
</view>
</view>
<view class="mt-30 p-40" v-if="info">
<el-carousel height="300px`" :style="{width: '100%'}" class="m-a"
v-if="info.businessCard && info.businessCard.album">
<template v-if="Array.isArray(info.businessCard.album)">
<el-carousel-item v-for="(item, index) in info.businessCard.album" :key="index"
:style="{width: '100%'}">
<el-image :src="item" fit="cover" :style="{width: '100%'}"/>
</el-carousel-item>
</template>
<el-carousel-item v-else :style="{width: '100%'}">
<el-image :src="info.businessCard.album" fit="cover" :style="{width: '100%'}"/>
</el-carousel-item>
</el-carousel>
<view class="flex flex-col justify-start items-start mb-20">
<view class="title">企业简介</view>
<view class="mt-20" v-if="info.businessCard && info.businessCard.companyIntroduction"
v-html="info.businessCard.companyIntroduction"></view>
<text v-else>商家暂未填写</text>
</view>
<view class="flex flex-col justify-start items-start mb-20"
v-if="info.businessCard && info.businessCard.video">
<view class="title">企业视频</view>
<video :src="info.businessCard.video" autoplay controls style="width: 100%"/>
</view>
<view class="flex flex-col justify-start items-start mb-20"
v-if="info.businessCard && info.businessCard.productImageList">
<view class="title">产品展示</view>
<view class="flex justify-start items-start flex-wrap">
<el-image :preview-src-list="info.businessCard.productImageList" :src="item"
v-for="(item, index) in info.businessCard.productImageList"
:key="index" fit="cover"
:style="{margin: (index !== 0 && (index + 1) % 5 === 0) ? '0 0 21px 0' : '0 21px 21px 0'}"
style="width: 215px; height: 215px;"/>
</view>
</view>
<view class="flex flex-col justify-start items-start mb-20"
v-if="info.businessCard && info.businessCard.exampleImageList">
<view class="title">案例展示</view>
<view class="flex justify-start items-start flex-wrap">
<el-image :preview-src-list="info.businessCard.exampleImageList" :src="item"
v-for="(item, index) in info.businessCard.exampleImageList"
:style="{margin: (index !== 0 && (index + 1) % 5 === 0) ? '0 0 21px 0' : '0 21px 21px 0'}"
:key="index" fit="cover"
style="width: 215px; height: 215px;"/>
</view>
</view>
<view class="flex flex-col justify-start items-start mb-20"
v-if="canShowMapLocation">
<view class="title">地图定位</view>
<view class="mapDiv">
<tdt-map :center="[info.businessCard.longitude, info.businessCard.latitude]" :zoom="12">
<tdt-marker :position="[info.businessCard.longitude, info.businessCard.latitude]"
:draggable="false"/>
</tdt-map>
</view>
</view>
<view class="flex flex-col justify-start items-start mb-20"
v-if="userArticle.length > 0">
<view class="title">新闻动态</view>
<view class="flex justify-start items-start flex-col w-100p">
<view class="flex justify-between items-center pointer w-100p mb-25"
@click="showArticle(index)"
v-for="(item, index) in userArticle" :key="index">
<text>{{ item.title }}</text>
<text class="text-gray">{{ item._add_time_str }}</text>
</view>
</view>
</view>
<view class="flex flex-col justify-start items-start mb-20">
<view class="title">联系我们</view>
<view class="mt-20 flex justify-start items-start flex-wrap w-100p text-30">
<view class="flex justify-start items-center w-50p mb-20">
<i class="el-icon-map-location mr-15"/>
<text class="content" v-if="info.company.addressRegion">地址:{{
info.company.addressRegion.province.name
}}{{ info.company.addressRegion.city.name }}{{
info.company.addressRegion.area.name
}}{{ info.company.addressDetail }}
</text>
</view>
<view class="flex justify-start items-center w-25p mb-20">
<i class="el-icon-phone mr-15"/>
<text class="content" v-if="info.businessCard">电话:{{
info.businessCard.companyMobile ? info.businessCard.companyMobile : '商家暂未填写'
}}
</text>
</view>
<view class="flex justify-start items-center w-25p mb-20">
<i class="el-icon-mobile mr-15"/>
<text class="content" v-if="info.manager">手机:{{
info.manager.mobile ? info.manager.mobile : '商家暂未填写'
}}
</text>
</view>
<view class="flex justify-start items-center w-33p">
<i class="el-icon-message mr-15"/>
<text class="content" v-if="info.businessCard">邮箱:{{
info.businessCard.email ? info.businessCard.email : '商家暂未填写'
}}
</text>
</view>
<view class="flex justify-start items-center w-33p" v-if="info.userLevel > 1">
<i class="el-icon-data-board mr-15"/>
<text class="content" v-if="info.businessCard">网址:{{
info.businessCard.website ? info.businessCard.website : '商家暂未填写'
}}
</text>
</view>
</view>
</view>
<template v-if="parseInt(info.userLevel) > 0">
<view class="flex flex-col justify-start items-start mb-20">
<view class="title">发布的现货</view>
<view class="mt-20 spot-bg w-100p p-40" v-if="info.spotList">
<view class="w-100p flex justify-between items-center">
<text class="font-bold text-40">{{ info.spotList.name }}</text>
<el-button type="primary" plain class="empty-bg-plain-btn"
@click.native="vk.navigateTo('/pages/spot/goods/detail?id=' + info.spotList._id)">
查看详情
</el-button>
</view>
<view class="w-60p flex justify-between items-center text-main my-20">
<text>库存:{{ info.spotList.stock }}吨</text>
<text
v-if="info.spotList.address && info.spotList.address.province && info.spotList.address.area && info.spotList.address.area ">
供货地:{{ info.spotList.address.province.name }}-{{
info.spotList.address.city.name
}}-{{ info.spotList.address.area.name }}
</text>
</view>
<view class="w-60p flex justify-between items-center text-gray">
<view class="flex justify-start items-center">
<i class="el-icon-user"/>
<text>{{ info.company.companyName }}</text>
</view>
<text class="">{{ info.spotList._add_time_str }}发布</text>
</view>
</view>
</view>
<view class="flex justify-between items-center mb-20">
<view class="title">发布的询价单</view>
<!-- <view class="text-main pointer" @click="vk.navigateTo('/pages/spot/goods/goods')">查看更多>-->
<view class="text-main pointer" v-if="info.enquiryList.length > 5" @click="showAllEnquiry = true">查看更多>
</view>
</view>
<enquiry :info="info" :limit="5"/>
<view class="flex justify-between items-center mb-20">
<view class="title">发布的加工单</view>
<!-- <view class="text-main pointer" @click="vk.navigateTo('/pages/process/list')">查看更多>-->
<view class="text-main pointer" v-if="info.processList.length > 5" @click="showAllProcess = true">查看更多>
</view>
</view>
<process :info="info" :limit="5"/>
</template>
</view>
</view>
</view>
<gap/>
<common-footer></common-footer>
<el-dialog v-if="articleIndex > -1 && dialogVisible"
title="新闻动态"
:visible.sync="dialogVisible"
width="70%">
<p class="text-35 font-bold pb-20">{{ userArticle[articleIndex].title }}</p>
<p class="text-gray text-28 pb-20 border-bottom">{{ userArticle[articleIndex]._add_time_str }}</p>
<div v-html="userArticle[articleIndex].content" class="pt-20"></div>
<div slot="footer">
<el-button @click="dialogVisible = false">关 闭</el-button>
</div>
</el-dialog>
<el-dialog v-if="showAllEnquiry"
title="全部询价单"
:visible.sync="showAllEnquiry"
width="70%">
<enquiry :info="info"/>
</el-dialog>
<el-dialog v-if="showAllProcess"
title="全部加工单"
:visible.sync="showAllProcess"
width="70%">
<process :info="info"/>
</el-dialog>
</view>
</template>
<script>
import {Protect, ExchangeThree} from '@icon-park/vue'
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import Gap from "../../components/gap/gap.vue";
import Enquiry from "@/pages/yellowPage/components/enquiry.vue";
import Process from "@/pages/yellowPage/components/process.vue";
export default {
name: "info",
components: {Process, Enquiry, Gap, Protect, ExchangeThree},
data() {
return {
id: null,
provinceData: provinces,
cityData: citys,
areaData: areas,
info: {
transactionAmount: 0,
paidEnsure: 0,
spotList: [],
enquiryList: [],
processList: [],
company: {
companyName: ''
}
},
allChildCate: [],
userArticle: [],
articleIndex: -1,
dialogVisible: false,
showAllEnquiry: false,
showAllProcess: false,
}
},
computed: {
canShowMapLocation() {
return this.info.businessCard
&& this.info.businessCard.longitude
&& parseInt(this.info.accountType) === 2
&& parseInt(this.info.userLevel) > 1
}
},
methods: {
getCategoryTreeData() {
vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...',
data: {},
success: (data) => {
this.allChildCate = []
data.rows.forEach(item => {
item.children.forEach(child => {
this.allChildCate.push(child)
})
})
this.getInfo()
}
});
},
getUserArticle() {
vk.callFunction({
url: 'client/userArticle/pub/getList',
title: '请求中...',
data: {
userId: this.id
},
success: (data) => {
this.userArticle = data.rows
}
});
},
getInfo() {
vk.callFunction({
url: "client/user/pub/getDetail",
data: {
_id: this.id
},
success: (res) => {
this.info = res.data
this.info.company.mainSpotCategory = []
if (this.info.company && this.info.company.mainSpotCategoryIds) {
this.allChildCate.forEach(child => {
if (this.info.company.mainSpotCategoryIds.includes(child._id)) {
this.info.company.mainSpotCategory.push(child.name)
}
})
}
this.info.enquiryList.map(val => {
let str = ''
if (val.addressRegion && val.addressRegion.area) {
str = val.addressRegion.province.name + val.addressRegion.city.name + val.addressRegion.area.name
}
if (val.addressDetail) str += val.addressDetail
val.address = str
return val
})
}
});
},
async toProcessDetail(id) {
const {userInfo} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm && userInfo.authStatus === 1) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
this.$confirm('您尚未认证和完善名片,是否前往个人中心?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo('/pages/user/user?menu=fadada');
})
} else {
vk.navigateTo({
url: `/pages/process/detail?id=${id}`
})
}
},
showArticle(index) {
this.articleIndex = index
this.dialogVisible = true
this.$nextTick(() => {
// 获取所有的img元素
var imgElements = document.getElementsByTagName('img');
// 遍历img元素数组
for (var i = 0; i < imgElements.length; i++) {
// 添加style属性,并设置width为100%
imgElements[i].style.width = '100%';
}
})
}
},
onLoad(option) {
if (option.id) {
this.id = option.id
this.getCategoryTreeData()
this.getUserArticle()
}
}
}
</script>
<style lang="scss" scoped>
.company {
.logo {
width: 100px;
height: 100px;
}
.title {
font-weight: bold;
font-size: 16px;
padding-left: 5px;
border-left: 3px solid #d0021b;
color: #d0021b;
margin: 20px 0;
}
.table-header {
border-top: 8px solid #F4F4F4;
}
.content {
color: #555;
}
}
.spot-bg {
background-color: #F9F9F9;
}
.mapDiv {
width: 100%;
height: 300px;
}
</style>