<!--
 * @Descripttion: (售后单记录表/tb_order_refund 详情弹窗)
 * @version: (1.0)
 * @Author: (lwh)
 * @Date: (2023-08-29)
 * @LastEditors: (lwh)
 * @LastEditTime: (2023-08-29)
-->
 <template>
  <el-dialog v-model="props.modelValue" title="售后单记录表信息详情" width="900px" @closed="closeDialog" @open="openDialog">
    <el-form ref="formRef" :model="formData" :disabled="true">

      <el-row :gutter="20">
	  

    
    
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单guid" >
              <el-input v-model="formData.orderGuid"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户guid" >
              <el-input v-model="formData.customerGuid"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="售后类型(1退货退款 2退货(无需退款) 3换货)" >
              <el-select v-model="formData.refundType" >
                <el-option v-for="item in  refund_type " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户退货原因" >
              <el-select v-model="formData.refundReason" >
                <el-option v-for="item in  refund_reason " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户退款说明" >
              <el-input v-model="formData.customerRefundDesc"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户退款凭证" >
              <UploadImage ref="uploadRef" v-model="formData.customerRefundImg" :limit="1" :fileSize="5"
              :drag="true" :isShowTip="false" :isDisabled="true"/>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="商品收货状态(1未收到货 2已收到货)" >
              <el-select v-model="formData.goodsReceiveStatus" >
                <el-option v-for="item in  goods_receive_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="商家审核状态(1待审核 2已同意 3已拒绝)" >
              <el-select v-model="formData.merchantAuditStatus" >
                <el-option v-for="item in  merchant_audit_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="商家拒绝原因(说明)" >
              <el-input v-model="formData.merchantRefuseDesc"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="实际退款金额" >
              <el-input v-model="formData.refundMoney"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="商家退货地址guid" >
              <el-input v-model="formData.shopRefundAddressGuid"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="用户是否发货(1未发货 2已发货)" >
              <el-select v-model="formData.isCustomerSend" >
                <el-option v-for="item in  is_customer_send " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户发货时间" >
              <el-date-picker v-model="formData.customerSendTime" type="datetime" :teleported="false" isabledStr}></el-date-picker>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户发货物流公司guid" >
              <el-input v-model="formData.logisticsCompanyGuid"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户发货物流单号" >
              <el-input v-model="formData.expressNo"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="售后单状态(1进行中 2已拒绝 3已完成 4已取消)" >
              <el-select v-model="formData.orderRefundStatus" >
                <el-option v-for="item in  order_refund_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>






      </el-row>
    </el-form>
  </el-dialog>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { reactive, ref, watch } from "vue";


// 打开弹窗时回调
const openDialog = async () => {
   await getrefund_type()
   await getrefund_reason()
   await getgoods_receive_status()
   await getmerchant_audit_status()
   await getis_customer_send()
   await getorder_refund_status()

}

const formData = ref({
  ...props.data,
});
watch(props, async (v) => {
  formData.value = v.data;
});

// -业务参数
// 售后类型(1退货退款 2退货(无需退款) 3换货)字典选项列表
const refund_type = ref([]);
// 客户退货原因字典选项列表
const refund_reason = ref([]);
// 商品收货状态(1未收到货 2已收到货)字典选项列表
const goods_receive_status = ref([]);
// 商家审核状态(1待审核 2已同意 3已拒绝)字典选项列表
const merchant_audit_status = ref([]);
// 用户是否发货(1未发货 2已发货)字典选项列表
const is_customer_send = ref([]);
// 售后单状态(1进行中 2已拒绝 3已完成 4已取消)字典选项列表
const order_refund_status = ref([]);

// -业务方法
// 字典获取
async function getrefund_type() {
  await proxy.getDicts('refund_type').then((res) => {
    refund_type.value = res.data
  })
}
// 字典获取
async function getrefund_reason() {
  await proxy.getDicts('refund_reason').then((res) => {
    refund_reason.value = res.data
  })
}
// 字典获取
async function getgoods_receive_status() {
  await proxy.getDicts('goods_receive_status').then((res) => {
    goods_receive_status.value = res.data
  })
}
// 字典获取
async function getmerchant_audit_status() {
  await proxy.getDicts('merchant_audit_status').then((res) => {
    merchant_audit_status.value = res.data
  })
}
// 字典获取
async function getis_customer_send() {
  await proxy.getDicts('is_customer_send').then((res) => {
    is_customer_send.value = res.data
  })
}
// 字典获取
async function getorder_refund_status() {
  await proxy.getDicts('order_refund_status').then((res) => {
    order_refund_status.value = res.data
  })
}



// 基础参数
const formRef = ref();
const labelWidth = 100;
const { proxy } = getCurrentInstance()
const props = defineProps({
  modelValue: Boolean,
  data: Object,
  done: Function,
});
const emits = defineEmits(["update:modelValue"]);


// -基础方法
const closeDialog = () => {
  emits("update:modelValue", false);
};

</script>
