<template>
  <Transition
    name="custom-classes"
    enter-active-class="animate__animated animate__faster animate__fadeInLeft"
    leave-active-class="animate__animated animate__faster animate__fadeOutLeft"
  >
    <div class="table-info-pop" v-if="tableData && showTableInfo">
      <div class="title">{{ Lang[Type].table_info }}</div>
      <div class="list flex flex-pack-between">
        <div class="item">
          <span class="lab">{{ Lang[Type].table }}：</span>
          <span>{{ tableData.table_name }}</span>
        </div>
        <div class="item">
          <span class="lab">{{ Lang[Type].boot }}：</span>
          <span>{{ tableData.boot_num }}</span>
        </div>
        <div class="item">
          <span class="lab">{{ Lang[Type].games }}：</span>
          <span>{{ tableData.number_tab_number }}</span>
        </div>
      </div>
      <div class="list">
        <div class="item">
          <span>{{ Lang[Type].dealer }}：</span>
          <span>Address</span>
        </div>
      </div>
      <div class="title">{{ Lang[Type].game_information }}</div>
      <div class="table">
        <div class="top list">
          <span>{{ Lang[Type].play_type }}</span>
          <span>{{ Lang[Type].odds }}</span>
          <span>{{ Lang[Type].limit }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].banker }}</span>
          <span>
            {{ tableData.price_banker }}/1({{ Lang[Type].is_commission }})
          </span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].player }}</span>
          <span>{{ tableData.price_player }}</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 2">
          <span>{{ Lang[Type].dragon }}</span>
          <span>{{ tableData.price_dragon }}</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 2">
          <span>{{ Lang[Type].tiger }}</span>
          <span>{{ tableData.price_tiger }}</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div
          class="list"
          v-if="tableData.game_id == 1 || tableData.game_id == 2"
        >
          <span>{{ Lang[Type].tie }}</span>
          <span>
            {{
              tableData.game_id == 1
                ? tableData.price_tie_baccarat
                : tableData.price_tie_dt
            }}
          </span>
          <span>{{ tableData.limit_money_tie }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].p_banker }}</span>
          <span>{{ tableData.price_pair }}</span>
          <span>{{ tableData.limit_money_pair }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].p_player }}</span>
          <span>{{ tableData.price_pair }}</span>
          <span>{{ tableData.limit_money_pair }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].big }}</span>
          <span>0.5</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].small }}</span>
          <span>1.5</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div class="list" v-if="tableData.game_id == 1">
          <span>{{ Lang[Type].luckSix }}</span>
          <span>12~20</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
        <div
          class="list"
          v-if="
            tableData.game_id == 4 ||
            tableData.game_id == 5 ||
            tableData.game_id == 6 ||
            tableData.game_id == 7
          "
        >
          <span>{{ Lang[Type].limit }}</span>
          <span>1</span>
          <span>{{ tableData.limit_money }}</span>
        </div>
      </div>
    </div>
  </Transition>
</template>

<script>
import { computed } from "vue"
import { useStore } from "vuex"
export default {
  name: "TableInfoPop",
  props: {
    tableData: {
      type: [Object, String],
      default: () => {}
    }
  },
  setup(props) {
    const store = useStore()
    const showTableInfo = computed(() => store.state.config.showTableInfo)
    const Type = computed(() => store.state.config.$Type)
    const Lang = computed(() => store.state.config.$lang)
    console.log(props)
    return {
      Type,
      Lang,
      showTableInfo
    }
  }
}
</script>
<style lang="scss" scoped>
.table-info-pop {
  position: absolute;
  transform: rotateX(0deg);
  z-index: 9999;
  left: 0;
  top: 0;
  bottom: 0;
  width: 9rem;
  background: #fff;
  font-size: 0.4rem;
  color: #555;
  overflow-y: auto;
  .title {
    font-weight: 600;
    color: #2fa8fc;
    line-height: 1;
    margin-top: 0.6rem;
    margin-bottom: 0.4rem;
    border-left: 3px solid #2fa8fc;
    padding-left: 5px;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
  .list {
    font-size: 0.38rem;
    padding-bottom: 0.2rem;
    padding-left: 0.5rem;
    padding-right: 0.8rem;
  }
  .table {
    .top {
      background: #e4eaed;
      padding: 0.1rem 0.3rem;
      box-sizing: border-box;
      margin-bottom: 0.2rem;
      margin-left: 0.2rem;
      margin-right: 0.2rem;
      span:last-child {
        text-align: center !important;
      }
    }
    .list {
      display: flex;
      justify-content: space-between;
      span:first-child {
        width: 1rem;
      }
      span:nth-child(2) {
        text-align: center;
        min-width: 3rem;
      }
      span:last-child {
        width: 2.2rem;
        text-align: right;
      }
    }
  }
}
</style>
