<template>
  <el-form label-width="120px" class="view" v-loading="formLoading" :class="{ 'mobile-card': mobile }">
    <el-row>
      <el-col :span="24">
        <el-form-item label="退款状态">
          <div class="el-input el-input--default is-disabled el-input--suffix ">{{
            getDictLabel(DICT_TYPE.TRADE_AFTER_SALE_STATUS, formData.status) }}</div>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <el-form-item>
          <div class="el-input el-input--default is-disabled el-input--suffix ">提醒: <br />
          如果未发货，请点击同意退款给买家。<br />
          如果实际已发货，请主动与买家联系。<br />
          如果订单整体退款后，优惠券和余额会退还给买家.</div>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>
<script lang="ts" setup>
import * as AfterSaleApi from '@/api/mall/trade/afterSale/index'
import { DICT_TYPE, getDictLabel, getDictObj } from '@/utils/dict'
import { useAppStore } from '@/store/modules/app'
const appStore = useAppStore()
const mobile = computed(() => appStore.getMobile)
defineOptions({ name: 'TradeAfterSaleDetail' })
const formData = ref({
  order: {},
  logs: []
})

const props = defineProps({
  obj: {
    default: {}
  }
})
/** 获得详情 */
const getDetail = async (id) => {
  if (id) {
    const res = await AfterSaleApi.getAfterSale(id)
    // 没有表单信息则关闭页面返回
    if (res == null) {
      message.notifyError('售后订单不存在')
      close()
    }
    formData.value = res
  }
}
onMounted(() => {
  getDetail(props.obj.id)
})
defineExpose({ getDetail }) // 提供 open 方法，用于打开弹窗
</script>

<style src="@/styles/PcComponents.css"  lang="scss" scoped></style>
