<template>
  <!-- 提货查询 完成备货-->
  <a-modal class="add-custom custom-detail"
           title="完成备货"
           centered
           v-model:visible="visible"
           :maskClosable="false"
           @cancel="cancel"
           width="890px">
    <template #footer>
        <a-button key="submit"
                  type="primary"
                  :loading="loading"
                  @click="submit">完成备货</a-button>
      <a-button key="cancel"
                type="primary"
                :loading="loading"
                @click="cancel">关闭</a-button>
    </template>
    <CommomDetail :selectedRow="selectedRow" />
  </a-modal>
</template>
<script lang="ts">
import { defineComponent, PropType, ref } from 'vue';
import { closeModal } from '@/common/setup/modal/index';
import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
import CommomDetail from '../common-detail/index.vue';
import {
    GoodsPickupConfirmReq,
    GoodsPickupOperateReq,
    t2bExchConfirmBusinessReq,
    TradeGoodsInfo
} from "@/services/proto/manager/interface";
import {getTimeValue} from "@/utils/time";
import {getUserId} from "@/services/bus/account";
import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
import {goodsPickupConfirm, goodsPickupOperate, t2bExchConfirmBusiness} from "@/services/proto/manager";
import {QhjTradeGoodsPickup} from "@/services/go/ermcp/qhj/interface";
import {getLongTypeLoginID} from "@/services/bus/login";
import {getUUID} from "ant-design-vue/es/vc-select/utils/commonUtil";
import Long from "long";

export default defineComponent({
    name: 'platinum_pick_query_complete_stocking',
    components: { CommomDetail },
    props: {
        selectedRow: {
            type: Object as PropType<QhjTradeGoodsPickup>,
            default: {},
        },
    },
    setup(props, context) {
        const { visible, cancel } = closeModal('platinum_pick_query_complete_stocking');
        const loading = ref<boolean>(false);
        function submit() {
            let reqParams: GoodsPickupConfirmReq = {
                TakeOrderID: Long.fromString(props.selectedRow.takeorderid), // uint64 提货单号
                Auditer: getUserId(), // uint64 审核人
                CheckRemark: "", // string 审核备注
                ClientTicket: getUserId().toString(), // string 客户端流水号
                MarketID: props.selectedRow.marketid,
            }
            requestResultLoadingAndInfo(goodsPickupConfirm, reqParams, loading, ['完成备货成功', '完成备货失败:']).then(() => {
                cancel();
                context.emit('refresh');
            });
        }
        return {
            cancel,
            visible,
            loading,
            submit,
        };
    },
});
</script>
