<template>
	<view class="page" v-if="showPage">
		<view class="pageMain">
			<view class="topBox flex align-center flex-direction padding-tb-40 padding-lr-30">
				<view class="logoImg margin-bottom-20">
					<image :src="supply.head_img" class="width-100p height-100p block" mode="aspectFill"></image>
				</view>
				<view class="text-30 text-fe text-bold line-40 text-cut-one">{{supply.company_name}}</view>
			</view>
			<view class="margin-top-20 padding-lr-30 flex">
				<view class="flex-one margin-right-20 flex align-center box "
					@click="goChat">
					<view class="icon-icon-xiaoxi iconfont text-40 margin-right-20 text-ff position-relative">
						<view class="circle" v-if="is_red == 2"></view>
					</view>
					<view class="text-30 text-fe">消息</view>
				</view>
				<view class="flex-one flex align-center box" @click="goManage">
					<view class="icon-icon-sahngpinguanli iconfont text-40 margin-right-20 text-ff"></view>
					<view class="text-30 text-fe">商品管理</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				is_red: 1,// 1-没有 2-有
				supply: {},
				showPage: false,
				status:1,//0--已下架 1--上架中
			}
		},

		onShow() {
			this.getPageData()
		},
		methods: {
			getPageData() {
				this.rq.getData('fire/api/Supply/supplyCenter').then(res => {
					if (res.code == 0) {
						this.is_red = res.data.is_red;
						this.supply = res.data.supply;
						this.status = res.data.supply.is_publish;
						this.showPage = true;
					}
				})
			},
			goChat(){
				if(this.status == 1){
					this.cn.alert('您已被下架，可以联系平台进行咨询')
				}else{
					uni.switchTab({
						url:'/pages/chat/index'
					})
				}	
			},
			goManage(){
				if(this.status == 1){
					this.cn.alert('您已被下架，可以联系平台进行咨询')
				}else{
					uni.navigateTo({
						url:'/pages/supplierCenter/goodsManage'
					})
				}
			},
		}
	}
</script>

<style scoped>
	.pageMain {
		width: 100vw;
		min-height: 100vh;
		background: #fff;
	}

	.topBox {
		background: linear-gradient(360deg, #5CC8FF 0%, #2F97FF 100%);
	}

	.logoImg {
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
		overflow: hidden;
	}

	.box {
		height: 110rpx;
		background: #5CC8FF;
		padding-left: 48rpx;
		box-sizing: border-box;
		border-radius: 10rpx;
	}

	.circle {
		width: 14rpx;
		height: 14rpx;
		background: #FF8534;
		border-radius: 50%;
		position: absolute;
		top: -7rpx;
		right: -7rpx;
	}
</style>
