<template>
	<view class="postDetail">
		<navbar leftClick @leftClick="$utils.navigateBack" title="详情" />

		<view class="swipe">
			<uv-swiper 
			:list="[detail.imageTitle]" 
			indicator
			height="420rpx"></uv-swiper>
		</view>

		<view class="box">
			
			<view class="title">
				{{ detail.title }}
			</view>

			<view class="createBy">
				{{ detail.num }}余座
				{{ detail.startTime }}出发
			</view>
			<view class="createBy">
				{{ detail.startAddress }}
				到
				{{ detail.endAddress }}
			</view>
			<view class="createBy">
				<view class="">
					{{ $dayjs(detail.createTime).format('YYYY-MM-DD') }}
				</view>
				
				<callPhone
				style="margin-left: auto;"
				:phone="detail.phone" 
				title="司机"/>
			</view>
			
		</view>
		
		<commentList
		@getData="getData"
		:list="list"
		:params="params"
		/>

	</view>
</template>

<script>
	import mixinsList from '@/mixins/list.js'
	import commentList from '../components/list/comment/commentList.vue'
	export default {
		mixins: [mixinsList],
		components: {
			commentList
		},
		data() {
			return {
				detail: {},
				mixinsListApi : 'getCommentPage',
				params : {
					type : '7',
					orderId : '',
					name : '',
				},
				id : 0,
			}
		},
		onLoad(options) {
			// this.$route.query的参数
			console.log(options)
			this.id = options.id
			
			
			this.queryParams.type = this.params.type
			this.queryParams.orderId = options.id
			
			this.params.orderId = options.id
			
			// 设置分享路径
			this.share.path = '/pages_order/car/carListDetail?id=' + this.id
		},
		onPullDownRefresh(){
			this.getDetail()
		},
		onShow() {
			this.getDetail()
		},
		methods: {
			getDetail() {
				this.$api('getCatDetail', {
					id : this.id
				}, res => {
					uni.stopPullDownRefresh()
					if (res.code == 200) {
						this.params.title = res.result.title
						
						this.detail = res.result
						
						// 设置分享信息
						this.share.title = res.result.title || '拼车详情'
						this.share.imageUrl = this.$utils.getImageOne(res.result.imageTitle)
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.postDetail {
		.box {
			padding: 20rpx;
			width: 100vw;
			background-color: #fff;
			box-sizing: border-box;
			.title {
				font-size: 34rpx;
				font-weight: 600;
				color: #000;
			}

			.createBy {
				display: flex;
				margin-top: auto;
				margin-bottom: 10rpx;
				font-size: 24rpx;
				margin-top: 20rpx;
				color: #555;

				&>view {
					display: flex;
					align-items: center;
					justify-content: center;
					padding-right: 20rpx;
				}
			}

			.controls {
				margin-top: 30rpx;
			}

			.content {
				margin-top: 30rpx;
				font-size: 28rpx;
			}
		}
	}
	.phone{
		background-color: rgba($uni-color, 0.2);
		color: $uni-color;
		padding: 8rpx 16rpx;
		border-radius: 10rpx;
		margin-left: auto;
		image{
			width: 20rpx;
			height: 20rpx;
		}
	}
</style>