<template>
	<view class="management">
		<view class="management-header">
			<view class="management-header-text">
				<view class="management-header-text-neishi" @click="topgi">
					<view class="management-header-text-icon">
						<image src="https://cdn.bjtdba.com/vod/image/2022-08-11/20220811133828415.png" mode="widthFix">
						</image>
					</view>
				</view>

				<view class="management-header-text-title">
					部门管理
				</view>
			</view>
		</view>
		<view class="management-bumen">
			<view class="management-bumen-text">
				添加部门
			</view>
			<view class="management-bumen-icon" @click="tinjia">
				<image src="https://cdn.bjtdba.com/vod/image/2022-08-11/20220811165146454.png" mode="widthFix"></image>
			</view>
		</view>
		<view class="management-list">
			<view class="kuil" v-for="(item,index) in systemRoleList" :key="index">
				<view class="kuil-left">
					部门
				</view>
				<view class="kuil-right">
					{{item.branch}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		queryStoreBranchBymerid
	} from '@/commit/api.js'
	export default {
		data() {
			return {
				merid: '',
				systemRoleList: []
			}
		},
		onLoad() {
			let selectmerchant = uni.getStorageSync('selectmerchant')
			this.merid = selectmerchant.merId
			this.queryStoreBranchBymerid()
		},
		methods: {
			//根据门店查询所有部门
			queryStoreBranchBymerid() {
				queryStoreBranchBymerid({
					merId: this.merid
				}).then(res => {
					if (res.data.status == 200) {
						this.systemRoleList = res.data.data.systemRoleList
					}
				}, fail => {
					console.log(fail)
				})
			},
			topgi() {
				uni.switchTab({
					url: '../../pages/storemanagement/index'
				});
			},
			tinjia() {
				uni.redirectTo({
					url: '/shop/department/managementadd'
				});
			}
		}
	}
</script>

<style>
	page {
		background-color: #F7F8FC;
	}
</style>
<style lang="scss" scoped>
	.management {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;

		.management-header {
			position: fixed;
			top: 0;
			left: 0;
			z-index: 111;
			width: 100%;
			height: 176rpx;
			background: #FFFFFF;
			display: flex;
			justify-content: center;

			.management-header-text {
				width: 686rpx;
				font-size: 36rpx;
				font-weight: 500;
				color: #333333;
				display: flex;
				margin-top: 107rpx;
				align-items: center;

				.management-header-text-neishi {
					width: 45rpx;
					height: 45rpx;
					margin-right: 17rpx;

					.management-header-text-icon {
						width: 36rpx;
						height: 36rpx;
						margin-top: 2rpx;

						image {
							width: 100%;
							height: 100%;
						}
					}

				}

			}
		}

		.management-bumen {
			width: 686rpx;
			font-size: 32rpx;
			font-weight: 400;
			color: #333333;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			margin: 202rpx 0 32rpx 0;

			.management-bumen-icon {
				width: 28rpx;
				height: 28rpx;
				margin-left: 12rpx;
				line-height: 28rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}
		}

		.management-list {
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;

			.kuil {
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 686rpx;
				height: 118rpx;
				background: #FFFFFF;
				border-radius: 8rpx;
				margin-bottom: 26rpx;
				font-size: 30rpx;
				font-weight: 400;
				color: #333333;

				.kuil-left {
					margin-left: 32rpx;
				}

				.kuil-right {
					margin-right: 32rpx;
				}
			}
		}
	}
</style>
