<!--现金流管理--查看入账 -->
<div class="base-extend">
    <div class="modal fade businessDialog" id="myModal-viewEntryInfo" data-backdrop="static">
        <div class="modal-dialog" style="width:12rem;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true" style="font-size:0.18rem">×</span><span class="sr-only">关闭</span>
                </button>
                <span class="modal-title">查看</span>
            </div>
            <div class="modal-content">
                <div class="newTabAddUpdateBox"
                     style="position:static;border:none;padding-left:0.2rem;padding-right:0.2rem;padding-bottom:0;">
                    <div class="row">
                        <table>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">出入账类型</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.entryOutType} ==1 ? '入账' : '出账' ">
                                </td>
                                <td width="15%">
                                    <span class="required_fileds_star">核心企业名称</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.customerName}">
                                </td>
                            </tr>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">业务名称</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" readOnly class="form-control "
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.businessName}">
                                </td>
                                <td width="15%">
                                    <span class="required_fileds_star">业务编号</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo?.businessNumber}">
                                </td>
                            </tr>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">公司归属</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control" readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageEntryInfo.companyBelongName}">
                                </td>
                                <td width="15%">
                                    <span class="required_fileds_star">银行名称</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageEntryInfo.bankName}">
                                </td>
                            </tr>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">银行卡号</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <input type="text" class="form-control" readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageEntryInfo.bankAccount}">
                                </td>
                            </tr>
                            <tr>
                                <!-- <td width="15%">
                                    <span class="required_fileds_star">入账方</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageEntryInfo.entryParty}=='1'?'买方':'卖方'">
                                </td> -->
                                <td width="15%">
                                    <span class="required_fileds_star">类型</span>：
                                </td>
                                <td wcolspan="3" class="enter">
                                    <input type="text" readOnly class="form-control " name="cashType"
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.cashTypeDict?.name}">
                                </td>
                                <td width="15%">
                                    <span class="required_fileds_star">币种</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.currencyDict?.code}">
                                </td>
                            </tr>
                            <tr class="amountTr">
                                <td width="15%">
                                    <span class="required_fileds_star">（实际）入账金额</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <input type="text" class="form-control amountInput" readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.amount}">
                                </td>
                            </tr>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">入账日期</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <input type="text" class="form-control" readOnly
                                           th:value="${#calendars.format(cashFlowAddEntryInfoVo?.cashFlowManageBaseVo.cashDate,'yyyy-MM-dd')}">
                                </td>
                            </tr>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">当前执行人</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <input type="text" class="form-control " readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.cashFlowManageEntryInfo?.currExecutor}">
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="row">
                        <!-- 附件信息回显 -->
                        <div class="fileInfoListOriginal" style="display:none"
                             th:each="file,files:${cashFlowAddEntryInfoVo?.fileList}">
                            <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>

                    </div>

                    <div class="row">
                        <table>
                            <tr>
                                <td width="15%"><span>结算清单单号</span></td>
                                <td width="17%"><span>结算总金额</span></td>
                                <td width="17%"><span>本次分配金额</span></td>
                                <td width="17%"><span>保理本息</span></td>
                                <td width="17%"><span>实退折扣金额</span></td>
                                <td width="17%"><span>平台利润</span></td>
                            </tr>
                            <tr th:each="list,lists:${cashFlowAddEntryInfoVo?.relationLedgerInfoVo?.billGoodsInfoVoList}">
                                <td style="background-color: #fff;" class="amountText" th:text="${list?.billInformationNumber}"></td>
                                <td style="background-color: #fff;" class="amountText" th:text="${list?.billAmountTotal}"></td>
                                <td style="background-color: #fff;" class="amountText" th:text="${list?.currentAssignAmount}"></td>
                                <td style="background-color: #fff;" class="amountText" th:text="${list?.principalInterest}"></td>
                                <td style="background-color: #fff;" class="amountText" th:text="${list?.discountAmount}"></td>
                                <td style="background-color: #fff;" class="amountText" th:text="${list?.platformProfit}"></td>
                            </tr>
                        </table>

                        <table>
                            <tr>
                                <td width="15%">
                                    <span class="required_fileds_star">资金占用费</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control amountInput" readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.relationLedgerInfoVo?.possessionCost}">
                                </td>
                                <td width="15%">
                                    <span class="required_fileds_star">质保金</span>：
                                </td>
                                <td width="35%" class="enter">
                                    <input type="text" class="form-control amountInput" readOnly
                                           th:value="${cashFlowAddEntryInfoVo?.relationLedgerInfoVo?.retentionMoney}">
                                </td>
                            </tr>
                            <tr class="appendix hide">
                                <td width="15%">
                                    <span class="">附件</span>：
                                </td>
                                <td class="enter addFileList" colspan="3">
                                    <input type="file" name="file" class="fileinput" style="display:none">
                                    <div class="uploaderFile">
                                        <div class="fileContent">
                                            <span class="spanHolder">上传附件</span>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr class="richText hide">
                                <td width="15%">
                                    <span class="">附件</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <textarea id="unifiedEditor" class="" style="height:250px;width:100%;"
                                    th:utext="${cashFlowAddEntryInfoVo?.cashFlowManageEntryInfo?.fileText}"></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td width="15%">
                                    <span class="">备注</span>：
                                </td>
                                <td colspan="3" class="enter">
                                    <textarea maxlength="300" style="resize:none;padding:0.05rem 0.1rem !important;"
                                              class="form-control autosize-transition " readOnly rows="3"
                                              th:text="${cashFlowAddEntryInfoVo?.cashFlowManageBaseVo?.remark}"></textarea>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default btn-white btn-info canclebtn" data-dismiss="modal"
                            style='margin-bottom:0;'>关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {

        if(!$('.originalId').val()) {
            $('.richText').removeClass('hide')
        }else{
            $('.appendix').removeClass('hide')
        }
        // 富文本框
        var editor = new UE.ui.Editor({
            'fullscreen':false
        });
        editor.render('unifiedEditor');

        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');

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

    })
</script>