let objParam, dataObj; let form, table, upload, tableIns, layer, element; let pageNum = 1; function setParams(params) { objParam = JSON.parse(params); console.error(objParam); $('#titleName').html(objParam.supName + '供应商付款记录'); $('#code').html(objParam.code + setPayStatus()); layui.use(["form", "table", 'upload', 'layer', 'element'], function () { form = layui.form; table = layui.table; upload = layui.upload; layer = layui.layer; }); function setPayStatus() { if (objParam.status === '未付') { return "●待付款"; } else { return "●已付款"; } } getSltDetailsInfo(); getPayCarDetails(); } // 供应商付款记录-详情 function getSltDetailsInfo() { let encryptedData = { planId: objParam.planId }; let url = dataUrl + 'backstage/carBalance/getSltDetailsInfo?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData)); ajaxRequest(url, "GET", null, true, function () { }, function (result) { console.error(result); if (result.code === 200) { dataObj = result.data; setTableData(result.data); } }, function (xhr, status, error) { errorFn(xhr, status, error) }, null); function setTableData(obj) { $('#supName').html(objParam.supName); $('#planCode').html("" + obj.code + ""); $('#proName').html(obj.proName); $('#carNum').html(obj.carNum); $('#money').html(obj.money); $('#dispatchDay').html(obj.dispatchDay); $('#remark').html(obj.remark); // 附件文档 setFileTable(obj.fileList); } // 附件文档赋值 function setFileTable(fileList) { $('#file-table tr:not(:first)').remove(); let html = ''; if (fileList && fileList.length > 0) { $.each(fileList, function (index, item) { html += '
' + item.monthPrice + '(' + item.dcUnit + ')' + '
'; } else { html += '' + item.dayPrice + '(' + item.dcUnit + ')' + '
'; } if (item.isOutSet === 1) { html += '' + (item.jcMoney ? item.jcMoney : 0) + '(进出场费)
' } return html; } } else { $('#dispatch-car-table2').css('display', 'none'); } } } // 预览文件 function viewFile(obj) { let fileName = obj.fileName.toLowerCase(); if (fileName.indexOf('png') > -1 || fileName.indexOf('jpg') > -1 || fileName.indexOf('jpeg') > -1) { layer.photos({ shade: 0.5, photos: { "title": "图片预览", "start": 0, "data": [ { "alt": "layer", "pid": 1, "src": fileUrl + obj.fileUrl + '?token=' + sessionStorage.getItem("gz-token"), } ] } }); } else { // 调用公司的预览文件的服务 commonViewFile(obj.fileUrl); } } // 下载文件 function downLoadFile(obj) { let url = dataUrl + "sys/file/download?fileId=" + obj.id; downLoadFileUtil(url, obj.fileName, null); } // 查看附件 function viewFileDetail(obj, type) { let title = '行驶证/挂靠协议驾驶证/身份证/导航图' if (type === 1) { title = '行驶证/挂靠协议驾驶证/身份证/导航图' } else if (type === 2) { title = '操作证/身份证/导航图' } obj.type = type; openIframeByParamObj("viewFileDetail", title, '../../car_demand_plan/child/view_file_detail.html', "92%", "95%", obj); } // 需求计划详情 function viewPlanDetail(obj) { obj.id = obj.planId; obj.code = obj.planCode || obj.code; let content = '../car_demand_plan/child/apply_plan_detail.html'; if (obj.code.indexOf('spec-') > -1) { content = '../car_demand_plan/child/emerg_internal_car_detail.html'; } openIframeByParamObj2("viewPlanDetail", "车辆需求计划", content, "92%", "95%", obj); } // 打印 function print() { $("#main-box").print({ globalStyles: true, mediaPrint: false, noPrintSelector: ".no-print", iframe: true, append: null, prepend: null, manuallyCopyFormValues: true, deferred: $.Deferred() }); } // 关闭页面 function closePage(type) { let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 parent.layer.close(index); // 再执行关闭 }