edit-admin-export-order
This commit is contained in:
@@ -342,27 +342,20 @@ class Orders extends HD_Controller
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$indexs = [];
|
||||
if ($params['export_type']) {
|
||||
$result = $this->orderslist->export_data($params['status_pid'], $params);
|
||||
$fileName = '保险明细';
|
||||
$data = $result['data'];
|
||||
$indexs = $result['indexs'];
|
||||
} else {
|
||||
$fieldAry = $this->orderslist->get_fields($params['status_pid'], 1);
|
||||
foreach ($fieldAry as $key => $value) {
|
||||
$indexs[$key] = $value['title'];
|
||||
}
|
||||
$result = $this->orderslist->lists($params['status_pid'], $params);
|
||||
$fileName = $result['_title'];
|
||||
foreach ($result['lists'] as $key => $value) {
|
||||
$temp = array();
|
||||
foreach ($fieldAry as $key2 => $value2) {
|
||||
$temp[$key2] = $value[$key2];
|
||||
}
|
||||
$data[] = $temp;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
$fieldAry = $this->ordersv2list->get_fields($params['status_pid'], 1);
|
||||
foreach ($fieldAry as $key => $value) {
|
||||
$indexs[$key] = $value['title'];
|
||||
}
|
||||
$result = $this->ordersv2list->lists($params['status_pid'], $params);
|
||||
$fileName = $result['_title'];
|
||||
foreach ($result['lists'] as $key => $value) {
|
||||
$temp = array();
|
||||
foreach ($fieldAry as $key2 => $value2) {
|
||||
$temp[$key2] = $value[$key2];
|
||||
}
|
||||
$data[] = $temp;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
@@ -245,7 +245,6 @@ class Ordersv2List
|
||||
$cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
|
||||
$fields['o_id'] = $val['id'];
|
||||
$fields['bill_time'] = $val['bill_time'];
|
||||
$fields['mobile'] = $val['mobile'];
|
||||
if(Orders_v2_entity::V2_START_ID<$val['id']){
|
||||
if($val['main_type']){
|
||||
$name = $info_json['c_company'];
|
||||
@@ -260,10 +259,14 @@ class Ordersv2List
|
||||
|
||||
}else{
|
||||
$open_url = '/receiver/orders/get?id=';
|
||||
$name = $val['name'];
|
||||
$mobile = $val['mobile'];
|
||||
$o_tp = '(旧订单)';
|
||||
$fields['name'] = $size > 1000 ? $val['name']
|
||||
: '<a href="javascript:;" data-open="'.$open_url . $val['id'] . '">' . $val['name']. $o_tp . '<br>' . $val['mobile'] . '</a>';
|
||||
}
|
||||
$fields['name'] = $name;
|
||||
$fields['mobile'] = $mobile;
|
||||
$fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}";
|
||||
$fields['price'] = number_format($money_json['price_car'], 2);
|
||||
$fields['payway_name'] = $this->paywayAry[$val['payway']];
|
||||
@@ -305,82 +308,15 @@ class Ordersv2List
|
||||
} else {
|
||||
$fields1['name'] = ['title' => '客户', 'width' => '14%'];
|
||||
}
|
||||
if (strlen($status_pid) && $status_pid == 0) {
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '22%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '10%'], 'price' => ['title' => '合同价', 'width' => '7%'],
|
||||
'payway_name' => ['title' => '付款', 'width' => '5%'],'admin_name' => ['title' => '销售员', 'width' => '7%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '8%'],'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '合同状态', 'width' => '7%'], 'order_time' => ['title' => '下定时间', 'width' => '12%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
} else if ($status_pid == 1) {
|
||||
$fields2 = ['title' => ['title' => '分期产品', 'width' => '15%'],
|
||||
'price_loan' => ['title' => '贷款金额', 'width' => '10%'], 'c_time' => ['title' => '分期时间', 'width' => '7%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '10%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '10%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
} else if ($status_pid == 2 || $status_pid == 3 || $status_pid == 4 || $status_pid == 5) {
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '9%']];
|
||||
$status_pid==4 && $fields2['u_time'] = ['title'=>'更新时间','width'=>'9%'];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
} else {
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'c_time' => ['title' => '订单时间', 'width' => '9%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
}
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'c_time' => ['title' => '订单时间', 'width' => '9%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
return $fields;
|
||||
}
|
||||
/*
|
||||
* 导出数据
|
||||
*/
|
||||
public function export_data($pid,$params){
|
||||
$indexs = [
|
||||
'name' => '客户姓名',
|
||||
'mobile' => '手机号',
|
||||
'c_time' => '订单时间',
|
||||
'bill_time' => '开票时间',
|
||||
'if_ins_db' => '是否代办',
|
||||
'company' => '保险公司',
|
||||
'business_risk' => '商业险金额',
|
||||
'ins_risk' => '交强险金额'
|
||||
];
|
||||
$result = $this->lists($pid, $params);
|
||||
foreach ($result['lists'] as $key => $value) {
|
||||
$temp = [
|
||||
'name' => $value['name'],
|
||||
'mobile' => $value['mobile'],
|
||||
'c_time' => $value['c_time'],
|
||||
'if_ins_db' => '',
|
||||
'company' => '',
|
||||
'business_risk' => '',
|
||||
'ins_risk' => ''
|
||||
];
|
||||
$temp['bill_time'] = $value['bill_time'] != '0000-00-00 00:00:00' ? $value['bill_time'] : '';
|
||||
$agent = $this->ci->order_agents_model->get(['o_id' => $value['o_id']],'jsondata');
|
||||
if($agent){
|
||||
$agent_jsondata = $agent['jsondata'] ? json_decode($agent['jsondata'], true) : '';
|
||||
if (isset($agent_jsondata['if_ins_db']) && $agent_jsondata['if_ins_db']) {
|
||||
$temp['if_ins_db'] = '是';
|
||||
isset($agent_jsondata['company']) && $temp['company'] = $agent_jsondata['company'];
|
||||
isset($agent_jsondata['ins_risk']) && $temp['ins_risk'] = $agent_jsondata['ins_risk'];
|
||||
isset($agent_jsondata['business_risk']) && $temp['business_risk'] = $agent_jsondata['business_risk'];
|
||||
}else{
|
||||
$temp['if_ins_db'] = '否';
|
||||
}
|
||||
}
|
||||
$data[] = $temp;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
return ['data'=>$data,'indexs'=>$indexs];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user