<template>
  <div class="delete_modal" v-if="modalFlag">
    <div class="modal_content">
      <p class="edit">编辑</p>
      <div class="content">
        <div class="dlr">
          <p style="width: 100px">DLR Code</p>
          <p>{{ dataObj.dlrCode }}</p>
        </div>
        <div class="area">
          <p style="width: 100px">所属区域</p>
          <p>{{ dataObj.localArea }}</p>
        </div>
        <div class="distributor">
          <p style="width: 100px">经销商店名</p>
          <p>{{ dataObj.dlrName }}</p>
        </div>
        <div class="plate">
          <p style="width: 100px">所属平台</p>
          <p>{{ dataObj.platformName}}</p>
        </div>
        <div class="account">
          <p style="width: 100px">平台账号</p>
          <input v-model="accountCode" :placeholder="dataObj['accountCode']"/>
        </div>
        <div class="isAttest">
          <p style="width: 100px">是否认证</p>
          <select ref="selectValue">
            <!-- 原来列表展示什么，select默认展示 -->
            <option>{{ dataObj.authorizationName === '是' ? "是" : "否" }}</option>
            <option>{{ dataObj.authorizationName === '是' ? "否" : "是" }}</option>
          </select>
        </div>
        <div class="fans">
          <p style="width: 100px">粉丝数</p>
          <input v-model="fansNums" :placeholder="dataObj['fansCount']"/>
        </div>
      </div>
      <div class="btn">
        <div class="current_button" @click="submit" style="margin: 0">确定</div>
        <div class="current_button" style="margin: 0" @click="hideModal">
          取消
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    modalFlag: {
      type: Boolean,
      default: true,
    },
    dataObj: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      accountCode: '',
      fansNums: ''
    };
  },
  methods: {
    submit: function () {
      let isAttesta = this.$refs.selectValue.value || "";
      let fansNum = this.fansNums || this.dataObj['accountCode'];
      let accountCode = this.accountCode || this.dataObj['accountCode'];
      fansNum = +fansNum;
      if (fansNum <= 0) {
        alert("请填写大于零的整数");
      } else if (Math.ceil(fansNum) !== fansNum) {
        alert("请填写大于零的整数");
      } else {
        this.$emit("edit_data", isAttesta, fansNum, accountCode);
      }
    },
    hideModal: function () {
      this.$emit("hide_modal");
    },
  },
  mounted() {
  },
};
</script>

<style scoped lang="less">
.delete_modal {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 100vw;
  background-color: rgba(127, 127, 127, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: left;
  .modal_content {
    width: 700px;
    height: 500px;
    background-color: #eee;
    transform: translateY(-50px);
    .edit {
      height: 40px;
      line-height: 40px;
      font-size: 20px;
      text-align: left;
      border-bottom: 1px solid #ccc;
      padding-left: 20px;
    }
    .content {
      padding-left: 220px;

      .dlr {
        display: flex;
        margin-top: 20px;
        p {
          font-size: 14px;
          height: 28px;
          line-height: 28px;
        }
      }
      .area {
        display: flex;
        margin-top: 15px;
        p {
          font-size: 14px;
          height: 28px;
          line-height: 28px;
        }
      }
      .distributor {
        margin-top: 15px;

        display: flex;
        height: 28px;
        line-height: 28px;
        p {
          font-size: 14px;
        }
      }
      .plate {
        margin-top: 15px;

        display: flex;
        height: 28px;
        line-height: 28px;
        p {
          font-size: 14px;
        }
      }
      .account {
        margin-top: 15px;

        display: flex;
        height: 28px;
        line-height: 28px;
        p {
          font-size: 14px;
        }
      }
      .isAttest {
        margin-top: 15px;

        display: flex;
        p {
          font-size: 14px;
          height: 28px;
          line-height: 28px;
        }
        select {
          border: 1px solid #ccc;
          width: 144px;
          height: 28px;
          font-size: 14px;
          option {
            color: #555;
            font-size: 14px;
          }
        }
      }
      .fans {
        margin-top: 15px;

        display: flex;
        height: 28px;
        line-height: 28px;
        p {
          font-size: 14px;
        }
        input {
          border: 1px solid #ccc;
          width: 144px;
          height: 28px;
          font-size: 14px;
        }
      }
    }
    .btn {
      margin: 0 auto;
      width: 150px;
      margin-top: 50px;
      display: flex;
      justify-content: space-between;
    }
  }
}
</style>
