<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>业务管理-查看业务</title>
    <link rel="stylesheet" type="text/css" href="/css/external/fileUploadBase.css">
    <style>
        .btn-info:active,
        .btn-info:focus {
            background-color: #fff;
        }

        li.notcompanyli:hover {
            color: #333 !important;
        }

        .base-extend .newTabAddUpdateBox td.enter .viewDetailWord {
            width: 0.35rem;
            text-align: center;
            top: 0.08rem;
            color: #333 !important;
            cursor: default;
            font-style: normal;
        }

        .error option, select.error {
            color: #333 !important;
        }

        .editLastRecord, .saveLastRecord {
            line-height: 0.2rem;
        }

    </style>
</head>
<body>
<div class="base-extend">
    <div class="addHeader">
        <ol class="breadcrumb" style="margin-top:0;">
            <i class="icon-chevron-sign-left newBackBtn"></i>
            <li>业务管理</li>
            <li>查看业务</li>
        </ol>
    </div>
    <div class="detailContentBox">
        <p class="detailContentBox-title">查看业务</p>
        <!-- <ul class="projectListTab">
            <li class="active">业务信息</li>
            <li>货物信息</li>
        </ul> -->
        <form class="form-horizontal" autocomplete="off">
            <div class="newTabAddUpdateBox" style="padding-top: 0;top: 0.6rem!important;bottom: 0rem">
                <input type="hidden" name="basicId" th:value="${businessBasicInfo?.id}">
                <div class="row">
                    <table>
                        <tr>
                            <td colspan="4">
                                <span class="detailContentBox-tabletitle">业务信息</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">核心企业名称：</td>
                            <td width="35%" style="background:#fff;" th:text="${businessBasicInfo?.customer?.enterpriseName}"></td>
                            <td width="15%">贸易平台：</td>
                            <td width="35%" style="background:#fff;"  th:text="${businessBasicInfo?.platform.platformName}"></td>
                        </tr>
                        <tr>
                            <td width="15%">业务名称：</td>
                            <td width="35%" style="background:#fff;" th:text="${businessBasicInfo?.businessName}"></td>
                            <td width="15%">业务编号：</td>
                            <td width="35%" style="background:#fff;"  th:text="${businessBasicInfo?.businessNumber}"></td>

                        </tr>
                        <tr>
                            <td width="15%">履约保证金上限：</td>
                            <td width="35%" style="background:#fff;" class="enter">
                                <input type="text" name="depositLimit" readonly class="form-control" maxlength="50" th:value="${businessBasicInfo?.depositLimit}">
                                <i class="viewDetailWord">元</i>
                            </td>

                            <td width="15%">业务经理：</td>
                            <td width="35%" style="background:#fff;" th:text="${businessBasicInfo?.userName}">
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">项目内容：</td>
                            <td colspan="3" style="background:#fff;"  th:text="${businessBasicInfo?.contents}"></td>
                        </tr>
                        <!-- <tr>
                            <td width="15%">创建时间：</td>
                            <td width="35%" style="background:#fff;" th:text="${#calendars.format(businessBasicInfo?.gmtCreate,'yyyy-MM-dd')}"></td>
                            <td width="15%">买方质保金：</td>
                            <td width="35%" style="background:#fff;" th:text="${businessBasicInfo?.purchaserRetentionMoney}" class="amountInput"></td>
                            <td width="15%">业务状态：</td>
                            <td width="35%" style="background:#fff;" class="status" th:text="${businessBasicInfo?.businessBasicDict?.name}"></td>
                        </tr> -->
                        <!-- <tr>
                            <td width="15%">验收经办人：</td>
                            <td width="35%" style="background:#fff;"  th:text="${businessBasicInfo?.checkOperator}"></td>
                            <td width="15%">结算经办人：</td>
                            <td width="35%" style="background:#fff;"  th:text="${businessBasicInfo?.settlementOperator}"></td>
                        </tr> -->

                    </table>
                </div>

                <div class="row">
                    <table>
                        <tr>
                            <td colspan="2">
                                <span class="detailContentBox-tabletitle">供应商</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="10%">
                                <span>序号</span>：
                            </td>
                            <td width="30%">
                                <span class="">供应商名称</span>：
                            </td>
                            <!-- <td width="30%">
                                <span class="">资金占用费</span>：
                            </td>
                            <td width="30%">
                                <span class="">质保金</span>：
                            </td> -->
                        </tr>
                        <tbody>
                            <tr th:each="supplier,supplierStat:${businessBasicInfo?.businessSupplierInfos}">
                                <td style="background-color: #fff" th:text="${supplierStat.count}"></td>
                                <td style="background-color: #fff" th:text="${supplier.supplierName}"></td>
                                <!-- <td style="background-color: #fff" th:text="${supplier.fundPossessionCost}" class="amountInput"></td>
                                <td style="background-color: #fff" th:text="${supplier.retentionMoney}" class="amountInput"></td> -->
                            </tr>
                        </tbody>
                    </table>
                </div>

                <div class="row">
                    <!-- 附件信息回显 -->
                    <div class="fileInfoListOriginal" style="display:none" th:each="file,files:${businessBasicInfo?.fileStorage}">
                        <input type="text" class="originalId" th:value="${file?.id}">
                        <input type="text" class="originalUrl" th:value="${file?.path}">
                        <input type="text" class="originalType" th:value="${file?.fileType}">
                        <input type="text" class="originalName" th:value="${file?.originalName}">
                        <input type="text" class="originalSize" th:value="${file?.size}">
                    </div>
                    <table class="fileInfoListBox">
                        <tr>
                            <td colspan="4">
                                <span class="detailContentBox-tabletitle">招投标文件</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%" class="fileRowspan" rowspan="1" style="text-align:left;">
                                <span>招投标文件</span>
                            </td>
                            <td colspan="3" class="enter addFileList">
                                <input type="file" class="fileinput" multiple style="display:none">
                                <div class="uploaderFile">
                                    <div class="fileContent">
                                        <span class="spanHolder">上传附件</span>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>

                <!-- <div class="row">
                    <table>
                        <tr>
                            <td colspan="4">
                                <span class="detailContentBox-tabletitle">金额信息</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">入账：</td>
                            <td width="35%" style="background:#fff;" class="amountInput"></td>
                            <td width="15%">出账：</td>
                            <td width="35%" style="background:#fff;" class="amountInput"></td>
                        </tr>
                    </table>
                </div> -->
            </div>

        </form>

    </div>
</div>

</body>
<script>
    $(function () {

        $(".amountInput").each(function (i,ele) {
            $(ele).text(commaDelimiter($(ele).text()))
        })

        // 附件相关dom
        var fileWrapperbasic = '<div class="file-wrapper"><div class="file-icon" style="color: #5AC4FC;"><div class="file-icon-image"></div></div>' +
            '<div class="content"><div class="file-name"></div><div class="file-size small text-muted"></div></div>' +
            '<div class="actions" style="width:0.5rem"><a target="_blank" class="btn-yulan-file">' +
            '<em style="font-style:normal">预览</em><i class="operateIconfont operateIcon-yulan"></i></a></div>' +
            '<div class="actions" style="width:0.5rem"><a class="btn-xiazai-file">' +
            '<em style="font-style:normal">下载</em><i class="operateIconfont operateIcon-xiazai"></i></a></div></div>';

        // 展示原先有的附件
        function showOriginalFile(source, insert) {
                for (var j = 0; j < $(source).length; j++) {
                    var originalFileWrapper = $(fileWrapperbasic).clone();
                    originalFileWrapper.find('.file-name').text($(source).eq(j).find('.originalName').val());
                    originalFileWrapper.find('.file-name').attr('originalid', $(source).eq(j).find('.originalId').val());
                    if (parseFloat($(source).eq(j).find('.originalSize').val()) < 1048576) {
                        originalFileWrapper.find('.file-size').text(($(source).eq(j).find('.originalSize').val() / 1024).toFixed(2) + "KB");
                    } else {
                        originalFileWrapper.find('.file-size').text(($(source).eq(j).find('.originalSize').val() / 1024 / 1024).toFixed(2) + "MB");
                    }
                    ;
                    var originaltype = $(source).eq(j).find('.originalType').val().toUpperCase();
                    if (originaltype == '.JPG' || originaltype == '.JPEG' || originaltype == '.PNG' || originaltype == '.BMP') {
                        originalFileWrapper.find('.file-icon-image').css('background-image', 'url(' + $(source).eq(j).find('.originalUrl').val() + ')');
                    } else {
                        originalFileWrapper.find('.file-icon-image').append('<i class="icon icon-file-pdf"></i>');
                    }
                    ;
                    originalFileWrapper.find('.btn-delete-file').addClass('btn-delete-originalfile').removeClass("btn-delete-file");

                    originalFileWrapper.find('.btn-yulan-file').attr('href', '/fileStorage/preview?fileId=' + $(source).eq(j).find('.originalId').val());
                    originalFileWrapper.find('.btn-xiazai-file').attr('href', '/fileStorage/downloadFile?fileId=' + $(source).eq(j).find('.originalId').val());
                    $(insert).find('.fileContent').append(originalFileWrapper)
                }
                ;
                j = null;
                if ($(insert).find('.file-wrapper').length > 0) {
                    $(insert).find('.spanHolder').remove();
                }
                ;
        };

        // 展示原附件
        showOriginalFile('.fileInfoListOriginal', '.addFileList');

        // 附件信息没有时--显示'无'
        $('.fileInfoListBox').each(function (i, ele) {
            if ($(ele).find('.file-wrapper').length <= 0) {
                $(ele).find('.fileContent').empty().html('<span style="padding-left:0.1rem;position:relative;top:0.08rem;">无附件信息</span>')
            }
            ;
        });

        //切换表格
        $(".projectListTab li").click(function () {

            if ($(this).text() == '基础信息') {
                $(".yk_rightcontent").load('/business/management/findDetail?businessBasicInfoId='+businessQuery.detailId);
            } else if ($(this).text() == '货物信息') {
                $(".yk_rightcontent").load('/business/management/findBillGoods?businessBasicInfoId='+businessQuery.detailId);
            }
        });

        $(".newBackBtn").click(function () {
            $(".yk_rightcontent").load('/business/management/list');
        })

    })

</script>
</html>
