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
1b04165b
authored
Mar 30, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整订单导出
parent
81fb427b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
4 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/OrderController.php
View file @
1b04165b
...
...
@@ -338,7 +338,7 @@ Class OrderController extends Controller
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$data
[
'p'
]
=
$request
->
input
(
'p'
,
1
);
// 当前页码
$data
[
'map'
]
=
$map
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
// 分页
...
...
@@ -453,6 +453,11 @@ Class OrderController extends Controller
array
(
'sale_name'
,
'推送业务员'
),
);
// 非竞调账号,则查看真实数据
// if ($info['username'] != 'vpadmin@ichunt.com') {
// $map['is_fake'] = 0;
// }
//获取订单列表
$url
=
Config
(
'website.api_domain'
)
.
'order/getAllOrder'
;
...
...
@@ -460,18 +465,135 @@ Class OrderController extends Controller
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$data
[
'map'
]
=
$map
;
$data
[
'export'
]
=
1
;
// 导出数据
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
if
(
is_array
(
$response
[
'data'
])){
// 订单数据处理
$export
=
$this
->
exportList
(
$response
[
'data'
]);
if
(
$export
){
$xlsName
=
'订单数据导出'
;
$xlslist
=
exportExcel
(
$xlsName
,
$xlsCell
,
$
response
[
'data'
]
);
$xlslist
=
exportExcel
(
$xlsName
,
$xlsCell
,
$
export
);
$this
->
$xlslist
;
}
else
{
return
redirect
(
'/prompt'
)
->
with
([
'message'
=>
"数据为空无法导出!"
,
'url'
=>
$_SERVER
[
'HTTP_REFERER'
],
'jumpTime'
=>
3
,
'status'
=>
false
]);
}
}
/**
* 导出到Excel
* @param [type] $order [查询出的订单数据]
* @return [type] [description]
*/
public
function
exportList
(
$order
)
{
// 订单类型
$order_type
=
array
(
'1'
=>
'全款'
,
'2'
=>
'预付款'
,
'3'
=>
'账期支付'
,
);
// 订单状态
$order_status
=
array
(
'-1'
=>
'已取消'
,
'1'
=>
'待审核'
,
'2'
=>
'待付款'
,
'3'
=>
'待付尾款'
,
'4'
=>
'待发货'
,
'7'
=>
'部分发货'
,
'8'
=>
'待收货'
,
'10'
=>
'交易成功'
,
);
// 订单发货状态
$shipping_status
=
array
(
'-1'
=>
'未配送'
,
'1'
=>
'配送中'
,
'2'
=>
'已签'
,
);
// 发票状态
$invoice_status
=
array
(
'-1'
=>
'待确认'
,
'1'
=>
'已开票'
,
'2'
=>
'已发货'
,
'3'
=>
'已签收'
,
);
$i
=
0
;
foreach
(
$order
as
$val
)
{
// 收货人
$address
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_address'
)
->
where
([
'order_id'
=>
$val
[
'order_id'
],
'address_type'
=>
1
])
->
first
();
// 商品信息
$goods
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_items'
)
->
where
(
'order_id'
,
'='
,
$val
[
'order_id'
])
->
where
(
'status'
,
'<>'
,
-
1
)
->
get
();
// 推送人
$sales
=
DB
::
table
(
'user_info'
)
->
where
([
'userId'
=>
$val
[
'sale_id'
]])
->
select
(
'name'
)
->
first
();
// 公司信息
$company
=
DB
::
connection
(
'order'
)
->
table
(
'lie_user_company'
)
->
where
([
'user_id'
=>
$val
[
'user_id'
]])
->
select
(
'com_name'
)
->
first
();
// 订单物流信息
$shipping
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_shipping'
)
->
where
([
'order_id'
=>
$val
[
'order_id'
],
'shipping_type'
=>
1
])
->
select
(
'status'
)
->
first
();
// 订单发票信息
$invoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_invoice'
)
->
where
([
'order_id'
=>
$val
[
'order_id'
]])
->
select
(
'invoice_status'
)
->
first
();
if
(
$goods
)
{
foreach
(
$goods
as
$item
)
{
$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'
]
=
$address
?
$address
->
consignee
:
''
;
$tmp
[
$i
][
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$val
[
'create_time'
]);
$tmp
[
$i
][
'com_name'
]
=
$company
?
$company
->
com_name
:
''
;
$tmp
[
$i
][
'goods_name'
]
=
$item
->
goods_name
;
$tmp
[
$i
][
'goods_number'
]
=
$item
->
goods_number
;
$tmp
[
$i
][
'goods_price'
]
=
$item
->
goods_price
;
$tmp
[
$i
][
'order_amount'
]
=
$item
->
goods_number
*
$item
->
goods_price
;
$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
(
$shipping
)
?
$shipping_status
[
$shipping
->
status
]
:
'无发货信息'
;
$tmp
[
$i
][
'invoice_status'
]
=
!
empty
(
$invoice
)
?
$invoice_status
[
$invoice
->
invoice_status
]
:
'无发票信息'
;
// 发票状态
$tmp
[
$i
][
'company_name'
]
=
$item
->
supplier_name
;
$tmp
[
$i
][
'sale_name'
]
=
isset
(
$sales
)
?
$sales
->
name
:
''
;
// 推送业务员
$i
++
;
}
}
}
if
(
!
empty
(
$tmp
))
{
return
$tmp
;
}
else
{
return
false
;
}
}
// 详情页
public
function
details
(
Request
$request
,
$id
)
{
...
...
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