<template>
  <div>
    <!-- 관리자ID 조회 -->
    <div class="popup popup_form modal44 popup_inside">
      <div class="pop-head">
        <h3 class="pop-tit">사용자ID 조회</h3>
      </div>
      <div class="pop-cont-detail input_box">
        <label>ID</label>
        <div class="input_search">
          <input class="search-box" type="text" value="" v-model="searchText1" maxlength="100">
          <button type="button" class="button btn-p2color" @click="memberDetail">조회</button>
        </div>
      </div>
        <table class="table-c">
          <thead>
            <tr>
              <th>ID</th>
              <th>사업자등록번호</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item, idx) in list">
              <td>{{ item.userId }}</td>
              <td><a href="javascript:void(0)" @click="setUserInfo(item)">{{ item.bregNo }}</a></td>
            </tr>
          </tbody>
        </table>
      <div class="popup-btn2">
        <button class="btn-default" @click="UserListPopClose();">닫기</button>
      </div>
    </div>

  </div>
</template>
<script>
import custMgtApi from '@/modules/custMgt/service/custMgtApi';
export default {
  name: "userListPop",
  data(){
      return {
        row: {},
        searchText1: '',
        list:[],
      }
  },
  components: {
  },
  props: ['sendData'],
  created(){
  },
  mounted() {

  },
  methods : {
    search (isKeep) {
    },
    setUserInfo (props){
      this.$emit('event-data', props)
      this.UserListPopClose();
    },
    // 모달 띄우기
    UserListPopOpen(){
      this.formReset();
      var dimmed = document.getElementsByClassName('modal44');
      for(var i = 0; i < dimmed.length; i++){
        dimmed[i].style.display = 'block';
      }
    },
    // 모달 끄기
    UserListPopClose(){
      var dimmed = document.getElementsByClassName('modal44');
      for(var i = 0; i < dimmed.length; i++){
        dimmed[i].style.display = 'none';
      }
    },

    async memberDetail(){
      try {
        this.row.searchText1 = this.searchText1
        if(this.row.searchText1 == ''){
          return false;
        }
        const response = await custMgtApi.memberDetail(this.row);
        const result = response.data;
        if (result != null && result.retCode == "0000") {
          this.list = result.data.list
        }
      } catch (error) { 
        
      }
    },
    formReset(){
      Object.assign(this.$data, this.$options.data());
    },
  }
}
</script>
