<template>
	<view class="b-pay">
		<view class="Shop-Infor">
			<view class="Shop-Infor-Left">
				<image class="Shop-Infor-Left-Img" :src="storeInofr['store_img']"></image>
			</view>
			<view class="Shop-Infor-Right">
				<!-- 为防止后期该位置添加东西所以再里面再包裹一层 -->
				<view class="Shop-Infor-Right-Title">
					{{storeInofr['store_name']}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import mixin from '@/static/js/mixin.js'
	export default {
		name: "b-pay",
		props: {
			storeid: {
				type: Number,
				default: 0
			}
		},
		
		data() {
			return {
				storeInofr: {
					store_img: '',
					store_name: ''
				}
			};
		},
		methods: {
			/**
			 * @获取店铺信息
			 * */
			getStoreInfo(store_id) {
				this.$store.dispatch('shop/getStore', {
					store_id
				}).then(res => {
					this.storeInofr = res
				}).catch(err=>{
					if(err['code'] == 7777){
						// 此处逻辑是因为当用户扫码进入支付页面时先判断是否存在token然后调用商家信息,但是当token存在但是token标识过期将会出现错误,
						// 所以在此处将判断接口返回的状态码是否需要登录,然后删除本地token重新进入登录逻辑
						console.log(err,'接口错误');
						uni.removeStorageSync('token');
						this.DetectUserLogin(()=>{
							this.getStoreInfo(store_id);
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.b-pay {
		padding: 32rpx;
		box-sizing: border-box;
	}

	.Shop-Infor {
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #ffffff;
		border-radius: 15rpx;
		padding: 20rpx;
		box-sizing: border-box;

		&-Left {
			width: 240rpx;
			height: 240rpx;

			&-Img {
				width: 100%;
				height: 100%;
				border-radius: 10rpx;
			}
		}

		&-Right {
			padding-left: 20rpx;
			box-sizing: border-box;
			flex: 1;
			display: flex;
			align-items: center;

			&-Title {
				color: #333333;
				font-size: 36rpx;
			}

		}
	}
</style>
