;(function($){ getWithdrawList($(".switch-btn.in-active").data("type"), 1) $(document).on("click", ".switch-btn", function(){ let _this = $(this) let type = _this.data("type") $(".switch-btn").removeClass("in-active") _this.addClass("in-active") getWithdrawList(type, 1) }) $(document).on("click", ".pager-list .page", function(e){ e.preventDefault() let _this = $(this) let page = _this.attr("href").split("page=")[1] getWithdrawList($(".switch-btn.in-active").data("type"), page) }) function getWithdrawList(type, page){ $.ajax({ "url":"/member/ajax/ajax_get_withdraw_list.php", type:"POST", data: { type: type, page:page }, success: function(res){ if(res){ $(".withdraw-table-wrapper").html(res) } }, error:function(){ alert('網路連線過慢,網頁請重新整理'); } }) } $(document).on("click", ".btn-withdraw", function(){ let _this = $(this) let act = _this.data("act") let sid = _this.data("sid") let subID = _this.data("subid") let formData = new FormData() formData.append("act", act); formData.append("sid", sid); formData.append("num", 3); formData.append("isBuy", 2); formData.append("subID", subID); $.ajax({ type: "POST", dataType: 'json', url:"/products/ajax/detail/ajax_add_warehouse.php", data: formData, processData: false, contentType: false, success: function(res){ // console if(res.status == 'Error'){ alert(res.Msg); } else { location.href = "/shopcart-warehouse/" } }, error: function(){ alert('網路連線過慢,網頁請重新整理'); } }) }) //查詢抽獎序號和兌獎資訊 $(document).on("click", ".btn-lottery-check", function(){ let _this = $(this) let order = _this.data("order") let lotid = _this.data("lot-id") $.ajax({ type: "POST", dataType: 'json', url:"/member/ajax/ajax_get_lottery_popup.php", data: { order: order, LotID: lotid }, success: function(res){ // console if(res.status == 'OK' && res.html){ $("#lotteryModal").addClass("in-active") $("#lotteryModal").find(".lottery-table-box").html(res.html) }else if(res.status == 'Error'){ alert(res.Msg); } }, error: function(){ alert('網路連線過慢,網頁請重新整理'); } }) }) $("#eventSigninForm").fromsAuth({type:'NONE'}); //登錄彈窗 $(document).on("click", ".state-btn", function(){ let _this = $(this) let order = _this.data("order") || null let amount = _this.data("lottery-amount") || null let popup = $("#eventSigninModal") let content = _this.parent(".state-row").children(".act_event_content").val() let des = _this.parent(".state-row").children(".act_event_des").val() let lotName = _this.parent(".state-row").children(".lot_name").val() let lotID = _this.data("lot-id") || null let isClose = _this.data("close") || null let subID = _this.data("sub-id") || null if(order && amount){ //需拉活動說明 popup.find(".terms-editor").html(content) popup.find(".terms-tips").text(des) popup.addClass("in-active") popup.find(".info-order-no").text(order) popup.find(".info-lottery-amount").text(amount) popup.find("#OrderNumber").val(order) popup.find("#LotID").val(lotID) popup.find("#LotNum").val(amount) popup.find("#isClose").val(isClose) popup.find("#SubID").val(subID) popup.find(".signin-title").text(lotName) } }) //檢查勾選 $(document).on("change", "#TermsCheck, #Citizenship", function(){ let btn = $(".signin-submit-btn") if($("#TermsCheck").is(":checked") && $("#Citizenship").is(":checked")){ btn.prop("disabled", false) btn.removeClass("btn-muted").addClass("btn-primary") }else{ btn.prop("disabled", true) btn.removeClass("btn-primary").addClass("btn-muted") } }) })($)