导出 关联 转赠状态

main
yanzai 3 weeks ago
parent ec8df66565
commit 058a1413dd

@ -48,7 +48,7 @@ class OrderController extends Controller
}
$count = $list->count();
$list = $list->orderBy('id', 'desc')
->skip(($page - 1) * $pageSize) // 跳过前9999条记录
->skip(($page - 1) * $pageSize)
->take($pageSize)->get();
return \Yz::Return(true, "查询完成", ['list' => $list, 'count' => $count]);
}
@ -307,6 +307,69 @@ class OrderController extends Controller
];
foreach ($list as $table_item) {
if($table_item->status==6){ //如果是转赠查询转赠订单状态
if($table_item->transfer_type==1){
$z_order=DB::table('orders')
->select('*',
DB::raw("
CASE
WHEN status = 1 THEN '待支付'
WHEN status = 2 THEN '已支付'
WHEN status = 3 THEN '交易关闭'
WHEN status = 4 THEN '已完成'
WHEN status = 5 THEN '已退款'
WHEN status = 6 THEN '已转赠'
ELSE '未知'
END AS status_text
"),
DB::raw("
CASE
WHEN check_status = 1 THEN '待检'
WHEN check_status = 2 THEN '已到检'
ELSE '未知'
END AS check_status_text
"),
)
->where('id',$table_item->transfer_link)->first();
if(!!$z_order){
$table_item->status_text=$table_item->status_text.',被转赠:'.$z_order->check_status_text;
}
}
if($table_item->transfer_type==2){
$z_code=DB::table('transfer_code')
->where(['id'=>$table_item->transfer_link,'is_del'=>0])->first();
if(!!$z_code && $z_code->status==2){
$z_order=DB::table('orders')
->select('*',
DB::raw("
CASE
WHEN status = 1 THEN '待支付'
WHEN status = 2 THEN '已支付'
WHEN status = 3 THEN '交易关闭'
WHEN status = 4 THEN '已完成'
WHEN status = 5 THEN '已退款'
WHEN status = 6 THEN '已转赠'
ELSE '未知'
END AS status_text
"),
DB::raw("
CASE
WHEN check_status = 1 THEN '待检'
WHEN check_status = 2 THEN '已到检'
ELSE '未知'
END AS check_status_text
"),
)
->where('id',$z_code->pay_order_id)->first();
if(!!$z_order){
$table_item->status_text=$table_item->status_text.',被转赠:'.$z_order->check_status_text;
}
}else{
$table_item->status_text=$table_item->status_text.',转赠码未使用';
}
}
}
foreach ($col as $index => $key) {
$worksheet->setCellValueExplicit($index . $row, $table_item->$key, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);}
$row++;

Loading…
Cancel
Save