let objParam, dataObj; let form, table, upload, tableIns, layer, element; let pageNum = 1; function setParams(params) { objParam = JSON.parse(params); $('#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(); } //admission fee // 供应商付款记录-详情 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) { if (result.code === 200) { dataObj = result.data; setTableData(result.data); } }, function (xhr, status, error) { errorFn(xhr, status, error) }, null); function setTableData(obj) { console.log(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 += '
' + parseFloat(item.monthPrice).toFixed(2) + '(' + item.dcUnit + ')' + '
'; } else { html += '' + parseFloat(item.dayPrice).toFixed(2) + '(' + item.dcUnit + ')' + '
'; } if (item.isOutSet === 1) { html += '' + (item.jcMoney ? parseFloat(item.jcMoney).toFixed(2) : 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 enter(obj) { var html = ` `; layer.open({ type: 1, title: '录入信息', content: html, area: ['500px', '300px'], shade: 0.3, btn: [], // 不显示默认按钮 success: function (layero) { // 渲染表单 form.render(); // 表单提交事件 form.on('submit(submitForm)', function (data) { obj.days = data.field.days; obj.fee = data.field.fee; let params = { encryptedData: JSON.stringify(obj) } let url = dataUrl + 'backstage/carBalance/updatePayCar'; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { getPayCarDetails() } }, function (xhr, status, error) { errorFn(xhr, status, error) }, null); // 显示成功提示 layer.msg('录入成功!', {icon: 1}); // 关闭弹窗 layer.closeAll('page'); return false; // 阻止表单跳转 }); // 重置按钮事件 layero.find('#resetForm').on('click', function () { form.val('feeForm', { 'days': '', 'fee': '' }); return false; // 阻止默认重置行为 }); } }); } // 打印 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); // 再执行关闭 }