<template>
  <div id="PrivilegeManagement" class="flex-row">
    <div :class="{'basic-main': !isEdit,'binary-left': isEdit}">
      <privilege-list v-ref:list @select-changed="edit"></privilege-list>
    </div>
    <div class="binary-right" style="overflow-y: scroll" v-if="isEdit">
      <privilege-edit @close="refresh" v-ref:edit :data="row"></privilege-edit>
    </div>
  </div>
</template>
<script>
  export default {
    title: '优惠管理',
    data () {
      return {
        isEdit: false,
        row: null
      }
    },
    ready () {
    },
    methods: {
      edit (row) {
        this.row = null
        this.isEdit = false
        this.$nextTick(() => {
          this.isEdit = true
          if (row) {
            this.row = row.val
          }
        })
      },
      refresh () {
        this.isEdit = false
        this.$refs.list.search()
      }
    },
    events: {

    }
  }
</script>
<style>

</style>
