<template>
	<view class="p-root-bind-view g_w_all g_h_all g_bg_f_5 g_kuaishou">
		<view class="g_h_10"></view>
		<g-panel-card-info
			:info="{
				avatar: info.logo,
				title: info.agencyName,
				num: '已发布职位' + info.jobNum,
			}"
			:isShowMore="type == 2 && title != '三天前' && status != 1 ? 1 : 0"
		/>
		<!-- <view class="g_mt_10 g_bg_f g_p_16 g_ml_10 g_mr_10 g_radius_8">
			<view class="g_mt_10  g_fs_16 g_bg_f_7 g_pl_16 g_pr_16 g_radius_8 g_pt_14 g_pb_14">
				<view>{{info.agencyName}}：{{info.remark ? info.remark : '-'}}</view>
			</view>
		</view> -->
		<view class="g_mt_10 g_bg_f g_p_16 g_ml_10 g_mr_10 g_radius_8 g_flex_row_start" v-if="type == 2 && title != '三天前'">
			<view class="g_fs_16 g_c_3">来源</view>
			<view class="g_fs_16 g_c_9 g_ml_28">{{ info.messageSource }}</view>
		</view>
		<view class="g_flex_row_center g_mt_32" v-if="type == 2 && title != '三天前'">
			<g-button btnText="通过" type="primary" @clickBtn="handleSubmit" />
		</view>
	</view>
</template>

<script>
export default {
	onReady() {
		this.G.setNavStyle();
	},
	onShareAppMessage() {
		return this.G.shareFun();
	},
	data() {
		return {
			id: 0,
			type: 0,
			info: {
				logo: "",
				agencyName: "",
				jobNum: 0,
				agencyId: 0,
				form: "-",
				remark: "-",
			},
			status: 0,
			title: "",
		};
	},
	onLoad(option) {
		this.id = option.id;
		this.type = option.type;
		this.status = option.status;
		this.title = option.time;
		this.getList();
	},
	methods: {
		getList() {
			let that = this;
			that.G.Get(
				that.api.bind_recordDetail + "/" + that.id,
				{
					id: that.id,
				},
				(res) => {
					console.log("获取详情：", res);
					that.info = res;
				}
			);
		},
		goPage($path) {
			if (this.type == 2 && this.title != "三天前") {
				uni.navigateTo({
					url: $path,
				});
			}
		},
		handleSubmit() {
			let that = this;
			uni.showLoading({
				title: "正在处理",
			});
			setTimeout(() => {
				uni.showLoading({
					title: "已发送",
				});
				uni.hideToast();
				setTimeout(() => {
					that.G.Get(
						that.api.bind_recordSubmit + "/" + that.id,
						{
							id: that.id,
						},
						(res) => {
							uni.showToast({
								title: "已通过验证",
								success() {},
							});
							let params = {
								id: that.info.agencyId,
								type: that.type,
								isShowMore: false,
								isShowJob: false,
							};
							if (res == 1) {
								// 是我的上游
								params.isShowMore = true;
								params.isShowJob = true;
							} else {
								// 不是我的上游
								params.isShowMore = true;
								params.isShowJob = false;
							}
							const pages = getCurrentPages();
							let _path = pages[pages.length - 1].route;
							setTimeout(() => {
								uni.navigateBack({
									delta: 1,
								});
							}, 1500);
						}
					);
				}, 300);
			}, 500);
		},
	},
};
</script>

<style lang="scss"></style>
