*實際成交與否,以最終發送之簡訊通知為準<\/span>")},error:function(n,t,i){console.log(n.status);console.log(i)},complete:function(){}});n=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4)))&&(n=!0);n&&$("html, body").animate({scrollTop:$("#scroll_here").offset().top},0)});var FinishAuction=function(){window.setTimeout(function(){window.location.reload()},1e3)},AddWishList=function(){$.ajax({url:"/ShoppingCart/AddProductToWish",data:{ProductId:27277,shoppingCartTypeId:2,quantity:1},type:"POST",dataType:"json",headers:{RequestVerificationToken:$('input:hidden[name="__RequestVerificationToken"]').val()},success:function(n){var t,i;n.message&&(n.success?($("div.growlUI").html("<\/i> "+n.message+"<\/span>"),$.blockUI({message:$("div.growlUI"),fadeIn:700,fadeOut:700,timeout:2e3,showOverlay:!1,centerY:!1,css:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"15px",backgroundColor:"#006000","-webkit-border-radius":"5px","-moz-border-radius":"5px",opacity:.9,color:"#fff"}}),t=parseInt($("#WishListShowCount").html()),isNaN(t)||(i=t+1,$("#WishListShowCount").html(i))):($("div.growlUI").html("<\/i> "+n.message+"<\/span>"),$.blockUI({message:$("div.growlUI"),fadeIn:700,fadeOut:700,timeout:2e3,showOverlay:!1,centerY:!1,css:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"15px",backgroundColor:"#EA0000","-webkit-border-radius":"5px","-moz-border-radius":"5px",opacity:.9,color:"#fff"}})))},error:function(n,t,i){console.log(n.status);console.log(i);location.href="/loginagain"},complete:function(){}})},BidPrice=function(){var i,t,o,r,u;console.log($("#bidPriceCurrent").val(),$("#bidPriceQuota").val(),$("#bidPrice_27277").val());var f=parseInt($("#bidPriceCurrent").val()),e=parseInt($("#bidPriceQuota").val()),n=parseInt($("#bidPrice_27277").val());if(isNaN(n)&&(n=0),i=$("#bidPrice2_27277").val(),t=parseInt(i),isNaN(f)||isNaN(e)||isNaN(n)||isNaN(t)||i.length>1)return $(".resultMessage",$("#resultModal")).html("輸入的價格資料錯誤"),$(".resultButton",$("#resultModal")).data("redir","0").data("url",""),$("#resultModal").modal({backdrop:"static",keyboard:!1}),!1;if(o=n*1e4+t*1e3,r=n,t>0&&(r+="."+t),console.log(n,t),o-f確定要出價<\/span> "+r+" 萬<\/span>");u.modal({backdrop:"static",keyboard:!1})},BidPriceSave=function(){$("#bidPriceModal").modal("hide");var t=parseInt($("#bidPriceCurrent").val()),i=parseInt($("#bidPrice_27277").val()),r=$("#bidPrice2_27277").val(),u=parseInt(r),f=i*1e4+u*1e3,n=$("div#_bidInfo"),e={ProductId:27277,CurrentPrice:t,BidPrice:f};$.ajax({url:"/Product/BidPriceV2",data:e,type:"POST",dataType:"json",headers:{RequestVerificationToken:$('input:hidden[name="__RequestVerificationToken"]').val()},success:function(t){var i=$("#resultModal"),r;t.success?($("div.growlUI").html("<\/i> 出價成功<\/span>"),$.blockUI({message:$("div.growlUI"),fadeIn:700,fadeOut:700,timeout:2e3,showOverlay:!1,centerY:!1,css:{width:"350px",top:"150px",left:"",right:"10px",border:"none",padding:"15px",backgroundColor:"#006000","-webkit-border-radius":"5px","-moz-border-radius":"5px",opacity:.9,color:"#fff"}}),$(".resultMessage",i).html("成功"),$(".resultButton",i).data("redir","0").data("url",""),$(".bid-info-title",n).html("目前出價"),$(".bid-info-price",n).html("$"+t.datas.BidPrice.toLocaleString("en-US")),$(".bid-info-count",n).html(" / "+t.datas.BidPriceCount+" 次出價"),$("#bidPriceCurrent").val(t.datas.BidPrice),$("#_lastCustomer").html(t.datas.LastCustomerName),console.log($("#_lastCustomer").closest("div.row").html()),$("#_lastCustomer").closest("div.row").show(),t.datas.IsOverLimitPrice&&$("#_isOverLimitPrice").html("目前出價已可成交<\/span>"),r=t.datas.BidPrice+1e3,$("#bidPrice_27277").val(parseInt(r/1e4,10)),$("#bidPrice2_27277").val(parseInt(r/1e3%10,10)),PushBidPrice(t.datas.ProductId,t.datas.CurrentPrice,t.datas.BidId,t.datas.BidPrice,t.datas.BidPriceCount,t.datas.LastCustomerName,t.datas.IsOverLimitPrice,$("#connectionId").val())):(t.code==2001?($(".resultMessage",i).html(t.errors),$(".resultButton",i).data("redir","1").data("url","/logout")):($(".resultMessage",i).html(t.errors),$(".resultButton",i).data("redir","0").data("url","")),$("#resultModal").modal({backdrop:"static",keyboard:!1}))},error:function(n,t,i){console.log(n.status);console.log(i);location.href="/loginagain"},complete:function(){}})},JoinNowConfirm=function(){$("#joinNowModal").modal({backdrop:"static",keyboard:!1})},CheckoutNowConfirm=function(){$("#checkoutNowModal").modal({backdrop:"static",keyboard:!1})},CheckoutNow=function(){$("#checkoutNowModal").modal("hide");$.blockUI({message:null});$.ajax({url:"/Product/CheckoutNow",data:{ProductId:27277},type:"POST",dataType:"json",headers:{RequestVerificationToken:$('input:hidden[name="__RequestVerificationToken"]').val()},success:function(n){var t=$("#resultModal");n.success?($(".resultMessage",t).html("成功"),$(".resultButton",t).data("redir","1").data("url",n.redirect)):($(".resultMessage",t).html(n.errors),$(".resultButton",t).data("redir","0").data("url",""));$("#resultModal").modal({backdrop:"static",keyboard:!1})},error:function(n,t,i){console.log(n.status);console.log(i)},complete:function(){$.unblockUI()}})},ResultClick=function(n){var i=$(n).data("redir"),t=$(n).data("url");i=="1"&&t.length>0?window.location.href=t:$("#resultModal").modal("hide")},ClearData=function(n){var t=$(n),i=t.val();i=="0"&&t.val("")},connection=(new signalR.HubConnectionBuilder).withUrl("/bidhub").build();connection.start().then(function(){console.log("Hub 連線完成")}).catch(function(n){console.log("出價即時更新連線錯誤: "+n.toString())});connection.on("InitConnectionComplated",function(n){console.log(n);$("#connectionId").val(n);connection.invoke("SendConnectionInfo",Number($("#productId").val()),Number($("#customerId").val())).catch(function(n){console.log("傳送錯誤: "+n.toString())})});connection.on("UpdateConnectionInfo",function(n){console.log("頁面資訊設定完成:"+n)});connection.on("UpdateBid",function(n){var t,u,i,r;console.log("價格更新完成:"+n);t=JSON.parse(n);u=Number($("#bidId").val());t.BidId>u&&(i=$("div#_bidInfo"),$("div.growlUI").html("<\/i> 有人出價了喔<\/span>"),$.blockUI({message:$("div.growlUI"),fadeIn:700,fadeOut:700,timeout:3e3,showOverlay:!1,centerY:!1,css:{width:"350px",top:"150px",left:"",right:"10px",border:"none",padding:"15px",backgroundColor:"#0047AB","-webkit-border-radius":"5px","-moz-border-radius":"5px",opacity:.9,color:"#fff"}}),$(".bid-info-title",i).html("目前出價"),$(".bid-info-price",i).html("$"+t.BidPrice.toLocaleString("en-US")),$(".bid-info-count",i).html(" / "+t.BidPriceCount+" 次出價"),$("#bidPriceCurrent").val(t.BidPrice),$("#_lastCustomer").html(t.LastCustomerName),console.log($("#_lastCustomer").closest("div.row").html()),$("#currentUserName").html()==t.LastCustomerName?$("#_lastCustomer").closest("div.row").show():$("#_lastCustomer").closest("div.row").hide(),t.IsOverLimitPrice&&$("#_isOverLimitPrice").html("目前出價已可成交<\/span>"),r=t.BidPrice+1e3,$("#bidPrice_27277").val(parseInt(r/1e4,10)),$("#bidPrice2_27277").val(parseInt(r/1e3%10,10)))});PushBidPrice=function(n,t,i,r,u,f,e,o){console.log("價格更新:",n,t,i,r,u,f,e,o);connection.invoke("SendBid",n,t,i,r,u,f,e,o).catch(function(n){console.log(n.toString())})}