<template>
	<view class="container">
		<view class="page-block">
			<view class="page-title-block">
				<view class="title">账号信息</view>
			</view>
			<view class="content">


				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>所属门店</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.storename}}</view>
					</view>
				</view>
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>真实姓名</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.nickname}}</view>
					</view>
				</view>


				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>账号</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.name}}</view>
					</view>
				</view>


			</view>
		</view>

		<!-- <view class="page-block">
			<view class="page-title-block"></view>
			<view class="content">
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>头像</text>
					</view>
				</view>
				<view class="qrcode-block">
					<image :src="URL+info.thumb" mode="aspectFit" class="qr-code-img"></image>
				</view>
			</view>
		</view> -->
		<view style="height:30rpx;"></view>
		<view class="footer-bar" style="height: 100rpx;">
			<view class="content flex flex-center" style="height: 100rpx;">
				<view class="detail-btn flex flex-center" style="border-right: 2rpx solid #F4F5F7;" @click="del">
					<image src="../static/images/icon_16.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#999999">删除账号</view>
				</view>
				<view class="detail-btn flex flex-center" @click="toEdit">
					<image src="../static/images/icon_17.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#3387FF">重新编辑</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				URL: getApp().globalData.URL,
				info: {}
			}
		},
		onLoad(options) {
			if (options.id) {
				this.id = options.id;
				this.store_user_info(options.id);
			}
		},
		methods: {
			//获取详情
			store_user_info(id) {
				this.request({
					url: 'Smdcshop/store_user_info',
					data: {
						id,
					}
				}).then(res => {
					if (res.code == 200) {
						this.info = res.data
					}
				})
			},

			toEdit() {
				uni.redirectTo({
					url: `./addstorenumber?id=${this.info.id}`
				})
			},

			del() {
				uni.showModal({
					title: '提示',
					content: '是否要删除？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/admin_delect',
								data: {
									id: this.id,
								},
							}).then(res => {
								console.log(res, "res")
								if (res.code === 200 || res.code === "200") {
									uni.showToast({
										title: "删除成功",
										icon: "none",
									})
									setTimeout(() => {
										uni.navigateBack()
									}, 2000)
								}
							}).catch((res) => {
								uni.showToast({
									title: res.message,
									icon: "none",
								})
							});
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
		}
	}
</script>

<style>
	@import url("../static/css/common.css");

	page {
		background-color: #F4F5F7;
	}

	.qrcode-block {
		padding: 56rpx 0;
	}

	.qrcode-block .qr-code-img {
		display: block;
		width: 150rpx;
		height: 150rpx;
		/* margin: 0 auto; */
	}
</style>
