Commit edb88701 by 朱继来

调整导出字段

parent f1edeedc
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class OrderItemsExtModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_items_ext';
protected $primaryKey = 'ext_id';
protected $guarded = ['ext_id'];
public $timestamps = false;
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ use Excel;
use DB;
use App\Model\OrderPriceModel;
use App\Model\UserMainModel;
use App\Model\OrderItemsExtModel;
use App\Model\SampleInfoModel;
class OrderModel extends Model
{
......@@ -268,7 +270,7 @@ class OrderModel extends Model
})
->where('it.status', 1)
->where('o.order_goods_type', '=', $map['order_goods_type'])
->select('o.order_id', 'o.order_sn', 'o.user_id', 'o.order_type', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.sale_type', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'o.advance_pay_time', 'o.pay_time', 'it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.goods_class', 'it.self_supplier_type', 'it.extra_price', 'it.goods_discount_amount', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'oe.erp_sn', 'oe.order_type as extend_order_type', 'oe.send_remark', 'oe.is_new as is_new_order', 'oe.business_type', 'oe.jd_order_id', 'oe.exchange_rate', 'oe.sample_demand_desc')
->select('o.order_id', 'o.order_sn', 'o.user_id', 'o.order_type', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.sale_type', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'o.advance_pay_time', 'o.pay_time', 'it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.self_supplier_type', 'it.extra_price', 'it.goods_discount_amount', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'oe.erp_sn', 'oe.order_type as extend_order_type', 'oe.send_remark', 'oe.is_new as is_new_order', 'oe.business_type', 'oe.jd_order_id', 'oe.exchange_rate')
->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC')
// ->get()
......@@ -383,6 +385,14 @@ class OrderModel extends Model
$UserCompanyModel = new UserCompanyModel();
$company_info = $UserCompanyModel->whereIn('user_id', $all_user_id)->lists('com_name', 'user_id')->toArray();
// 获取明细扩展信息
$OrderItemsExtModel = new OrderItemsExtModel();
$order_items_ext_info = $OrderItemsExtModel->whereIn('order_id', $all_order_id)->select('order_id', 'goods_class')->get()->keyBy('order_id')->toArray();
// 获取样片信息
$SampleInfoModel = new SampleInfoModel();
$sample_info = $SampleInfoModel->whereIn('order_id', $all_order_id)->select('order_id', 'sample_demand_desc')->get()->keyBy('order_id')->toArray();
// 获取所有订单收货地址
$OrderAddressModel = new OrderAddressModel();
$order_address = $OrderAddressModel->where('address_type', 1)->whereIn('order_id', $all_order_id)->select('order_id', 'mobile', 'consignee', 'province','city','district', 'address')->get()->keyBy('order_id')->toArray();
......@@ -422,8 +432,9 @@ class OrderModel extends Model
$tmp[$i]['goods_id'] = $order[$i]['goods_id']."\t";
// 自营商品名称换成商品型号
$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_name'] = $order[$i]['order_goods_type'] == 1 ? $order[$i]['goods_name'] : $this->getGoodsName($order[$i]['goods_id']);
$tmp[$i]['goods_class'] = isset($order_items_ext_info[$order[$i]['order_id']]) ? $order_items_ext_info[$order[$i]['order_id']]['goods_class'] : '';
$tmp[$i]['brand_name'] = $order[$i]['brand_name'];
$tmp[$i]['supplier_name'] = $order[$i]['supplier_name'];
$tmp[$i]['currency'] = $order[$i]['currency'] == 1 ? 'RMB' : 'USD';
......@@ -497,8 +508,10 @@ class OrderModel extends Model
$tmp[$i]['sale_type'] = $order[$i]['sale_type'] == 1 ? '现卖' : '预售';
// 自营其他业务类型
$tmp[$i]['business_type'] = $order[$i]['business_type'] ? Config('params.business_type')[$order[$i]['business_type']] : '正常订单';
$tmp[$i]['self_supplier_type'] = isset($self_supplier_type[$order[$i]['self_supplier_type']]) ? $self_supplier_type[$order[$i]['self_supplier_type']] : '未知'; // 自采标记
$tmp[$i]['sample_demand_desc'] = $order[$i]['sample_demand_desc']; // 样片项目需求描述
// 自采标记
$tmp[$i]['self_supplier_type'] = isset($self_supplier_type[$order[$i]['self_supplier_type']]) ? $self_supplier_type[$order[$i]['self_supplier_type']] : '未知';
// 样片项目需求描述
$tmp[$i]['sample_demand_desc'] = isset($sample_info[$order[$i]['order_id']]) ? $sample_info[$order[$i]['order_id']]['sample_demand_desc'] : '';
//收货地址的电话
$tmp[$i]['receiving_address'] = isset($current_order_addr['mobile']) ? $current_order_addr['mobile'] : '';
} else {
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class SampleInfoModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_sample_info';
protected $primaryKey = 'sample_id';
protected $guarded = ['sample_id'];
public $timestamps = false;
}
\ No newline at end of file
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