Files
jjx-web/pages/process/list.vue
T
b2894lxlx aa1df73a53 1、新增签约宝
2、调整自营
3、新增购物车(未完善)
2023-12-04 19:25:58 +08:00

475 lines
17 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">
<el-carousel height="170px">
<el-carousel-item v-for="item in 4" :key="item">
<image class="carousel-img"
src="/static/images/600fc93e6b85324b3ea1373ee264290d.jpg"
mode="aspectFill"></image>
</el-carousel-item>
</el-carousel>
<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-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="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">
<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>
<!-- <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="已选择">
<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="sheet-list">
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns"
:customRightBtns="table1.customRightBtns" :query-form-param="queryParam"
:pagination="true">
<template v-slot:action="{ row, column, index }">
<el-button size="mini" type="primary" plain @click.native="toDetail(row._id)">{{ vk.getVuex('$user.userInfo._id') === row.userId ? '查看' : '申请加工' }}</el-button>
</template>
</vk-data-table>
</view>
<right-bar></right-bar>
<common-footer></common-footer>
</view>
</template>
<script>
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
provinces.unshift({
code: 9999,
name: '全国'
})
export default {
data() {
return {
categoryTreeData: [],
provinceData: provinces,
checkProvinceList: [],
allChildCate: [],
companyList: [],
checkCompanyList: [],
clickedCateIndex: -1,
checkCategoryList: [],
showAllCompany: false,
keyword: '',
queryParam: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: (obj = {}) => {
let {data, success, fail, complete} = obj;
vk.callFunction({
url: `client/process/sheet/pub/getList`,
data: data,
success: (res) => {
if (typeof success === "function") {
success({
rows: res.rows, // 列表数据
total: res.total, // 总记录数
});
}
},
fail: (err => {
}),
complete: (res) => {
if (typeof complete === "function") complete(res);
}
})
},
// customRightBtns: [{
// title: vk.getVuex('$user.userInfo._id') '申请加工',
// // icon: 'el-icon-search',
// type: 'primary',
// plain: true,
// onClick: ({_id}) => {
// this.toDetail(_id)
// // vk.navigateTo('/pages/process/detail?id=' + item._id);
// }
// },],
// 表格字段显示规则
columns: [
{
key: "title",
title: "标题",
type: "html",
formatter: (val, row, column, index) => {
return `<text class="text-main">${val}</text>`
}
},
{
key: "num",
title: "加工量",
type: "text",
// formatter: (val, row, column, index) => {
// return val.map(item=>item.procureNumber + item.procureUnit).join("/")
// }
},
// {
// key: "productList",
// title: "收货地",
// type: "text",
// formatter: (val, row, column, index) => {
// let str = ""
// try {
// str = val.map(item => {
// const addressStr = item.address.region.province.name + "-" + item.address.region.city.name + "-" + item.address.region.area.name
// return addressStr
// }).join("/")
// } catch (err) {
// str = ""
// }
// return str
// }
// },
{
key: "user",
title: "采购企业",
type: "text",
formatter: (val, row, column, index) => {
if(val.accountType === 1) {
return val.person.personName
}else {
return val.company.companyName
}
}
},
{
key: "",
title: "报价情况",
type: "text",
formatter: (val, row, column, index) => {
return `${val.quoteNum}家已报价`
}
},
{
key: "_add_time",
title: "发布时间",
type: "time",
},
{
key: "action", title: "操作", type: "html"
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
},
// 表格相关结束 -----------------------------------------------------------
};
},
onLoad() {
// this.search(1)
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()
},
methods: {
selectCate(id) {
const index = this.checkCategoryList.indexOf(id)
if (index === -1) this.checkCategoryList.push(id)
else this.checkCategoryList.splice(index, 1)
this.search(1)
},
selectTexture(id) {
if (id === -1) this.checkTextureList = []
else {
const index = this.checkTextureList.indexOf(id)
if (index === -1) this.checkTextureList.push(id)
else this.checkTextureList.splice(index, 1)
}
this.search(1)
},
selectCompany(id) {
if (id === -1) this.checkCompanyList = []
else {
const index = this.checkCompanyList.indexOf(id)
if (index === -1) this.checkCompanyList.push(id)
else this.checkCompanyList.splice(index, 1)
}
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'
})
},
async toRelease() {
const {userInfo} = 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=business-card'});
})
} else {
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=business-card');
})
} else {
vk.navigateTo({
url: `/pages/process/detail?id=${id}`
})
}
},
search(pageIndex) {
const categoryIds = []
this.checkCategoryList.forEach(item => {
item.forEach(sitem => {
categoryIds.push(sitem._id)
})
})
this.queryParam.formData = {
keyword: this.keyword,
companyList: this.checkCompanyList,
categoryIds
}
this.$refs.table1.search()
// vk.callFunction({
// url: 'client/process/sheet/pub/getList',
// data: {
// pageIndex: pageIndex,
// pageSize: 20,
// keyword: this.keyword,
// },
// success: (data) => {
// console.log('data: ', data);
//
// this.goodsData = data
// }
// });
},
getCertUrl() {
vk.callFunction({
url: 'client/fadada.getVerifyUrl',
success: (res) => {
location.href = res.data.url
}
});
},
},
computed: {
checkCategoryArr() {
let arr = []
this.checkCategoryList.forEach(item => {
arr.push(...item)
})
this.checkProvinceList.forEach(item => {
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>