<template>
	<view class="g_bg_page">
		<view class="g_h_all" style="" v-if="!isLogin">
			<!-- <unloginInfo></unloginInfo> -->
		</view>
		<view class="g_pb_48" v-else>
			<view class="g_h_10"> </view>
			<!-- 账单 -->
			<!-- v-if="userInfo.user.agencyRole == 1 || userInfo.user.agencyRole == 2 || userInfo.hasBill || true" -->
			<view class="g_radius_8 g_p_16 g_bg_f g_text_c g_ml_10 g_mr_10" hover-class="thover" @click="goPage('/root/bind/order?active=0')">
				<view class="g_fw_600 g_mb_10 g_fs_20">{{ upNum }}</view>
				<view class="g_c_6">关注发单号</view>
			</view>
			<!-- v-if="agencyInfo.supplierAccount == 1" -->
			<view class="g_mt_10" v-if="false">
				<!-- 发单号 -->
				<g-panel-card-num :list="orderDataList" :subhead="agencyInfo.fullName || ''" titleNav="/root/merchantManagement/orderManagement" :border="true" :speed="1" :marginBottom="16" cusType="num" :height="26" :num="5" cusTitle="我的发单号" :bottomBox="true" bottomNav="/root/merchantManagement/jobForm" @clickItem="handleClickNum" />
			</view>

			<view class="g_mt_10">
				<!-- 报名工单 -->
				<g-panel-card-num :list="billDataList" titleNav="/pages/apply/index" :border="true" :speed="1" :marginBottom="16" cusType="num" :height="26" :num="5" cusTitle="报名工单" @clickItem="handleClickNum" />
			</view>
			<!-- wx:if="{{configInfo.record}}" -->
			<!-- titleNav="/root/detail/applyTob" -->
			<!-- 今日数据 -->
			<!-- titleNav="/root/person/todayData" -->
			<!-- <view class="g_mt_10">
				<g-panel-card-num :list="todayDataList" :border="true" :speed="1" :marginBottom="16" cusType="num" :height="26" :num="5" cusTitle="今日数据" @clickItem="handleClickNum" />
			</view> -->

			<view class="g_mt_24">
				<view class="g_mb_10 g_fw_600 g_pl_16 g_fs_17">仅项目方可见：</view>
				<view class="g_p_16 g_bg_f g_radius_8 g_flex_row_between flex_center g_ml_10 g_mr_10">
					<view class="g_flex_row_start flex_center">
						<view class="t-icon g_w_48 g_h_48 _i t-icon-fazhandaili1"></view>
						<!-- <img src="https://file.matripe.com.cn/images/2025/06/03/1748920927011674.jpeg" class="g_w_48 g_h_48 g_radius_8" alt="" /> -->
						<view class="g_flex_column_between g_ml_10">
							<view class="g_fs_16 g_c_0 g_fw_600 g_mb_6">发展代理</view>
							<view class="g_c_9">邀请更多代理（粉丝）关注我</view>
						</view>
					</view>
					<view class="g_c_main g_bg_e7 g_radius_20" hover-class="thover" @click="goPage('/root/bind/search?active=1')" style="padding: 4px 12px">去邀请</view>
				</view>
				<view class="g_fs_12 g_c_6 g_pl_20 g_mt_10">该卡片内容仅对开通「发单号」且有「渠道管理」权限的用户显示，代理在该页面看不到此卡片内容</view>
			</view>
		</view>
		<!-- <servicePopup
			:show="showService"
			@updateShow="
				(e) => {
					showService = e;
				}
			"
		></servicePopup> -->
	</view>
</template>

<script>
// import gEmpty from "@/components/empty.vue";
// import unloginInfo from "@/components/unloginInfo.vue";
// import servicePopup from "@/components/servicePopup.vue";
export default {
	onShareAppMessage() {
		return this.G.shareFun();
	},
	onReady() {
		this.G.setNavStyle();
	},
	components: {
		// gEmpty,
		// unloginInfo,
		// servicePopup,
	},
	data() {
		return {
			globalData: getApp().globalData,
			showService: false,
			isLogin: false,
			userInfo: {},
			agencyInfo: {},
			upNum: 0,
			map: { num10: "0", num20: "0", num25: "0", num30: "0", num40: "0", num999: "0", user999: "0", user40: "0", user48: "0", user50: "0", agencyData: {} },
			orderDataList: [
				{
					name: "在招",
					num: "-",
					path: "/root/merchantManagement/orderManagement?recruitment=1",
				},
				{
					name: "总职位",
					num: "-",
					path: "/root/merchantManagement/orderManagement",
				},
				{
					name: "互关",
					num: "-",
					path: "",
				},
				{
					name: "关注",
					num: "-",
					path: "",
				},
				{
					name: "粉丝",
					num: "-",
					path: "",
				},
			],
			todayDataList: [
				{
					name: "报名",
					num: "-",
					path: "/root/person/todayData",
				},
				{
					name: "到面",
					num: "-",
					path: "/root/person/todayData",
				},
				{
					name: "通过",
					num: "-",
					path: "/root/person/todayData",
				},
				{
					name: "入职",
					num: "-",
					path: "/root/person/todayData",
				},
				{
					name: "在职",
					num: "-",
					path: "/root/person/todayData",
				},
			],
			billDataList: [
				{
					name: "审核中",
					num: 0,
					path: "/pages/apply/index?status=1",
				},
				{
					name: "待接待",
					num: 0,
					path: "/pages/apply/index?status=2",
				},
				{
					name: "待面试",
					num: 0,
					path: "/pages/apply/index?status=3",
				},
				{
					name: "待入职",
					num: 0,
					path: "/pages/apply/index?status=4",
				},
				{
					name: "在职中",
					num: 0,
					path: "/pages/apply/index?status=5",
				},
			],
			query: {
				pageNum: 1,
				size: 50,
				list: [],
				jobType: 2,
				recruitment: "",
			},
		};
	},
	onLoad() {},
	onShow() {
		let that = this;
		that.userInfo = uni.getStorageSync("apply-userinfo");
		that.agencyInfo = uni.getStorageSync("agencyInfo");
		console.log("that.agencyInfo", that.agencyInfo);
		that.isLogin = uni.getStorageSync("apply-token") ? true : false;
		// if (that.userInfo.agencyStatus == 1) {
		this.getData();
		this.getJobList();
		this.getCompanyInfo();
		// }
		// if (typeof that.$scope.getTabBar === "function" && that.$scope.getTabBar()) {
		// 	that.$scope.getTabBar().setData({
		// 		selected: 4,
		// 		isShow: true,
		// 	});
		// }
		// if (typeof that.$mp.page.getTabBar === "function" && that.$mp.page.getTabBar()) {
		// 	that.$mp.page.getTabBar().setData({
		// 		selected: 4,
		// 		isShow: true,
		// 	});
		// }
	},
	created() {},

	methods: {
		getJobList($type = "init") {
			let that = this;
			this.G.Get(this.api.get_user_supplieraccount_data, {}, (res) => {
				console.log("res", res);
				that.orderDataList = [
					{
						name: "在招",
						num: res.customJobStatus1Num,
						path: "/root/merchantManagement/orderManagement?recruitment=1",
					},
					{
						name: "总职位",
						num: res.customJobStatusNum,
						path: "/root/merchantManagement/orderManagement",
					},
					{
						name: "互关",
						num: "-",
						path: "",
					},
					{
						name: "关注",
						num: "-",
						path: "",
					},
					{
						name: "粉丝",
						num: "-",
						path: "",
					},
				];
			});
		},
		getData() {
			let that = this;
			this.G.Get(this.api.user_dataValue, {}, (res) => {
				console.log("res", res);
				if (res) {
					that.map = res;
				}
				that.todayDataList = [
					{
						name: "报名",
						num: that.map.agencyData.signUps || 0,
						path: "/root/person/todayData",
					},
					{
						name: "到面",
						num: that.map.agencyData.arrived || 0,
						path: "/root/person/todayData",
					},
					{
						name: "通过",
						num: that.map.agencyData.passed || 0,
						path: "/root/person/todayData",
					},
					{
						name: "入职",
						num: that.map.agencyData.entry || 0,
						path: "/root/person/todayData",
					},
					{
						name: "在职",
						num: that.map.agencyData.obJob || 0,
						path: "/root/person/todayData",
					},
				];
				that.billDataList = [
					{
						name: "审核中",
						num: that.map.num10 || 0,
						path: "/pages/apply/index?status=1",
					},
					{
						name: "待接待",
						num: that.map.num20 || 0,
						path: "/pages/apply/index?status=2",
					},
					{
						name: "待面试",
						num: that.map.num25 || 0,
						path: "/pages/apply/index?status=3",
					},
					{
						name: "待入职",
						num: that.map.num30 || 0,
						path: "/pages/apply/index?status=4",
					},
					{
						name: "在职中",
						num: that.map.num40 || 0,
						path: "/pages/apply/index?status=5",
					},
				];
			});
		},
		getCompanyInfo() {
			let that = this;
			that.G.Get(
				that.api.bind_enterpriseDetail + "/" + uni.getStorageSync("apply-agencyId"),
				{
					agencyId: uni.getStorageSync("apply-agencyId"),
					type: 1,
				},
				(res) => {
					console.log("item.", res);
					that.upNum = res.upNum;
				}
			);
		},
		handleClickNum(e) {
			console.log(e);
			if (!e.item.path) {
				if (e.item.name == "联系客服") {
					this.showService = true;
				}
				return false;
			}
			uni.navigateTo({
				url: e.item.path,
			});
		},
		goLogin() {
			console.log("123");
			uni.reLaunch({
				url: "/pages/login/index",
			});
		},
		goPage(url) {
			this.G.isLogin();
			if (this.G.isLogin()) {
				uni.navigateTo({
					url,
				});
			}
		},
	},
};
</script>

<style>
page {
	/* margin-top: 10px; */
	/* background-color: #f5f5f5; */
	box-sizing: border-box;
}
</style>
