<template>
  <view class="company">
    <view class="company-content">
      <view class="company-title">
        <u-icon
          name="clock-fill"
          color="#016BF6"
          size="40"
          style="margin-right: 16rpx"
        ></u-icon>
        {{companyinfo.message}}
      </view>
      <view class="review-desc">
        您的企业【{{companyinfo.companyAllName}}】于[{{companyinfo.companyCreateTime}}]提交了企业认证申请，
        {{companyinfo.status==3 ? '审核未通过，理由如下：' : '请耐心等待认证结果'}}
      </view>
      
      <!-- 审核拒绝理由区域 -->
      <view class="reject-reason" v-if="companyinfo.status==3">
        {{companyinfo.auditContent}}
      </view>
      
      <view class="review-btn" @click="goCompleteMsg">
        {{companyinfo.status==3 ? '重新提交' : '我知道了'}}
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      companyinfo: {} // 改为对象初始值更合适
    };
  },
  
  onShow() {
    this.getcompanystatus()
  },
  
  methods: {
    goCompleteMsg() {
		if(ompanyinfo.status==3){
			 uni.navigateTo({ url: "/my/jobPosting?companyName=" });
		}else{
			 uni.navigateTo({ url: "/package/jobIntention/completeMsg" });
		}
		
     
    },
    
    // 查询用户企业状态
    getcompanystatus() {
      this.$Request.get("/app/company/selectCompanyByUserId", "")
        .then((res) => {
          if (res.code != 0) {
            uni.showToast({
              title: res.msg || "查询状态失败",
              icon: "none"
            });
            return;
          }
          this.companyinfo = res.data || {};
          console.log("查询用户企业状态", res)
        })
        .catch((err) => {
          console.error("查询失败：", err);
          uni.showToast({
            title: "网络异常",
            icon: "none"
          });
        });
    }
  },
};
</script>

<style scoped lang="scss">
.company {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  font-family: DM Sans;
  
  .company-content {
    flex: 1;
    padding: 40rpx;
    box-sizing: border-box;
    overflow: hidden;
    overflow-y: auto;
    padding-top: 200rpx;
    
    .company-title {
      color: rgba(29, 33, 41, 1);
      font-family: DM Sans;
      font-size: 36rpx;
      font-weight: 500;
      line-height: 44rpx;
      text-align: center;
    }
    
    .review-desc {
      color: rgba(102, 102, 102, 1);
      font-family: DM Sans;
      font-size: 24rpx;
      font-weight: 400;
      line-height: 32rpx;
      text-align: center;
      padding-top: 22rpx;
      padding-bottom: 20rpx;
    }
    
    // 拒绝理由样式
    .reject-reason {
      color: #ff4d4f; /* 红色表示错误/拒绝 */
      font-family: DM Sans;
      font-size: 26rpx;
      line-height: 36rpx;
      text-align: center;
      padding: 20rpx;
      margin: 0 22rpx 50rpx;
      background-color: #fff8f8;
      border-radius: 8rpx;
      border: 1px solid #ffebe9;
    }
    
    .review-btn {
      padding: 16rpx 32rpx;
      box-sizing: border-box;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 999px;
      background: rgba(255, 102, 0, 1);
      color: rgba(255, 255, 255, 1);
      font-family: DM Sans;
      font-size: 32rpx;
      font-weight: 400;
      margin: 0 22rpx;
    }
  }
  
  .bottom-btn {
    flex-shrink: 0;
    padding-bottom: 50rpx;
    text-align: center;
    color: #016bf6;
    font-family: DM Sans;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 36rpx;
  }
}
</style>