From 01406cac41d5cb57bafaf91036d2026ca5e9cb69 Mon Sep 17 00:00:00 2001
From: lccsw <805383944@qq.com>
Date: Wed, 13 Apr 2022 14:02:26 +0800
Subject: [PATCH] edit-admin-order
---
admin/controllers/receiver/orderv2/Orders.php | 11 +++-
admin/libraries/Ordersv2List.php | 58 ++++++++++++++----
admin/views/receiver/orderv2/lists.php | 59 +++++++++++++------
api/controllers/plan/Order.php | 45 ++++++++++++++
.../order/Receiver_orders_v2_model.php | 4 +-
5 files changed, 144 insertions(+), 33 deletions(-)
diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php
index 7b69de1b..afa80a95 100644
--- a/admin/controllers/receiver/orderv2/Orders.php
+++ b/admin/controllers/receiver/orderv2/Orders.php
@@ -71,7 +71,11 @@ class Orders extends HD_Controller
$where_s["{$t2}.status in ({$key2},{$up_key})"] = null;
}
$where_s = array_merge($where,$where_s);
- $count2 = $this->receiver_orders_v2_model->selectOrders($where_s,'','', '', 1);
+ $having = 'total = 1';
+ if($key==0 && $key2==1){ //已付款
+ $having = 'total >= 1';
+ }
+ $count2 = $this->receiver_orders_v2_model->selectOrders($where_s,'','', '', 1,'',$having);
}else{
$where_s = [
"id not in (select o_id from lc_receiver_order_status where pid_status={$value['pid_status']} and status=1)" => null
@@ -721,6 +725,9 @@ class Orders extends HD_Controller
$url = http_host_com('api').'/pdfapi/add_pdf?oid='.$row['id'];
$pdf_res = file_get_contents($url);
}
+ if($row['order_time'] == '0000-00-00 00:00:00'){ //更新下定时间
+ $this->receiver_orders_v2_model->update(['order_time' => date('Y-m-d H:i:s',strtotime($pay_time))], ['id' => $row['id']]);
+ }
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
@@ -765,7 +772,7 @@ class Orders extends HD_Controller
}
$re_data = $this->receiver_order_datas_model->get(['o_id'=>$id]);
if(!$re_data){
- $re_data_id = $this->eceiver_order_datas_model->add(['c_time'=>time(),'o_id'=>$id]);
+ $re_data_id = $this->receiver_order_datas_model->add(['c_time'=>time(),'o_id'=>$id]);
}else{
$re_data_id = $re_data['id'];
}
diff --git a/admin/libraries/Ordersv2List.php b/admin/libraries/Ordersv2List.php
index 48d2ff8a..d7df9df1 100644
--- a/admin/libraries/Ordersv2List.php
+++ b/admin/libraries/Ordersv2List.php
@@ -122,6 +122,16 @@ class Ordersv2List
$where["{$this->t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
+ //下定时间
+ if ($params['order_time']) {
+ $order_time = explode(' ~ ', $params['order_time']);
+ if ($order_time[0]) {
+ $where["{$this->t1}.order_time >="] = strtotime($order_time[0] . ' 00:00:00');
+ }
+ if ($order_time[1]) {
+ $where["{$this->t1}.order_time <="] = strtotime($order_time[1] . ' 23:59:59');
+ }
+ }
//开票时间
if ($params['bill_time']) {
$bill_time = explode(' ~ ', $params['bill_time']);
@@ -191,7 +201,8 @@ class Ordersv2List
}
$fileds = "{$this->t1}.id,{$this->t1}.name,{$this->t1}.mobile,{$this->t1}.brand_id,{$this->t1}.s_id,{$this->t1}.v_id,
{$this->t1}.cor_id,{$this->t1}.incor_id,{$this->t1}.money_json,{$this->t1}.payway,{$this->t1}.status,{$this->t1}.c_time,
- {$this->t1}.biz_id,{$this->t1}.bill_time,{$this->t1}.customer_id,{$this->t1}.owner_name,{$this->t1}.owner_mobile,{$this->t1}.main_type,{$this->t1}.info_json";
+ {$this->t1}.biz_id,{$this->t1}.bill_time,{$this->t1}.customer_id,{$this->t1}.owner_name,{$this->t1}.owner_mobile,{$this->t1}.main_type,{$this->t1}.info_json,
+ {$this->t1}.order_time,{$this->t1}.bill_time";
if($params['status_pid']==3){
$where["{$this->t1}.id in (select o_id from lc_receiver_order_status where pid_status=0 and status=2)"] = null;
}
@@ -202,8 +213,12 @@ class Ordersv2List
$where["{$this->t2}.pid_status"] = $params['status_pid'];
$up_key = $params['status']+1;
$where["{$this->t2}.status in ({$params['status']},{$up_key})"] = null;
- $count = $this->ci->mdOrders->selectOrders($where,'', '', '', 1);
- $rows = $this->ci->mdOrders->selectOrders($where, "c_time desc", $page, $size, '',$fileds);
+ $having = "total = 1";
+ if($params['status_pid']==0 && $params['status']==1){
+ $having = "total >= 1";
+ }
+ $count = $this->ci->mdOrders->selectOrders($where,'', '', '', 1,'',$having);
+ $rows = $this->ci->mdOrders->selectOrders($where, "c_time desc", $page, $size, '',$fileds,$having);
}else{
if(strlen($params['status'])){
$where["id not in (select o_id from lc_receiver_order_status where pid_status={$params['status_pid']} and status=1)"] = null;
@@ -282,8 +297,13 @@ class Ordersv2List
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
$fields['cf_title'] = $customers[$val['customer_id']][0]['cf_title'];
- $fields['cf_clues'] = $customers[$val['customer_id']][0]['cf_clues'];
- $fields['cf_name'] = $cfroms[$customers[$val['customer_id']][0]['cf_id']][0]['title'];
+ $cf_name = $cfroms[$customers[$val['customer_id']][0]['cf_id']][0]['title'];
+ $cf_clues = $customers[$val['customer_id']][0]['cf_clues'];
+ $fields['cf_name'] = '';
+ $cf_name && $fields['cf_name'] = $cf_name.'(线上)
';
+ $cf_clues && $fields['cf_name'] .= $cf_clues.'(线下)';
+ $fields['order_time'] = $val['order_time'] != '0000-00-00 00:00:00' ? $val['order_time'] : '';
+ $fields['bill_time'] = $val['bill_time'] != '0000-00-00 00:00:00' ? $val['bill_time'] : '';
$lists[] = $fields;
}
}
@@ -311,12 +331,28 @@ class Ordersv2List
} else {
$fields1['name'] = ['title' => '客户', 'width' => '14%'];
}
- $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%']];
+ if(strlen($status_pid) && $status_pid==0){
+ $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%'],
+ 'order_time' => ['title' => '下定时间', 'width' => '9%']];
+ }elseif($status_pid==3){
+ $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%'],
+ 'bill_time' => ['title' => '开票时间', 'width' => '9%']];
+ }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);
return $fields;
}
diff --git a/admin/views/receiver/orderv2/lists.php b/admin/views/receiver/orderv2/lists.php
index 222fbfb3..e2d4ef39 100644
--- a/admin/views/receiver/orderv2/lists.php
+++ b/admin/views/receiver/orderv2/lists.php
@@ -218,6 +218,29 @@
+
+
| = $v['title'] ?> | + } ?> +||||||||
|---|---|---|---|---|---|---|---|---|
| = $v['name'] ?> | -= $v['car_name'] ?> | -= $v['biz_name'] ?> | -= $v['price'] ?> | -= $v['payway_name'] ?> | -= $v['cf_title'] ?> | -
- = $v['cf_name'] ?>(线上) }?> - = $v['cf_clues'] ?>(线下)}?> - |
- = $v['status_name'] ?> | -= $v['c_time'] ?> | -
| = $v[$key] ?> | + } ?> +