<template>
  <ele-modal
    :width="400"
    :visible="visible"
    :title="`工单号：${taskId}`"
    :body-style="{ paddingBottom: '28px' }"
    @update:visible="updateVisible"
    :footer="null"
    @ok="save"
  >
    <div
      class="qrcode-list"
      style="display: flex; justify-content: space-around"
    >
      <div>
        <img :src="qrcode" width="240" height="240" />
        <div
          style="
            display: flex;
            justify-content: center;
            font-size: 26px;
            padding-top: 20px;
          "
          >微信扫一扫</div
        >
      </div>
    </div>
  </ele-modal>
</template>
<script lang="ts" setup>
  import { User } from '@/api/system/user/model';
  import { reactive, ref } from 'vue';

  defineProps<{
    // 弹窗是否打开
    visible: boolean;
  }>();

  const emit = defineEmits<{
    (e: 'done', user: User): void;
    (e: 'update:visible', visible: boolean): void;
  }>();

  /* 更新visible */
  const updateVisible = (value: boolean) => {
    emit('update:visible', value);
  };

  const qrcode = ref('https://file.jimeigroup.cn/reg-code3/hgkghiji.png');

  // 用户信息
  const form = reactive<User>({
    userId: undefined,
    nickname: undefined
  });

  const chooseUser = (item: User) => {
    form.userId = item.userId;
    form.nickname = item.nickname;
  };

  const save = () => {
    emit('done', form);
  };
</script>
<style scoped lang="less"></style>
