<template>
  <el-dialog title="主动退款" :visible.sync="showProactiveRefundDialog" @close="closeProactiveRefundDialog">
    <div style="font-weight: bold">
      注意：建议你与买家协商后，再确定是否退款。主动退款后购买金额将返回用户的支付账户且不可撤销，请谨慎操作。
    </div>
    <div>
      <div class="mt10">售后方式：仅退款</div>
      <div class="mt10">关联订单状态：待发货</div>
      <div class="mt10" v-if="refundInfo.payNum">退货数量：{{ refundInfo.payNum }}</div>
      <div class="mt10">退款金额：￥{{ refundInfo.payPrice }}</div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="onClose">取 消</el-button>
      <el-button type="primary" @click="onSubmit">提 交</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { proactiveRefundApi } from '@/api/order';
export default {
  props: ['showProactiveRefundDialog', 'refundInfo'],

  data() {
    return {};
  },

  methods: {
    onClose() {
      this.$emit('closeProactiveRefundDialog');
    },

    onSubmit() {
      let params = {
        orderNo: this.refundInfo.orderNo,
      };

      proactiveRefundApi(params).then((res) => {
        this.$message({
          message: '退款成功',
          type: 'success',
          showClose: true,
        });
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.mt10 {
  margin-top: 10px;
}
</style>
