You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
260 lines
5.9 KiB
260 lines
5.9 KiB
<template> |
|
<view :class="[{oh: !per}]"> |
|
<view class="page"> |
|
<view class="search-wrap"> |
|
<uni-search-bar class="search" radius="30" placeholder="请输入" v-model="keyword" clearButton="auto" cancelButton="none" @confirm="initList" @clear="clearKeyword" /> |
|
</view> |
|
|
|
<view v-if="list.length" class="list"> |
|
<view class="item" v-for="(item, i) in list" :key="i" @click.stop="toDetail(item)"> |
|
<view class="pro-name"> |
|
<image class="icon" :src="item.logoUrl ? item.logoUrl : Common.shopIcon"></image> |
|
{{ item.companyName }} |
|
</view> |
|
<view class="info"> |
|
<view v-if="item.briefIntroduction" class="intro"> |
|
<image class="icon" src="http://124.71.79.122/images/miniProgram/intro.png" mode="widthFix" /> |
|
<view class="text ell">{{ item.briefIntroduction }}</view> |
|
</view> |
|
<view v-if="item.province || item.city" class="meta"> |
|
<image class="icon" src="http://124.71.79.122/images/miniProgram/address1.png" mode="widthFix" /> |
|
{{ item.province }}-{{ item.city }} |
|
</view> |
|
<view class="actions"> |
|
<view class="star" @click.stop="collect(item)"> |
|
<uni-icons class="star-icon" color="#ffcf47" :type="item.whetherAttention ? 'star-filled' : 'star'" size="25" @click.stop="collect(item)"></uni-icons> |
|
{{ item.whetherAttention ? '取消关注' : '关注' }} |
|
</view> |
|
<view class="order" @click.stop="toOrder(item)">我想采购</view> |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
<empty v-else></empty> |
|
</view> |
|
|
|
<order ref="order" /> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
import { selectEnterpriseCertificationList, treeStructureList, collect, cancelCollection } from '@/apis/modules/supplier.js' |
|
import Common from '@/config/common' |
|
export default { |
|
data() { |
|
return { |
|
Common, |
|
teamId: uni.getStorageSync('teamId') || '', |
|
platformId: uni.getStorageSync('platformId'), |
|
list: [], |
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
|
status: 'more', // 上拉加载状态 more|loading|noMore |
|
keyword: '', |
|
page: 1, |
|
pageSize: 5, |
|
total: 0, |
|
active: '', |
|
typeVisible: false, |
|
submiting: false, |
|
} |
|
}, |
|
// 下拉刷新 |
|
onPullDownRefresh() { |
|
this.initList() |
|
setTimeout(() => { |
|
uni.stopPullDownRefresh() |
|
}, 1500) |
|
}, |
|
// 上拉加载 |
|
onReachBottom() { |
|
if (this.reachBottom >= 0) { |
|
this.reachBottom = 1 |
|
this.status = 'loading' |
|
this.getList() |
|
} |
|
}, |
|
onShow() { |
|
this.keyword = '' |
|
this.initList() |
|
}, |
|
methods: { |
|
initList() { |
|
this.page = 1 |
|
this.reachBottom = 0 |
|
this.getList() |
|
}, |
|
// 列表 |
|
getList() { |
|
uni.showLoading({ |
|
title: '加载中' |
|
}) |
|
selectEnterpriseCertificationList({ |
|
auditStatus: null, |
|
authenticationStatus: 2, |
|
pageNum: this.page, |
|
pageSize: this.pageSize, |
|
platformSource: 6, |
|
keyWord: this.keyword, |
|
whetherAttention: 1 |
|
}).then(({ data }) => { |
|
this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records |
|
this.page++ // 每次获取了数据后page+1 |
|
const noMore = this.list.length === data.total // 是否加载完所有数据 |
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
|
uni.hideLoading() |
|
}).catch(e => { |
|
uni.hideLoading() |
|
}) |
|
}, |
|
// keyword清除回调 |
|
clearKeyword() { |
|
this.keyword = '' |
|
this.initList() |
|
}, |
|
// 跳转学习详情 |
|
toDetail(item) { |
|
this.$util.to('/other/supplierDetail/supplierDetail?teamId=' + item.teamId) |
|
}, |
|
// 我想采购 |
|
toOrder(row) { |
|
const el = this.$refs.order |
|
el.remarks = '' |
|
el.getGoods(row.teamId) |
|
el.$refs.popup.open() |
|
}, |
|
// 关注 |
|
async collect(row) { |
|
if (this.submiting) return false |
|
this.submiting = true |
|
if (row.whetherAttention) { |
|
const that = this |
|
uni.showModal({ |
|
title: '提示', |
|
content: '确定要取消关注吗?', |
|
async success(res) { |
|
if (res.confirm) { |
|
await cancelCollection(row.attentionId) |
|
that.submiting = false |
|
that.$util.sucMsg('取消关注成功') |
|
that.initList() |
|
} |
|
} |
|
}) |
|
|
|
} else { |
|
const res = await collect({ |
|
supplierAccountId: row.accountId |
|
}) |
|
this.submiting = false |
|
this.initList() |
|
} |
|
}, |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
.banner { |
|
display: block; |
|
width: 100%; |
|
border: 0; |
|
} |
|
.wrap { |
|
display: flex; |
|
align-items: flex-start; |
|
} |
|
.list { |
|
flex: 1; |
|
width: 100vw; |
|
overflow: hidden; |
|
.item { |
|
position: relative; |
|
padding: 24rpx; |
|
margin: 16rpx 24rpx; |
|
background-color: #fff; |
|
border-radius: 16rpx; |
|
} |
|
.pro-name { |
|
display: flex; |
|
align-items: center; |
|
padding: 18rpx 0; |
|
font-size: 32rpx; |
|
font-weight: 600; |
|
color: #333; |
|
border-bottom: 1px solid #E6E8ED; |
|
.icon { |
|
width: 66rpx; |
|
min-width: 66rpx; |
|
height: 66rpx; |
|
margin-right: 20rpx; |
|
border-radius: 4px; |
|
} |
|
} |
|
.info { |
|
position: relative; |
|
padding: 12rpx 0; |
|
} |
|
.line { |
|
display: flex; |
|
padding: 12rpx 0; |
|
} |
|
.name { |
|
margin-right: 10rpx; |
|
font-size: 28rpx; |
|
color: #999; |
|
} |
|
.intro { |
|
display: flex; |
|
align-items: center; |
|
margin: 10rpx 0 20rpx; |
|
font-size: 26rpx; |
|
color: #3c3c3c; |
|
.text { |
|
max-width: 49%; |
|
} |
|
} |
|
.meta { |
|
display: flex; |
|
align-items: center; |
|
margin-bottom: 20rpx; |
|
font-size: 26rpx; |
|
color: #3c3c3c; |
|
} |
|
.icon { |
|
width: 30rpx; |
|
margin-right: 10rpx; |
|
} |
|
.ell-wrap { |
|
display: inline-flex; |
|
align-items: center; |
|
} |
|
.ell { |
|
white-space: nowrap; |
|
text-overflow: ellipsis; |
|
overflow: hidden; |
|
} |
|
.actions { |
|
display: flex; |
|
justify-content: flex-end; |
|
align-items: center; |
|
} |
|
.star { |
|
display: inline-flex; |
|
align-items: center; |
|
margin-right: 20rpx; |
|
font-size: 28rpx; |
|
color: #333; |
|
.star-icon { |
|
margin-right: 10rpx; |
|
} |
|
} |
|
.order { |
|
padding: 8rpx 28rpx; |
|
font-size: 28rpx; |
|
color: #fff; |
|
background-color: $uni-primary; |
|
border-radius: 20px; |
|
} |
|
} |
|
</style>
|
|
|