<template>
	<view class="store-detail">
		<view class="attention">
			<view class="attention-box">
				<view class="attention-l">
					<image class="attention-l-img" :src="info.logo" mode=""></image>
					<view class="attention-l-text">
						<text class="attention-l-title">{{info.name}}</text>
						<view class="attention-l-text-s">
							<text class="">粉丝数 {{info.fans_count}}</text>
							<!-- <text class="icon_arrow_right iconfont icon-arrow-right"></text> -->
						</view>
					</view>
				</view>
				<view :style="{border:info.isFollow?'1px solid #efbd6f':'',color:info.isFollow?'#efbd6f':'#fff','background-color':info.isFollow?'':t('color1')}" class="attention-r" @click="followFn">
					<text class="attention-r-text">{{info.isFollow?'已关注':'关注'}}</text>
				</view>
			</view>
		</view>
		<view class="store-detail-conten">
			<view class="detail-conten-b">
				<view class="detail-conten-c" style="letter-spacing:rpx;">
					<view class="detail-conten-t">
						<view class="detail-conten-t-tilt">店铺简介</view>
						<view class="detail-conten-t-text" >{{info.content}}</view>
					</view>
					<view class="detail-conten-t">
						<view class="detail-conten-t-tilt">店铺地址</view>
						<view class="detail-conten-t-text">{{info.address}}</view>
					</view>
					
					<view class="detail-conten-t">
						<view class="detail-conten-t-tilt">开店时间</view>
						<view class="detail-conten-t-text">{{info.createtime}}</view>
					</view>
					
					<view class="detail-conten-t">
						<view class="detail-conten-t-tilt">营业时间</view>
						<view class="detail-conten-t-text">{{info.start_hours||''}}-{{info.end_hours||''}}</view>
					</view>
					<view class="detail-conten-t">
						<view class="detail-conten-t-tilt">联系电话</view>
						<view class="detail-conten-t-text">{{info.tel}}</view>
					</view>
					
				</view>
				<button class="btn"  @tap="goback">去看看全部商品</button>
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp();
	export default {
		data() {
			return {
				opt:{},
				info:{},
				isattention: true,
			}
		},
		onLoad(opt) {
			this.opt = opt
			this.getInfo();
		},
		methods: {
			goback(){
				uni.navigateBack(1)
			},
			followFn(){
					  var that = this;
					 app.post('ApiMy/addFollow', {follow_id: that.opt.id ||'',type:'store'}, function (res) {
					 	  
					     console.log(res)	
						 uni.showToast({
						 	title:res.msg,
							icon:'none'
						 })
						 that.getInfo()
					 				 // that.info = res.business
					 	  
					 }) 
			},
			getInfo(){
				var that = this;
				 app.get('ApiBusiness/newIndex', {id: that.opt.id ||''}, function (res) {
				  
			         console.log(res)	
					 that.info = res.business
				  
				 })
			  },
			attention() {
				this.isattention = !this.isattention
			},
		}
	}
</script>

<style lang="scss" scoped>
	.store-detail {
		letter-spacing:2rpx;
		color: #333;
		.attention {
			padding: 30rpx 20rpx;
			
			.attention-box {
				padding: 30rpx 20rpx;
				background: #fff;
				display: flex;
				align-items: center;
				justify-content: space-between;
				box-sizing: border-box;
				border-radius: 10rpx;
				
				.attention-l {
					display: flex;
					align-items: center;
					
					.attention-l-img {
						width: 120rpx;
						height: 120rpx;
						border-radius: 16rpx;
					}
					.attention-l-text {
						height: 100%;
						padding-left: 20rpx;
						display: flex;
						flex-direction: column;
						.attention-l-title {
							font-size: 30rpx;
							font-weight: bold;
						}
						.attention-l-text-s {
							padding-top: 10rpx;
							display: flex;
							align-items: center;
							font-size: 24rpx;
							color: #bdbdbd;
							
							.icon_arrow_right {
								padding-left: 20rpx;
							}
						}
						
					}
				}
				.attention-r {
					width: 120rpx;
					height: 54rpx;
					line-height: 54rpx;
					text-align: center;
					// background-color: #EFBD6F;
					// color: #fff;
					color: #ccc;
					border-radius: 8rpx;
				}
			}
		}
		
		.store-detail-conten {
			padding: 0 20rpx;
			.detail-conten-b {
				display: flex;
				flex-direction: column;
				border-radius: 10rpx;
				background-color: #fff;
				
				.detail-conten-c {
					min-height: 400rpx;
					padding:0 20rpx ;
					display: flex;
					flex-direction: column;
					justify-content: space-evenly;
				}
				.detail-conten-t {
					display: flex;
					// align-items: center;
					.detail-conten-t-tilt {
						width: 150rpx;
						font-weight: bold;
						font-size: 30rpx;
					}
					
					.detail-conten-t-text {
						flex: 1;
						// color: #bdbdbd;
						padding-top: 4rpx;
						// font-weight: bold;
						color: #111111;
					}
				}
				
				.btn {
					font-size: 30rpx; font-weight: bold;
					width: 650rpx;
					margin: 30rpx auto;
					border-radius: 400rpx;
					height: 70rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					background-image: linear-gradient(to right, #fbd89e , #eec071);
					color: #fff;
				}
			}

		}
	}
</style>
