<template>
	<view class="content">
	<view class="c-top">
		<view class="" @click="getback()">
			<uni-icons type="left" size="18"></uni-icons>
		</view>
		<view class="c-t-input">
			<uni-icons type="search" size="22" color="#BCBCBC"></uni-icons>
			<input type="text" placeholder="输入手机号搜索" v-model="phoneNum">
		</view>
		<view class="" @click="sousuo()">搜索</view>
	</view>
		<view class="tap">
			<view class="tap-box" v-for="(item,index) in tapList" :key="index" @click="tapqh(index)">
				<view class="xhuihui" :class="{'xzhei':tapindex == index}">{{item.text}}</view>
				<view class="gang" v-if="tapindex == index"></view>
			</view>
		</view>

		<view class="dil">
			<view class="bjimg" v-if="listarr == ''">
				<image src="http://www.nuoyunr.com/lananRsc/detection/qs.png" mode=""></image>
			</view>
			<view class="d-box" v-for="(item,index) in listarr" :key="index">
				<view class="box-top">


					<view class="top-tile">
						<view class="dix" @click="goren(item.id)">
						<view class="da">{{item.goodsTitle}}</view>
						<view class="dda">{{item.adressDetail}}</view>

						<!-- <view class="huang">{{item.averageScore}} <uni-icons type="star-filled" color= "#FF9600" size="14"></uni-icons></view> -->
						</view>
						<view class="dix">
							<view class="sanyuan">
								<view class="xhui">时间:</view>
								<view class="dda">{{item.appointmentDay}} {{item.appointmentTime}}</view>
							</view>

								<view class="sanyuan">
									<view class="xhui">联系人电话:</view>
									<view class="dda">{{item.userPhone}}</view>
								</view>

						</view>
					</view>
					<view class="">
						<view class="" @click="tel(item.userPhone)">
							<view class="top-anniu">
								<uni-icons type="phone-filled" color="#ffffff" size="24"></uni-icons>
							</view>

						</view>
						<view style="margin-top: 30px;" @click="fang(item.latitude,item.longitude)">
							<view class="top-anniu">
								<uni-icons type="paperplane-filled" color="#ffffff" size="24"></uni-icons>
							</view>
							<view  class="ddaa">{{(item.distance/1000).toFixed(2)}} <text class="xhei">km</text> </view>
						</view>

					</view>

				</view>
				<scroll-view scroll-x="true" class="box-bottom">
					<view class="santu" v-for="(items,index) in item.goodsList" :key="index">
						<view class="simg">
							<image :src="items.goodsImage" mode=""></image>
						</view>
						<view class="ming">{{items.goodsTitle}}</view>
						<view class="jus">¥{{items.price / 100}}</view>
					</view>
				</scroll-view>

			</view>
		</view>

	</view>

</template>

<script>
	import request from '../../utils/request'
	import config from '@/config'
	export default {
		data() {
			return {
				partnerId:'',
				tapindex:0,
				siteName:'',
				searchValue:"",
				categoryId:"",
				distance:100,//距离
				threeoptions:1,//三选
				Alloptions:[],//全部分类
				show:false,
				listarr:[],
				baseUrl:'',
				pding: 0,//综合筛选
				pjing:false,//评价筛选
				hzc: false,
				phoneNum:'',
				longitude:"116.953",
				latitude:"36.6573",
				orderType:"",
				pageNum: 1,//第几页
				pageSize: 20,//一页多少张
				totalPages: 0,//总数
				tapList:[
					{
					text:"未指派",
					value:"0"
					},

					{
					text:"已指派",
					value:"1",
					}
				]
			}
		},
		onReachBottom() {
			if (this.pageNum >= this.totalPages) {
				uni.showToast({
					title: '没有下一页数据',
					icon: 'none'
				})
			} else {
				this.pageNum++
				this.getlist()
			}
		},
		onShow() {
			this.baseUrl = this.$baseUrl
			this.partnerId = uni.getStorageSync('partnerId')
			this.getlist()
		},
		methods: {
			tapqh(index){
				this.tapindex = index
				this.listarr=[]
				this.getlist()
			},
			goren(id){
				uni.navigateTo({
					url:'/pages/index/order-home?id='+id
				})
			},
			tel(e){
				uni.makePhoneCall({
					phoneNumber: e //仅为示例
				});
			},
			fang(latitude,longitude){

			uni.openLocation({
				latitude: latitude,
				longitude: longitude,
				success: function () {
				}
			});
			},
			async getlist(){

					let data = {
						pickStatus:this.tapindex,
						partnerId:this.partnerId,
						phoneNum:this.phoneNum,
						pageSize:this.pageSize,
						pageNum:this.pageNum
					}
				let res = await request({

					url: '/partnerOwn/partner/getPickCarList',
					method: 'get',
					params: data
				})

				if (this.pageNum != 1){
					this.listarr = this.listarr.concat(res.rows)
				}else{
					this.listarr = res.rows
					}
				let total =  res.total
				this.totalPages = Math.ceil(total / this.pageSize);

			},
			gomerchant(id){
				uni.navigateTo({
					url:'/pages/detection/MerchantDetails?id='+id
				})
			},
			sousuo(){
				this.getlist()
			},
			getqbfl(){
				//全部分类
				this.show = true
				this.threeoptions = 1
			},
			getfwjl(){
				//距离
				this.threeoptions = 2
				this.orderType = "jl"
				this.getlist()
			},
			getzhsx(){
				//综合筛选
				this.show = true
				this.threeoptions = 3
			},
			qhzz(index ,id) {
				this.pding = index
				this.categoryId = id
			},
			getback(){
				uni.navigateBack()
			},

			gethp(){
				this.orderType = "hp"
			},
			getxl(){
				this.orderType = "xl"
			},
			getwc(){
				this.getlist()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		height: calc(100vh);
		background-color: #F6F6F6;
		box-sizing: border-box;
		// padding-top: 45px;
	}

	.dil{
		box-sizing: border-box;
		background-color: #F6F6F6;
		padding: 0px 12px;
	}
	.lan{
		color: #0D2E8D;
	}
	.dis{
		display: flex;
		align-items: center;
	}
	.dix{
		width: 100%;
		display: flex;
		flex-wrap: wrap;
	}
	.d-box{
		background: #FFFFFF;
		border-radius: 8px;
		padding: 10px;
		margin-top: 10px;
	}
	.box-top{
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.touxiang{
		width: 70px;
		height: 70px;
		border-radius: 8px;
		box-sizing: border-box;
		overflow: hidden;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.bjimg{
		width: 255px;
		height: 236px;
		margin: 0px auto;
		margin-top: 100px;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.top-tile{
		width: 80%;
		margin-left: 15px;
	}
	.da{
		font-size: 18px;
		font-weight: bold;
		color: #333333;

	}

	.huang{
		margin-left: 20px;
		color: #FF9600;
		font-size: 14px;
	}
	.top-anniu{
		width: 35px;
		height:35px;
		background: #0D2E8D;
		border-radius: 50%;
		display: flex;
		font-size: 14px;
		justify-content: center;
		align-items: center;
		color: white;
		margin: 0 auto;
	}
	.box-cont{
		width: 100%;
		display: flex;
		justify-content: space-around;
		align-items: center;
		margin-top: 15px;
	}
	.sanyuan{
		margin-top: 5px;
		text-align: center;
		display: flex;
		align-items: center;
	}
	.dda{
		font-size: 16px;
		font-weight: 500;
		color: #333333;
		margin-right: 10px;
	}
	.ddaa{
		font-size: 12px;
		font-weight: 500;
	}
	.xhui{
		font-size: 16px;
		font-weight: 400;
		color: #999999;
		margin-right: 5px;
	}
	.xbox{
		width: 100%;
		display: flex;
	}
	.xhei{
		font-size: 14px;
		font-weight: 400;
		color: #333333;
		margin-left: 5px;
	}
	.box-bottom{
		width: 100%;
		box-sizing: border-box;
		white-space: nowrap;
		// display: flex;
		// justify-content: space-between;
		// align-items: center;

	}
	.santu{
		width: 32%;
		display: inline-block;
		// width: 100px;
		margin-top: 15px;
		margin-right: 10px;
	}
	.simg{
		width: 100%;
		height: 80px;
		overflow: hidden;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.ming{
		width: 100%;
		 white-space: nowrap;
		 overflow: hidden;
		 text-overflow: ellipsis;
		font-size: 15px;
		font-weight: 400;
		color: #333333;
		margin: 0px auto;
	}
	.jus{
		font-size: 15px;
		font-weight: bold;
		color: #FF571A;
	}
	.c-top{
		width: 100%;
		height: 88px;
		box-sizing: border-box;
		padding: 15px;
		padding-top: 45px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: white;
	}
	.c-t-input{
		width: 80%;
		background-color: #F0F0F0;
		color: #BCBCBC;
		height: 40px;
		border-radius: 50px;
		display: flex;
		align-items: center;
		padding: 0px 10px;
		box-sizing: border-box;
	}
	.c-title{
		font-size: 18px;
		font-weight: bold
	}

	.top-list {
		width: 100%;
		height: 88rpx;
		background: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.list-box {
		height: 100%;
		width: 33%;
		display: flex;
		align-items: center;
		justify-content: center;

	}

	/* 遮罩 */
	.xuanx {
		position: fixed;
		top: 260rpx;
		width: 100%;
		height: calc(100vh);
		background: rgba(0, 0, 0, 0.2)
	}
	.nbian{
		padding-top: 45px;
	}

	.x-xiang {
		width: 100%;
		background: white;
		box-sizing: border-box;
		padding: 30rpx;
		display: flex;
		flex-wrap: wrap;
	}
	.x-ing {
		width: 100%;
		background: white;
		box-sizing: border-box;
		padding: 30rpx;

	}

	.ann {
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		background: #F2F6FF;
		border-radius: 24rpx;
		padding: 10rpx 30rpx;
		color: #666666;
		font-size: 28rpx;
		margin-right: 20rpx;
		margin-bottom: 30rpx;
	}

	.ax {
		font-size: 28rpx;
		background: #0D2E8D;
		color: white !important;
	}

	.xsanniu {
		border-top: 1px solid #EEEEEE;
		background: white;
		box-sizing: border-box;
		padding: 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.wc {
		width: 436rpx;
		height: 80rpx;
		background: #0D2E8D;
		border-radius: 40rpx;
		display: flex;
		align-items: center;
		color: white;
		font-size: 32rpx;
		justify-content: center;
	}

	.fanhu {
		width: 224rpx;
		height: 80rpx;
		background: #FFFFFF;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		opacity: 1;
		border: 2rpx solid #0D2E8D;
		display: flex;
		align-items: center;
		color: #0D2E8D;
		justify-content: center;
	}

	.tap{
		width: 100%;
		height: 44px;
		background: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.tap-box{
		width: 50%;

	}
	.xhuihui{
		width: 100%;
		text-align: center;
		font-size: 16px;
		font-family: Source Han Sans CN-Regular, Source Han Sans CN;
		font-weight: 400;
		color: #666666;
	}
	.gang{
		width: 24px;
		height: 4px;
		background: #0D2E8D;
		border-radius: 4px ;
		margin: 2px auto;
	}
	.xzhei{

		font-weight: bold !important;
		color: #333333 !important;
	}
</style>