<template>
	<view class="page-content">
		<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
			<block slot="backText">返回</block>
			<block slot="content">合作企业</block>
		</cu-custom>
		<view  v-if="companyList.length>0">
			<company-item v-for="item in companyList" :key="item.id" :company="item"></company-item>
		</view>
		<view v-if="companyList.length<1">
			<Empty />
		</view>
	</view>
	</view>
</template>

<script>

	import partnerApi from '@/api/partner.js'
	import companyItem from '../../components/company-item.vue'	
	export default {
		components: {
			companyItem
		},
		data() {
			return {
				wanjinAccount: true,
				companyList:[],
				oilSiteId:uni.getStorageSync('oilSite').oilSiteCode
			}
		},
		onShow() {
			this.getCompanyList()
		},
		methods: {
			routerTo(key) {
				if (key === 'xk') {
					var url = '/pages/qrcode/QrCode_xy/QrCode_xy'
				} else {
					var url = '/pages/qrcode/QrCode-wjy/QrCode-wjy'
				}
				console.log(url)
				uni.navigateTo({
					url: url,
					fail: (err) => {
						console.log('失败', url, err)
					}
				})
			},
			getCompanyList(){
				partnerApi.companyJoinSite(this.oilSiteId).then(res=>{
					if(res.code==20000){
						this.companyList = res.data
					}
				})
			}

		}
	}
</script>

<style scoped>
	.card {
		position: relative;
		width: 700upx;
		margin: auto;
	}

	.qr-bg {
		min-height: 200rpx;
		text-align: center;
		max-height: 300rpx;
	}

	.text {
		position: absolute;
		z-index: 1;
		left: 4rem;
		top: 1.2rem;
		color: #fff;
	}

	.van-tag {
		display: inline-block;
		padding: 0.3rem 0.4rem;
		position: absolute;
		right: 1px;
		font-size: 12px;
		top: 15.75%;
		background-color: #fff;
		border-radius: 10rem 0 0 10rem;
		border-color: transparent;
	}

	.opened {
		color: #fe0505;
	}

	.before-open {
		padding-bottom: 4px;
	}

	.qr-bg image {
		background-size: cover;
		width: 700upx;
		height: 232rpx;
	}

	.tip-container {
		margin-top: 0.5rem;
		color: rgba(191, 39, 1, 1);
		background: rgba(255, 255, 255, 1);
		box-shadow: 6px 2px 6px 1px rgba(0, 0, 0, 0.06);
		opacity: 0.71;
		border-radius: 0px 20px 20px 15px;
		padding: 0.3rem 0.8rem;
	}

	.opened {
		color: #fe0505;
	}

	.before-open {
		padding-bottom: 4px;
	}
</style>
