<template>
	<view class="content">
		<view class="topBox">
			<view class="topStatus"></view>
			<view class="flex-between" style="margin-top: 26rpx;">
				<view class="menuBox">
					<view class="menuView" :class="{checkMenu: menuNum == 1}" @click="menuClick(1)">
						抢单大厅
						<view class="menuLine" v-show="menuNum == 1"></view>
					</view>
					<view class="menuView" :class="{checkMenu: menuNum == 2}" @click="menuClick(2)">
						回收大堂
						<view class="menuLine" v-show="menuNum == 2"></view>
					</view>
				</view>
				<view class="cityBox flex-center">
					南京市
				</view>
			</view>
		</view>
		<view class="contentBox">
			<view class="notice "  >
				<view class="notice-icon">
					<image class="icon  " src="/static/img/news.png" mode=""></image>
				</view> 
				<view class="notice-row"  > 
					<text class=" ">{{notice}}</text>  
				</view> 
			</view> 
			<view class="flex-between" style="margin-top: 31rpx;">
				<view>
					<view>订单列表</view>
				</view>
				<view class="flex-center">
					<view class="flex-center selectBox">
						<view>全部需求</view>
						<u-icon name="arrow-down" color="#333333" size="12" style="margin-left: 13rpx;"></u-icon>
					</view>
					<view class="flex-center selectBox">
						<view>距离最近</view>
						<u-icon name="arrow-down" color="#333333" size="12" style="margin-left: 13rpx;"></u-icon>
					</view>
				</view>
			</view>
			<view class="orderBox">
				<view class="flex-between">
					<view class="flex-center">
						<view>36分钟内</view>
						<view>(10:17前)上门</view>
					</view>
					<view>1.5公里</view>
				</view>
				<view class="flex-between addressBox">
					<view class="addressText">‌江苏省南京市玄武区珠江路88号金鹰...</view>
					<view class="addressBtn">导航</view>
				</view>
				<view class="flex-between goodsWrap">
					<view class="goodsBox1 flex-center" style="width: 40%;">
						<image src="/static/img/41.png" class="goodsImg"></image>
						<view>
							<view class="goodsText1">回收品类</view>
							<veiw class="goodsText2">冰箱</veiw>
						</view>
					</view>
					<view class="goodsBox2 flex-column-center" style="width: 20%;">
						<view class="goodsText1">数量</view>
						<veiw class="goodsText2">X1</veiw>
					</view>
					<view class="goodsBox3 flex-column-center" style="width: 40%;">
						<view class="goodsText1">预估价</view>
						<veiw class="flex-center">
							<view class="priceIcon">￥</view>
							<view class="priceNum">333</view>
						</veiw>
					</view>
				</view>
				<view class="flex-between userBox">
					<view class="flex-center">
						<image src="/static/img/39.png" class="userImg"></image>
						<view>糯米小团子</view>
					</view>
					<view class="userBtn flex-center">
						抢单
					</view>
				</view>
			</view>
			<view class='pinlei'  >
				<view class='pinlei-title'  >请选择回收品类</view>
			</view>   
			<view class="imgnavbar">
					<view class="imgnavbar-list" v-if="limit == '3' || limit == '4' || limit == '5'"
					 v-bind:class="'row'+limit">
						<view class="imgnavbar-item" ref="imgwitem" v-for="(item, index2) in  typelist" :key="index2" @click="gotype(item.id)">
							<image class="imgnavbar-item-img" :src="item.image" mode="aspectFill" ></image>
							<view class="imgnavbar-item-text">{{item.name}}</view>
						</view>
					</view>
				</view> 
			
			<view class="lc" v-if="index_img"><image class="imgnavbar-item-img" mode="aspectFill" :src="index_img"  ></image></view>
			<!-- 常见问题 -->
			<view class='problem_header'  >
				<view class='left'  >常见问题</view>
					<view class="right" @click="gopage()">更多</view>
			</view>  
			<view class="problem " v-if="question_list.length>0"> 
				<view class="problem_main">
					<view class="li" v-for="(item,index) in question_list" :key="index"  @click="show(index)">
						<view class="left"> 
							<view class="left_2">{{item.name}}</view>
							<view class="left_1" >	 
								<image v-if="item.is_show==1" class="icon" src="/static/img/up.png" mode=""></image>
								<image v-if="item.is_show==0" class="icon" src="/static/img/down.png" mode=""></image>
							</view>   
						</view>
						<view class="left " v-if="item.is_show==1">
							<view class="left_3"><text style="white-space: pre-wrap;line-height: 20px;">{{item.content}}</text></view> 
						</view>
					</view> 
				</view>
			</view>
			<view style="margin-bottom: 100px;  
		  padding-bottom: 30px;"></view>
		  </view>
	</view>
</template>

<script>
	export default {
		data() {
			return { 
				jscode:'',
				limit:3, 
				typelist: [],
				banner:[],
				notice:'',
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				current:0,  
				index_img:'',
				question_list:'',
				menuNum: 1
			}
		},
		onShow() { 
			this.getdata() 
			this.config()
		},
		onHide() {  
		},
		onLoad() {  
			this.getdata() 
			 this.getquestion()
		},
		onShareAppMessage(res) {
		    if (res.from === 'button') { 
		    }
		    return {
		      title: '',
			  imageUrl: ''
		    }
		},
		onReachBottom (){ 
		},
		methods: {  
			menuClick(val){
				this.menuNum = val
			},
			gotype(id){   
				uni.navigateTo({
					url:'../type/type?id='+id
				})    
			},  
			getdata(){
				let data = { 
				}
				this.$api.indexpage(data,res=>{ 
					if(res.code == '1'){
						this.typelist = res.data.type
						this.banner = res.data.banner
						this.notice = res.data.notice
						this.limit = res.data.nav_num 
					}
				})
			}, 
			config(){
				this.$api.config({}, res => { 
				    if (res.code == "1") { 
						this.index_img = res.data.index_img;
						if(res.data.sitename){
							uni.setNavigationBarTitle({
								title: res.data.sitename
							});
						} 
				    }else{ 
						 
					}
				}) 
			},show(index){
				var question_list = this.question_list;
				 question_list.forEach((item,index2) => {  
					 if(index == index2){
						question_list[index2].is_show =  item.is_show==1 ? 0: 1;  
					 }
				}) 
				this.question_list = question_list;
			},
			getquestion(){
				let data={page:1,limit:10}
				this.$api.question_list(data,res=>{ 
					if(res.code == '1'){
						this.question_list=  res.data.list.data 
					}
				}) 
			}, 
			gopage(){   
				uni.navigateTo({
					url:'/pages/question/index'
				})    
			},  
		}
	}
</script>

<style lang="scss">
	page {
	    background: rgba(251, 249, 256, 1)
	}
	.topBox{
		background: linear-gradient(0deg, #FFF8F2 0%, #FFFBED 100%);
		overflow: hidden;
		padding-bottom: 6rpx;
	}
	.topStatus{
		height: var(--status-bar-height);	//这里是状态栏css变量
	}
	.menuBox{
		display: flex;
		padding: 20rpx 0;
		.menuView{
			font-weight: 500;
			font-size: 28rpx;
			color: #AE8F71;
			padding: 0 21rpx;
			.menuLine{
				width: 80rpx;
				height: 10rpx;
				border-radius: 2rpx;
				background: linear-gradient(to right, #FFF8EF, #ED7B29);
				margin-top: -12rpx;
			}
		}
		.checkMenu{
			font-weight: bold;
			font-size: 34rpx;
			color: #221B16;
		}
	}
	.cityBox{
		padding: 0 25rpx;
		height: 60rpx;
		background: #FFFFFF;
		border-radius: 30rpx;
		font-weight: 500;
		font-size: 26rpx;
		color: #333333;
	}
	.contentBox{
		padding: 0 35rpx;
	}
	.selectBox{
		background: #F2F2F2;
		border-radius: 25rpx;
		font-weight: 500;
		font-size: 24rpx;
		color: #333333;
		padding: 12rpx 22rpx;
	}
	.selectBox:first-child{
		margin-right: 14rpx;
	}
	.goodsImg{
		width: 80rpx;
		height: 80rpx;
		background: #FFC90E;
		border-radius: 20rpx;
		margin-right: 22rpx;
	}
	.goodsWrap{
		background: #FFF9F5;
		border-radius: 20rpx;
		padding: 14rpx 16rpx;
	}
	.goodsBox1{
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
	}
	.goodsBox3{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: flex-end;
		padding-right: 30rpx;
	}
	.goodsText1{
		font-weight: 500;
		font-size: 22rpx;
		color: #333333;
		margin-bottom: 10rpx;
	}
	.goodsText2{
		font-weight: 500;
		font-size: 30rpx;
		color: #333333;
	}
	.priceIcon{
		font-weight: 500;
		font-size: 24rpx;
		color: #ED6343;
	}
	.priceNum{
		font-weight: 500;
		font-size: 36rpx;
		color: #ED6343;
	}
	.userBox{
		font-weight: bold;
		font-size: 28rpx;
		color: #333333;
	}
	.userImg{
		width: 42rpx;
		height: 42rpx;
		margin-right: 14rpx;
	}
	.userBtn{
		width: 184rpx;
		height: 60rpx;
		background: #FB8F0C;
		border-radius: 30rpx;
		ont-size: 24rpx;
		color: #FFFFFF;
	}
	.addressBox{
		margin-top: 20rpx;
		.addressText{
			font-weight: 400;
			font-size: 24rpx;
			color: #333333;
			width: 405rpx;
			overflow: hidden;/*超出部分隐藏*/
			text-overflow:ellipsis;/* 超出部分显示省略号 */
			white-space: nowrap;/*规定段落中的文本不进行换行 */
		}
	}
	.orderBox{
		background: #FFFFFF;
		box-shadow: 0px 8rpx 27rpx 0px rgba(255,141,75,0.08);
		border-radius: 30rpx;
		margin-top: 20rpx;
		padding: 25rpx 33rpx;
	}
	
.pinlei{background-color: #fff;    padding: 15px 0px 1px 5px;
   }
  .pinlei-title { border-left: solid 3px #46b45d;padding-left: 4px;font-size: 30rpx;
    color: #333;    font-weight: bold;}
	.imgnavbar {
		width: 100%;
		background-color: #fff; margin-bottom: 8px;
	}
	.imgnavbar-list {
		overflow: hidden;
		padding: 24upx 0 0;
		width: 96%;
		margin: 0 auto;
	} 
	.imgnavbar-list .imgnavbar-item {
		height: auto;
		float: left;
		padding: 0upx 10upx;
		margin-bottom: 30upx;
		margin-top: 12upx;
		text-align: center;
	}

	.imgnavbar-list .imgnavbar-item image {
		width: 86upx;
		height: 86upx;
		margin-bottom: 6upx;
	}

	.imgnavbar-item-text {
		font-size: 26upx;
		color: #666;
		width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.imgnavbar-list.row3 .imgnavbar-item {
		width: 33.3%;
	}

	.imgnavbar-list.row4 .imgnavbar-item {
		width: 25%;
	}

	.imgnavbar-list.row5 .imgnavbar-item {
		width: 20%;
	}

	.imgnavbar-list.row5 .imgnavbar-item .imgnavbar-item-text {
		font-size: 30upx;
	}
	
	.notice {
		padding: 15rpx 26rpx 15rpx 60rpx;
		margin-top: 10rpx;
		position: relative;
		overflow: hidden;
		background-color: #fff;
		color: #333;
		margin-bottom: 16rpx;
		background: #FFECEB;
		border-radius: 16rpx;
		border: 1px solid #FFFFFF;
	}
	.notice-icon {
		display: inline-block;
		height: 40rpx;
		position: absolute;
		top: 59%;
		left: 26rpx;
		-webkit-transform: translateY(-50%);
		        transform: translateY(-50%);
		overflow: hidden;
	}
	.notice-icon image {
		width: 30rpx;
		height: 30rpx;
		float: left;
	}
	.notice-row {
		margin-left: 10rpx;
		height: 50rpx;
		line-height: 50rpx;
		width: 672rpx;
		display: inline-block;
		font-size: 28rpx;
		float: left;
	}
	 
	 

.nav{
	height: 300rpx;
	width: 100%;   
	.swiper{
		height: 300rpx;
		width: 100%;  
		overflow: hidden;  
		image{
			height: 300rpx;
			width: 100%; 
		}	
	}
} 
.lc{ 
   margin-bottom: 6px; }
	.lc image{height: 248rpx;width:100%}

.problem_header{    
	background-color: #fff;
	    padding: -2px 0px 1px 5px; 
	    justify-content: space-between;
	    display: flex;
	.left{    border-left: solid 3px #46b45d;
    padding-left: 4px;
    font-size: 30rpx;
    color: #333;
    font-weight: bold;margin-left: 4px;
    margin-top: 15px;
 
	}
	.right{    float: right;
    margin-right: 25px;
    font-size: 12px;
    margin-top: 15px;
	}
} 
	  
 	.problem{
		background-color: #fff;
 		.problem_main{
 			width: 92%;
 			margin: 0 auto;padding-bottom: 10px;

 			.li{ 
 				    padding-top: 20rpx;
 				    border-bottom: 1px solid #eee;
 				.left{
 					overflow: hidden;
 					margin-bottom: 20rpx;
 					.left_1{
 						float: left;
 						height: 4vh;
 						width: 4vh;  
 					}
 					.left_2{
 						font-size: 30rpx;
 						float:left;
 						width: 90%;
 					}
 					.left_3{
 						font-size: 24rpx;
 						float:left;
 						width: 92%;color: #676767;padding-left: 12px;
 					}
 				}
 				 
 			}
 			.li:last-child{
 				border: none;
 			}
 		}
 	}
</style>

