<template>
  <el-dialog title="存款审核" v-model="formOpen" width="500px" append-to-body draggable @close="cancel" :close-on-click-modal = "false">
    <el-form ref="dictRef" :model="form" :rules="rules" label-width="100" size="small">
      <el-form-item label="赠送金额" :prop="freeAmount">
        <el-input-number placeholder="赠送金额" v-model="form.freeAmount" style="
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 100%;
                  " :controls="false" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import {
  verifyDeposit
} from "@/api/business/entrust/deposit";
import { ref } from 'vue';

const title = ref('')
const selectionName = ref('')
const selectionUser = ref(null)

import { listUser } from "@/api/system/user";
import { setWorkOrderService } from '@/api/business/crm/workOrder';
const props = defineProps({
  getList: {
    type: Function,
    default: () => { },
  },
});

const { getList } = toRefs(props);

const formOpen = ref(false)
const form = ref({
})
const rules = ref({})
const { proxy } = getCurrentInstance()
const ids = ref([])

function submitForm() {
  form.value.status = 1
  proxy.$modal.confirm(`确认审核通过么？`)
    .then(_ => {
      verifyDeposit(form.value).then(res => {
        getList.value()
        cancel()
      })
    }).then(res => {
      getList()
    })
}

function cancel() {
  formOpen.value = false
  reset()
}

function open(formOption) {
  console.log(formOption)
  formOpen.value = true
  form.value = proxy.deepClone(formOption)
}

function reset() {
  form.value = {}
}


// 暴露给父组件的方法
defineExpose({
  open
})
</script>