var dtLang = { "sProcessing": "处理中...", "lengthMenu": '显示 项结果', "sZeroRecords": "没有匹配结果", "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项", "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项", "sInfoFiltered": "(由 _MAX_ 项结果过滤)", "sInfoPostFix": "", "sSearch": "搜索:", "sUrl": "", "sEmptyTable": "表中数据为空", "sLoadingRecords": "载入中...", "sInfoThousands": ",", "oPaginate": { "sFirst": "首页", "sPrevious": "上页", "sNext": "下页", "sLast": "末页" } , "oAria": { "sSortAscending": ": 以升序排列此列", "sSortDescending": ": 以降序排列此列" } }; var askListROHead = ""; var askListROTail = "
序号资源卖方价格
"; var fillAskListRO = function(data) { var html = askListROHead; var lines = data; for (var i = 0; i < lines.length; i++) { html += ""; html += (i + 1); html += ""; html += lines[i].item; html += ""; html += lines[i].seller; html += ""; html += lines[i].price; html += ""; } html += askListROTail; $("#askListRODiv").html(html); $("#askListROTab").DataTable({ "language": dtLang, "rowCallback": function(row, data, displayNum, displayIndex, dataIndex) { } , "headerCallback": function(thead, data, start, end, display) { $(thead).css("background", primaryColor); $(thead).css("color", "white"); $(thead).children().css("background", primaryColor); $(thead).children().css("color", "white"); } , scrollCollapse: false, searching: false, paging: true, pageLength: 5, order: [[0, 'asc']], "columnDefs": [ { "targets": 1, "render": function(data, type, row, meta) { if (data.length > 30) { return "" + data.substring(0, 30) + " ..."; } else { return data; } } }, { "targets": 2, "render": function(data, type, row, meta) { return "" + data.substring(0, 5) + " "; } } ] } ); }; var bidListAllHead = ""; var bidListAllTail = "
序号资源买方价格
"; var fillBidListAll = function(data) { var html = bidListAllHead; var lines = data; for (var i = 0; i < lines.length; i++) { html += ""; html += (i + 1); html += ""; html += lines[i].item; html += ""; html += lines[i].bidder; html += ""; html += lines[i].price; html += ""; } html += bidListAllTail; $("#bidListAllDiv").html(html); $("#bidListAllTab").DataTable({ "language": dtLang, "rowCallback": function(row, data, displayNum, displayIndex, dataIndex) { } , "headerCallback": function(thead, data, start, end, display) { $(thead).css("background", primaryColor); $(thead).css("color", "white"); $(thead).children().css("background", primaryColor); $(thead).children().css("color", "white"); } , scrollCollapse: false, searching: false, paging: true, pageLength: 5, order: [[0, 'asc']], "columnDefs": [ { "targets": 1, "render": function(data, type, row, meta) { if (data.length > 30) { return "" + data.substring(0, 30) + " ..."; } else { return data; } } }, { "targets": 2, "render": function(data, type, row, meta) { return "" + data.substring(0, 5) + " "; } } ] } ); }; var finalListOwnerHead = ""; var finalListOwnerTail = "
序号资源卖方卖方价格买方买方价格已使用使用结果
"; var fillFinalListOwner = function(data) { var html = finalListOwnerHead; var lines = data; for (var i = 0; i < lines.length; i++) { html += ""; html += (i + 1); html += ""; html += lines[i].item; html += ""; html += lines[i].seller; html += ""; html += lines[i].sellerPrice; html += ""; html += lines[i].bidder; html += ""; html += lines[i].bidderPrice; html += ""; html += lines[i].used; html += ""; html += lines[i].result; html += ""; } html += finalListOwnerTail; $("#finalListOwnerDiv").html(html); $("#finalListOwnerDiv").off("click", "tr").on( "click", "tr", function(event) { var pos = ($(this).closest("tr").find("td").eq(0) .text() - 1) / 1; if (pos != undefined) { alert(global.finalListOwner[pos].item); } } ); $("#finalListOwnerTab").DataTable({ "language": dtLang, "rowCallback": function(row, data, displayNum, displayIndex, dataIndex) { } , "headerCallback": function(thead, data, start, end, display) { $(thead).css("background", primaryColor); $(thead).css("color", "white"); $(thead).children().css("background", primaryColor); $(thead).children().css("color", "white"); } , scrollCollapse: false, searching: false, paging: true, pageLength: 5, order: [[0, 'asc']], "columnDefs": [ { "targets": 1, "render": function(data, type, row, meta) { if (data.length > 20) { return "" + data.substring(0, 20) + " ..."; } else { return data; } } }, { "targets": 2, "render": function(data, type, row, meta) { return "" + data.substring(0, 5) + " "; } }, { "targets": 4, "render": function(data, type, row, meta) { return "" + data.substring(0, 5) + " "; } }, { "targets": 6, "render": function(data, type, row, meta) { if (data == "true") { return "是"; } else { return "否"; } } } ] } ); }; var askListRWHead = ""; var askListRWTail = "
序号资源卖方卖方价格出价操作
"; var fillAskListRW = function(data) { var html = askListRWHead; var lines = data; for (var i = 0; i < lines.length; i++) { html += ""; html += (i + 1); html += ""; html += lines[i].item; html += ""; html += lines[i].seller; html += ""; html += lines[i].price; html += ""; html += ""; html += ""; html += ""; html += ""; } html += askListRWTail; $("#askListRWDiv").html(html); $("#askListRWDiv").off("click", ":button").on( "click", ":button", function(event) { var bidArg = { }; var pos = ($(this).closest("tr").find("td").eq(0) .text() - 1) / 1; bidArg.item = global.askListRW[pos].item; bidArg.price = $("#priceInput"+pos)[0].value; if (bidArg.price/1!=bidArg.price || bidArg.price/1<=0){ alert("价格必须是大于0的整数"); return; } executeCurrentContract("bid",JSON.stringify(bidArg),function(data){ alert("竞标资源:"+data.result); flushAllUserData(); }); } ); $("#askListRWTab").DataTable({ "language": dtLang, "rowCallback": function(row, data, displayNum, displayIndex, dataIndex) { } , "headerCallback": function(thead, data, start, end, display) { $(thead).css("background", primaryColor); $(thead).css("color", "white"); $(thead).children().css("background", primaryColor); $(thead).children().css("color", "white"); } , scrollCollapse: false, searching: false, paging: true, pageLength: 5, order: [[0, 'asc']], "columnDefs": [ { "targets": 1, "render": function(data, type, row, meta) { if (data.length > 30) { return "" + data.substring(0, 30) + " ..."; } else { return data; } } }, { "targets": 2, "render": function(data, type, row, meta) { if (data != "Anonymous") { return "" + data.substring(0, 5) + " ";; } else { return data; } } } ] } ); }; var bidListPrivateHead = ""; var bidListPrivateTail = "
序号资源买方价格
"; var fillBidListPrivate = function(data) { var html = bidListPrivateHead; var lines = data; for (var i = 0; i < lines.length; i++) { html += ""; html += (i + 1); html += ""; html += lines[i].item; html += ""; html += lines[i].bidder; html += ""; html += lines[i].price; html += ""; } html += bidListPrivateTail; $("#bidListPrivateDiv").html(html); $("#bidListPrivateTab").DataTable({ "language": dtLang, "rowCallback": function(row, data, displayNum, displayIndex, dataIndex) { } , "headerCallback": function(thead, data, start, end, display) { $(thead).css("background", primaryColor); $(thead).css("color", "white"); $(thead).children().css("background", primaryColor); $(thead).children().css("color", "white"); } , scrollCollapse: false, searching: false, paging: true, pageLength: 5, order: [[0, 'asc']], "columnDefs": [ { "targets": 1, "render": function(data, type, row, meta) { if (data.length > 30) { return "" + data.substring(0, 30) + " ..."; } else { return data; } } }, { "targets": 2, "render": function(data, type, row, meta) { return "" + data.substring(0, 5) + " "; } } ] } ); }; var finalListPrivateHead = ""; var finalListPrivateTail = "
序号资源卖方卖方价格买方买方价格已使用使用结果操作
"; var fillFinalListPrivate = function(data) { var html = finalListPrivateHead; var lines = data; for (var i = 0; i < lines.length; i++) { html += ""; html += (i + 1); html += ""; html += lines[i].item; html += ""; html += lines[i].seller; html += ""; html += lines[i].sellerPrice; html += ""; html += lines[i].bidder; html += ""; html += lines[i].bidderPrice; html += ""; html += lines[i].used; html += ""; html += lines[i].result; html += ""; html += ""; html += ""; } html += finalListPrivateTail; $("#finalListPrivateDiv").html(html); $("#finalListPrivateDiv").off("click", ":button").on( "click", ":button", function(event) { var execArg = { }; var pos = ($(this).closest("tr").find("td").eq(0) .text() - 1) / 1; execArg.item = global.finalListPrivate[pos].item; executeCurrentContract("execute",JSON.stringify(execArg),function(data){ alert("使用资源:"+data.result); flushAllUserData(); }); } ); $("#finalListPrivateTab").DataTable({ "language": dtLang, "rowCallback": function(row, data, displayNum, displayIndex, dataIndex) { } , "headerCallback": function(thead, data, start, end, display) { $(thead).css("background", primaryColor); $(thead).css("color", "white"); $(thead).children().css("background", primaryColor); $(thead).children().css("color", "white"); } , scrollCollapse: false, searching: false, paging: true, pageLength: 5, order: [[0, 'asc']], "columnDefs": [ { "targets": 1, "render": function(data, type, row, meta) { if (data.length > 20) { return "" + data.substring(0, 20) + " ..."; } else { return data; } } }, { "targets": 2, "render": function(data, type, row, meta) { if (data != "Anonymous") { return "" + data.substring(0, 5) + " ";; } else { return data; } } }, { "targets": 4, "render": function(data, type, row, meta) { if (data != "Anonymous") { return "" + data.substring(0, 5) + " ";; } else { return data; } } }, { "targets": 6, "render": function(data, type, row, meta) { if (data == "true") { return "是"; } else { return "否"; } } } ] } ); };