<template>
	<view class="content">
		<view class="container">
			<view class="top-box">
				<view class="t-db">
					<view class="d-s">
						<view style="margin-right: 10px;font-size: 14px;">{{memberInfo.name}}</view>
						<view class="icon_" v-if="memberInfo.secondaryCardType && memberInfo.secondaryCardType==1">
							共享副卡-不限额</view>
						<view class="icon_" v-if="memberInfo.secondaryCardType && memberInfo.secondaryCardType==2">
							共享副卡-限额</view>
						<view class="icon_" v-if="memberInfo.secondaryCardType && memberInfo.secondaryCardType==3">独立副卡
						</view>
						<view class="icon_" v-if="memberInfo.carNum">{{memberInfo.carNum}}</view>
					</view>
				</view>
				<view class="on-title">{{memberInfo.remainingCreditLimit}}</view>
			</view>
			<view class="box-hang" style="margin-top: 10px;" @click="goEdit()">
				<view class="">编辑信息</view>
				<view class="dis">
					<uni-icons type="right" size="16"></uni-icons>
				</view>
			</view>
			<view class="box-wai">
				<view class="">副卡额度(元)</view>
				<view class="box-hang1" style="margin-top: 10px;">
					<view class="">{{memberInfo.secondaryCardLimit}}</view>
					<view class="tiao-z" @click="goFleetLimit()">
						调整
					</view>
				</view>
			</view>

			<view class="box-hang" style="margin-top: 10px;">
				<view class=""><span style="color: red;">*</span>是否开启消费通知</view>
				<view class="dis">
					<u-switch v-model="memberInfo.isOpenNotice" :activeValue='0' :inactiveValue='1'
						activeColor="#6DD400" inactiveColor="rgb(230, 230, 230)"></u-switch>
				</view>
			</view>
			<view class="box-hang">
				<view class=""><span style="color: red;">*</span>是否启用</view>
				<view class="dis">
					<u-switch v-model="memberInfo.status" activeValue='qy' inactiveValue='jy' activeColor="#6DD400"
						inactiveColor="rgb(230, 230, 230)"></u-switch>
				</view>
			</view>
			<view class="but-sub" @click="show=!show">注销副卡</view>

			<u-modal :show="show" :title="title" :content='content' :showCancelButton='true' @confirm="confirm"
				@cancel="cancel" confirmColor="#FA6400"></u-modal>

		</view>

	</view>
</template>

<script>
	import request from '../../utils/request';
	export default {
		data() {
			return {
				title: '',
				List: [],
				pageNo: 1,
				pageSize: 10,
				totalPage: '',
				value: '',
				value1: true,
				value2: true,
				show: false,
				title: "注销副卡",
				content: '成员一经注销,将无法进行恢复,请谨慎操作,以免影响正常使用!',
				memberInfo: {},
				memberId: ''
			}
		},
		onPullDownRefresh() {
			//下拉刷新
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// 触底加载
			if (this.pageNo >= this.totalPage) {

			} else {
				this.pageNo++
			}
		},
		onLoad(e) {
			this.memberId = e.memberId

		},
		onShow() {
			this.getInfo()
		},
		components: {

		},
		methods: {
			getInfo() {
				request({
					url: '/fleetMember/' + this.memberId,
					method: 'get',
				}).then(res => {
					this.memberInfo = res.data
				})
			},
			goEdit() {
				uni.navigateTo({
					url: '/pagesMy/fleetMember/addMember?memberId=' + this.memberId
				})
			},
			goFleetLimit() {
				uni.navigateTo({
					url: '/pagesMy/fleetLimit/index?memberId=' + this.memberId
				})
			},
			confirm() {
				this.show = false
				request({
					url: '/fleetMember/signOUTMember',
					method: 'put',
					data: {
						id: this.memberId
					}
				}).then(res => {
					this.memberInfo = res.data
				})
			},
			cancel() {
				this.show = false
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
	}

	.container {
		width: 100%;
		height: 100vh;
		box-sizing: border-box;
		padding-top: 10px;
	}

	.my-header {
		width: 100%;
		height: 88px;
		background: #ffffff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #000;
		box-sizing: border-box;
		padding: 0px 15px;
		padding-top: 40px;
		z-index: 99999;

		.my-icons {
			width: 20px;

		}

		position: fixed;
		top: 0px;
	}

	.but-sub {
		width: 305px;
		height: 40px;
		line-height: 40px;
		margin: 0 auto;
		background-color: #FF9655;
		color: white;
		border-radius: 50px;
		text-align: center;
		margin-top: 57px;
	}

	.box-wai {
		background-color: white;
		width: 100%;
		box-sizing: border-box;
		padding: 15px 15px;
		border-bottom: 1px solid #f4f5f6;
		margin-top: 10px;
	}

	.box-hang1 {
		background-color: white;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		box-sizing: border-box;
	}

	.tiao-z {
		background: #E02020;
		color: #fff;
		width: 50px;
		height: 20px;
		border-radius: 20px;
		text-align: center;
		font-size: 14px;
	}

	.box-hang {
		background-color: white;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		box-sizing: border-box;
		padding: 15px 15px;
		border-bottom: 1px solid #f4f5f6;
	}

	.top-box {
		width: 96%;
		height: 70px;
		background: linear-gradient(135deg, #F77955 0%, #FFA360 100%, #F9C58C 100%);
		box-sizing: border-box;
		padding: 10px;
		margin: 0 auto;
		color: #fff;
	}

	.icon_ {
		width: 80px;
		height: 16px;
		background: rgba(255, 255, 255, 0.48);
		border-radius: 2px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		font-weight: 500;
		font-size: 10px;
		margin-right: 10px;
	}

	.on-title {
		font-size: 20px;
		color: #fff;
		margin-top: 10px;
	}

	.d-s {
		display: flex;
	}
</style>