<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>
		<div style="background-color: #fff;width: calc(100% - 20px);margin: 0px auto;border-radius: 8px;padding-left: 10px;padding-top: 8px;"> 
			<div class="g_flex_row_between">
				<div style="width: 64px;height: 64px;overflow: hidden;margin-right: 10px;" class="g_flex_c g_flex_none">
					<img :src="info.avatar || 'https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/pugongying/default.svg'" alt="" style="width: 64px;height: 64px;border-radius: 50%;">
				</div>
				<div class="g_flex_1" style="padding: 8px 0;border-bottom: 1px solid rgba(0, 0, 0, 0.1);padding-right: 12px;height: 72.5px;">
					<div style="color: #000;font-size: 17px;margin-bottom: 8px;" class="g_ell_1">{{ info.agencyName }}</div>
					<div style="color: #999;font-size: 14px;" class="g_ell_1">{{ info.nickName }}</div>
				</div>
			</div>
			<div class="g_flex_row_start" style="padding: 10px 0;" v-if="info.tel">
				<div style="color: #000;font-size: 14px;margin-right: 14px;padding-left: 4px;">联系电话</div>
				<div style="color: #576b95;font-size: 14px;">
					{{ info.tel }}
				</div>
			</div>
		</div>
		<div 
			style="background-color: #fff;border-radius: 8px;width: calc(100% - 20px);margin: 10px auto 0;padding: 14px 10px;color: #666;font-size: 16px;min-height: 88px;position: relative;">
			{{ info.remark.trim() || '无备注' }}
			<div style="position: absolute;right: 16px;bottom: 16px;color: #333;font-size: 12px;">
				{{ info.remark.trim() ? (info.remark.length) : 3 }}/ 30
			</div>
		</div>
		<view class="g_mt_10 g_bg_f g_p_16 g_ml_10 g_mr_10 g_radius_8 g_flex_row_start" >
			<view class="g_fs_17 g_c_3 g_flex_none" style="margin-right: 14px;">来源</view>
			<view class="g_fs_17 g_c_9 g_ml_28 g_flex_1" style="text-align: right;">{{ info.messageSource }}</view>
		</view>
		<view class="g_flex_row_center" v-if="info.recordStatus == 1" style="margin-top: 60px;">
			<rh-button btnText="通过" type="primary" @clickBtn="handleSubmit" />
		</view>
		<view class="g_flex_row_center dbtn" v-if="info.recordStatus == 2" style="margin-top: 60px;">
			<rh-button btnText="已通过" type="disabled" />
		</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;
				}
			);
		},
		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;
							}
						}
					);
				}, 300);
			}, 500);
		},
	},
};
</script>

<style lang="scss">
.dbtn{
	.bocai_btn_type_disabled{
		background-color:#999999 !important;
		border:1px solid #999999 !important;
		color:#ffffff !important;
	}
}
</style>
