<template>
  <Detail :selectedRow="selectedRow">
    <fieldset class="formFieldSet">
      <legend>其它信息</legend>
      <Des :list="desList" />
    </fieldset>
  </Detail>
</template>

<script lang="ts">
import { defineComponent, PropType, ref, watchEffect } from 'vue';
import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
import { formatValue } from '@/common/methods';
import { ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
import Detail from '../common-detail/index.vue';
import { Des, handleDesList } from '@/common/components/commonDes';
import { handlerManagerList } from '@/common/setup/user';

export default defineComponent({
    name: 'spot-contract-info-detail',
    components: { Detail, Des },
    props: {
        selectedRow: {
            type: Object as PropType<Ermcp3ContractRsp>,
            default: {},
        },
        businessManager: {
            type: Array as PropType<ErmcpLoginUserEx[]>,
            default: [],
        },
    },
    setup(props, context) {
        const loading = ref<boolean>(false);
        // 预览附件
        const { desList, getDesList } = handleDesList();
        // 获取 业务账户
        const { findManagerName } = handlerManagerList(loading, 1);
        watchEffect(() => {
            if (props.selectedRow.contracctstatus) {
                const data = props.selectedRow;
                const list = [
                    { label: '保证金', value: formatValue(data.contractmargin) },
                    { label: '业务员', value: formatValue(findManagerName(data.saleuserid, props.businessManager)) },
                    { label: '跟单员', value: formatValue(findManagerName(data.meruserid, props.businessManager)) },
                    { label: '交易用户', value: formatValue(data.tradeusername) },
                    { label: '备注', value: formatValue(data.remark) },
                ];
                getDesList(list);
            }
        });
        return {
            desList,
        };
    },
});
</script>

<style lang="less">
.custom-detail {
    .upload {
        .look {
            margin-left: 0;
        }
    }
}
</style>;
