切换导航条
此项目
正在载入...
登录
何书鹏
/
anttest
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
何书鹏
4 years ago
提交
b6b6b937f7f69b19288de11fa020698bb6fd1144
1 个父辈
13950555
经销商导出订单
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
39 行增加
和
36 行删除
application/admin/controller/shopro/order/Order.php
application/admin/model/shopro/order/OrderItem.php
application/admin/controller/shopro/order/Order.php
查看文件 @
b6b6b93
...
...
@@ -111,78 +111,81 @@ class Order extends Base
$list
=
$this
->
buildSearchOrder
()
->
where
(
$where
)
->
with
([
'user'
,
'item'
])
->
with
([
'user'
,
'item'
=>
[
'goods_sku_sn'
]
])
->
order
(
$sort
,
$order
)
->
select
();
// 经销商
$dealer
=
[];
$group_id_arr
=
array_column
(
$this
->
auth
->
getGroups
(),
'group_id'
);
if
(
!
in_array
(
1
,
$group_id_arr
)
&&
in_array
(
2
,
$group_id_arr
)){
$dealer
=
\app\admin\model\dealer\Dealer
::
where
(
'admin_id'
,
$this
->
auth
->
id
)
->
find
();
}
$expCellName
=
[
'order_id'
=>
'Id'
,
'order_sn'
=>
'订单号'
,
// 'type_text' => '订单类型',
'status_text'
=>
'订单状态'
,
// 'pay_type_text' => '支付类型',
'paytime_text'
=>
'支付时间'
,
// 'platform_text' => '交易平台',
'user_info'
=>
'用户信息'
,
'total_amount'
=>
'订单总金额'
,
'discount_fee'
=>
'优惠金额'
,
];
// 经销商不显示订单总金额和优惠金额
if
(
!
$dealer
){
$expCellName
=
array_merge
(
$expCellName
,[
'total_amount'
=>
'订单总金额'
,
'discount_fee'
=>
'优惠金额'
,
]);
}
$expCellName
=
array_merge
(
$expCellName
,[
'pay_fee'
=>
'实际支付金额'
,
// 'score_fee' => '积分支付数量',
'activity_type_text'
=>
'营销类型'
,
'goods_title'
=>
'商品名称'
,
'goods_sku_sn'
=>
'规格编号'
,
'goods_original_price'
=>
'商品原价'
,
'goods_price'
=>
'商品价格'
,
'goods_sku_text'
=>
'商品规格'
,
'goods_num'
=>
'购买数量'
,
'dispatch_status_text'
=>
'发货状态'
,
'dispatch_fee'
=>
'发货费用'
,
// 'dispatch_type_text' => '发货方式',
// 'aftersale_refund' => '售后/退款',
// 'comment_status_text' => '评价状态',
'refund_fee'
=>
'退款金额'
,
'refund_msg'
=>
'退款原因'
,
'express_name'
=>
'快递公司'
,
'express_code'
=>
'快递编码'
,
'express_no'
=>
'快递单号'
,
];
// 经销商
$dealer
=
[];
$group_id_arr
=
array_column
(
$this
->
auth
->
getGroups
(),
'group_id'
);
if
(
!
in_array
(
1
,
$group_id_arr
)
&&
in_array
(
2
,
$group_id_arr
)){
$dealer
=
\app\admin\model\dealer\Dealer
::
where
(
'admin_id'
,
$this
->
auth
->
id
)
->
find
();
}
]);
$newList
=
[];
foreach
(
$list
as
$key
=>
$order
)
{
$data
=
[
'order_id'
=>
$order
[
'id'
],
'order_sn'
=>
$order
[
'order_sn'
],
// 'type_text' => $order['type_text'],
'status_text'
=>
$order
[
'status_text'
],
// 'pay_type_text' => $order['pay_type_text'],
'paytime_text'
=>
$order
[
'paytime_text'
],
// 'platform_text' => $order['platform_text'],
'user_info'
=>
$order
[
'user'
]
?
(
$order
[
'user'
][
'nickname'
]
.
'-'
.
$order
[
'user'
][
'mobile'
])
:
''
,
'total_amount'
=>
$order
[
'total_amount'
],
'discount_fee'
=>
$order
[
'discount_fee'
],
'pay_fee'
=>
$order
[
'pay_fee'
],
'score_fee'
=>
$order
[
'score_fee'
],
];
// 经销商不显示订单总金额和优惠金额
if
(
!
$dealer
){
$data
=
array_merge
(
$data
,[
'total_amount'
=>
$order
[
'total_amount'
],
'discount_fee'
=>
$order
[
'discount_fee'
],
]);
}
$data
=
array_merge
(
$data
,[
'pay_fee'
=>
$order
[
'pay_fee'
],
]);
foreach
(
$order
[
'item'
]
as
$k
=>
$item
)
{
if
(
!
$dealer
||
(
$dealer
&&
$item
[
'dealer_id'
]
==
$dealer
[
'id'
])){
$goods_sku_sn
=
$item
[
'goods_sku_sn'
]
?
$item
[
'goods_sku_sn'
][
'sn'
]
:
''
;
$itemData
=
[
'activity_type_text'
=>
$item
[
'activity_type_text'
],
'goods_title'
=>
$item
[
'goods_title'
],
'goods_sku_sn'
=>
$goods_sku_sn
,
'goods_original_price'
=>
$item
[
'goods_original_price'
],
'goods_price'
=>
$item
[
'goods_price'
],
'goods_sku_text'
=>
$item
[
'goods_sku_text'
],
'goods_num'
=>
$item
[
'goods_num'
],
'dispatch_status_text'
=>
$item
[
'dispatch_status_text'
],
'dispatch_fee'
=>
$item
[
'dispatch_fee'
],
// 'dispatch_type_text' => $item['dispatch_type_text'],
// 'aftersale_refund' => $item['aftersale_status_text'] . '/' . $item['refund_status_text'],
// 'comment_status_text' => $item['comment_status_text'],
'refund_fee'
=>
$item
[
'refund_fee'
],
'refund_msg'
=>
$item
[
'refund_msg'
],
'express_name'
=>
$item
[
'express_name'
],
...
...
@@ -195,9 +198,10 @@ class Order extends Base
}
}
$total_amount
=
!
$dealer
?
";订单总金额:¥"
.
array_sum
(
array_column
(
$list
,
'total_amount'
))
.
";优惠总金额:¥"
.
array_sum
(
array_column
(
$list
,
'discount_fee'
))
:
''
;
// 增加合计
$newList
[]
=
[
'order_id'
=>
"订单总数:"
.
count
(
$list
)
.
";订单总金额:¥"
.
array_sum
(
array_column
(
$list
,
'total_amount'
))
.
";优惠总金额:¥"
.
array_sum
(
array_column
(
$list
,
'discount_fee'
))
.
";实际支付总金额:¥"
.
array_sum
(
array_column
(
$list
,
'pay_fee'
))
'order_id'
=>
"订单总数:"
.
count
(
$list
)
.
$total_amount
.
";实际支付总金额:¥"
.
array_sum
(
array_column
(
$list
,
'pay_fee'
))
];
$export
->
exportExcel
(
'订单列表-'
.
date
(
'Y-m-d H:i:s'
),
$expCellName
,
$newList
);
...
...
@@ -899,16 +903,12 @@ class Order extends Base
$fieldArr
=
[
'Id'
=>
'order_id'
,
'订单号'
=>
'order_sn'
,
// '订单类型' => 'type_text',
'订单状态'
=>
'status_text'
,
// '支付类型' => 'pay_type_text',
'支付时间'
=>
'paytime_text'
,
// '交易平台' => 'platform_text',
'用户信息'
=>
'user_info'
,
'订单总金额'
=>
'total_amount'
,
'优惠金额'
=>
'discount_fee'
,
'实际支付金额'
=>
'pay_fee'
,
// '积分支付数量' => 'score_fee',
'营销类型'
=>
'activity_type_text'
,
'商品名称'
=>
'goods_title'
,
'商品原价'
=>
'goods_original_price'
,
...
...
@@ -917,9 +917,6 @@ class Order extends Base
'购买数量'
=>
'goods_num'
,
'发货状态'
=>
'dispatch_status_text'
,
'发货费用'
=>
'dispatch_fee'
,
// '发货方式' => 'dispatch_type_text',
// '售后/退款' => 'aftersale_refund',
// '评价状态' => 'comment_status_text',
'退款金额'
=>
'refund_fee'
,
'退款原因'
=>
'refund_msg'
,
'快递公司'
=>
'express_name'
,
...
...
application/admin/model/shopro/order/OrderItem.php
查看文件 @
b6b6b93
...
...
@@ -268,4 +268,10 @@ class OrderItem extends Model
{
return
$this
->
belongsTo
(
\app\admin\model\shopro\store\Store
::
class
,
'store_id'
);
}
// 规格编号
public
function
goodsSkuSn
()
{
return
$this
->
belongsTo
(
\app\admin\model\shopro\goods\SkuPrice
::
class
,
'goods_sku_price_id'
)
->
field
(
'id,sn'
);
}
}
...
...
请
注册
或
登录
后发表评论