<template>
  <div class="white-box">
    <div class="white-box-footer">
      <el-result icon="info" title="信息提示" subTitle="下载填写申请退货单后, 发送申请单到客服Email: elkenafrica@gmail.com">
        <template slot="extra">
          <el-button type="primary" size="small" @click="handleDownloadFile">申请退货<!-- 下载申请单 --></el-button>
        </template>
      </el-result>
    </div>
  </div>
</template>

<script>
  import network from '@/utils/network'
  import {SERVER_API_HTTP_TYPE, SERVER_API_DOMAIN} from '@/utils/config'

  export default {
    name: 'order-backing-out',
    data() {
      return {}
    },
    methods: {
      // 下载申请退货单
      handleDownloadFile() {
        network.getData(`shop/order-backing-out`).then(response => {
                    let { fileUrl } = response

                    let downloadElement = document.createElement('a')
                    downloadElement.target = '_blank'
                    downloadElement.href = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/' + fileUrl
                    // 下载后文件名
                    downloadElement.download = fileUrl
                    //点击下载
                    downloadElement.click()
                })
            },
      },
  }
</script>

<style scoped>
 
</style>
