<script setup>
const props = defineProps({
  modelValue: { type: Boolean, default: false },
  loading: { type: Boolean, default: false },
  type: { type: String, default: 'tk' },
  platform: { type: String, default: 'local' },
  remark: { type: String, default: '' },
  platformMap: { type: Object, default: () => ({}) },
});

const emit = defineEmits(['update:modelValue', 'update:type', 'update:platform', 'update:remark', 'confirm']);
</script>

<template>
  <el-dialog
    :model-value="modelValue"
    title="补号"
    width="420px"
    @update:model-value="(v) => emit('update:modelValue', v)"
  >
    <el-form label-width="84px">
      <el-form-item label="账号类型">
        <el-select :model-value="type" style="width: 100%" @update:model-value="(v) => emit('update:type', v)">
          <el-option label="Token" value="tk" />
          <el-option label="账号密码" value="account" />
          <el-option label="账号密码+Token" value="account_tk" />
        </el-select>
      </el-form-item>
      <el-form-item label="提取平台">
        <el-select :model-value="platform" style="width: 100%" @update:model-value="(v) => emit('update:platform', v)">
          <el-option v-for="(v, k) in platformMap" :key="k" :value="k" :label="v.label" />
        </el-select>
      </el-form-item>
      <el-form-item label="备注">
        <el-input
          :model-value="remark"
          type="textarea"
          :rows="3"
          placeholder="提取备注（可选）"
          @update:model-value="(v) => emit('update:remark', v)"
        />
      </el-form-item>
    </el-form>
    <template #footer>
      <el-button @click="emit('update:modelValue', false)">取消</el-button>
      <el-button type="warning" :loading="loading" @click="emit('confirm')">确认补号</el-button>
    </template>
  </el-dialog>
</template>
