Commit 05f3d024 by 朱继来

调整订单导出

parent abc3e829
Showing with 47 additions and 25 deletions
......@@ -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();
foreach ($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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment