Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ca6c6a54
authored
May 28, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
fix conflict
parents
e06288d0
05f3d024
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
50 deletions
app/Http/Controllers/OrderController.php
app/Http/routes.php
app/Http/Controllers/OrderController.php
View file @
ca6c6a54
...
...
@@ -475,7 +475,11 @@ Class OrderController extends Controller
array
(
'goods_name'
,
'商品型号'
),
array
(
'goods_number'
,
'数量'
),
array
(
'goods_price'
,
'单价'
),
array
(
'order_amount'
,
'应付金额'
),
array
(
'goods_amount'
,
'商品总额'
),
array
(
'shipping_fee'
,
'运费'
),
array
(
'extra_fee'
,
'附加费'
),
array
(
'coupon'
,
'优惠券'
),
array
(
'order_amount'
,
'订单总额'
),
array
(
'currency'
,
'币种'
),
array
(
'order_type'
,
'订单类型'
),
array
(
'order_status'
,
'订单状态'
),
...
...
@@ -685,41 +689,59 @@ Class OrderController extends Controller
'3'
=>
'已签收'
,
);
$i
=
0
;
$tmp
=
array
();
for
each
(
$order
as
$val
)
{
for
(
$i
=
0
;
$i
<
count
(
$order
);
$i
++
)
{
// 推送人
if
(
$val
->
sale_id
)
{
$sales
=
DB
::
table
(
'user_info'
)
->
where
([
'userId'
=>
$val
->
sale_id
])
->
select
(
'name'
)
->
first
();
}
$tmp
[
$i
][
'order_id'
]
=
$val
->
order_id
;
$tmp
[
$i
][
'order_sn'
]
=
$val
->
order_sn
;
$tmp
[
$i
][
'user_account'
]
=
$val
->
mobile
?
$val
->
mobile
:
$val
->
email
;
$tmp
[
$i
][
'consignee'
]
=
isset
(
$val
->
consignee
)
?
$val
->
consignee
:
''
;
$tmp
[
$i
][
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$val
->
create_time
);
$tmp
[
$i
][
'com_name'
]
=
isset
(
$val
->
com_name
)
?
$val
->
com_name
:
''
;
$tmp
[
$i
][
'goods_name'
]
=
$val
->
goods_name
;
$tmp
[
$i
][
'goods_number'
]
=
$val
->
goods_number
;
$tmp
[
$i
][
'goods_price'
]
=
$val
->
goods_price
;
$tmp
[
$i
][
'order_amount'
]
=
$val
->
order_amount
;
$tmp
[
$i
][
'currency'
]
=
$val
->
currency
==
1
?
'RMB'
:
'USD'
;
$tmp
[
$i
][
'order_type'
]
=
$order_type
[
$val
->
order_pay_type
];
$tmp
[
$i
][
'order_status'
]
=
$order_status
[
$val
->
status
];
// 发货状态
$tmp
[
$i
][
'shipping_status'
]
=
!
empty
(
$val
->
shipping_status
)
?
$shipping_status
[
$val
->
shipping_status
]
:
'无发货信息'
;
$tmp
[
$i
][
'invoice_status'
]
=
!
empty
(
$val
->
invoice_status
)
?
$invoice_status
[
$val
->
invoice_status
]
:
'无发票信息'
;
// 发票状态
$tmp
[
$i
][
'company_name'
]
=
$val
->
supplier_name
;
if
(
$order
[
$i
]
->
sale_id
)
{
$sales
=
DB
::
table
(
'user_info'
)
->
where
([
'userId'
=>
$order
[
$i
]
->
sale_id
])
->
select
(
'name'
)
->
first
();
}
$tmp
[
$i
][
'order_id'
]
=
$order
[
$i
]
->
order_id
;
$tmp
[
$i
][
'order_sn'
]
=
$order
[
$i
]
->
order_sn
;
$tmp
[
$i
][
'user_account'
]
=
$order
[
$i
]
->
mobile
?
$order
[
$i
]
->
mobile
:
$order
[
$i
]
->
email
;
$tmp
[
$i
][
'consignee'
]
=
isset
(
$order
[
$i
]
->
consignee
)
?
$order
[
$i
]
->
consignee
:
''
;
$tmp
[
$i
][
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$order
[
$i
]
->
create_time
);
$tmp
[
$i
][
'com_name'
]
=
isset
(
$order
[
$i
]
->
com_name
)
?
$order
[
$i
]
->
com_name
:
''
;
$tmp
[
$i
][
'goods_name'
]
=
$order
[
$i
]
->
goods_name
;
$tmp
[
$i
][
'goods_number'
]
=
$order
[
$i
]
->
goods_number
;
$tmp
[
$i
][
'goods_price'
]
=
$order
[
$i
]
->
goods_price
;
$tmp
[
$i
][
'goods_amount'
]
=
$order
[
$i
]
->
goods_number
*
$order
[
$i
]
->
goods_price
;
if
(
$i
>
0
&&
$order
[
$i
]
->
order_id
==
$order
[
$i
-
1
]
->
order_id
)
{
$tmp
[
$i
][
'shipping_fee'
]
=
''
;
$tmp
[
$i
][
'extra_fee'
]
=
''
;
$tmp
[
$i
][
'coupon'
]
=
''
;
$tmp
[
$i
][
'order_amount'
]
=
''
;
}
else
{
$tmp
[
$i
][
'shipping_fee'
]
=
$this
->
getOrderPrice
(
$order
[
$i
]
->
order_id
,
3
);
$tmp
[
$i
][
'extra_fee'
]
=
$this
->
getOrderPrice
(
$order
[
$i
]
->
order_id
,
2
);
$tmp
[
$i
][
'coupon'
]
=
$this
->
getOrderPrice
(
$order
[
$i
]
->
order_id
,
-
4
);
$tmp
[
$i
][
'order_amount'
]
=
$order
[
$i
]
->
order_amount
;
}
$tmp
[
$i
][
'currency'
]
=
$order
[
$i
]
->
currency
==
1
?
'RMB'
:
'USD'
;
$tmp
[
$i
][
'order_type'
]
=
$order_type
[
$order
[
$i
]
->
order_pay_type
];
$tmp
[
$i
][
'order_status'
]
=
$order_status
[
$order
[
$i
]
->
status
];
$tmp
[
$i
][
'shipping_status'
]
=
!
empty
(
$order
[
$i
]
->
shipping_status
)
?
$shipping_status
[
$order
[
$i
]
->
shipping_status
]
:
'无发货信息'
;
// 发货状态
$tmp
[
$i
][
'invoice_status'
]
=
!
empty
(
$order
[
$i
]
->
invoice_status
)
?
$invoice_status
[
$order
[
$i
]
->
invoice_status
]
:
'无发票信息'
;
// 发票状态
$tmp
[
$i
][
'company_name'
]
=
$order
[
$i
]
->
supplier_name
;
$tmp
[
$i
][
'sale_name'
]
=
isset
(
$sales
)
?
$sales
->
name
:
''
;
// 推送业务员
unset
(
$sales
);
$i
++
;
}
return
$tmp
;
}
// 订单金额展示
public
function
getOrderPrice
(
$order_id
,
$type
)
{
$price
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_price'
)
->
where
(
'order_id'
,
'='
,
$order_id
)
->
where
(
'price_type'
,
'='
,
$type
)
->
select
(
'price'
)
->
first
();
return
$price
?
$price
->
price
:
0
;
}
// 下载合同
public
function
ajaxDownloadContract
(
Request
$request
)
{
...
...
@@ -1590,6 +1612,7 @@ Class OrderController extends Controller
{
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_goods_type'
,
'='
,
1
)
->
where
(
'status'
,
'='
,
2
)
// ->whereNotIn('user_id', $this->testMobile())
->
where
(
'is_type'
,
'='
,
0
)
...
...
@@ -1648,6 +1671,7 @@ Class OrderController extends Controller
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_goods_type'
,
'='
,
1
)
->
where
(
'status'
,
'='
,
2
)
// ->whereNotIn('user_id', $this->testMobile())
->
where
(
'is_type'
,
'='
,
0
)
...
...
@@ -1716,35 +1740,72 @@ Class OrderController extends Controller
return
[
'errcode'
=>
0
,
'errmsg'
=>
'延长成功'
];
}
// 自营订单到达48小时后自动取消订单
public
function
selfOrderCancel
()
public
function
tempCount
(
Request
$request
)
{
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
whereNotIn
(
'user_id'
,
$this
->
testMobile
())
->
where
(
'status'
,
'='
,
2
)
->
where
(
'order_goods_type'
,
'='
,
2
)
->
where
(
'is_type'
,
'='
,
0
)
->
select
(
'order_id'
,
'create_time'
)
->
orderBy
(
'create_time'
,
'DESC'
)
->
get
();
$current
=
strtotime
(
date
(
'Y-m-d'
,
time
()));
// 当天0点
if
(
!
empty
(
$order
))
{
foreach
(
$order
as
$v
)
{
$limit_time
=
$v
->
create_time
+
2
*
86400
;
$half
=
strtotime
(
'2017-11-28'
);
// 半年
if
(
$limit_time
<=
time
())
{
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
'='
,
$v
->
order_id
)
->
update
([
'status'
=>
-
1
,
'cancel_time'
=>
time
()]);
$year
=
strtotime
(
'2017-05-28'
);
// 一年
if
(
$update
)
{
continue
;
}
}
}
}
// 订单数量
$halfCount
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
// ->where('order_goods_type', 1)
// ->where('order_type', 1)
->
whereNotIn
(
'user_id'
,
$this
->
testMobile
())
->
where
(
'is_type'
,
0
)
->
whereBetween
(
'create_time'
,
[
$half
,
$current
])
->
count
();
echo
'半年订单数:'
.
$halfCount
.
'<br>'
;
$yearCount
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
whereNotIn
(
'user_id'
,
$this
->
testMobile
())
->
where
(
'is_type'
,
0
)
->
whereBetween
(
'create_time'
,
[
$year
,
$current
])
->
count
();
echo
'一年订单数:'
.
$yearCount
.
'<br>'
;
// 普票订单数
$halfInvoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order as o'
)
->
leftJoin
(
'lie_order_invoice as i'
,
'o.order_id'
,
'='
,
'i.order_id'
)
->
whereNotIn
(
'o.user_id'
,
$this
->
testMobile
())
->
where
(
'o.is_type'
,
0
)
->
where
(
'i.inv_type'
,
2
)
->
whereBetween
(
'o.create_time'
,
[
$half
,
$current
])
->
count
();
echo
'半年普票订单数:'
.
$halfInvoice
.
'<br>'
;
$yearInvoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order as o'
)
->
leftJoin
(
'lie_order_invoice as i'
,
'o.order_id'
,
'='
,
'i.order_id'
)
->
whereNotIn
(
'o.user_id'
,
$this
->
testMobile
())
->
where
(
'o.is_type'
,
0
)
->
where
(
'i.inv_type'
,
2
)
->
whereBetween
(
'o.create_time'
,
[
$year
,
$current
])
->
count
();
echo
'一年普票订单数:'
.
$yearInvoice
.
'<br>'
;
// 增票订单数
$halfAddInvoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order as o'
)
->
leftJoin
(
'lie_order_invoice as i'
,
'o.order_id'
,
'='
,
'i.order_id'
)
->
whereNotIn
(
'o.user_id'
,
$this
->
testMobile
())
->
where
(
'o.is_type'
,
0
)
->
where
(
'i.inv_type'
,
3
)
->
whereBetween
(
'o.create_time'
,
[
$half
,
$current
])
->
count
();
echo
'半年增票订单数:'
.
$halfAddInvoice
.
'<br>'
;
$yearAddInvoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order as o'
)
->
leftJoin
(
'lie_order_invoice as i'
,
'o.order_id'
,
'='
,
'i.order_id'
)
->
whereNotIn
(
'o.user_id'
,
$this
->
testMobile
())
->
where
(
'o.is_type'
,
0
)
->
where
(
'i.inv_type'
,
3
)
->
whereBetween
(
'o.create_time'
,
[
$year
,
$current
])
->
count
();
echo
'一年增票订单数:'
.
$yearAddInvoice
.
'<br>'
;
}
}
\ No newline at end of file
app/Http/routes.php
View file @
ca6c6a54
...
...
@@ -71,6 +71,7 @@ Route::group(['middleware' => 'web'], function () {
Route
::
post
(
'/ajaxSelfExpress'
,
'OrderController@ajaxSelfExpress'
);
Route
::
match
([
'get'
,
'post'
],
'/express_set'
,
'OrderController@expressSet'
);
Route
::
match
([
'get'
,
'post'
],
'/tempcount'
,
'OrderController@tempCount'
);
Route
::
post
(
'/ajaxDownloadContract'
,
'OrderController@ajaxDownloadContract'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment