<!--
  @description:购物车-赠品详情
  @Modifier: haofengxian
  @routerPath:
  @date: 2021-12-04 13:07
-->
<template>
  <el-dialog v-dialogDrag :visible.sync="giftDialog" title="赠品详情">
    <p v-for="item in giftList" :key="item.skuId">
      【赠品】{{ item.skuName }}
    </p>
    <!--底部操作按钮-->
    <span slot="footer" class="dialog-footer">
      <el-button @click="giftDialog = false">取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { getSkuGift } from '@/api/shoppingmall/order'
export default {
  name: 'GiftDetailDialog',
  data() {
    return {
      giftList: [], // 赠品列表
      giftDialog: false // 赠品弹框显示框
    }
  },
  methods: {
    // 查看赠品
    openDialogGetSkuGift(skuId) {
      this.giftDialog = true
      getSkuGift(skuId, this.$store.getters.info.id).then(res => {
        if (res.header.ret === '0') {
          this.giftList = [...res.data]
        }
        this.giftDialog = false
      }).catch(() => {
        this.giftDialog = false
      })
    }
  }
}
</script>

<style scoped>

</style>
