Files
jjx-web-sign-only/pages/enquiry/list.vue
T
2026-10-08 18:20:51 +08:00

571 lines
19 KiB
Vue

<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="carousel">
<common-swiper page="enquiry"/>
<view class="goods-options">
<el-row class="">
<el-button @click="toRelease" type="primary" round>发布询价单</el-button>
<el-button @click="toMyEnquiry" type="primary" round plain class="post-btn">我发布的询价单
</el-button>
<el-button @click="toMyQuote" type="primary" round plain class="post-btn">我的报价
</el-button>
</el-row>
</view>
</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(1)" clearable placeholder="输入关键字搜索" v-model="keyword">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
<el-button @click="search(1)" type="primary" slot="append" style="border-radius: 0">搜索
</el-button>
</el-input>
</el-form-item>
<el-form-item label="分类:" class="border-bottom pb-30">
<view class="flex justify-start items-center flex-wrap">
<text @click="selectAll" class="pointer mr-25"
:class="[checkCategoryList.length === 0 ? 'text-main selected-cate' : '']">全部
</text>
<view v-for="(item, index) in allProductList" :key="index">
<text @click="selectCate(item.name)" class="pointer mr-25"
:class="[checkCategoryList.includes(item.name) ? 'text-main selected-cate' : '']">
{{ item.name }}
</text>
</view>
<text @click="selectCate(-2)" class="pointer mr-25"
:class="[checkCategoryList.includes(-2) ? 'text-main selected-cate' : '']">
其他
</text>
</view>
<!-- <view class="child-cate flex justify-start items-center flex-wrap">-->
<!-- <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-if="clickedCateIndex > -1">-->
<!-- <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>-->
<!-- &lt;!&ndash; <text @click="showAllTexture = !showAllTexture" class="pointer mr-25" >查看更多&ndash;&gt;-->
<!-- &lt;!&ndash; </text>&ndash;&gt;-->
<!-- </view>-->
</el-form-item>
<el-form-item label="区域筛选">
<el-cascader :options="areaOptions" :props="{label: 'name', value: 'code', checkStrictly: true}"
v-model="address"
clearable style="width: 300px;" @change="selectArea"/>
</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>
<div class="flex justify-between items-center w-1200 m-a">
<template v-if="ad11.length">
<el-carousel :height="`100px`" :style="{width: '600px'}" class="m-a">
<el-carousel-item v-for="(item, index) in ad11" :key="index" :style="{width: '600px'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer carousel-img" :src="item.swiper" mode="aspectFill"
:style="{width: '600px'}"/>
</el-carousel-item>
</el-carousel>
</template>
<template v-if="ad112.length">
<el-carousel :height="`100px`" :style="{width: '600px'}" class="m-a">
<el-carousel-item v-for="(item, index) in ad112" :key="index" :style="{width: '600px'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer carousel-img" :src="item.swiper" mode="aspectFill"
:style="{width: '600px'}"/>
</el-carousel-item>
</el-carousel>
</template>
</div>
<!-- 商品列表 -->
<view class="sheet-list">
<view class="flex justify-start items-center my-20">
<el-button @click="changeStatus('notPick')" type="primary" :plain="status === 'picked'" round>正在询价
</el-button>
<el-button @click="changeStatus('picked')" type="primary" :plain="status === 'notPick'" round>合作成交
</el-button>
</view>
<el-table :data="list.rows" style="width: 100%">
<el-table-column align="center" label="品名/材质">
<template v-slot="{ row }">
<p v-if="row.productList && row.productList.length" class="text-main">{{
row.productList.map(item => `${item.goodsName}${item.materialQuality ? `(${item.materialQuality})` : ''}`).join("/")
}}</p>
<p class="text-main" v-else>{{ row.projectName }}</p>
</template>
</el-table-column>
<el-table-column align="center" label="采购量">
<template v-slot="{ row }">
<p class="text-main">
{{
row.productList.map(item => (item.procureNumber ? item.procureNumber : '') + (item.procureUnit ? item.procureUnit : '')).join("/")
}}</p>
</template>
</el-table-column>
<el-table-column prop="fullAddress" label="收货地"/>
<el-table-column align="center" label="采购企业">
<template v-slot="{ row }">
<p v-if="row.user">{{
row.user.accountType === 1 ? row.user.person.personName.replace(/^(.).*(.)$/, "$1*$2") : row.user.company.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6")
}}</p>
</template>
</el-table-column>
<el-table-column align="center" label="报价情况">
<template v-slot="{ row }">
<p>{{ `${row.quoteNum}家已报价` }}</p>
</template>
</el-table-column>
<el-table-column align="center" prop="_add_time_str" label="发布时间"/>
<el-table-column align="center" label="操作">
<template v-slot="{ row }">
<el-button size="mini" type="primary" plain
@click.native="vk.navigateTo('/pages/enquiry/detail?id=' + row._id)">详情
</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-20 text-center">
<el-pagination @current-change="search" background layout="prev, pager, next"
:total="list.total" :page-size="pageSize"/>
</div>
</view>
<right-bar></right-bar>
<common-footer></common-footer>
</view>
</template>
<script>
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";
export default {
data() {
return {
allChildCate: [],
categoryTreeData: [],
companyList: [],
clickedCateIndex: -1,
showAllProvince: false,
showAllTexture: false,
showAllCompany: false,
provinceData: provinces,
cityData: citys,
areaData: areas,
checkCategoryList: [],
allProductList: [],
checkTextureList: [],
checkCompanyList: [],
attributes: [],
keyword: '',
list: {
rows: [],
total: 0
},
pageSize: 20,
queryParam: {},
areaOptions: [],
address: [],
area: null,
status: 'notPick',
ad11: [],
ad112: [],
};
},
onShow() {
// this.search(1)
vk.callFunction({
url: 'client/enquiry/template/pub/getList',
title: '请求中...',
data: {},
success: (data) => {
this.categoryTreeData = data.rows
this.allChildCate = []
this.categoryTreeData.forEach(item => {
item.children.forEach(child => {
this.allChildCate.push(child)
})
})
}
});
// this.getAttributes()
// this.getCompany()
// this.getStealFactory()
this.search()
},
onLoad(options) {
this.getCate()
if (options && options.keyword) this.keyword = options.keyword
this.areaOptions = provinces.map(item => {
item.children = [];
return item
})
this.areaOptions.forEach((province, index) => {
citys[index].forEach(city => {
city.children = []
this.areaOptions[index].children.push(city)
})
})
this.areaOptions.forEach((province, index) => {
province.children.forEach((city, cityIndex) => {
this.areaOptions[index].children[cityIndex].children.push(...areas[index][cityIndex])
})
})
},
methods: {
async getCate() {
const {rows} = await vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...',
});
this.allProductList = []
this.productCateList = rows.map(item => {
item.children.forEach(child => {
this.allProductList.push({
...child,
parentName: item.name
})
})
item.idList = []
return item
})
},
selectCate(name) {
if (name === -2) {
this.clickedCateIndex = -2
this.checkCategoryList = [-2]
this.search(1)
} else {
// const index = this.checkCategoryList.indexOf(name)
// if (index === -1) this.checkCategoryList.push(name)
// else this.checkCategoryList.splice(index, 1)
this.checkCategoryList = [name]
this.search(1)
}
},
selectTexture(name) {
if (name === -1) this.checkTextureList = []
else {
const index = this.checkTextureList.indexOf(name)
if (index === -1) this.checkTextureList.push(name)
else this.checkTextureList.splice(index, 1)
}
this.search(1)
},
selectCompany(name) {
if (name === -1) this.checkCompanyList = []
else {
const index = this.checkCompanyList.indexOf(name)
if (index === -1) this.checkCompanyList.push(name)
else this.checkCompanyList.splice(index, 1)
}
this.search(1)
},
toMyEnquiry() {
vk.navigateTo({
url: '/pages/enquiry/my'
})
},
toMyQuote() {
vk.navigateTo({
url: '/pages/enquiry/quote/my'
})
},
async toRelease() {
const {userInfo, accountNum} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
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({url: '/pages/user/user?menu=fadada'});
})
} else if (accountNum === 0) {
this.$confirm('请先到个人中心添加收款账户', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=account'});
})
} else {
if (userInfo.businessCard.status !== 1) {
this.$confirm('您的名片信息未审核,请耐心等待', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
return
}
vk.navigateTo({
url: '/pages/enquiry/release'
})
}
},
selectArea(e) {
this.area = e
this.search(1)
},
changeStatus(status) {
this.status = status
this.search(1)
},
search(pageIndex = 1) {
let cateList = [], material = []
if (this.checkCategoryList.length === 1 && this.checkCategoryList[0] === -2) cateList.push(0)
else {
cateList = this.checkCategoryList
}
vk.callFunction({
url: 'client/enquiry/sheet/pub/getList',
title: '请求中...',
data: {
pageIndex,
pageSize: this.pageSize,
keyword: this.keyword,
companyList: this.checkCompanyList,
// categoryIds: this.checkCategoryList
cateList,
material: this.checkTextureList,
area: this.area,
status: this.status,
},
success: (data) => {
this.list = data
this.list.rows.forEach((val, index) => {
this.list.rows[index].fullAddress = (val.addressRegion && val.addressRegion.province) ? `${val.addressRegion.province.name}${val.addressRegion.city.name}${val.addressRegion.area.name}` : ''
if (val.addressDetail) this.list.rows[index].fullAddress += val.addressDetail
})
this.getAd11()
this.getAd112()
}
});
},
getAttributes() {
vk.callFunction({
url: 'client/enquiry/attributes/pub/getList',
title: '请求中...',
data: {},
success: (data) => {
this.attributes = data.rows.find(attr => attr.label === '材质').options.map(item => {
item.name = item.label
return item
})
}
});
},
getCompany() {
vk.callFunction({
url: 'client/user/pub/getCompany',
title: '请求中...',
data: {},
success: (data) => {
this.companyList = data.rows.map(item => {
item.name = item.company.companyName
return item
})
}
});
},
selectAll() {
this.clickedCateIndex = -1
this.checkCategoryList = []
this.search(1)
},
async getAd11() {
this.ad11 = []
if (!this.area || this.area.length === 0) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 11
}
})
if (res.data) this.ad11 = res.data
} else {
const {rows} = await vk.callFunction({
url: 'client/user/pub/getCompany',
data: {
pageIndex: 1,
pageSize: 10,
isCoop: 1,
province: [this.area[0]]
}
})
rows.forEach(item => {
if (item.businessCard.album && item.businessCard.album.length > 0) {
this.ad11.push({
swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
companyId: item._id
})
}
})
}
},
async getAd112() {
this.ad112 = []
if (!this.area || this.area.length === 0) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 112
}
})
if (res.data) this.ad112 = res.data
} else {
const {rows} = await vk.callFunction({
url: 'client/user/pub/getCompany',
data: {
pageIndex: 1,
pageSize: 10,
isCoop: 1,
province: [this.area[0]]
}
})
rows.forEach(item => {
if (item.businessCard.album && item.businessCard.album.length > 0) {
this.ad112.push({
swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
companyId: item._id
})
}
})
}
},
},
computed: {
checkCategoryArr() {
const arr = []
if (this.checkCategoryList.length === 1 && this.checkCategoryList[0] !== -2)arr.push({name: this.checkCategoryList[0]})
this.attributes.forEach(item => {
if (this.checkTextureList.includes(item.value)) {
arr.push(item)
}
})
if (this.area && this.area.length) {
const nameArr = []
if (this.area.length > 0) {
const province = this.provinceData.find(item => item.code === this.area[0])
nameArr.push(province.name)
if (this.area.length > 1) {
const city = province.children.find(item => item.code === this.area[1])
nameArr.push(city.name)
if (this.area.length > 2) {
const area = city.children.find(item => item.code === this.area[2])
nameArr.push(area.name)
}
}
}
console.log(nameArr)
if (nameArr.length) arr.push({name: nameArr.join('/')})
}
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;
}
}
.sheet-list {
width: 1200px;
margin: 20px auto;
// display: flex;
}
.paginatio {
float: none;
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
}
.post-btn {
background: none;
color: #A92924;
}
.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;
}
</style>