<template>
	<view>
		<view class="card">
			<view class="center" >
				<image style="width: 140rpx;height: 140rpx;margin-top: -80rpx;border-radius: 50%;" :src="detail.cover" mode=""></image>
			</view>
			<view class="content">
				<view class="item" >
					<text >商户名称</text>
					<text>{{detail.name}}</text>
				</view>
				<view class="item" >
					<text >手机号码</text>
					<text>{{detail.personTel}}</text>
				</view>
				<view class="item" >
					<text >联系人</text>
					<text>{{detail.personName}}</text>
				</view>
				<view class="item" >
					<text >地址</text>
					<text>{{detail.address || '暂无数据'}}</text>
				</view>
				<view class="item" >
					<text >行业</text>
					<text>{{detail.labelKey}}</text>
				</view>
			</view>
		</view>
		
		<view style="padding:40rpx 30rpx 10rpx;font-weight: 800;font-size: 32rpx;">
			<text>数据看板</text>
		</view>
		<view class="data-board">
			<view class="content">
				<view class="item">
					<text>{{data.allMembers}}</text>
					<text>会员数量</text>
				</view>
				<view class="item">
					<text>{{data.pointsTotalValue}}</text>
					<text>积分总价值</text>
				</view>
				<view class="item">
					<text>{{data.totalValue}}</text>
					<text>累计收入</text>
				</view>
				<view class="item">
					<text>{{data.transactionNum}}</text>
					<text>累计交易笔数</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				detail:{},
				data:{}
			}
		},
		onLoad(options) {
			this.id=options.id
			this.getDtail()
			this.getShopData()
		},
		methods: {
			getDtail(){
				this.$api.shop.detail({id:this.id}).then(res=>{
					this.detail=res.data
				})
			},
			getShopData(){
				this.$api.shop.indexInfo({shopId:this.id}).then(res=>{
					this.data=res.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.card{
		background-color: #FFFFFF;
		margin-top: 120rpx;
		position: relative;
		.content{
			padding: 10rpx 50rpx 0;
			
			.item{
				padding: 30rpx 0;
				border-bottom: 1rpx solid #EBEBEB;
				display: flex;
				justify-content: space-between;
				
				text:first-child{
					color: #888888;
				}
				
				text:last-child{
					color: #303030;
				}
			}
			
			.item:last-child{
				border: none;
			}
			
		}
	}
	
	.data-board{
		margin: 20rpx;
		border-radius: 20rpx;
		background-image: linear-gradient(to right,#FF8D32,#FBA33D);
		
		.content{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
			
			.item{
				padding: 40rpx;
				width: 40%;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				
				text:first-child{
					font-weight: 800;
					font-size: 38rpx;
					color: #FFFFFF;
				}
				text:last-child{
					font-size: 26rpx;
					color: #FFF6EE;
				}
			}
		}
	}
</style>
