<!--  -->
<template>
	<view class="content">
			<view style="width: 100%; height: 44px;"></view>
			<view class="top-heder">
				<view class="t-left" @click="getfan()">
					<uni-icons type="left" size="18"></uni-icons>
				</view>
				<view class="t-input">
					<uni-icons type="search" color="#BCBCBC" size="22"></uni-icons>
					<input type="text" v-model="phoneNum" placeholder="请输入手机号.....">
				</view>
				<view class="sou" @click="getindex()">搜索</view>
			</view>
			
			<view class="mub">
			<view class="top-ail">
				<view class="jsy" v-if="goodsList.length == 0">
					<image src="http://www.nuoyunr.com/lananRsc/detection/qs.png" mode=""></image>
				</view>
				<view class="a-box" v-for="(item,index) in goodsList" :key="index">
					<view class="t-box">
						<view class="s-right">
							<view class="s-title">{{item.goodsTitle}}</view>
							<view class="dis">
								<view class="s-hui">预约时间 {{item.appointmentDay}}</view>
								<view class="s-hui" v-if="item.appointmentPeriod == 0">上午</view>
								<view class="s-hui" v-if="item.appointmentPeriod == 1">下午</view>
							</view>
						
								<view class="s-hui">预约人：{{item.buyName}}</view>
								<view class="s-hui">电话：{{item.buyPhoneNum}}</view>
								<view class="s-hui">车辆信息：{{item.carBrand || ''}}</view>
								<view class="s-hui">车辆号码：{{item.carNo || ''}}</view>
								<view class="s-hui">车辆性质：{{item.carNature || ''}}</view>
						
						
						
						</view>
						<view class="" @click="tel(item.buyPhoneNum)">
							<view class="top-anniu">
								<uni-icons type="phone-filled" color="#ffffff" size="24"></uni-icons>
							</view>
							
						</view>
					</view>
					
				</view>
			</view>
			</view>

		<!-- 底部 -->
		
		
	</view>
</template>

<script>
	import config from '@/config'
	import request from '../../utils/request';
	export default {
		data() {
			return {
				msg:'3',
			    goodsList:[],
				baseUrl:"http://192.168.1.4:8080/lanan",
				partnerId:'',
				isListing:1,
				phoneNum:'',
				goodsTitle:"",
				taplist:[
					{Text:'已发布',id:1},
					{Text:'待上架',id:0},
				],
				pageNum: 1,//第几页
				pageSize: 20,//一页多少张
				totalPages: 0,//总数
			}
		},
		onLoad() {

		},
		onPullDownRefresh() {
					uni.showLoading()
					setTimeout(() => {
						uni.hideLoading()
						uni.stopPullDownRefresh()
					}, 500)
				},
		onReachBottom() {
					console.log(111)
					if (this.pageNum >= this.totalPages) {
						uni.showToast({
							title: '没有下一页数据',
							icon: 'none'
						})
		
					} else {
						this.pageNum++
						console.log(222)
						this.getindex()
					}
				},
		onShow() {
			// this.baseUrl = this.$baseUrl
			this.partnerId = uni.getStorageSync('partnerId')
			this.getindex()
		},
		methods: {
			tel(e){
				uni.makePhoneCall({
					phoneNumber: e //仅为示例
				});
			},
			async getindex(){
				// 首页信息
				let data = {
					partnerId:this.partnerId,
					phoneNum:this.phoneNum,
					pageSize:this.pageSize,
					pageNum:this.pageNum
				}
				let res = await request({
					
					url:'/partnerOwn/partner/getAppointmentList',
					method: 'get',
					params: data
				})	
				if(res.code == 200){
						this.goodsList = res.rows
						let total =  res.total
						this.totalPages = Math.ceil(total / this.pageSize);
				}
				
			},
			// 去编辑
			getedit(id){
				uni.navigateTo({
					url:'/pages/order/editorder?id='+id
				})
			},
			// 下架
			
			async getxia(id){
				let data ={
					goodsId :id
				}
				let res = await request({
					url:'/partnerOwn/partner/changeListing',
					method: 'post',
					params: data
				})
				if(res.code == 200){
					uni.showToast({
						title:"操作成功",
						
					})
					this.getindex()
				}
			},
			// 删除
			async getdelete(id){
				let data ={
					goodsId :id
				}
				let res = await request({
					url:'/partnerOwn/partner/delGoods',
					method: 'post',
					params: data
				})
				if(res.code == 200){
					uni.showToast({
						title:"操作成功",
						
					})
					this.getindex()
				}
			},
			gettapindex(index,id){
				this.isListing = id
				this.getindex()
			},
			
			getfan(){
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.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;
	}
	.content {
		box-sizing: border-box;
		width: 100%;
		height: calc(100vh);
		background: white;
	}
	.dis{
		width: 100%;
		display: flex;
		align-items: center;
	}
	.top-heder{
		width: 100%;
		height: 46px;
		background: white;
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		padding: 5px 15px;
	}
	.t-left{
		width: 10%;
	}
	.t-input{
		width: 75%;
		height: 36px;
		background: #F0F0F0;
		border-radius: 50px;
		box-sizing: border-box;
		padding: 0 15px;
		display: flex;
		align-items: center;
		
	}
	.top-ail{
		width: 100%;
		box-sizing: border-box;
		padding: 15px;
		background-color: #F4F4F4;
		
	}
	.sou{
		width: 10%;
		margin-left: 5px;
	}
	.mub{
		background-color: #F4F4F4;
		height: calc(100vh);
	}
	.dix{
		display: flex;
		align-items: center;
	}
	.top-tap{
		width: 100%;
		height: 44px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		
	}
	.tap-box{
		width: 50%;
		height: 100%;
		text-align: center;
		font-size: 16px;
		font-weight: 400;
		color: #606266;
		box-sizing: border-box;
		padding-top: 10px;
	}
	.gang{
		width: 30px;
		height: 4px;
		background: #0D2E8D;
		border-radius: 4px;
		margin: 4px auto;
	}
	.a-box{
		width: 100%;
		border-radius: 8px;
		background-color: white;
		box-sizing: border-box;
		padding: 15px;
		margin-bottom: 10px;
	}
	.t-box{
		width: 100%;
		box-sizing: border-box;
		padding-bottom: 15px;
		display: flex;
		border-bottom:  1px solid #EEEEEE;
	}
	.s-img{
		width: 110px;
		height: 110px;
		margin-right: 10px;
		overflow: hidden;
		border-radius: 8px;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.s-right{
		width: 100%;
	}
	.s-title{
		font-size: 18px;
		font-weight: bold;
		color: #333333;
	}
	.s-hui{
		font-size: 15px;
		font-weight: 400;
		color: #999999;
		
	}
	.s-ju{
		font-size: 18px;
		font-weight: bold;
		color: #FF571A;
	}
	.d-bottom{
		width: 100%;
		box-sizing: border-box;
		padding-top: 10px;
		display: flex;
		align-items: center;
		justify-content: flex-end;
	}
	.bottom-box{
		width: 66px;
		height: 31px;
		background: #DAE1F8;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 50px;
		font-size: 15px;
		font-weight: 400;
		color: #0D2E8D;
		margin-left: 5px;
	}
	.lan{
		color: #0D2E8D !important;
	}
	.jsy{
		width: 100%;
		margin-top: 20px;
		text-align: center;
		color: #0D2E8D !important;
	}
</style>
