543 lines
19 KiB
Vue
543 lines
19 KiB
Vue
<template>
|
|
<view>
|
|
<top-bar></top-bar>
|
|
<common-header></common-header>
|
|
<category-bar></category-bar>
|
|
|
|
<!-- <view class="page-nav">
|
|
<el-breadcrumb separator="/">
|
|
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
|
<el-breadcrumb-item><navigator url="/pages/spot/goods/goods">现货市场</navigator></el-breadcrumb-item>
|
|
</el-breadcrumb>
|
|
</view> -->
|
|
|
|
<view class="carousel">
|
|
<common-swiper page="process"/>
|
|
<view class="goods-options">
|
|
<el-row class="">
|
|
<el-button @click="toRelease" type="primary" round>发布加工单</el-button>
|
|
<el-button @click="toMyEnquiry" type="primary" round plain>我发布的加工单</el-button>
|
|
<el-button @click="toMyQuote" type="primary" round plain>我的报价</el-button>
|
|
<el-button @click="navTo('/pages/process/factoryList')" type="success" round plain>加工厂列表</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="selectCate({_id: -1})" class="pointer mr-25"
|
|
:class="[checkCategoryList.length === 0 ? 'text-main selected-cate' : '']">全部
|
|
</text>
|
|
<view v-for="(item, index) in categoryTreeData" :key="index">
|
|
<text @click="selectCate(item)" class="pointer mr-25"
|
|
:class="[checkCategoryList.length && checkCategoryList.includes(item._id) ? 'text-main selected-cate' : '']">
|
|
{{ item.name }}
|
|
</text>
|
|
</view>
|
|
</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)"-->
|
|
<!-- :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)"-->
|
|
<!-- :class="[checkCategoryList.includes(item._id) ? 'text-main' : '']"-->
|
|
<!-- v-for="(item, index) in categoryTreeData[clickedCateIndex].children" :key="index">-->
|
|
<!-- {{ item.name }}-->
|
|
<!-- </text>-->
|
|
<!-- </template>-->
|
|
<!-- <!– <text @click="showAllTexture = !showAllTexture" 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="selectCompany(-1)" class="pointer mr-25"-->
|
|
<!-- :class="[checkCompanyList.length === 0 ? 'text-main selected-cate' : '']">全部-->
|
|
<!-- </text>-->
|
|
<!-- <view v-for="(item, index) in companyList" :key="index">-->
|
|
<!-- <text @click="selectCompany(item._id)" class="pointer mr-25"-->
|
|
<!-- :class="[checkCompanyList.includes(item._id) ? 'text-main selected-cate' : '']"-->
|
|
<!-- v-if="index < 10 || showAllCompany">-->
|
|
<!-- {{ item.name }}-->
|
|
<!-- </text>-->
|
|
<!-- </view>-->
|
|
<!-- <text @click="showAllCompany = !showAllCompany" class="pointer mr-25"-->
|
|
<!-- v-if="companyList.length > 10">查看更多-->
|
|
<!-- </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' : '']">
|
|
{{ item.name }}
|
|
</text>
|
|
</view>
|
|
<!-- <text @click="showAllProvince = !showAllProvince" class="pointer mr-25">查看更多-->
|
|
<!-- </text>-->
|
|
</view>
|
|
</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="ad13.length">
|
|
<el-carousel :height="`100px`" :style="{width: ad14.length ? '50%' : '100%'}" class="m-a">
|
|
<el-carousel-item v-for="(item, index) in ad13" :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="ad14.length">
|
|
<el-carousel :height="`100px`" :style="{width: ad13.length ? '50%' : '100%'}" class="m-a">
|
|
<el-carousel-item v-for="(item, index) in ad14" :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>
|
|
<!-- 商品列表 -->
|
|
<view class="sheet-list">
|
|
<view class="flex justify-start items-center my-20">
|
|
<el-button @click="changeStatus(0)" type="primary" :plain="status === 1" round>正在询价</el-button>
|
|
<el-button @click="changeStatus(1)" type="primary" :plain="status === 0" round>合作成交
|
|
</el-button>
|
|
</view>
|
|
<el-table :data="list.rows" style="width: 100%" :loading="loading">
|
|
<el-table-column align="center" label="标题">
|
|
<template v-slot="{ row }">
|
|
<p class="text-main">{{ row.title }}</p>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="num" label="加工量" width="80"/>
|
|
<el-table-column align="center" label="采购企业" width="260">
|
|
<template v-slot="{ row }">
|
|
<p v-if="row.user">{{
|
|
row.user.accountType === 1 ? row.user.person.personName : row.user.company.companyName
|
|
}}</p>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="加工产品交货地址">
|
|
<template v-slot="{ row }">
|
|
<p v-if="row.addressRegion && row.addressRegion.province">{{
|
|
row.addressRegion.province.name
|
|
}}{{ row.addressRegion.city.name }}{{
|
|
row.addressRegion.area.name
|
|
}}</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="toDetail(row._id)" v-if="status === 0">
|
|
{{ vk.getVuex('$user.userInfo._id') === row.userId ? '查看' : '申请合作' }}
|
|
</el-button>
|
|
<el-button size="mini" type="primary" plain @click.native="toDetail(row._id)" v-if="status === 1">
|
|
查看详情
|
|
</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";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
categoryTreeData: [],
|
|
checkProvinceList: [],
|
|
allChildCate: [],
|
|
companyList: [],
|
|
checkCompanyList: [],
|
|
clickedCateIndex: -1,
|
|
checkCategoryList: [],
|
|
checkCategoryNameList: [],
|
|
showAllCompany: false,
|
|
keyword: '',
|
|
queryParam: {},
|
|
list: {
|
|
rows: [],
|
|
total: 0
|
|
},
|
|
pageSize: 20,
|
|
provinceData: provinces,
|
|
showAllProvince: true,
|
|
loading: true,
|
|
status: 0,
|
|
ad13: [],
|
|
ad14: [],
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
if (options && options.keyword) this.keyword = options.keyword
|
|
// this.search(1)
|
|
vk.callFunction({
|
|
url: 'client/process/category/pub/getTree',
|
|
title: '请求中...',
|
|
success: (data) => {
|
|
this.categoryTreeData = data.rows
|
|
this.allChildCate = []
|
|
this.categoryTreeData.forEach(item => {
|
|
item.children.forEach(child => {
|
|
console.log(child)
|
|
this.allChildCate.push(child)
|
|
})
|
|
})
|
|
}
|
|
});
|
|
this.search()
|
|
this.getCompany()
|
|
},
|
|
methods: {
|
|
selectCate({_id, name}) {
|
|
if (_id === -1) {
|
|
this.checkCategoryList = []
|
|
this.checkCategoryNameList = []
|
|
return this.search(1)
|
|
}
|
|
const index = this.checkCategoryList.indexOf(_id)
|
|
if (index === -1) {
|
|
this.checkCategoryList = [_id]
|
|
this.checkCategoryNameList = [name]
|
|
} else {
|
|
this.checkCategoryList.splice(index, 1)
|
|
this.checkCategoryNameList.splice(index, 1)
|
|
}
|
|
this.search(1)
|
|
},
|
|
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.search(1)
|
|
},
|
|
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
|
|
})
|
|
}
|
|
});
|
|
},
|
|
toMyEnquiry() {
|
|
vk.navigateTo({
|
|
url: '/pages/process/my'
|
|
})
|
|
},
|
|
toMyQuote() {
|
|
vk.navigateTo({
|
|
url: '/pages/process/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/process/release'
|
|
})
|
|
}
|
|
},
|
|
async toDetail(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 {
|
|
if (userInfo.businessCard.status !== 1) {
|
|
this.$confirm('您的名片信息未审核,请耐心等待', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
vk.navigateTo({
|
|
url: `/pages/process/detail?id=${id}`
|
|
})
|
|
}
|
|
},
|
|
search(pageIndex = 1) {
|
|
vk.callFunction({
|
|
url: 'client/process/sheet/pub/getList',
|
|
title: '请求中...',
|
|
data: {
|
|
pageIndex,
|
|
pageSize: this.pageSize,
|
|
keyword: this.keyword,
|
|
// companyList: this.checkCompanyList,
|
|
categoryIds: this.checkCategoryList.length ? this.checkCategoryList : null,
|
|
provinceCodes: this.checkProvinceList,
|
|
status: this.status,
|
|
},
|
|
success: (data) => {
|
|
this.list = data
|
|
this.loading = false
|
|
this.getAd13()
|
|
this.getAd14()
|
|
}
|
|
});
|
|
},
|
|
getCertUrl() {
|
|
vk.callFunction({
|
|
url: 'client/fadada.getVerifyUrl',
|
|
success: (res) => {
|
|
location.href = res.data.url
|
|
}
|
|
});
|
|
},
|
|
navTo(url) {
|
|
vk.navigateTo({url});
|
|
},
|
|
changeStatus(status) {
|
|
this.status = status
|
|
this.search(1)
|
|
},
|
|
async getAd13() {
|
|
this.ad13 = []
|
|
// if (this.checkProvinceList.length === 0) {
|
|
const res = await vk.callFunction({
|
|
url: 'client/ad/pub/getList',
|
|
data: {
|
|
adKey: 13,
|
|
region: this.checkProvinceList.length > 0 ? this.checkProvinceList[0] : null
|
|
}
|
|
})
|
|
if (res.data) this.ad13 = 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.ad13.push({
|
|
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
|
|
// companyId: item._id
|
|
// })
|
|
// }
|
|
// })
|
|
// }
|
|
},
|
|
async getAd14() {
|
|
this.ad14 = []
|
|
// if (this.checkProvinceList.length === 0) {
|
|
const res = await vk.callFunction({
|
|
url: 'client/ad/pub/getList',
|
|
data: {
|
|
adKey: 14,
|
|
region: this.checkProvinceList.length > 0 ? this.checkProvinceList[0] : null
|
|
}
|
|
})
|
|
if (res.data) this.ad14 = 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.ad14.push({
|
|
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
|
|
// companyId: item._id
|
|
// })
|
|
// }
|
|
// })
|
|
// }
|
|
},
|
|
|
|
},
|
|
computed: {
|
|
checkCategoryArr() {
|
|
let arr = []
|
|
|
|
this.checkCategoryNameList.forEach(name => {
|
|
arr.push({name})
|
|
})
|
|
|
|
this.provinceData.forEach(item => {
|
|
if (this.checkProvinceList.includes(item.code)) {
|
|
arr.push(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;
|
|
}
|
|
}
|
|
|
|
|
|
.sheet-list {
|
|
width: 1200px;
|
|
margin: 20px auto;
|
|
// display: flex;
|
|
|
|
}
|
|
|
|
|
|
.paginatio {
|
|
float: none;
|
|
width: 1200px;
|
|
margin: 20px auto;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
|
|
.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>
|