edit-admin-order_list

This commit is contained in:
lccsw
2021-11-12 16:04:59 +08:00
parent 06d3923550
commit a452cb0470
9 changed files with 209 additions and 22 deletions
+19
View File
@@ -20,6 +20,7 @@ class Customer extends HD_Controller
parent::__construct();
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model');
$this->load->model('receiver/receiver_clues_model', 'clues_model');
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('receiver/receiver_xz_model');
$this->load->model('app/licheb/app_licheb_users_model');
@@ -259,11 +260,29 @@ class Customer extends HD_Controller
} else {
$mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : '';
}
$cf_row = $this->clues_cfrom_model->get(['id'=>$row['cf_id']], 'id,title');
//获取分销用户
$cf_user = '';
$clues = $this->clues_model->get(['id'=>$row['rid']],'recommend_id');
if($clues['recommend_id']){
$this->load->model('app/liche/app_liche_users_model');
$user = $this->app_liche_users_model->get(['id'=>$clues['recommend_id']],'id,nickname,up_uid');
$user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id'=>$user['up_uid']],'id,nickname'); //上一级分销用户
print_r($up_user);
if($up_user){
$cf_user = "{$up_user['nickname']}(一级) => {$user['nickname']}(二级)";
}else{
$cf_user = $user['nickname'];
}
}
$info = array(
'id' => $row['id'],
'name' => $row['name'],
'mobile' => $mobile_sub,
'cf_title' => $row['cf_title'],
'cf_name' => $cf_row['title'],
'cf_clues' => $row['cf_clues'],
'cf_user' => $cf_user,
'c_time' => date('Y-m-d H:i:s', $row['c_time']),
'status' => $row['status'],
);
+2
View File
@@ -566,6 +566,7 @@ class Orders extends HD_Controller
$bill['id'] = $this->order_bills_model->add($add_data);
}
$bill['src_file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : '';
$bill['bill_time'] = $row['bill_time'] != '0000-00-00 00:00:00' ? $row['bill_time'] : '';
$this->data['bill'] = $bill;
return $this->show_view('receiver/orders/get_bill');
}
@@ -595,6 +596,7 @@ class Orders extends HD_Controller
, 'com_time' => $bill_time, 'biz_id' => $row_order['biz_id'], 'addr_id' => $row_order['addr_id']);
$this->items_entity->add_log($params);
}
$this->orders_model->update(['bill_time'=>$bill_time],['id'=>$row['o_id']]);
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
} else {
+116 -20
View File
@@ -150,6 +150,16 @@ class OrdersList
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
//开票时间
if ($params['bill_time']) {
$bill_time = explode(' ~ ', $params['bill_time']);
if ($bill_time[0]) {
$where["bill_time >="] = $bill_time[0] . ' 00:00:00';
}
if ($bill_time[1]) {
$where["bill_time <="] = $bill_time[1] . ' 23:59:59';
}
}
if ($params['brand_id']) {//品牌
$where["brand_id"] = $params['brand_id'];
} else {
@@ -221,7 +231,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -255,7 +273,9 @@ class OrdersList
$fields['status_name'] = $status_arr[$val['status']]['name'];
$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['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$fields['cf_clues'] = $customers[$val['rid']][0]['cf_clues'];
$fields['cf_name'] = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'];
$lists[] = $fields;
}
}
@@ -431,7 +451,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
//品牌车型
$brands = $this->ci->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
//车系车型
@@ -479,7 +507,11 @@ class OrdersList
$fields['price'] = $val['price'] > 1 ? number_format($val['price']) : number_format($val['price'], 2);
$fields['deposit'] = $val['deposit'] > 1 ? number_format($val['deposit']) : number_format($val['deposit'], 2);
$fields['biz_name'] = $map_biz[$admin['biz_id']];
$fields['cf_title'] = $customers[$val['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$cf_name = '';
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
$customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
$fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -643,7 +675,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
$finance_arr = array_column($rows, 'finance_id');
$finance_rows = $this->ci->sys_finance_model->get_map_by_ids($finance_arr, 'id,title');
foreach ($rows as $key => $val) {
@@ -657,7 +697,11 @@ class OrdersList
$fields['price_loan'] = number_format($price_loan, 2);
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
$fields['status_name'] = $status_arr[$val['status']];
$fields['cf_title'] = $customers[$val['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$cf_name = '';
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
$customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
$fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -820,7 +864,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -853,7 +905,11 @@ class OrdersList
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['cf_title'] = $customers[$val['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$cf_name = '';
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
$customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
$fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1016,7 +1072,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -1050,6 +1114,11 @@ class OrdersList
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['cf_title'] = $customers[$val['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$cf_name = '';
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
$customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
$fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1212,7 +1281,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -1245,7 +1322,11 @@ class OrdersList
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['cf_title'] = $customers[$val['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$cf_name = '';
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
$customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
$fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1408,7 +1489,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
$cfroms = [];
if($customers){
foreach($customers as $key=>$val){
$cf_id_arr[] = $val[0]['cf_id'];
}
//获取来源
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
}
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -1441,7 +1530,11 @@ class OrdersList
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['cf_title'] = $customers[$val['rid']];
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
$cf_name = '';
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
$customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
$fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1471,26 +1564,29 @@ class OrdersList
if (strlen($status_pid) && $status_pid == 0) {
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '22%'],
'biz_name' => ['title' => '门店', 'width' => '10%'], 'price' => ['title' => '合同价', 'width' => '7%'],
'deposit' => ['title' => '定金', 'width' => '7%'], 'payway_name' => ['title' => '付款', 'width' => '5%'],
'admin_name' => ['title' => '销售员', 'width' => '7%'], 'cf_title' => ['title' => '来源类型', 'width' => '8%'],
'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%'], 'c_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%'], 'status_name' => ['title' => '状态', 'width' => '10%']];
'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%'],
'deposit' => ['title' => '定金', 'width' => '8%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'status_name' => ['title' => '状态', 'width' => '9%']];
'payway_name' => ['title' => '付款方式', 'width' => '8%'],
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
'status_name' => ['title' => '状态', 'width' => '9%']];
$fields = array_merge($fields1, $fields2);
} else {
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
'deposit' => ['title' => '定金', 'width' => '8%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'status_name' => ['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);
}
+16
View File
@@ -61,6 +61,22 @@
加入时间:{{info.c_time}}
</td>
</tr>
<tr>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">线上来源:</div>
{{info.cf_name}}&nbsp
</div>
</td>
<td class="table-td">
线下来源:{{info.cf_clues}}
</td>
<td class="table-td">
<template v-if="info.cf_user">分销来源:{{info.cf_user}}</template>
</td>
<td class="table-td">
</td>
</tr>
<tr>
<td>
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
+14
View File
@@ -229,6 +229,17 @@
</select>
</div>
</div>
<?if($params['status']==6){?>
<div class="am-form-group fl">
<label class="am-para-label w100">开票时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-bill-time" name="bill_time" type="text" value="<?= $params['bill_time'] ?>"
placeholder="订单时间范围" autocomplete="off"/>
</div>
</div>
</div>
<?}?>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
@@ -281,6 +292,9 @@
laydate.render({
elem: '#id-create-time', range: '~'
});
laydate.render({
elem: '#id-bill-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
+7
View File
@@ -33,6 +33,13 @@
</div>
</div>
<div class="am-form-group" v-if="info.bill_time">
<label class="am-para-label">开票时间:</label>
<div class="am-para-input w150" style="line-height:39px;">
{{info.bill_time}}
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
+5 -2
View File
@@ -237,9 +237,9 @@
<th width="24%"><span>车辆</span></th>
<th width="11%"><span>门店</span></th>
<th width="8%"><span>车辆平台价</span></th>
<th width="7%"><span>定金</span></th>
<th width="6%"><span>付款方式</span></th>
<th width="8%"><span>来源类型</span></th>
<th width="10%"><span>来源</span></th>
<th width="8%"><span>状态</span></th>
<th width="12%"><span>订单时间</span></th>
</tr>
@@ -252,9 +252,12 @@
<td><?= $v['car_name'] ?></td>
<td><?= $v['biz_name'] ?></td>
<td><?= $v['price'] ?></td>
<td><?= $v['deposit'] ?></td>
<td><?= $v['payway_name'] ?></td>
<td><?= $v['cf_title'] ?></td>
<td>
<?if($v['cf_name']){?><?= $v['cf_name'] ?>(线上)<br><?}?>
<?if($v['cf_clues']){?><?= $v['cf_clues'] ?>(线下)<?}?>
</td>
<td><?= $v['status_name'] ?></td>
<td><?= $v['c_time'] ?></td>
</tr>
+29
View File
@@ -70,4 +70,33 @@ class Test extends HD_Controller
echo 'finish';
}
}
public function bill_time(){
$this->load->model('items/items_model');
$this->load->model('receiver/order/receiver_orders_model');
$page = $this->input->get('page');
$size = $this->input->get('size');
!$page && $page = 1;
!$size && $size = 20;
$where = [
'bill_time>' => '0000-00-00 00:00:00'
];
$rows = $this->items_model->select($where,'id desc',$page,$size);
if($rows){
foreach($rows as $key=>$val){
$last_id = $val['id'];
$this->receiver_orders_model->update(['bill_time'=>$val['bill_time']],['item_id'=>$val['id']]);
}
$where = [
'bill_time>' => '0000-00-00 00:00:00',
'id<' => $last_id
];
$left = $this->items_model->count($where);
$ids = implode(',',array_column($rows,'id'));
echo "do:{$ids} left:{$left}";
}else{
echo 'finish';
}
}
}
+1
View File
@@ -197,3 +197,4 @@ alter table lc_receiver_orders add finance_id int(10) unsigned not null default
alter table lc_receiver_orders add money_json json default null comment "价格json数据" after info_json;
alter table lc_receiver_orders add srv_ids varchar(100) not null default '' comment '服务id多个逗号隔开' after pack_id;
alter table lc_receiver_orders add fine_ids varchar(100) not null default '' comment '精品id多个逗号隔开' after srv_ids;
alter table lc_receiver_orders add bill_time timestamp not null default '0000-00-00 00:00:00' comment '开票时间' after delry_time;