Files
jjx-wap/components/index/work.vue
T
2026-10-08 18:34:09 +08:00

131 lines
3.7 KiB
Vue
Raw 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">
<view class="layout-work">
<view class="index-h2 p-left-30 p-right-30">
<view class="big">合作商家</view>
<view class="more" @click="listLink()">更多</view>
</view>
<view class="work-box flex justify-between flex-wrap bg-white">
<view class="item" @click="detailLink(item._id)" v-for="(item, index) in companyList" :key="index">
<view class="company flex justify-center align-center flex-nowrap">
<view class="icon">
<image class="radius" :src="item.businessCard.logo" mode=""></image>
</view>
<view class="text flex-1 p-left-20 text-single">{{ item.company.companyName }}</view>
</view>
<view class="main text-single m-top-10">
主营:{{ item.company.mainSpotCategory.join() }}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isLogin: false,
companyList: [],
allChildCate: [],
}
},
methods: {
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()
}
});
},
listLink() {
vk.navigateTo('/pages/yellow/yellow')
},
detailLink(id) {
vk.navigateTo(`/pages/yellow/detail?id=${id}`);
},
async getCompanyList() {
const {rows} = await vk.callFunction({
url: 'client/user/pub/getCompany',
data: {
pageIndex: 1,
pageSize: 10,
isCoop: 1,
}
})
this.companyList = rows.map(info => {
info.company.mainSpotCategory = []
if (info.company && info.company.mainSpotCategoryIds) {
this.allChildCate.forEach(child => {
if (info.company.mainSpotCategoryIds.includes(child._id)) {
info.company.mainSpotCategory.push(child.name)
}
})
}
return info
})
},
},
mounted() {
this.getCategoryTreeData()
},
}
</script>
<style lang="scss">
.work-box {
padding: 20rpx 30rpx;
.item {
position: relative;
width: 50%;
height: 136rpx;
padding: 10rpx;
box-sizing: border-box;
border-bottom: 1px solid #f2f2f2;
.main {
height: 36rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #666666;
}
.company {
width: 100%;
height: 64rpx;
.icon {
width: 64rpx;
height: 64rpx;
}
.text {
font-size: 26rpx;
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;
}
}
</style>