<template>
	<view>
		
		<scroll-view scroll-x class="bg-white radius nav echo-fixed-top">
			<view class="flex text-center solid-bottom">
				<view class="cu-item flex-sub" :class="1==TabCur?'text-blue cur':''" @tap="tabSelect" :data-id="1">
					订单信息
				</view>
				<view class="cu-item flex-sub" :class="2==TabCur?'text-blue cur':''" @tap="tabSelect" :data-id="2">
					报备记录
				</view>
			</view>
		</scroll-view>
		<view class="echo-fixed-top-empty"></view>
		
		<view class="cu-list menu margin-bottom-sm">
			<view class="cu-item">
				<view class="content">
					<text>{{order.demand.title}}</text>
				</view>
			</view>
			<view class="cu-item">
				<view class="content">
					<text>招聘公司：{{order.demand.worker.title}}</text>
				</view>
			</view>
		</view>
		
		<block v-if="1==TabCur">
			<view class="cu-list menu margin-bottom-sm">
				<view class="cu-item">
					<view class="content">
						<text>状态</text>
					</view>
					<view class="action">
						<text>{{order.status_text}}</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text>年龄</text>
					</view>
					<view class="action">
						<text>{{order.demand.agegroup}}</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text>综合月薪</text>
					</view>
					<view class="action">
						<text>{{order.demand.zwagall}}</text>
					</view>
				</view>
			</view>
			<view class="cu-bar bg-white solids-bottom">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text> 岗位要求
				</view>
			</view>
			<view class="echo-article-details bg-white margin-bottom-sm">
				<text>{{order.demand.requirement}}</text>
			</view>
			
			<view class="cu-bar bg-white solids-bottom">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text> 企业简介
				</view>
			</view>
			<view class="echo-article-details bg-white margin-bottom-sm">
				<text>{{order.demand.comdetails}}</text>
			</view>
		</block>
		
		
		<block v-if="2==TabCur">
			<view class="padding text-center text-grey" v-if="order_log.length==0">
				暂无报备记录...
			</view>
			<view v-else>
				<view class="cu-timeline" v-for="(item,index) in order_log" :key="index">
					<view class="cu-time">{{item.arrivetime}}</view>
					<view class="cu-item text-blue">
						<view class="content">
							<view class="text-bold margin-bottom-sm">{{item.realname}}</view>
							<view class="text-gray text-sm">电话：{{item.mobile}}</view>
							<view class="text-gray text-sm">身份证：{{item.idcard}}</view>
						</view>
					</view>
				</view>
			</view>
		</block>
		
		<view class="cu-bar bg-white tabbar border shop foot">
			<view class="bg-blue submit echo-foot-button" @tap="goPage('/pages/broker/setreport?id=' + order.id)" v-if="order.status==2"> <text>立即报备</text> </view>
			<view class="bg-grey submit echo-foot-button" v-else> <text>已招满</text> </view>
		</view>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				TabCur: 1,
				isRotate: false,
				brokerinfo: {},
				order: {},
				order_log: [],
			}
		},
		onLoad: function(option) {
			_this = this;
			_this.brokerinfo = uni.getStorageSync('brokerinfo') || false;
			var id = option.id || 0;
			_this.$req.ajax({
				path: "broker/getorder",
				data: {
					id: id,
					brokerid: _this.brokerinfo.id
				}
			}).then((data) => {
				_this.order = data.order;
				_this.order_log = data.order_log;
			}).catch((err) => {
				uni.showModal({
					title: '信息提示',
					content: err,
					showCancel: false
				});
			});
		},
		methods: {
			tabSelect: function(e) {
				_this.TabCur = e.currentTarget.dataset.id;
			},
			goPage: function(pageurl) {
				uni.navigateTo({
					url: pageurl,
					fail: function() {
						uni.switchTab({
							url: pageurl
						});
					}
				});
			},
		}
	}
</script>

<style>
	.cu-time{ width: 300rpx !important; padding-left: 30rpx !important; text-align: left !important; }
</style>

