<template>
  <van-overlay :show="value" :duration="0.1">
    <div class="tabUnbuy tabmodal" @click.stop>
      <!-- <img src="../assets/img/close.png" class="close" @click="$emit('change', false)" /> -->
      <div class="text-box">退订</div>
      <div class="text-group">
        <van-radio-group v-model="radio">
          <van-cell-group>
            <van-cell v-for="(item, index) in datas" :key="index" :title="item.productName" clickable @click="itemInfo = item">
              <template #right-icon>
                <van-radio checked-color="#fdc51b" :name="index" />
              </template>
            </van-cell>
          </van-cell-group>
        </van-radio-group>
      </div>

      <div class="btn-box">
        <div class="btn left" @click="$emit('change', false)">取消</div>
        <div class="btn right" @click="itemClick">
          退订
        </div>
      </div>
    </div>
  </van-overlay>
</template>
<script>
export default {
  data () {
    return {
      showSheet: true,
      radio: null,
      itemInfo: {}
    }
  },
  model: {
    prop: "value",
    event: "change"
  },
  props: {
    value: Boolean,
    datas: Array
  },
  methods: {
    itemClick () {
      if (this.radio == null) {
        return this.$toast('请选择退订产品')
      }
      this.$emit('itemClick', this.itemInfo)
    }
  }
};
</script>
<style lang="scss" scoped>
.tabUnbuy {
  top: 412px;
  padding: 20px 30px;
  font-size: 40px;
  font-family: Source Han Sans CN;
  font-weight: bold;
  color: #222222;

  .text-box {
    line-height: 48px;
    text-align: center;
  }
  .text-group {
    margin-top: 40px;
    font-size: 30px;
  }

  .btn-box {
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    margin-bottom: 20px;

    .btn {
      width: 190px;
      margin-top: 30px;
      height: 80px;
      line-height: 80px;
      border-radius: 40px;
      font-size: 34px;
      font-weight: bold;
      text-align: center;
    }

    .left {
      border: 2px #777777 solid;
      color: #777777;
      background-color: #ffffff;
    }

    .right {
      color: #fff;
      background: #FF7B00;
    }
  }
}

.tabmodal {
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 333px;
  transform: translateX(-50%);
  width: 580px;
  background-color: #fff;
  border-radius: 8px;
}
</style>