<template>
	<view class="container logistics clearfix"> 
		<view class="list-cell-item" :class="isACtive ? 'active' : ''" v-for="(item,index) in companyList" :key="index" >
			<view class="item-name">{{item.name}}</view>
			<view class="item-icon"><text class="iconfont icon-gou"></text></view>
		</view>
	</view>
</template>
<script>
	import authorize from '@/common/config/authorize.js'
	import { mapState,mapMutations } from 'vuex';
	import { queryShoppingCartList,shoppingCartUpdate,shoppingCartDelete } from "@/api/cart.js" 
	
	export default{
		data(){
			return{
				CustomBar:this.CustomBar,// 顶部导航栏高度
				isIphoneX:this.$store.state.isIphoneX,
				isACtive:true,
				companyList:[
					{name:'顺丰快递'},
					{name:'申通快递'},
					{name:'韵达快递'},
					{name:'圆通快递'},
					{name:'中通快递'},
					{name:'德邦物流'},
					{name:'菜鸟裹裹'}
				]
			}
		},
		onLoad(option){
			console.log(option)
			// this.initGetCartGoodsList();
		},
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		methods:{
			initGetCartGoodsList(){//初始化购物车 index:1
				let params = {userID:this.userID}
				queryShoppingCartList(params).then(response =>{
					this.$store.commit('updateAllNum',response.data.cartQuantity)
					const responseData = response.data
					if(responseData.pageDate && responseData.pageDate.length > 0 ){
						this.productsList = responseData.pageDate;
						this.productsList.forEach((item,index) => {
							let productsListLength = item.productsList.length,
								invalidLength = 0;
							item.productsList.forEach(pros => {
								pros.shopID = item.shopID;
								if(pros.validFlag == '3' ) {invalidLength++;}
							})
							item.isDisabled = invalidLength === productsListLength;
						})
					} else {
						this.productsList = [];
					}
				}).catch(error =>{
					this.$util.msg(error.msg,2000);
				})
			},		
		},
		onPullDownRefresh() {//下拉刷新
			// this.initGetCartGoodsList()
			// 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>