<template>
  <div>
    <!-- 根据 type 的值决定显示哪个组件 -->
    <capitalpoolinfo ref="capitalpoolinforef" v-if="type == '1'" @changecouponid="changecouponid"/>
    <couponinfo ref="couponinforef" v-else-if="type == '2'" @changecouponid="changecouponid"/>
  </div>
</template>

<script>
import capitalpoolinfo from './capitalpoolinfo.vue';
import couponinfo from './couponinfo.vue';

export default {
  components: {
    capitalpoolinfo,
    couponinfo
  },
  props: {
    type: {
      type: String,
      required: '1'
    },
  },
  data() {
    return {
      id: '',
      info: {}
    }
  },
  methods: {
    int(e,info) {
        if(this.type === '1'){
          this.$refs.capitalpoolinforef.int(e)
        }else{
          this.info = info
          this.$refs.couponinforef.int(e,info)
        }
    },
    chanetype(e) {
        this.type = e
    },
    changecouponid(e) {
        console.error(e)
        let c1 = {
          type:'2',
          id:e.id,
          info:e
        }
        this.$emit('changetypeinfo',c1)
    },
    changecapitalpoolid(e) {
       
    },
  },
};
</script>

<style scoped>
/* 添加样式 */
</style>