<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;">
              <el-form :model="editbgid" ref="formInline" label-width="120px" class="demo-ruleForm">
                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-form-item label="策略名称" prop="policyName">
                      <div class="duiqi">{{editbgid.policyName  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="适用资源" prop="applicableResources">
                      <div class="duiqi">{{editbgid.applicableResources  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="是否出租" prop="isRental">
                      <div class="duiqi">{{editbgid.isRental=='0'?'自营':editbgid.isRental=='1'?'是':'无'}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <!-- <el-col :span="8">
                    <el-form-item label="付款日" prop="payDay">
                      <div  class="duiqi">{{editbgid.payDay  || '无'}}</div>
                    </el-form-item>
                  </el-col> -->
                  <el-col :span="8">
                    <el-form-item label="租金" prop="rentalPrice">
                      <div  class="duiqi">{{editbgid.rentalPrice?editbgid.rentalPrice+' 元':'无'}} <span v-if="editbgid.applicableResources == '商铺'">/M²</span></div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="付款周期" prop="leaseTerm">
                      <div  class="duiqi">{{editbgid.leaseTerm  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="租赁时段" prop="contact">
                      <div  class="duiqi">{{editbgid.contact  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-form-item label="免租条件" prop="rentFreeCondition">
                      <div  class="duiqi">{{editbgid.rentFreeCondition  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="免租期" prop="rentFreePeriod">
                      <div  class="duiqi">{{editbgid.rentFreePeriod  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8"  v-if="editbgid.applicableResources == '商铺'">
                    <el-form-item label="经营类型" prop="businessType">
                      <div  class="duiqi" >{{editbgid.businessType  || '无'}}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="优惠政策" prop="preferentialPolicy">
                  <div  class="duiqi" v-if="editbgid.preferentialPolicy" v-html="editbgid.preferentialPolicy"></div>
                  <div class="duiqi" v-else>无</div>
                </el-form-item>
                <el-form-item label="其他说明" prop="otherDescription">
                  <div v-if="editbgid.otherDescription"  class="duiqi" v-html="editbgid.otherDescription"></div>
                  <div class="duiqi" v-else>无</div>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </el-tab-pane>

      </el-tabs>
    </div>
    <div>
      <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 MapXian from "@/components/MapContainer/MapXian";
  import TitleWithCircle from '@/components/top/index';
  import {
    cereResourceStrategylist,
    cereBusinessPlan
  } from '@/api/newly';
  import newmap from "@/components/newmap/index";
  export default {
    components: {
      TitleWithCircle,
      newmap,
      MapXian
    },
    props: {
      leixing: {
        type: Boolean,
        default: true
      },
      editbgid: {
        type: Object,
        default: function() {
          return {};
        },
      },
    },
    data() {
      return {
        xiangTab: 'first',
        list: [],
        parentMessage: {},
        datalist: [],
        datalist1:[]
      }
    },
    created() {
      if (this.editbgid.id) {
        let c1 = {
          pageNumber: 0,
          pageSize: 10,
          resourcesId: 'cd' + this.editbgid.id
        }
        cereResourceStrategylist(c1).then(res => {
          console.error(res)
          this.datalist = res.data
        })
        cereBusinessPlan(c1).then(res => {
          console.error(res)
          this.datalist1 = res.data
        })

      }
      
    },
    computed: {

    },
    methods: {
      openfile(e) {
        if (e) {
          const fullUrl = e;
          try {
            window.open(fullUrl, '_blank'); // 在新标签页中打开文件
          } catch (error) {
            console.error('打开文件失败:', error);
          }
        } else {
          console.error('无文件可查看');
        }
      },
      changetype() {
        this.xiangTab = 'first'
        this.$emit('removeonaction', '1')
      },
    }
  }
</script>
<style>
  .el-form-item__label {
    color: #a2a2a2;
  }

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