$(function(){
tabFlagMap["shop"] = false;
tabFuncMap.shop = function(){
var index = 1;
$.each(shopoddsdata,function(key,map){
var gate = gatetable[map.ID];
if(gate){
var tr = $("
");
$("#shopTable tbody").append(tr);
var shopItemTd = $(" | ");
var shopPriceTd = $(" | ");
var shopName = $(""+gate.NAME+" | ").append(""+gate.PY+"");
var ticket = gate["门票"];
var ticketRefresh = gate["刷新票"];
var discover = gate["发现"];
var unlock = gate["解锁"];
if(discover > 0) {
shopName.append("
发现:").append(findMapTips(discover));
}
if(unlock > 0) {
shopName.append("
解锁:").append(findMapTips(unlock));
}
if(ticket > 0) {
shopName.append("
门票:").append(findMapTips(ticket));
}
if(ticketRefresh > 0) {
shopName.append("
刷新票:").append(findMapTips(ticketRefresh));
}
tr.append($(""+map.INDEX+" | "));
tr.append(shopName);
tr.append(shopItemTd);
tr.append(shopPriceTd);
for(var i=1;i<=10;i++){
var shopOdds = map["商品"+i];
var shopItem = shopitemdata[map["商品"+i].split(":")[0]];
var shopItemDiv = $("");//需要空白占位
shopItemTd.append(shopItemDiv);
var shopPriceDiv = $("");//需要空白占位
shopPriceTd.append(shopPriceDiv);
shadow(shopItemDiv,shopPriceDiv);
if(shopOdds){
if(shopItem){
//区分是道具还是随机数据
if(shopItem['道具ID']>0){
var item = findMapTips(shopItem['道具ID']);
shopItemDiv.append(item);
if(item.html() == ""){
shopItemDiv.append("商品数据缺失:"+map["商品"+i]);
}
}else{
var item = shopItem.NAME;
shopItemDiv.append(item);
}
//区分是金钱购买还是道具换购
if(shopItem["货币类型"] == "0"){
var price = shopItem["价格"];
if(price< 10000){
}else if(price < 100000000){
price = price / 10000;
price += "万";
}else{
price = price / 100000000;
price += "亿";
}
shopPriceDiv.append(" = "+price+"");
}else{
var item = findMapTips(shopItem["货币类型"]).prepend(" = ");
shopPriceDiv.append(item.append(" × "+shopItem["价格"]).append(""));
if(item.html() == ""){
shopPriceDiv.append("货币数据缺失:"+map["商品"+i]);
}
}
}
}
}
}
});
/*shopTable*/
$('#shopTable').dataTable( {
"pagingType": "full_numbers",
"language": {
"lengthMenu": "每页 _MENU_ 条记录",
"zeroRecords": "没有找到商品,一定是你没充值VIP!",
"info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
"infoEmpty": "空荡荡的没有商品",
"infoFiltered": "(从 _MAX_ 条商品过滤)",
"search": "搜索(可用商店名称首字母):",
"paginate": {
"first": "首页(W)",
"last": "末页(S)",
"next": "下一页(D)",
"previous": "上一页(A)"
},
},
// 默认按照索引排序,且隐藏索引列
"order": [[ 0, "asc" ]],
"columnDefs": [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
},
]
});
$('#shopTable th:nth(0)').css("text-align","center");
$('#shopTable th:nth(1)').css("text-align","right");
$('#shopTable th:nth(2)').css("text-align","left");
}
});
//悬停阴影
function shadow(item,price){
//
item.mouseenter(function(){
item.css("background-color","#E6E6E6");
price.css("background-color","#E6E6E6");
});
item.mouseleave(function(){
item.css("background-color","");
price.css("background-color","");
});
//
price.mouseenter(function(){
item.css("background-color","#E6E6E6");
price.css("background-color","#E6E6E6");
});
price.mouseleave(function(){
item.css("background-color","");
price.css("background-color","");
});
}