;(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('網路連線過慢,網頁請重新整理'); } }) }) })($)