diff --git a/app/Http/Controllers/Order/OrderController.php b/app/Http/Controllers/Order/OrderController.php index 7d76688..73f7639 100644 --- a/app/Http/Controllers/Order/OrderController.php +++ b/app/Http/Controllers/Order/OrderController.php @@ -21,7 +21,7 @@ public function addOrder(){ $oComment = $_GET['oComment']; $oNum = $_GET['oNum']; $oPrice = $_GET['oPrice']; - + $orderTime = date('y-m-d H:i:s', time()); $userId = $_SESSION['userId']; @@ -55,7 +55,9 @@ public function addOrder(){ //模版使用次数自增 \DB::table('templates')->where('id', $oTem)->increment('count'); - return $eid; + //return $eid; + + return $curAlbumName[0]; } @@ -71,11 +73,12 @@ public function deleteOrder(){ public function getTemplates(){ if(!isset($_SESSION)){ session_start(); - } + } $curName = $_SESSION['userName']; - ///$resSet = \DB::table('templates')->where('author_name', $curName)->get(); - //return $resSet; - return $curName; + $resSet = \DB::table('templates')->get(); + return $resSet; + //return $curName; + } public function displayOrder(){ diff --git a/public/js/create_records/order.js b/public/js/create_records/order.js index eaca595..fc00686 100644 --- a/public/js/create_records/order.js +++ b/public/js/create_records/order.js @@ -1,25 +1,7 @@ window.imgList = ""; window.temId = 0; -function deleteOrder(){ - $.ajax({ - type: 'get', - url: '/deleteOrder', - dataType : "text", - success : function(data) { - if(data != null){ - console.log(data); - //alert("删除成功!"); - //window.location.href = "/home"; - } - }, - error : function() { - alert("false"); - } - }); - -} function selectTemplate(objId){ for (var i = 0; i < imgList.length; i++) { @@ -59,10 +41,11 @@ yinjiApp.controller('orderController', var ele = ""; $("div.order_text").append(ele); } - //var tt = "img" + data[0].id; - //console.log(tt); - temId = "img" + data[0].id; - document.getElementById(temId).className = "hasBorder"; + if(data.length != 0){ + temId = "img" + data[0].id; + document.getElementById(temId).className = "hasBorder"; + } + } else{ console.log("false"); @@ -71,6 +54,7 @@ yinjiApp.controller('orderController', $scope.addOrder = function(){ + if($("#text_box2").val() < $("#text_box1").val()){ alert("页码错误"); } @@ -83,7 +67,13 @@ yinjiApp.controller('orderController', commentText = "无"; } - var oTem = temId.substring(3,4); + if(temId == 0){ + //console.log("00000"); + var oTem = 0; + }else{ + var oTem = temId.substring(3,4); + + } $http({ method: 'GET',//注意,这里必须要用GET方法 @@ -92,17 +82,17 @@ yinjiApp.controller('orderController', 'oName': $scope.oName, 'oPhone': $scope.oPhone, 'oAddress' : $scope.oAddress, - 'oComment' : commentText, - 'oNum' : pageRange, - 'oPrice' : pagePrice, - 'oTemplate' : oTem + 'oComment' : commentText, + 'oNum' : pageRange, + 'oPrice' : pagePrice, + 'oTemplate' : oTem } }) .success(function(data) { if(data != null){ console.log(data); alert("成功!"); - window.location.href = "/"; + window.location.href = "/orderInfo"; } else{ console.log("false"); diff --git a/public/js/orderDetail.js b/public/js/orderDetail.js index 5972b9a..a2173fd 100644 --- a/public/js/orderDetail.js +++ b/public/js/orderDetail.js @@ -16,7 +16,8 @@ function deleteOrder(objId, obj){ if(data != null){ console.log(data); alert("删除成功!"); - deleteCurRow(obj); + //deleteCurRow(obj); + window.location.reload(); } }, error : function() {