Files
2026-10-08 18:34:09 +08:00

440 lines
13 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template> <!-- 找加工 -->
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<!-- 顶部 -->
<uiheader title="找加工"></uiheader>
<!-- 搜索栏 -->
<cmsearch :k="keyword" @search="afterSearch" :show-back="false"></cmsearch>
<!-- 轮播图-传值:list="数组" -->
<cmswiper page="process" height="320rpx"></cmswiper>
<!-- 选择器 -->
<view class="bg-white p-20 flex justify-center items-center">
<view class="flex-1 mx-20">
<u-button type="primary" shape="circle" size="small" @click="toRelease">发布加工</u-button>
</view>
<view class="flex-1 mx-20">
<u-button type="primary" shape="circle" size="small" plain @click="toMyEnquiry">我发布的</u-button>
</view>
<view class="flex-1 mx-20">
<u-button type="primary" shape="circle" size="small" plain @click="toMyQuote">我的报价</u-button>
</view>
<view class="flex-1 mx-20">
<u-button type="success" shape="circle" size="small" plain @click="$jump('/pages/work/factoryList')">
加工厂列表
</u-button>
</view>
</view>
<view class="layout-pick flex flex-col justify-start items-start bg-white text-25">
<view class="flex justify-start items-center">
<view class="flex-1 ip down" @click="isPick = true">分类: {{ pickValue ? pickValue : '全部分类' }}</view>
</view>
<view class="flex justify-between items-center mt-15 w-100p">
<view class="ip down" @click="isPickStatus = true">询价状态: {{ status }}</view>
<view class="ip down" @click="showAddress">地区:{{ locationValue }}</view>
</view>
</view>
</u-sticky>
<!-- 数据列表 -->
<view class="layout layout-work">
<uiswiper :ad="13" :category-id="cateId" :category-ids="cateId ? [cateId] : []" :region="region"
padding="10rpx 0"></uiswiper>
<uiswiper :ad="14" :category-id="cateId" :category-ids="cateId ? [cateId] : []" :region="region"
padding="10rpx 0"></uiswiper>
<view class="table-box">
<view class="thead">
<view class="tr">
<view class="flex justify-center items-center font-bold" style="width: 41%; height: 50rpx">标题</view>
<view class="flex justify-center items-center w-15p font-bold" style="height: 50rpx">加工量</view>
<view class="flex justify-center items-center font-bold" style="width: 32%; height: 50rpx">收货地</view>
<view class="flex justify-center items-center w-12p font-bold" style="height: 50rpx">操作</view>
</view>
</view>
<view class="tbody mt-10">
<view class="flex justify-center items-center" v-for="(item, index) in list.rows" :key="index">
<view class="td-n flex justify-center items-center" @click="toDetail(item._id)" style="width: 41%;">
<text class="u-line-2 flex justify-center items-center">{{ item.title }}</text>
</view>
<view class="td-n w-15p flex justify-center items-center">{{ item.num }}</view>
<view class="td-n flex justify-center items-center" style="width: 32%">
<text class="u-line-2 flex justify-center items-center">{{
(item.addressRegion && item.addressRegion.province && item.addressRegion.city && item.addressRegion.area) ?
`${item.addressRegion.province.name}${item.addressRegion.city.name}${item.addressRegion.area.name}` : ''
}}
</text>
</view>
<view class="td-n w-12p flex justify-center items-center">
<u-button
class="minibtn"
size="mini"
type="error"
plain
text="查看"
@click="toDetail(item._id)"
></u-button>
</view>
</view>
</view>
</view>
</view>
<!-- 暂无数据 -->
<u-empty mode="list" text="暂无更多内容~" v-if="list.rows.length === 0"></u-empty>
<!-- <cmempty></cmempty> -->
<!-- 圆形按钮 -->
<!-- <view v-if="showMore" class="more-btns">-->
<!-- <view class="item" @click="$jump('/pages/work/factoryList')">-->
<!-- <factory-building theme="outline" size="24" fill="#a92924"/>-->
<!-- </view>-->
<!-- <view class="item" @click="toMyQuote">-->
<!-- <u-icon name="order" color="#A92924" size="24"></u-icon>-->
<!-- </view>-->
<!-- <view class="item" @click="toMyEnquiry">-->
<!-- <u-icon name="account" color="#A92924" size="24"></u-icon>-->
<!-- </view>-->
<!-- <view class="item" @click="toRelease">-->
<!-- <u-icon name="plus" color="#A92924" size="24"></u-icon>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="issue" @click="showMore = !showMore">-->
<!-- <u-icon :name="showMore ? 'close' : 'plus'" color="#fff" size="24"></u-icon>-->
<!-- </view>-->
<AddressSelect ref="AddressSelect" @confirm="regionConfirm"/>
<u-picker v-if="isPick" :show="isPick" :columns="[categoryTreeData]"
key-name="name" @confirm="handConfirmPick" @cancel="isPick = false">
<template #more>
<text @click="resetCate">重置</text>
</template>
</u-picker>
<collapse></collapse>
<u-picker v-if="isPickStatus" :show="isPickStatus"
:columns="[[{name: '正在询价', value: 0}, {name: '合作成交', value: 1}, ]]"
key-name="name" @confirm="handConfirmStatusPick" @cancel="isPickStatus = false">
</u-picker>
</view>
</template>
<script>
import uiheader from '@/components/index/header'
import cmsearch from '@/components/common/search'
import cmempty from '@/components/common/empty'
import cmswiper from '@/components/common/swiper'
import {FactoryBuilding} from '@icon-park/vue'
import AddressSelect from "@/components/AddressSelect.vue";
import Collapse from "@/components/index/collapse.vue";
import uiswiper from "@/components/index/swiper.vue";
export default {
components: {
uiswiper,
Collapse,
AddressSelect,
uiheader,
cmsearch,
cmempty,
cmswiper,
FactoryBuilding,
},
data() {
return {
allChildCate: [],
categoryTreeData: [],
pageSize: 500,
keyword: '',
checkCategoryList: [],
checkProvinceList: [],
list: {
rows: []
},
showMore: false,
locationValue: '全国',
region: {
province: {
code: null,
name: null,
}
},
pickValue: '全部',
isPick: false,
cateId: null,
cateIndex: [0, 0],
status: '正在询价',
statusVal: 0,
isPickStatus: false,
};
},
methods: {
handleChangeCate({indexs}) {
this.cateIndex = indexs
},
handConfirmPick({value}) {
this.pickValue = value[0].name
this.cateId = value[0]._id
this.isPick = false
this.search(1)
},
handConfirmStatusPick({value}) {
this.status = value[0].name
this.statusVal = value[0].value
this.isPickStatus = false
this.search(1)
},
resetCate() {
this.cateIndex = [0, 0]
this.pickValue = '全部'
this.cateId = null
this.isPick = false
this.search(1)
},
getCateList() {
vk.callFunction({
url: 'client/process/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)
})
})
}
});
},
showAddress() {
this.$refs.AddressSelect.open(this.region, 1, true);
},
regionConfirm({province}) {
this.region = {province}
this.locationValue = `${province.name}`
this.search(1)
},
afterSearch(keyword) {
this.keyword = keyword
this.search()
},
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.cateId ? [this.cateId] : null,
provinceCodes: this.region.province.code ? [this.region.province.code] : null,
status: this.statusVal
},
success: (data) => {
this.list = data
this.loading = false
}
});
},
toMyEnquiry() {
vk.navigateTo({
url: '/pages/work/my'
})
},
toMyQuote() {
vk.navigateTo({
url: '/pages/work/myQuote'
})
},
async toRelease() {
const {userInfo, accountNum} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
uni.showModal({
title: '提示',
content: '您尚未认证, 是否前往认证?',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 0)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
uni.showModal({
title: '提示',
content: '请完善名片信息',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 1)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (accountNum === 0) {
uni.showModal({
title: '提示',
content: '请先到个人中心添加收款账户',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 7)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else {
if (userInfo.businessCard.status !== 1) {
uni.showModal({
title: '提示',
content: '您的名片信息未审核,请耐心等待',
})
return
}
vk.navigateTo({
url: '/pages/work/publish'
})
}
},
async toDetail(id) {
const {userInfo} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
uni.showModal({
title: '提示',
content: '您尚未认证, 是否前往认证?',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 0)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
uni.showModal({
title: '提示',
content: '请完善名片信息',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 1)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else {
vk.navigateTo(`/pages/work/detail?id=${id}`)
}
},
},
onLoad(option) {
if (option.keyword) this.keyword = option.keyword
this.getCateList()
this.search()
}
}
</script>
<style lang="scss">
.u-button--small {
padding: 0 !important;
}
.minibtn {
width: 60rpx;
font-size: 20rpx;
color: #A92924 !important;
border-color: #A92924;
}
.layout-pick {
// width: 690rpx;
//height: 68rpx;
padding: 0 30rpx;
font-size: 24rpx;
line-height: 40rpx;
color: #4F4F4F;
.ip {
position: relative;
//width: 150rpx;
//max-width: 33.333%;
height: 40rpx;
padding-right: 30rpx;
overflow: hidden;
box-sizing: border-box;
}
.down::after {
position: absolute;
right: 10rpx;
top: 50%;
z-index: 9;
content: '';
margin-top: -6rpx;
width: 0;
height: 0;
border-left: 10rpx solid transparent;
border-right: 10rpx solid transparent;
border-top: 12rpx solid #999999;
}
}
.layout-work {
margin: 20rpx 10rpx;
}
.tr {
display: flex;
justify-content: space-between;
align-items: center;
}
.table-box {
font-size: 24rpx;
line-height: 28rpx;
text-align: center;
}
.th, .td {
display: flex;
justify-content: center;
align-items: center;
width: 20%;
height: 76rpx;
color: #000;
overflow: hidden;
box-sizing: border-box;
}
.td-n {
border-right: 1px solid #f2f2f2;
border-bottom: 1px solid #f2f2f2;
background: #ffffff;
height: 60rpx;
&:first-child {
color: #A92924;
}
&:last-child {
border-right: none;
}
}
.more-btns {
position: fixed;
right: 30rpx;
bottom: 220rpx;
z-index: 99;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 90rpx;
border-radius: 999rpx;
background: white;
border: 1px solid #A92924;
.item {
margin: 20rpx 0;
}
}
</style>