<template>
	<view class="container logistics clearfix"> 
		<view class="list-cell-item" :class="selectID == item.id  ? 'active' : ''" v-for="(item,index) in companyList" :key="item.id" @click="checkLogics(item)">
			<view class="item-name">{{item.label}}</view>
			<view class="item-icon" v-show="selectID == item.id"><text class="iconfont icon-gou"></text></view>
		</view>
	</view>
</template>
<script>
	import authorize from '@/common/config/authorize.js'
	import { mapState,mapMutations } from 'vuex';
	
	export default{
		data(){
			return{
				CustomBar:this.CustomBar,// 顶部导航栏高度
				isIphoneX:this.$store.state.isIphoneX,
				isACtive:false,
				companyList:[],
				selectID:'',
			}
		},
		onLoad(option){
			this.selectID = option.selectID
			this.initGetLogisticsCompany();
		},
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		methods:{
			initGetLogisticsCompany(){//查询物流公司列表
				let params = {userID:this.userID}
				this.ShopService.GetLogisticsCompany({}).then(response =>{
					this.companyList = response.data
				}).catch(error =>{
					this.$util.msg(error.msg,2000);
				})
			},	
			checkLogics(item){//选择物流
				uni.setStorageSync('selectLogics',item)
				var pages = getCurrentPages();
				var prevPage = pages[pages.length - 2];  //上一个页面	
					prevPage.setData({select:'select'})
				uni.navigateBack();
			}
		},
		onPullDownRefresh() {//下拉刷新
			this.initGetLogisticsCompany()
			uni.stopPullDownRefresh()
		},
		onShow(){
			
		},
	}
</script>

<style lang="scss">
	page{
		background: #f7f7f7;
		height: auto;
	}
	.logistics{
		width: 702rpx;
		padding: 0 24rpx;
		border-top: 1px solid #F7F7F7;
		background-color: #FFFFFF;
		.list-cell-item{
			width: 702rpx;
			height: 88rpx;
			line-height: 88rpx;
			border-bottom: 1px solid #F7F7F7;
			&.active{
				.item-name{
					color: $color-system;
				}
				.item-icon{
					color: $color-system;
				}
			}
			.item-name{
				float: left;
				font-size: $font-size-28;
				color: $text-color;
			}
			.item-icon{
				width:88rpx;
				height: 88rpx;
				float: right;
				line-height: 88rpx;
				text-align: center;
				.icon-gou{
					font-size: $font-size-44;
				}
			}
		}
	}
</style>