<template>
  <div>
    <div>
      <el-tabs v-model="xiangTab">
        <el-tab-pane label="申请内容" name="first">
          <div style="margin-top: 30px;" class="editcss">
            <TitleWithCircle title="申请信息" />
            <div style="padding: 20px;margin-top: 10px;">
              <el-form :model="info" ref="ruleForm" label-width="140px" class="demo-ruleForm">
                <el-form-item label="Banner图" prop="coverImage">
                  <el-image  style="width: 200px;margin-right: 10px;"  v-for="item in info.coverImage.split(',')" :src="$baseURL+item" fit="contain"></el-image>
                </el-form-item>
                <el-form-item label="投放内容" prop="adTitle">
                  <div class="duiqi">{{info.adTitle}}</div>
                </el-form-item>
              </el-form>
            </div>
            <TitleWithCircle title="营业执照信息" />
            <div style="padding: 20px;margin-top: 10px;">
              <el-form :model="info" ref="ruleForm" label-width="140px" class="demo-ruleForm">
                <el-row :gutter="20">
                  <el-col :span="9">
                    <el-form-item label="主体名称" prop="entityName">
                      <div class="duiqi">{{info.entityName}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="9">
                    <el-form-item label="统一社会信用代码" prop="unifiedSocialCreditCode">
                      <div class="duiqi">{{info.unifiedSocialCreditCode}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="9">
                    <el-form-item label="类型" prop="entityType">
                      <div class="duiqi">{{info.entityType}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="9">
                    <el-form-item label="法定代表人" prop="legalRepresentative">
                      <div class="duiqi">{{info.legalRepresentative}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="经营范围" prop="businessScope">
                  <div class="duiqi">{{info.businessScope}}</div>
                </el-form-item>
                <el-row :gutter="20">
                  <el-col :span="9">
                    <el-form-item label="注册资本" prop="registeredCapital">
                      <div class="duiqi">{{info.registeredCapital}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="9">
                    <el-form-item label="成立日期" prop="establishmentDate">
                      <div class="duiqi">{{info.establishmentDate}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="住所" prop="residence">
                  <div class="duiqi">{{info.residence}}</div>
                </el-form-item>
                <el-row :gutter="20">
                  <el-col :span="9">
                    <el-form-item label="邮箱地址" prop="emailAddress">
                      <div class="duiqi">{{info.emailAddress}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="9">
                    <el-form-item label="营业期限" prop="businessStartDate">
                      <div class="duiqi">{{info.businessStartDate}} - {{info.businessEndDate}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="营业执照" prop="businessLicense">
                  <!-- <div class="duiqi">{{info.businessLicense}}</div> -->
                  <el-image style="width: 200px;" :src="$baseURL+info.businessLicense" fit="contain"></el-image>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="商家信息" name="second">
          <div style="margin-top: 30px;" class="editcss">
            <TitleWithCircle title="基础信息" />
            <div style="padding: 20px;margin-top: 10px;">
              <el-form :model="shop" ref="ruleForm" label-width="140px" class="demo-ruleForm">
                <el-row :gutter="20">
                  <el-col :span="9">
                    <el-form-item label="姓名" prop="operatorName">
                      <div class="duiqi">{{info.operatorName}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="9">
                    <el-form-item label="手机号" prop="phone">
                      <div class="duiqi">{{info.phone}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="9">
                    <el-form-item label="证件类型" prop="idCardType">
                      <div class="duiqi">{{info.idCardType}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="9">
                    <el-form-item label="身份证号码" prop="idNumber">
                      <div class="duiqi">{{info.idNumber}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="身份证照片（正）" prop="idPhotoFront">
                  <div style="margin-top: 10px;">
                    <el-image style="width: 200px;" :src="$baseURL+info.idPhotoFront" fit="contain"></el-image>
                  </div>
                </el-form-item>
                <el-form-item label="身份证照片（反）" prop="idPhotoBack">
                  <div style="margin-top: 10px;">
                    <el-image style="width: 200px;" :src="$baseURL+info.idPhotoBack" fit="contain"></el-image>
                  </div>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="广告位信息" name="third">
          <div style="margin-top: 30px;" class="editcss">
            <TitleWithCircle title="基础信息" />
            <div style="padding: 20px;" v-if="info.cereAdvertisingInformation.id">
              <el-form :model="info.cereAdvertisingInformation" ref="ruleForm" label-width="140px"
                class="demo-ruleForm">
                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-form-item label="广告位名称" prop="advertisingName">
                      <div class="duiqi">{{info.cereAdvertisingInformation.advertisingName || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="广告位编号" prop="advertisingSpaceNumber">
                      <div class="duiqi">{{info.cereAdvertisingInformation.advertisingSpaceNumber || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="广告位类型" prop="advertisingType">
                      <div class="duiqi">{{info.cereAdvertisingInformation.advertisingType || '无'}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20" v-if="info.cereAdvertisingInformation.advertisingType == '线上广告位'">
                  <el-col :span="8">
                    <el-form-item label="所属端" prop="affiliation" >
                      <div class="duiqi">{{info.cereAdvertisingInformation.affiliation || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="广告位数量" prop="advertisingNumber" >
                      <div class="duiqi">{{info.cereAdvertisingInformation.advertisingNumber || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="广告尺寸" prop="dimensions">
                      <div class="duiqi">{{info.cereAdvertisingInformation.dimensions || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="可上传大小" prop="size">
                      <div class="duiqi">{{info.cereAdvertisingInformation.size || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="播放时长" prop="playDuration">
                      <div class="duiqi">{{info.cereAdvertisingInformation.playDuration || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="推送地址" prop="pushAddress">
                      <div class="duiqi">{{info.cereAdvertisingInformation.pushAddress || '无'}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20" v-if="info.cereAdvertisingInformation.advertisingType == '实体广告位'">
                  <el-col :span="8">
                    <el-form-item label="设备类型" prop="deviceType" >
                      <div class="duiqi">{{info.cereAdvertisingInformation.deviceType || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备大小" prop="equipmentSize" >
                      <div class="duiqi">{{info.cereAdvertisingInformation.equipmentSize || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="广告尺寸" prop="dimensions">
                      <div class="duiqi">{{info.cereAdvertisingInformation.dimensions || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="广告材质" prop="advertisingMaterial">
                      <div class="duiqi">{{info.cereAdvertisingInformation.advertisingMaterial || '无'}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="详细位置" prop="detailedLocation" v-if="info.cereAdvertisingInformation.advertisingType == '实体广告位'">
                  <div class="duiqi">{{info.cereAdvertisingInformation.detailedLocation || '无'}}</div>
                </el-form-item>
                <el-form-item label="地图标点" prop="mapPunctuation" v-if="info.cereAdvertisingInformation.advertisingType == '实体广告位'">
                  <div style="width: 100%;height: 300px;">
                    <newmap :isx="false" :message="info.cereAdvertisingInformation.mapPunctuation"></newmap>
                  </div>
                </el-form-item>
                <el-form-item label="位置示意图" prop="locationDiagram">
                  <img  v-for="item in info.cereAdvertisingInformation.locationDiagram.split(',')" :src="$baseURL+item" alt="" style="width:140px;height:140px;margin-left: 15px;">
                </el-form-item>
                
                <el-form-item label="备注信息" prop="memo" v-if="info.cereAdvertisingInformation.advertisingType == '线上广告位'">
                  <div class="duiqi">{{info.cereAdvertisingInformation.memo || '无'}}</div>
                </el-form-item>
              </el-form>
            </div>

          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
    <div v-if="info.auditStatus == 1 && issp == '2'" style="border-top: 2px solid #eee;">
      <div style="padding-left: 130px;margin: 25px 0;">
        <el-radio v-model="radio" label="2">同意</el-radio>
        <el-radio v-model="radio" label="3">拒绝</el-radio>
      </div>
      <el-form :model="info" label-width="130px" class="demo-ruleForm">
        <el-form-item label="审核意见">
          <el-input maxlength="200" show-word-limit rows="4" v-model="auditComments" placeholder="请输入审核意见"
            type="textarea" />
        </el-form-item>
      </el-form>
    </div>
    <div v-if="(info.auditStatus == '2' || info.auditStatus == '3') && xiangTab == 'first'">
      <TitleWithCircle title="审核结果"/>
      <div style="padding: 20px;">
        <el-form :model="editbgid" label-width="100px" class="demo-ruleForm">
          <el-form-item label="状态">
            <div class="duiqi">{{info.auditStatus=='2'?'已发布':info.auditStatus=='3'?'不通过':'无'}}</div>
          </el-form-item>
          <el-form-item label="审核意见">
            <div class="duiqi">{{info.auditComments || '无'}}</div>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div>
      <el-button v-if="info.auditStatus == 1 && issp == '2'" @click="minSev"
        style="background-color: #3F9B6A;color: #fff;">确定</el-button>
      <el-button class="buttonHover"
        style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;margin-top: 20px;"
        @click="changetype">返回</el-button>
    </div>
  </div>
</template>

<script>
  import newmap from "@/components/newmap/index";
  import {
    AdvertiserInfoEdit,
  } from '@/api/advertisement.js'

  import TitleWithCircle from '@/components/top/index';
  import MapXian from "@/components/MapContainer/MapXian";
  export default {
    components: {
      TitleWithCircle,
      MapXian,
      newmap
    },
    props: {
      info: {
        type: Object,
        default: function() {
          return {}; // 返回一个空数组作为默认值
        },
      },
      issp: {
        type: String,
        default: function() {
          return '1';
        },
      },
    },
    data() {
      return {
        auditComments:'',
        radio: '2',
        ontype: '线上广告位',
        url: '',
        type: '1',
        tableData: [],
        xiangTab: 'first',
        siteIds: [],
        list: [],
        advIds: [],
        shopIds: [],
        shop: {},
        newshop: {},
        newinfo: {},
        parentMessage: {}
      }
    },
    created() {
      console.log(this.info)
     
    },
    computed: {

    },
    methods: {
      minSev() {
        console.error(this.info)
        console.error(this.radio)

        AdvertiserInfoEdit({
          id: this.info.id,
          'auditStatus': this.radio,
          auditComments: this.auditComments
        }).then(res => {
          console.error(res)
          if (res.code == 200) {
            this.$message({
              message: '处理成功',
              type: 'success'
            })
            this.info.auditStatus = this.radio
          } else {
            this.$message({
              message: '处理失败',
              type: 'error'
            })
          }
        })
      },
      openfile(e) {
        if (e) {
          const fullUrl = this.$baseURL + e;
          try {
            window.open(fullUrl, '_blank'); // 在新标签页中打开文件
          } catch (error) {
            console.error('打开文件失败:', error);
          }
        } else {
          console.error('无文件可查看');
        }
      },
      changetype() {
        this.xiangTab = 'first'
        if (this.type == '1') {
          this.$emit('removeonaction', '1')
        } else {
          this.type = '1'
        }
      },
      open(row) {
        console.error(row)
        this.type = '2'
        this.newinfo = row
        businessListGetById({
          shopId: row.relatedMerchants
        }).then(res => {
          console.log(res)
          this.newshop = res.data
        })
      },
      closeFn() {
        this.$emit('change', false);
      },
    }
  }
</script>
<style>
  .el-form-item__label {
    color: #a2a2a2;
  }

  .greens {
    color: #3F9B6A;
  }
</style>
