Skip to content

Commit

Permalink
新消息提醒部分修改
Browse files Browse the repository at this point in the history
  • Loading branch information
canzhen committed Jun 19, 2016
1 parent 0e9f909 commit f6088a5
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 117 deletions.
28 changes: 13 additions & 15 deletions app/Http/Controllers/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\Request;

use App\Order;
use App\Http\Requests;
use App\Http\Controllers\Controller;

Expand Down Expand Up @@ -36,21 +37,18 @@ public function addOrder(){
->where('id', $curAlbum)
->pluck('name');

$eid = \DB::table('orders')
->insertGetId(
array(
'user_name' => $curUserName[0],
'album_name' =>$curAlbumName[0],
'price' => $oPrice,
'quantity' => $oNum,
'address' => $oAddress,
'status' => "未付款",
'order_date' => $orderTime,
'delivery_date' => $orderTime,
'comment' => $oComment,
'template' => $oTem
)
);
$newOrder = new Order;
$newOrder->user_name = $curUserName[0];
$newOrder->album_name = $curAlbumName[0];
$newOrder->price = $oPrice;
$newOrder->quantity = $oNum;
$newOrder->address = $oAddress;
$newOrder->status = "未付款";
$newOrder->order_date = $orderTime;
$newOrder->delivery_date = $oComment;
$newOrder->comment = "";
$newOrder->template = $oTem;
$eid = $newOrder->save();

//模版使用次数自增
\DB::table('templates')->where('id', $oTem)->increment('count');
Expand Down
4 changes: 0 additions & 4 deletions public/js/company/cpy_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,22 @@ yinjiApp.controller('cpyIndexController',
$http.get("/cpy/getOrders")
.success(function (response)
{
console.log("Nihao ");
//首页这里只显示前5个订单
for (var i = 0 ; i < 5; i++){
if(response[i] != null)
$scope.deployedOrder[i] = response[i];
}
//获取首页报表数据
var date,quantity,orderDate,data=new Object();
console.log (response.length);
for (i=0; i<response.length; i++){
date = (response[i].order_date.split(" "))[0];
console.log("date:"+date);
quantity = parseInt(response[i].quantity);
if (data[date] == null)
data[date] = quantity;
else{
data[date] += quantity;
}
}
console.log("data:"+data);
setMorrisChart(data);
});

Expand Down
92 changes: 23 additions & 69 deletions public/js/create_records/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,94 +53,48 @@ yinjiApp.controller('orderController',
});


$scope.addOrder = function(){
<<<<<<< HEAD
if($("#text_box2").val() == 0 || $("#text_box1").val() == 0){
=======

if($("#text_box2").val() < $("#text_box1").val()){
>>>>>>> d66a417a02acaa3755d91df5b496faa927fb490d
$scope.addOrder = function() {
if ($("#text_box2").val() == 0 || $("#text_box1").val() == 0 ||
($("#text_box2").val() < $("#text_box1").val())) {
alert("页码错误");
}else{
if($("#text_box2").val() < $("#text_box1").val()){

}
else{
var pageRange = $("#text_box1").val() + "-" + $("#text_box2").val();
var pagePrice = ($("#text_box2").val() - $("#text_box1").val()) * 10;//单价10块一张。。。

var commentText = $scope.oComment;
if(commentText == "" || commentText == null){
commentText = "无";
}

<<<<<<< HEAD
if(temId == 0){
var oTem = 0;
}else{
var oTem = temId.substring(3,4);
} else {
var pageRange = $("#text_box1").val() + "-" + $("#text_box2").val();
var pagePrice = ($("#text_box2").val() - $("#text_box1").val()) * 10;//单价10块一张。。。

}

$http({
method: 'GET',//注意,这里必须要用GET方法
url:'/addOrder',
params:{
'oName': $scope.oName,
'oPhone': $scope.oPhone,
'oAddress' : $scope.oAddress,
'oComment' : commentText,
'oNum' : 1,
'oPrice' : pagePrice,
'oTemplate' : oTem
}
})
.success(function(data) {
if(data != null){
console.log(data);
alert("成功!");
window.location.href = "/";
}
else{
console.log("false");
}
});
var commentText = $scope.oComment;
if (commentText == "" || commentText == null) {
commentText = "无";
}
=======
if(temId == 0){
if (temId == 0) {
//console.log("00000");
var oTem = 0;
}else{
var oTem = temId.substring(3,4);
} else {
var oTem = temId.substring(3, 4);

}

$http({
method: 'GET',//注意,这里必须要用GET方法
url:'/addOrder',
params:{
url: '/addOrder',
params: {
'oName': $scope.oName,
'oPhone': $scope.oPhone,
'oAddress' : $scope.oAddress,
'oComment' : commentText,
'oNum' : pageRange,
'oPrice' : pagePrice,
'oTemplate' : oTem
'oAddress': $scope.oAddress,
'oComment': commentText,
'oNum': pageRange,
'oPrice': pagePrice,
'oTemplate': oTem
}
})
.success(function(data) {
if(data != null){
}).success(function (data) {
if (data != null) {
console.log(data);
alert("成功!");
window.location.href = "/orderInfo";
}
else{
else {
console.log("false");
}
});
>>>>>>> d66a417a02acaa3755d91df5b496faa927fb490d
}


}
});
67 changes: 39 additions & 28 deletions public/js/layouts/cpy_sidebar/cpy_sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,35 @@ yinjiApp.controller('cpyNavController',
$scope.odSecond = "";

var date = new Date(),
currentYear = date.getFullYear(),
currentMonth = date.getMonth(),
currentDay = date.getDay(),
currentHour = date.getHours(),
currentMinute = date.getMinutes(),
currentSecond = date.getSeconds(),
currentYear = parseInt(date.getFullYear()),
currentMonth = parseInt(date.getMonth()+1),
currentDay = parseInt(date.getDate()),
currentHour = parseInt(date.getHours()),
currentMinute = parseInt(date.getMinutes()),
currentSecond = parseInt(date.getSeconds()),
latestOrderTime,latestEvaTime;


//获取首页订单
$http.get("/cpy/getEvaluations")
.success(function (response)
{
var fullDateInfo = response[response.length-1].created_at.split(" ");
var date = fullDateInfo[0].split("-");
if (date[0]==currentYear &&
date[1]==currentMonth &&
date[1]==currentDay){
latestEvaTime = fullDateInfo[1].split(":");
$scope.evaHour = currentHour - latestEvaTime[0];
if ($scope.evaHour < 1){
$scope.evaMinute = currentMinute - latestEvaTime[1];
if ($scope.evaMinute < 1)
$scope.evaSecond = currentSecond - latestEvaTime[2];
if (response != null && response.length > 0){
var fullDateInfo = response[response.length-1].created_at.split(" ");
var date = fullDateInfo[0].split("-");
date[0]=parseInt(date[0]);
date[1]=parseInt(date[1]);
date[2]=parseInt(date[2]);
if (date[0]==currentYear &&
date[1]==currentMonth &&
date[2]==currentDay){
latestEvaTime = fullDateInfo[1].split(":");
$scope.evaHour = currentHour - latestEvaTime[0];
if ($scope.evaHour < 1){
$scope.evaMinute = currentMinute - latestEvaTime[1];
if ($scope.evaMinute < 1)
$scope.evaSecond = currentSecond - latestEvaTime[2];
}
}
}
});
Expand All @@ -83,19 +88,25 @@ yinjiApp.controller('cpyNavController',
$http.get("/cpy/getOrders")
.success(function (response)
{
var fullDateInfo = response[response.length-1].created_at.split(" ");
var date = fullDateInfo[0].split("-");
if (date[0]==currentYear &&
date[1]==currentMonth &&
date[1]==currentDay) {
latestOrderTime = fullDateInfo[1].split(":");
$scope.odHour = currentHour - latestOrderTime[0];
if ($scope.odHour < 1) {
$scope.odMinute = currentMinute - latestOrderTime[1];
if ($scope.odMinute < 1)
$scope.odSecond = currentSecond - latestOrderTime[2];
if (response != null && response.length > 0) {
var fullDateInfo = response[response.length - 1].created_at.split(" ");
var date = fullDateInfo[0].split("-");
date[0]=parseInt(date[0]);
date[1]=parseInt(date[1]);
date[2]=parseInt(date[2]);
if (date[0] == currentYear &&
date[1] == currentMonth &&
date[2] == currentDay) {
latestOrderTime = fullDateInfo[1].split(":");
$scope.odHour = currentHour - latestOrderTime[0];
if ($scope.odHour < 1) {
$scope.odMinute = currentMinute - latestOrderTime[1];
if ($scope.odMinute < 1)
$scope.odSecond = currentSecond - latestOrderTime[2];
}
}
}
console.log('Hour:'+$scope.odHour+'\nMinute:'+$scope.odMinute+'\nSecond:'+$scope.odSecond);
});


Expand Down
3 changes: 2 additions & 1 deletion resources/views/layouts/cpy_sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-alerts">
<li ng-show="!(evaHour!='' ||evaMinute!=''||evaSecond!='')"
<li ng-show="!(evaHour!='' ||evaMinute!=''||evaSecond!='')
&& !(odHour!='' ||odMinute!=''||odSecond!='')"
style="padding-left:5%;">
oops..暂无新消息哟
</li>
Expand Down

0 comments on commit f6088a5

Please sign in to comment.