524 lines
14 KiB
Vue
524 lines
14 KiB
Vue
<template> <!-- 旧货交易 -->
|
||
<view class="wrap">
|
||
<!-- 吸顶 -->
|
||
<u-sticky offset-top="0" customNavHeight="0">
|
||
<!-- 顶部 -->
|
||
<uiheader title="旧货交易"></uiheader>
|
||
<!-- 搜索栏 -->
|
||
<cmsearch :k="keyword" @search="afterSearch"></cmsearch>
|
||
</u-sticky>
|
||
<!-- 轮播图-传值:list="数组" -->
|
||
<cmswiper page="old" 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="mini" @click="toRelease">发布旧货</u-button>
|
||
</view>
|
||
<view class="flex-1 mx-20">
|
||
<u-button type="primary" shape="circle" size="mini" plain @click="toMyEnquiry">我发布的</u-button>
|
||
</view>
|
||
<view class="flex-1 mx-20">
|
||
<u-button type="primary" shape="circle" size="mini" plain @click="toMyQuote">我的报价</u-button>
|
||
</view>
|
||
</view>
|
||
<cmfourth></cmfourth>
|
||
<!-- 加急公告 -->
|
||
<view class="layout layout-notice bg-white flex justify-start align-center">
|
||
<view class="notice-left">
|
||
<view>加急</view>
|
||
<view>公告</view>
|
||
</view>
|
||
<view class="notice-right m-left-30">
|
||
<swiper class="swiper-box" vertical="true" :autoplay="true" :interval="3000" :duration="1000"
|
||
next-margin="48rpx">
|
||
<swiper-item class="swiper-item" v-for="(item, index) in urgentList" :key="index"
|
||
@click="$jump(`/pages/junk/detail?id=${item._id}`)">
|
||
<view class="swiper-item">
|
||
<view class="city" v-if="item.addressRegion && item.addressRegion.city">[{{
|
||
item.addressRegion.city.name
|
||
}}]
|
||
</view>
|
||
<template v-else>
|
||
<view class="city" v-if="item.deliverAddressRegion && item.deliverAddressRegion.city">[{{
|
||
item.deliverAddressRegion.city.name
|
||
}}]
|
||
</view>
|
||
</template>
|
||
<view class="text text-single">{{ item.title }}</view>
|
||
<view class="date">{{ dayjs(item._add_time_str).format('MM-DD') }}</view>
|
||
</view>
|
||
</swiper-item>
|
||
</swiper>
|
||
</view>
|
||
</view>
|
||
<!-- 最新拍卖消息 -->
|
||
<view class="layout layout-list">
|
||
<view class="list-h2">
|
||
<view class="big">最新拍卖消息</view>
|
||
<view class="more" @click="listLink(0)">更多></view>
|
||
</view>
|
||
<view class="list-box m-top-10">
|
||
<view class="li text-single" v-for="(item, index) in dataList[0]" :key="index"
|
||
v-if="item.addressRegion && item.addressRegion.city "
|
||
@click="$jump(`/pages/junk/detail?id=${item._id}`)">
|
||
<text>【{{ item.addressRegion.city.name }}】</text>
|
||
<text class="text-main" v-if="item.isUrgent">[加急]</text>
|
||
{{ item.title }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 最新采购消息 -->
|
||
<view class="layout layout-list">
|
||
<view class="list-h2">
|
||
<view class="big">最新采购消息</view>
|
||
<view class="more" @click="listLink(1)">更多></view>
|
||
</view>
|
||
<view class="list-box m-top-10">
|
||
<view class="li text-single" v-for="(item, index) in dataList[1]" :key="index"
|
||
v-if="item.deliverAddressRegion && item.deliverAddressRegion.city "
|
||
@click="$jump(`/pages/junk/detail?id=${item._id}`)">
|
||
<text>【{{ item.deliverAddressRegion.city.name }}】</text>
|
||
<text class="text-main" v-if="item.isUrgent">[加急]</text>
|
||
{{ item.title }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 列表-最新租赁消息 -->
|
||
<view class="layout layout-list">
|
||
<view class="list-h2">
|
||
<view class="big red">最新租赁消息</view>
|
||
<view class="more" @click="listLink(2)">更多></view>
|
||
</view>
|
||
<view class="list-box m-top-10">
|
||
<view class="li text-single" v-for="(item, index) in dataList[2]" :key="index"
|
||
@click="$jump(`/pages/junk/detail?id=${item._id}`)">
|
||
<text v-if="item.addressRegion && item.addressRegion.city">【{{ item.addressRegion.city.name }}】</text>
|
||
<template v-else>
|
||
<text v-if="item.deliverAddressRegion && item.deliverAddressRegion.city">【{{ item.deliverAddressRegion.city.name }}】</text>
|
||
</template>
|
||
<text class="text-main" v-if="item.isUrgent">[加急]</text>
|
||
{{ item.title }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 列表-最新物资回收消息 -->
|
||
<view class="layout layout-list">
|
||
<view class="list-h2">
|
||
<view class="big red">最新物资回收消息</view>
|
||
<view class="more" @click="listLink(3)">更多></view>
|
||
</view>
|
||
<view class="list-box m-top-10">
|
||
<view class="li text-single" v-for="(item, index) in dataList[3]" :key="index"
|
||
v-if="item.addressRegion && item.addressRegion.city "
|
||
@click="$jump(`/pages/junk/detail?id=${item._id}`)">
|
||
<text>【{{ item.addressRegion.city.name }}】</text>
|
||
<text class="text-main" v-if="item.isUrgent">[加急]</text>
|
||
{{ item.title }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 品牌推荐 -->
|
||
<view class="layout layout-brand bg-white">
|
||
<view class="brand-img flex justify-center p-top-20">
|
||
<image class="img" src="/static/img/brand.png" mode=""></image>
|
||
</view>
|
||
<view class="brand-box flex justify-between flex-wrap">
|
||
<view class="item" v-for="(item, index) in companyList" :key="index"
|
||
@click="$jump(`/pages/yellow/detail?id=${item.uid}`)">
|
||
<view class="flex flex-col justify-start items-start ml-10" style="width: 290rpx">
|
||
<view class="text text-24 flex-1 u-line-1">{{ item.company.companyName }}</view>
|
||
<view class="main m-top-10 u-line-1">
|
||
主营:{{
|
||
(item.mainSpotCategory && item.mainSpotCategory.length > 0) ? item.mainSpotCategory.join() : (item.company.mainSpotCategorySelf || '')
|
||
}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- <view v-if="showMore" class="more-btns">-->
|
||
<!-- <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>-->
|
||
<collapse></collapse>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import uiheader from '@/components/index/header'
|
||
import cmsearch from '@/components/common/search'
|
||
import cmempty from '@/components/common/empty'
|
||
import cmfourth from '@/components/common/fourth'
|
||
import cmswiper from '@/components/common/swiper'
|
||
import dayjs from 'dayjs'
|
||
import Collapse from "@/components/index/collapse.vue";
|
||
import {FactoryBuilding} from "@icon-park/vue";
|
||
|
||
export default {
|
||
components: {
|
||
FactoryBuilding,
|
||
Collapse,
|
||
uiheader,
|
||
cmsearch,
|
||
cmempty,
|
||
cmfourth,
|
||
cmswiper,
|
||
},
|
||
data() {
|
||
return {
|
||
companyList: [],
|
||
dataList: [],
|
||
urgentList: [],
|
||
allChildCate: [],
|
||
keyword: '',
|
||
showMore: false
|
||
};
|
||
},
|
||
methods: {
|
||
dayjs,
|
||
toMyEnquiry() {
|
||
vk.navigateTo({
|
||
url: '/pages/junk/my'
|
||
})
|
||
},
|
||
toMyQuote() {
|
||
vk.navigateTo({
|
||
url: '/pages/junk/myQuote'
|
||
})
|
||
},
|
||
listLink(type) {
|
||
vk.navigateTo(`/pages/junk/list?type=${type}`);
|
||
},
|
||
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 {
|
||
vk.navigateTo({
|
||
url: '/pages/junk/publish'
|
||
})
|
||
}
|
||
},
|
||
async getInfo(id) {
|
||
this.info = await vk.callFunction({
|
||
url: 'client/goods/list/pub/getDetail',
|
||
data: {
|
||
id
|
||
}
|
||
})
|
||
},
|
||
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.getCompanyList()
|
||
}
|
||
});
|
||
},
|
||
async getCompanyList() {
|
||
const {rows} = await vk.callFunction({
|
||
url: 'client/user/pub/getCompany',
|
||
data: {isCoop: 1}
|
||
})
|
||
this.companyList = rows.map(item => {
|
||
item.name = item.company.companyName
|
||
item.mainSpotCategory = []
|
||
if (item.company && item.company.mainSpotCategoryIds) {
|
||
this.allChildCate.forEach(child => {
|
||
if (item.company.mainSpotCategoryIds.includes(child._id)) {
|
||
item.mainSpotCategory.push(child.name)
|
||
}
|
||
})
|
||
}
|
||
return item
|
||
})
|
||
},
|
||
afterSearch(keyword) {
|
||
this.keyword = keyword
|
||
this.getDataList()
|
||
},
|
||
async getDataList() {
|
||
for (let i = 0; i < 4; i++) {
|
||
const {rows} = await vk.callFunction({
|
||
url: 'client/old/pub/getList',
|
||
data: {
|
||
type: i,
|
||
keyword: this.keyword
|
||
}
|
||
})
|
||
this.dataList[i] = rows.map(item => {
|
||
item.addDate = dayjs(item._add_time).format('MM-DD')
|
||
return item
|
||
})
|
||
this.$forceUpdate()
|
||
}
|
||
},
|
||
async getUrgentList() {
|
||
const {rows} = await vk.callFunction({
|
||
url: 'client/old/pub/getList',
|
||
data: {
|
||
isUrgent: true
|
||
}
|
||
})
|
||
this.urgentList = rows.map(item => {
|
||
item.addDate = dayjs(item._add_time).format('MM-DD')
|
||
return item
|
||
})
|
||
console.log(this.urgentList)
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
if (option.keyword) this.keyword = option.keyword
|
||
this.getCategoryTreeData()
|
||
this.getDataList()
|
||
this.getUrgentList()
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
background: #F8F8F8;
|
||
}
|
||
|
||
.layout-notice {
|
||
margin: 20rpx 30rpx;
|
||
padding: 20rpx 20rpx;
|
||
|
||
.notice-left {
|
||
width: 80rpx;
|
||
height: 100%;
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
line-height: 32rpx;
|
||
color: #A92924;
|
||
border-right: 1px solid #f2f2f2;
|
||
}
|
||
|
||
.notice-right {
|
||
width: 550rpx;
|
||
height: auto;
|
||
}
|
||
|
||
.swiper-box {
|
||
width: 100%;
|
||
height: 96rpx;
|
||
}
|
||
|
||
.swiper-item {
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
width: 100%;
|
||
height: 48rpx !important;
|
||
overflow: hidden;
|
||
font-size: 24rpx;
|
||
line-height: 48rpx;
|
||
color: #999999;
|
||
|
||
.text {
|
||
margin: 0 10rpx;
|
||
max-width: 300rpx;
|
||
color: #333333;
|
||
}
|
||
}
|
||
}
|
||
|
||
.layout-banner {
|
||
padding: 0rpx 30rpx;
|
||
|
||
.banner {
|
||
margin-top: 20rpx;
|
||
width: 100%;
|
||
height: 126rpx;
|
||
}
|
||
}
|
||
|
||
.layout-brand {
|
||
margin: 30rpx 30rpx 10rpx;
|
||
|
||
.brand-img {
|
||
.img {
|
||
width: 174rpx;
|
||
height: 58rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.brand-box {
|
||
padding: 10rpx;
|
||
|
||
.item {
|
||
position: relative;
|
||
width: 50%;
|
||
height: 136rpx;
|
||
//padding: 10rpx;
|
||
box-sizing: border-box;
|
||
border-bottom: 1px solid #f2f2f2;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
.main {
|
||
height: 36rpx;
|
||
font-size: 24rpx;
|
||
line-height: 36rpx;
|
||
color: #666666;
|
||
}
|
||
|
||
.company {
|
||
width: 64rpx;
|
||
//height: 64rpx;
|
||
|
||
.icon {
|
||
width: 64rpx;
|
||
height: 64rpx;
|
||
}
|
||
|
||
.text {
|
||
font-size: 25rpx;
|
||
font-weight: 600;
|
||
line-height: 48rpx;
|
||
color: #101010;
|
||
}
|
||
}
|
||
}
|
||
|
||
.item:nth-child(2n+1) {
|
||
border-right: 1px solid #f2f2f2;
|
||
}
|
||
|
||
.item:nth-last-child(-n+2) {
|
||
border-bottom: none;
|
||
}
|
||
}
|
||
|
||
.layout-list {
|
||
margin: 20rpx 30rpx 10rpx;
|
||
border-radius: 12rpx;
|
||
|
||
.list-h2 {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 10rpx 0rpx;
|
||
|
||
.big {
|
||
font-size: 28rpx;
|
||
line-height: 48rpx;
|
||
color: #000000;
|
||
}
|
||
|
||
.more {
|
||
font-size: 26rpx;
|
||
line-height: 40rpx;
|
||
color: #A92924;
|
||
}
|
||
|
||
.red {
|
||
color: #A92924 !important;
|
||
}
|
||
}
|
||
|
||
.list-box {
|
||
padding: 20rpx 20rpx;
|
||
background: #FFFDFD;
|
||
border-radius: 20rpx;
|
||
|
||
.li {
|
||
position: relative;
|
||
width: 100%;
|
||
height: 48rpx;
|
||
font-size: 24rpx;
|
||
line-height: 48rpx;
|
||
color: #6c6c6c;
|
||
text-indent: 1em;
|
||
|
||
&:before {
|
||
position: absolute;
|
||
left: 0;
|
||
top: 50%;
|
||
z-index: 9;
|
||
content: '';
|
||
margin-top: -2px;
|
||
width: 4px;
|
||
height: 4px;
|
||
background: #A92924;
|
||
border-radius: 50%;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
.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>
|