diff --git a/admin/controllers/items/Transfer.php b/admin/controllers/items/Transfer.php index 7a13661f..8322f40e 100644 --- a/admin/controllers/items/Transfer.php +++ b/admin/controllers/items/Transfer.php @@ -132,6 +132,9 @@ class Transfer extends HD_Controller if ($params['title']) { $where["item_id in (select id from lc_items where vin like '%{$params['title']}%')"] = null; } + if ($params['admin_name']) { + $where["admin_id in (select id from lc_sys_admin where username like '%{$params['admin_name']}%')"] = null; + } if ($params['brand_id'] || $params['s_id'] || $params['v_id']) { $where_items = "brand_id = {$params['brand_id']}"; $params['s_id'] && $where_items .= " and s_id = {$params['s_id']}"; @@ -152,8 +155,7 @@ class Transfer extends HD_Controller $lists = array(); if ($total) { $rows = $this->mdTransfer->select($where, 'id desc', $params['page'], $params['size']); - $out_uids = $in_uids = []; - $out_uids_ad = $in_uids_ad = []; + $out_uids = $in_uids = $out_uids_ad = $in_uids_ad = $admin_ids = $map_admin = []; foreach ($rows as $v2) { if ($v2['out_uid']) { if ($v2['out_type'] == 1) { @@ -169,11 +171,16 @@ class Transfer extends HD_Controller $in_uids_ad[] = $v2['in_uid']; } } + $v2['admin_id'] && $admin_ids[] = $v2['admin_id'];//调拨人员id } $uids_arr = array_merge($out_uids, $in_uids); $uids_ad_arr = array_merge($out_uids_ad, $in_uids_ad); $uids = $this->mdUsers->get_map_by_ids($uids_arr, 'id,uname'); $uids_ad = $this->mdSysAdmin->get_map_by_ids($uids_ad_arr, 'id,username as uname'); + if ($admin_ids) { + $str_admin_ids = implode(',', array_unique($admin_ids)); + $map_admin = $this->mdSysAdmin->map('id', 'username', ["id in({$str_admin_ids})" => null]); + } foreach ($rows as $v) { $jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : []; $item_info = $this->item_info($v['item_id'], 1); @@ -202,6 +209,7 @@ class Transfer extends HD_Controller $in_addr_name = $this->take_biz(['uid' => $v['in_uid'], 'biz_id' => $v['biz_id'], 'addr_id' => $v['addr_id']], $v['in_type']); } $jsondata['transport']['name'] && $transport_name = $jsondata['transport']['name']; + $admin_name = $v['admin_id'] ? $map_admin[$v['admin_id']] : '-'; $setValue = [ 'id' => $v['id'], 'title' => $item_info['title'], @@ -211,6 +219,7 @@ class Transfer extends HD_Controller 'transport_name' => $transport_name, 'trailer_fees' => $v['trailer_fees'], 'abnormal' => $this->mdTransfer->abnormalAry($v['abnormal']), + 'admin_name' => $admin_name, 'c_time' => date('Y.m.d H:i', $v['c_time']), 'status' => $v['status'], 'status_name' => $statusAry[$v['status']], @@ -298,7 +307,12 @@ class Transfer extends HD_Controller } } $jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : []; - $fields[] = ['title' => '调拨时间', 'value' => date('Y-m-d H:i:s', $re['c_time'])]; + $admin_name = date('Y-m-d H:i:s', $re['c_time']); + if ($re['admin_id']) { + $re_admin = $this->mdSysAdmin->get(array('id' => $re['admin_id'])); + $re_admin && $admin_name = $re_admin['username'] . '   ' . $admin_name; + } + $fields[] = ['title' => '调拨信息', 'value' => $admin_name]; $fields[] = ['title' => '提车信息', 'value' => $out_content . $out_content_bak]; $fields[] = ['title' => '接车信息', 'value' => $in_content . $in_content_bak]; $fields[] = ['title' => '运输人员', 'value' => $jsondata['transport']['name'] . '   ' . @@ -615,6 +629,7 @@ class Transfer extends HD_Controller $id = $info['id']; $this->mdTransfer->update($add, ['id' => $id]); } else { + $add['admin_id'] = $this->uid; $add['c_time'] = $c_time; $id = $this->mdTransfer->add($add); if (!$id) { @@ -965,6 +980,7 @@ class Transfer extends HD_Controller $temp['title'] = $value['title']; $temp['vin'] = $value['vin']; $temp['transport_name'] = $value['transport_name']; + $temp['admin_name'] = $value['admin_name']; $temp['c_time'] = $value['c_time']; $temp['out_uid_title'] = $value['out_uid_title']; $temp['out_addr_name'] = $value['out_addr_name']; @@ -981,6 +997,7 @@ class Transfer extends HD_Controller 'title' => '车辆', 'vin' => '车架号', 'transport_name' => '运输人员', + 'admin_name' => '调拨人', 'c_time' => '调拨时间', 'out_uid_title' => '提车人', 'out_addr_name' => '提车地址', diff --git a/admin/views/items/transfer/lists.php b/admin/views/items/transfer/lists.php index 8900cecf..c75235f7 100644 --- a/admin/views/items/transfer/lists.php +++ b/admin/views/items/transfer/lists.php @@ -89,12 +89,19 @@
- +
+
+ +
+ +
+
@@ -235,7 +242,7 @@ 车辆 车架号 运输人/费 - 调拨时间 + 调拨人/时间 提车人 接车人 异常 @@ -251,7 +258,7 @@ ' . $v['trailer_fees'] : '' ?> - +
' . $v['out_addr_name'] : '' ?> ' . $v['in_addr_name'] : '' ?> @@ -326,6 +333,7 @@ $('#v_id').val('0'); $('#out_time').val(''); $('#in_time').val(''); + $('#admin_name').val(''); that.params.trailer_fees = ''; that.params.status = ''; that.params.abnormal = ''; diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php index 32a91961..180fbd2d 100644 --- a/api/controllers/plan/Licheb.php +++ b/api/controllers/plan/Licheb.php @@ -78,7 +78,7 @@ class Licheb extends HD_Controller $a_num = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type' => 4, 'c_time>=' => $s_time, 'c_time<=' => $e_time, "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null] ); - $follows = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type<>' => 3, 'c_time>=' => $s_time, 'c_time<=' => $e_time, + $follows = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type in(0,1,2)' => null, 'c_time>=' => $s_time, 'c_time<=' => $e_time, "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null], 'distinct(customer_id)' ); $defeats = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type' => 7, 'c_time>=' => $s_time, 'c_time<=' => $e_time, diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 376858b4..8b05561e 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -715,15 +715,12 @@ class Customers extends Wxapp ]; $val['cont_time'] != '0000-00-00 00:00:00' && $other_data['上次联系'] = date('Y-m-d', strtotime($val['cont_time'])); $tags = [$val['level'] . '级用户']; - $defeat = $orders_pay = ''; + $defeat = ''; if ($val['if_defeat'] == 1) { $defeat = '战败申请中'; } else if ($val['if_defeat'] == 2) { $defeat = '再战'; } - //查找订单未支付 - $orders_count = $this->mdOrders->count(['status' => 0, 'customer_id' => $val['id']]); - $orders_count && $orders_pay = '订单未支付'; $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], @@ -732,8 +729,7 @@ class Customers extends Wxapp 'is_top' => $val['is_top'], 'other_data' => $other_data, 'tags' => $tags, - 'defeat' => $defeat, - 'orders_pay' => $orders_pay + 'defeat' => $defeat ]; } } diff --git a/api/controllers/wxapp/licheb/Transfer.php b/api/controllers/wxapp/licheb/Transfer.php index 3496d258..0ec87b82 100644 --- a/api/controllers/wxapp/licheb/Transfer.php +++ b/api/controllers/wxapp/licheb/Transfer.php @@ -115,22 +115,21 @@ class Transfer extends Wxapp $limit = $size; if ($select_type) {//渠道经理 $res = $this->mdTransfer->select($where, 'id desc', $page, $limit, 'id,item_id,out_uid,in_uid,jsondata - ,c_time,biz_id,out_type,in_type,out_time,in_time'); + ,c_time,biz_id,out_type,in_type,out_time,in_time,admin_id'); $url = '/pages/allot/detail/index?tran_id='; } else { $this->db->from('lc_items_transfer_remind'); $this->db->join('lc_items_transfer', "lc_items_transfer.id = lc_items_transfer_remind.tran_id", 'left'); $this->db->select('lc_items_transfer_remind.id,lc_items_transfer_remind.tran_id,lc_items_transfer.item_id,lc_items_transfer.out_uid,lc_items_transfer.in_uid ,lc_items_transfer.jsondata,lc_items_transfer.c_time,lc_items_transfer.biz_id,lc_items_transfer.out_type,lc_items_transfer.in_type - ,lc_items_transfer.out_time,lc_items_transfer.in_time'); + ,lc_items_transfer.out_time,lc_items_transfer.in_time,lc_items_transfer.admin_id'); $this->db->where($where); $this->db->order_by('lc_items_transfer_remind.id Desc'); $this->db->group_by('lc_items_transfer_remind.tran_id'); $this->db->limit($limit, $offset); $res = $this->db->get()->result_array(); } - $out_uids = $in_uids = []; - $out_uids_ad = $in_uids_ad = []; + $out_uids = $in_uids = $out_uids_ad = $in_uids_ad = $admin_ids = $map_admin = []; foreach ($res as $v2) { if ($v2['out_uid']) { if ($v2['out_type'] == 1) { @@ -146,12 +145,17 @@ class Transfer extends Wxapp $in_uids_ad[] = $v2['in_uid']; } } + $v2['admin_id'] && $admin_ids[] = $v2['admin_id'];//调拨人员id } $uids_arr = array_merge($out_uids, $in_uids); $uids_ad_arr = array_merge($out_uids_ad, $in_uids_ad); $uids = $this->mdUsers->get_map_by_ids($uids_arr, 'id,uname'); $uids_ad = $this->mdSysAdmin->get_map_by_ids($uids_ad_arr, 'id,username as uname'); $bizs = $this->mdBiz->get_map_by_ids(array_unique(array_column($res, 'biz_id')), 'id,biz_name');//门店 + if ($admin_ids) { + $str_admin_ids = implode(',', array_unique($admin_ids)); + $map_admin = $this->mdSysAdmin->map('id', 'username', ["id in({$str_admin_ids})" => null]); + } foreach ($res as $key => $val) { $jsondata = $val['jsondata'] ? json_decode($val['jsondata'], true) : []; $item_info = $this->item_info($val['item_id']); @@ -210,6 +214,9 @@ class Transfer extends Wxapp $other_data[] = ['title' => '品牌车型', 'value' => $item_info['title_1']]; $other_data[] = ['title' => '颜色型号', 'value' => $item_info['title_2']]; $other_data[] = ['title' => '车架号', 'value' => $item_info['vin']]; + if ($val['admin_id']) { + $other_data[] = ['title' => '调拨人', 'value' => $map_admin[$val['admin_id']]]; + } $other_data[] = ['title' => '调拨时间', 'value' => date('Y-m-d', $val['c_time'])]; $other_data[] = ['title' => '提车人', 'value' => $out_uid_title]; if ($out_uid_title && $val['out_time'] != '0000-00-00 00:00:00') {