<template>
	<view class="content-box">
		
		<view class="step-box">
			<view class="step-1">1</view>
			<view style="color: #d7d7d7;font-size: 54rpx;">------</view>
			<view class="step-1" style="background-color:#aaaaaa;">2</view>
		</view>
	
		<view class="info-box">
			<view class="info-title-box">
				<!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
				<text>所属支部</text>
			</view>
			<view class="info-value-box">
				  <picker @change="bindPickerChange"  :range="honorBranch" :range-key="'name'" class="select-box">
				        <view class="uni-input">{{branchValue}}</view>
						<image src="/static/arrow_down.svg" mode="aspectFill"></image>
				  </picker>
			</view>		
		</view>
		<view style="margin-top: 15%;">
			<button type="primary" class="submit-bth" style="background-color: #169bd5;" @click="goStep()">下一步</button>
		</view>
	</view>
</template>

<script>
	import md5 from "@/common/md5.js";
	// import pickerAddress from '@/components/liudx-pickerAddress/index.vue'
	// var graceChecker = require("../../../common/graceChecker.js");
	export default {
		components: {
		},
		data() {
			return {
				isAuthPhone:getApp().globalData.user_phone,
				branchValue:'',
				honorBranch:[],
			}
		},
		onLoad() {
			//this.getTradeRequest();
			this.getActivityBranch();
		},
		onShow() {
		},
		// onShareAppMessage() {
		// 	  return {
		// 	      title: '分销小助手',
		// 	      path:'/pages/index/index?scene=' + getApp().globalData.user_id
		// 	    }
		// },
		methods: {
			getActivityBranch() {
			    let md5Sign = md5(
			      "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
			        "&secret=" +getApp().globalData.secret
			    );
			    let url = getApp().globalData.shareUrl +"api/api.php" +
			      "?method=activity&action=activity_branch&timestamp=" +
			      getApp().globalData.globalTimestamp +"&sign=" + md5Sign;
			    uni.request({
			      url: url,
			      method: "POST",
			      header: {
			        "content-type": "application/x-www-form-urlencoded",
			      },
			      data: {
			        openid:getApp().globalData.open_id,
			      },
			      success: (res) => {
			        if (res.data.code === 200) {
						this.honorBranch = res.data.data;
						this.branchValue = res.data.data[0].name;
			        }
			      },
			      fail: () => {
			        console.log("连接失败");
			      },
			    });
			},
			goStep(){
				  uni.navigateTo({
				  	url:'./create2'
				  })
			 },
			bindPickerChange(e) {
				 this.branchValue =  this.honorBranch[e.target.value].name
			  },
			submitRequest(params){
				   console.log(params)
				 	 let that = this;
			},  
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		&_list{
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content:space-around;
			&_lable{
				
			}
			&_content{
				flex: 1;
				width: auto;
				text-align: right;
			}
		}
	}
	.content-box {
		width: 100%;
		/* height: 100%; */
		display: flex;
		flex-direction: column;
		align-items: center;
		/* justify-content: center; */
	}
	.info-box {
		width: 90%;
		margin: 3% auto;
		display: flex;
		flex-direction: column;
		// align-items: center;
		// height: 180rpx;
	}
	.info-title-box {
		width: 20%;
		display: flex;
		align-items: center;
		font-size: 26rpx;
	}
	.info-title-box image{
		width: 15rpx;
		height: 15rpx;
		margin-right: 2%;
	}
	.info-value-box {
		width: 100%;
	}
	.info-value-box input {
		height: 88rpx;
		background: #f7f7f7;
		font-size: 26rpx;
		padding-left: 4%;
		margin: 2% auto;
	}
	.info-value-box picker {
		position: relative;
	}
	.info-value-box picker image {
		position: absolute;
		width: 25rpx;
		height: 25rpx;
		right: 10px;
		top: 30rpx;
	}
	.select-box {
		height: 80rpx;
		background: #f7f7f7;
		font-size: 26rpx;
		padding-left: 4%;
		margin: 2% auto;
		color: #888;
		line-height: 88rpx;
	}
	.info-gender-box {
		width: 75%;
		font-size: 28rpx;
	}
	.form-radio {
			 transform: scale(0.6);
	}
	.padding-left-2 {
		// padding-left: 2%;
	}
	.margin-right-10 {
		margin-right: 10%;
	}
	.border-line-box {
		width: 100%;
		height: 20rpx;
		background: #f7f7f7;
	}
	.picker-box{
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 60rpx;
		line-height: 60rpx;
		background: #f7f7f7;
		height: 88rpx;
		line-height: 88rpx;
		background: #f7f7f7;
		font-size: 28rpx;
		padding-left: 4%;
	}
	.picker-class {
		border-radius: 10rpx;
		padding: 10rpx;
		width: 73%;
		font-size: 28rpx;
		background: #f5f5f5;
	}
	.picker-class image {
		width: 26rpx;
		height: 26rpx;
	}
	
	.step-box {
		display: flex;
		justify-content: space-evenly;
		align-items: center;
		width: 90%;
		margin: 5% 0 5% 0;
	}
	.step-1 {
		width: 60rpx;
		height: 60rpx;
		border-radius: 50%;
		background-color:#02a7f0;
		text-align: center;
		line-height: 60rpx;
		color: #fff;
	}
	.submit-bth {
		width: 200rpx;
		font-size: 26rpx;
		margin: 0 0 5% 0;
		color: #fff;
	}
</style>