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
044bd655
authored
Mar 19, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整订单导出字段
parent
105cea97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
43 deletions
app/Http/Controllers/OrderController.php
app/Model/OrderModel.php
app/Http/Controllers/OrderController.php
View file @
044bd655
...
@@ -666,45 +666,45 @@ Class OrderController extends Controller
...
@@ -666,45 +666,45 @@ Class OrderController extends Controller
if
(
$order_goods_type
==
1
)
{
if
(
$order_goods_type
==
1
)
{
$file_name
=
'联营订单导出'
;
$file_name
=
'联营订单导出'
;
$source_items_id
=
Config
(
'website.export_joint_source_id'
);
$source_items_id
=
Config
(
'website.export_joint_source_id'
);
$headerCell
=
[
'订单ID'
,
'订单编号'
,
'ERP单号'
,
'京东订单号'
,
'会员账号'
,
'收货人'
,
'下单日期'
,
'下单时间'
,
'客户名称'
,
'平台来源'
,
'SKUID'
,
'商品型号'
,
'商品分类'
,
'制造商'
,
'供应商'
,
'
数量'
,
'单价'
,
'均摊后单价'
,
'商品小计'
,
'币种'
,
'客服
'
,
'商品总额'
,
'运费'
,
'附加费'
,
'优惠券'
,
'订单总额'
,
'人民币总额'
,
'付款类型'
,
'订单状态'
,
'发货状态'
,
'收货地址'
,
'发票类型'
,
'发票状态'
,
'发票抬头'
,
'公司注册地址'
,
'公司电话'
,
'adtags来源'
,
'新用户来源'
,
'取消原因'
,
'推送备注'
,
'是否为测试订单'
,
'是否为新订单'
,
'付款日期'
,
'付款时间'
];
$headerCell
=
[
'订单ID'
,
'订单编号'
,
'ERP单号'
,
'京东订单号'
,
'会员账号'
,
'收货人'
,
'下单日期'
,
'下单时间'
,
'客户名称'
,
'平台来源'
,
'SKUID'
,
'商品型号'
,
'商品分类'
,
'制造商'
,
'供应商'
,
'
币种'
,
'客服'
,
'数量'
,
'单价'
,
'均摊后单价'
,
'商品小计'
,
'费用'
,
'折扣
'
,
'商品总额'
,
'运费'
,
'附加费'
,
'优惠券'
,
'订单总额'
,
'人民币总额'
,
'付款类型'
,
'订单状态'
,
'发货状态'
,
'收货地址'
,
'发票类型'
,
'发票状态'
,
'发票抬头'
,
'公司注册地址'
,
'公司电话'
,
'adtags来源'
,
'新用户来源'
,
'取消原因'
,
'推送备注'
,
'是否为测试订单'
,
'是否为新订单'
,
'付款日期'
,
'付款时间'
];
$return_url
=
'/list'
;
$return_url
=
'/list'
;
}
else
{
}
else
{
$file_name
=
'自营订单导出'
;
$file_name
=
'自营订单导出'
;
$source_items_id
=
Config
(
'website.export_self_source_id'
);
$source_items_id
=
Config
(
'website.export_self_source_id'
);
$headerCell
=
[
'订单ID'
,
'订单编号'
,
'ERP单号'
,
'京东订单号'
,
'会员账号'
,
'收货人'
,
'下单日期'
,
'下单时间'
,
'客户名称'
,
'平台来源'
,
'SKUID'
,
'商品型号'
,
'商品分类'
,
'制造商'
,
'供应商'
,
'
数量'
,
'单价'
,
'均摊后单价'
,
'商品小计'
,
'币种'
,
'客服
'
,
'商品总额'
,
'运费'
,
'附加费'
,
'优惠券'
,
'订单总额'
,
'付款类型'
,
'订单状态'
,
'发货状态'
,
'收货地址'
,
'发票类型'
,
'发票状态'
,
'发票抬头'
,
'公司注册地址'
,
'公司电话'
,
'adtags来源'
,
'新用户来源'
,
'取消原因'
,
'推送备注'
,
'是否为测试订单'
,
'销售类型'
,
'业务类型'
,
'自采标记'
,
'项目需求描述'
,
'收货联系电话'
,
'付款日期'
,
'付款时间'
];
$headerCell
=
[
'订单ID'
,
'订单编号'
,
'ERP单号'
,
'京东订单号'
,
'会员账号'
,
'收货人'
,
'下单日期'
,
'下单时间'
,
'客户名称'
,
'平台来源'
,
'SKUID'
,
'商品型号'
,
'商品分类'
,
'制造商'
,
'供应商'
,
'
币种'
,
'客服'
,
'数量'
,
'单价'
,
'均摊后单价'
,
'商品小计'
,
'费用'
,
'折扣
'
,
'商品总额'
,
'运费'
,
'附加费'
,
'优惠券'
,
'订单总额'
,
'付款类型'
,
'订单状态'
,
'发货状态'
,
'收货地址'
,
'发票类型'
,
'发票状态'
,
'发票抬头'
,
'公司注册地址'
,
'公司电话'
,
'adtags来源'
,
'新用户来源'
,
'取消原因'
,
'推送备注'
,
'是否为测试订单'
,
'销售类型'
,
'业务类型'
,
'自采标记'
,
'项目需求描述'
,
'收货联系电话'
,
'付款日期'
,
'付款时间'
];
$return_url
=
'/self_order'
;
$return_url
=
'/self_order'
;
}
}
//
$info['map']['p'] = 1;
$info
[
'map'
][
'p'
]
=
1
;
//
$potrol = $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http';
$potrol
=
$_SERVER
[
'SERVER_PORT'
]
==
443
?
'https'
:
'http'
;
//
$params = [
$params
=
[
//
"type" => 2, // 类型 1:模板调用 2: api回调 (必填)
"type"
=>
2
,
// 类型 1:模板调用 2: api回调 (必填)
//
"source_items_id" => $source_items_id, //设置来源明细id:http://data.ichunt.net/database/1199(必填)
"source_items_id"
=>
$source_items_id
,
//设置来源明细id:http://data.ichunt.net/database/1199(必填)
//
"file_name" => $file_name,//导出后文件名称(必填)
"file_name"
=>
$file_name
,
//导出后文件名称(必填)
//
"excel_suf" => "csv", //导出文件格式 csv,xls(必填)
"excel_suf"
=>
"csv"
,
//导出文件格式 csv,xls(必填)
//
"header" => $headerCell, //导出文件头部 (必填,不得用 ID 做头部,数据顺序必须一致)
"header"
=>
$headerCell
,
//导出文件头部 (必填,不得用 ID 做头部,数据顺序必须一致)
//
"query_param" => $info['map'], //p 第几页,limit每页多少条 占位符,照抄不需要改 (必填)
"query_param"
=>
$info
[
'map'
],
//p 第几页,limit每页多少条 占位符,照抄不需要改 (必填)
//
"callbackurl" => $potrol."://".$_SERVER['HTTP_HOST']."/hprose/service", //hrpose 数据提供网址(提供导出脚本分页回调获取数据,必填)
"callbackurl"
=>
$potrol
.
"://"
.
$_SERVER
[
'HTTP_HOST'
]
.
"/hprose/service"
,
//hrpose 数据提供网址(提供导出脚本分页回调获取数据,必填)
//
"callbackfuc" => "orderExport", //hrpose 回调函数(必填)
"callbackfuc"
=>
"orderExport"
,
//hrpose 回调函数(必填)
//
"create_uid" => $request->user->userId, #创建人id(必填)
"create_uid"
=>
$request
->
user
->
userId
,
#创建人id(必填)
//
];
];
//
//
调用导出系统
// 调用导出系统
//
$url = Config('website.export_url');
$url
=
Config
(
'website.export_url'
);
//
$client = new \Hprose\Http\Client($url."/insertExport", false);
$client
=
new
\Hprose\Http\Client
(
$url
.
"/insertExport"
,
false
);
//
$res = $client->insertExport(json_encode($params));
$res
=
$client
->
insertExport
(
json_encode
(
$params
));
//
//
print_r($res);
// print_r($res);
//
$res = json_decode($res, true);
$res
=
json_decode
(
$res
,
true
);
//
if ($res['err_code'] == 0) return ['err_code'=>0, 'err_msg'=>'推入到导出系统成功', 'data'=>$res['data']];
if
(
$res
[
'err_code'
]
==
0
)
return
[
'err_code'
=>
0
,
'err_msg'
=>
'推入到导出系统成功'
,
'data'
=>
$res
[
'data'
]];
//
return ['err_code'=>1, 'err_msg'=>'推入到导出系统失败'];
return
[
'err_code'
=>
1
,
'err_msg'
=>
'推入到导出系统失败'
];
$orderModel
=
new
OrderModel
();
//
$orderModel = new OrderModel();
return
$orderModel
->
orderExport
(
$info
[
'map'
]);
//
return $orderModel->orderExport($info['map']);
}
}
// 下载合同
// 下载合同
...
...
app/Model/OrderModel.php
View file @
044bd655
...
@@ -336,8 +336,11 @@ class OrderModel extends Model
...
@@ -336,8 +336,11 @@ class OrderModel extends Model
// 获取所有价格
// 获取所有价格
$OrderPriceModel
=
new
OrderPriceModel
();
$OrderPriceModel
=
new
OrderPriceModel
();
$order_price
=
$OrderPriceModel
->
whereIn
(
'order_id'
,
$all_order_id
)
->
select
(
'order_id'
,
'price_type'
,
'price'
)
->
get
()
->
keyBy
(
'order_id'
)
->
toArray
();
// $order_price = $OrderPriceModel->whereIn('order_id', $all_order_id)->select('order_id', 'price_type', 'price')->get()->keyBy('order_id')->toArray();
dd
(
$order_price
);
$order_price
=
$OrderPriceModel
->
whereIn
(
'order_id'
,
$all_order_id
)
->
select
(
'order_id'
,
'price_type'
,
'price'
)
->
get
()
->
keyBy
(
function
(
$item
)
{
return
strtoupper
(
$item
[
'order_id'
]
.
'.'
.
$item
[
'price_type'
]);
})
->
toArray
();
// 获取用户公司名称
// 获取用户公司名称
$UserCompanyModel
=
new
UserCompanyModel
();
$UserCompanyModel
=
new
UserCompanyModel
();
$company_info
=
$UserCompanyModel
->
whereIn
(
'user_id'
,
$all_user_id
)
->
lists
(
'com_name'
,
'user_id'
)
->
toArray
();
$company_info
=
$UserCompanyModel
->
whereIn
(
'user_id'
,
$all_user_id
)
->
lists
(
'com_name'
,
'user_id'
)
->
toArray
();
...
@@ -371,16 +374,18 @@ dd($order_price);
...
@@ -371,16 +374,18 @@ dd($order_price);
$tmp
[
$i
][
'goods_id'
]
=
$order
[
$i
][
'goods_id'
];
$tmp
[
$i
][
'goods_id'
]
=
$order
[
$i
][
'goods_id'
];
// 自营商品名称换成商品型号
// 自营商品名称换成商品型号
$tmp
[
$i
][
'goods_name'
]
=
$order
[
$i
][
'order_goods_type'
]
==
1
?
$order
[
$i
][
'goods_name'
]
:
$this
->
getGoodsName
(
$order
[
$i
][
'goods_id'
]);
$tmp
[
$i
][
'goods_name'
]
=
$order
[
$i
][
'order_goods_type'
]
==
1
?
$order
[
$i
][
'goods_name'
]
:
$this
->
getGoodsName
(
$order
[
$i
][
'goods_id'
]);
$tmp
[
$i
][
'goods_class'
]
=
$order
[
$i
][
'goods_class'
];
$tmp
[
$i
][
'goods_class'
]
=
$order
[
$i
][
'goods_class'
];
$tmp
[
$i
][
'brand_name'
]
=
$order
[
$i
][
'brand_name'
];
$tmp
[
$i
][
'brand_name'
]
=
$order
[
$i
][
'brand_name'
];
$tmp
[
$i
][
'supplier_name'
]
=
$order
[
$i
][
'supplier_name'
];
$tmp
[
$i
][
'supplier_name'
]
=
$order
[
$i
][
'supplier_name'
];
$tmp
[
$i
][
'goods_number'
]
=
$order
[
$i
][
'goods_number'
];
$tmp
[
$i
][
'currency'
]
=
$order
[
$i
][
'currency'
]
==
1
?
'RMB'
:
'USD'
;
$tmp
[
$i
][
'goods_price'
]
=
$order
[
$i
][
'goods_price'
];
$tmp
[
$i
][
'sale_name'
]
=
isset
(
$sales
[
$order
[
$i
][
'sale_id'
]])
?
$sales
[
$order
[
$i
][
'sale_id'
]]
:
''
;
// 推送业务员
$tmp
[
$i
][
'single_pre_price'
]
=
$order
[
$i
][
'single_pre_price'
];
$tmp
[
$i
][
'goods_number'
]
=
$order
[
$i
][
'goods_number'
];
$tmp
[
$i
][
'goods_amount'
]
=
$order
[
$i
][
'goods_number'
]
*
$order
[
$i
][
'goods_price'
];
$tmp
[
$i
][
'goods_price'
]
=
$order
[
$i
][
'goods_price'
];
$tmp
[
$i
][
'currency'
]
=
$order
[
$i
][
'currency'
]
==
1
?
'RMB'
:
'USD'
;
$tmp
[
$i
][
'single_pre_price'
]
=
$order
[
$i
][
'single_pre_price'
];
$tmp
[
$i
][
'sale_name'
]
=
isset
(
$sales
[
$order
[
$i
][
'sale_id'
]])
?
$sales
[
$order
[
$i
][
'sale_id'
]]
:
''
;
// 推送业务员
$tmp
[
$i
][
'goods_amount'
]
=
$order
[
$i
][
'goods_number'
]
*
$order
[
$i
][
'goods_price'
];
$tmp
[
$i
][
'extra_price'
]
=
$order
[
$i
][
'extra_price'
];
// 费用
$tmp
[
$i
][
'goods_discount_amount'
]
=
$order
[
$i
][
'goods_discount_amount'
];
// 折扣
if
(
$i
>
0
&&
$order
[
$i
][
'order_id'
]
==
$order
[
$i
-
1
][
'order_id'
])
{
if
(
$i
>
0
&&
$order
[
$i
][
'order_id'
]
==
$order
[
$i
-
1
][
'order_id'
])
{
$tmp
[
$i
][
'goods_sum'
]
=
''
;
$tmp
[
$i
][
'goods_sum'
]
=
''
;
...
@@ -393,12 +398,10 @@ dd($order_price);
...
@@ -393,12 +398,10 @@ dd($order_price);
$tmp
[
$i
][
'rmb_amount'
]
=
''
;
// 人民币总额
$tmp
[
$i
][
'rmb_amount'
]
=
''
;
// 人民币总额
}
}
}
else
{
}
else
{
$price
=
isset
(
$order_price
[
$order
[
$i
][
'order_id'
]])
?
$order_price
[
$order
[
$i
][
'order_id'
]]
:
false
;
$tmp
[
$i
][
'goods_sum'
]
=
isset
(
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.1'
])
?
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.1'
][
'price'
]
:
0
;
$tmp
[
$i
][
'shipping_fee'
]
=
isset
(
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.3'
])
?
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.1'
][
'price'
]
:
0
;
$tmp
[
$i
][
'goods_sum'
]
=
$price
&&
$price
[
'price_type'
]
==
1
?
$price
[
'price'
]
:
0
;
$tmp
[
$i
][
'extra_fee'
]
=
isset
(
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.2'
])
?
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.1'
][
'price'
]
:
0
;
$tmp
[
$i
][
'shipping_fee'
]
=
$price
&&
$price
[
'price_type'
]
==
3
?
$price
[
'price'
]
:
0
;
$tmp
[
$i
][
'coupon'
]
=
isset
(
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.-4'
])
?
$order_price
[
$order
[
$i
][
'order_id'
]
.
'.1'
][
'price'
]
:
0
;
$tmp
[
$i
][
'extra_fee'
]
=
$price
&&
$price
[
'price_type'
]
==
2
?
$price
[
'price'
]
:
0
;
$tmp
[
$i
][
'coupon'
]
=
$price
&&
$price
[
'price_type'
]
==
-
4
?
$price
[
'price'
]
:
0
;
$tmp
[
$i
][
'order_amount'
]
=
$order
[
$i
][
'order_amount'
];
$tmp
[
$i
][
'order_amount'
]
=
$order
[
$i
][
'order_amount'
];
if
(
$order
[
$i
][
'order_goods_type'
]
==
1
)
{
if
(
$order
[
$i
][
'order_goods_type'
]
==
1
)
{
...
...
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