<template>
  <!-- 确认提货-->
  <div>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType, ref } from 'vue';
import Drawer from '@/common/components/drawer/index.vue';
import { WrFinanceBuyApply, WrOutInApply } from '@/services/go/wrtrade/interface';
import { ModalEnum } from '@/common/constants/modalNameEnum';
import { _closeModal } from '@/common/setup/modal/modal';
import { Modal } from 'ant-design-vue';
import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
import { WROutConfirmReq, WRTradeFinanceBuyCancelReq } from '@/services/proto/warehousetrade/interface';
import { getUserId } from '@/services/bus/account';
import { v4 as uuidv4 } from 'uuid';
import Long from 'long';
import { WROutConfirm } from '@/services/proto/warehousetrade';

export default defineComponent({
  name: ModalEnum.financing_manager_apply_cancel,
  components: { Drawer },
  emits: ['cancel', 'update'],
  props: {
    selectedRow: {
      type: Object as PropType<WrOutInApply>,
      default: {},
    },
  },
  setup(props, context) {
    const { visible, cancel } = _closeModal(context);
    const loading = ref<boolean>(false);
    Modal.confirm({
      title: '确认提货',
      content: '是否确认提货！',
      onOk: submit,
      onCancel: cancel,
    });
    function submit() {
      // 挂牌撤单请求
      const paramReq: WROutConfirmReq = {
        applyid: Long.fromString(props.selectedRow.applyid),
        operatesrc: 2,
        operateid: getUserId(),
      };
      requestResultLoadingAndInfo(WROutConfirm, paramReq, loading, ['提货成功', '提货失败:']).then(() => {
        cancel(true);
      });
    }
    return {
      visible,
      cancel,
      submit,
      loading,
    };
  },
});
</script>