owners_722

This commit is contained in:
dengbw
2022-07-22 17:30:48 +08:00
committed by lccsw
parent 1acdac1d51
commit 5009cc79a7
4 changed files with 103 additions and 17 deletions
+29 -6
View File
@@ -10,7 +10,6 @@ class Owners extends HD_Controller
{
private $searchTpAry = array('mobile' => '车主电话', 'name' => '车主姓名', 'car_num' => '车牌号');
private $searchTimeAry = array('c_time' => '创建时间', 'order_time' => '购车时间', 'ck_time' => '交付时间', 'u_time' => '最后操作时间');
protected $log_dir;
public function __construct()
{
@@ -20,7 +19,6 @@ class Owners extends HD_Controller
$this->load->model('receiver/receiver_owners_tag_model', 'mdOwnersTag');
$this->load->model('receiver/receiver_owners_tagdata_model', 'mdOwnersTagdata');
$this->load->model('receiver/receiver_xz_model');
$this->log_dir = 'receiver_' . get_class($this);
}
public function index()
@@ -33,7 +31,11 @@ class Owners extends HD_Controller
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$where = array('status>=0' => null);
if (strlen($params['status'])) {
$where["status"] = $params['status'];
} else {
$where["status>=0"] = null;
}
if ($params['title']) {
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
@@ -96,6 +98,7 @@ class Owners extends HD_Controller
$count = $this->mdOwners->count($where);
$lists = [];
$wxqyAry = $this->mdOwners->wxqyAry();
$statusAry = $this->mdOwners->statusAry();
if ($count) {
$this->load->model('auto/auto_brand_model', 'mdBrand');
$this->load->model('auto/auto_series_model', 'mdSeries');
@@ -143,11 +146,13 @@ class Owners extends HD_Controller
'order_time' => $val['order_time'] != '0000-00-00 00:00:00' ? $val['order_time'] : '',
'ck_time' => $val['ck_time'] != '0000-00-00 00:00:00' ? $val['ck_time'] : '',
'u_time' => $val['u_time'],
'status_name' => $statusAry[$val['status']],
);
}
}
$show_info['searchTpAry'] = $this->searchTpAry;
$show_info['wxqyAry'] = $wxqyAry;
$show_info['statusAry'] = $statusAry;
$this->data['show_info'] = $show_info;
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
@@ -172,6 +177,7 @@ class Owners extends HD_Controller
}
$info = $row;
$info['mobile'] = $mobile_sub;
$info['edit_type'] = 0;
$info['order_time'] = $row['order_time'] != '0000-00-00 00:00:00' ? $row['order_time'] : '';
$info['ck_time'] = $row['ck_time'] != '0000-00-00 00:00:00' ? $row['ck_time'] : '';
$info['c_time'] = date('Y-m-d H:i:s', $row['c_time']);
@@ -211,6 +217,7 @@ class Owners extends HD_Controller
}
}
$show_info['wxqyAry'] = $this->mdOwners->wxqyAry();
$show_info['statusAry'] = $this->mdOwners->statusAry();
$this->data['show_info'] = $show_info;
$this->data['info'] = $info;
$this->data['logs'] = $logs;
@@ -268,8 +275,24 @@ class Owners extends HD_Controller
}
$msg = '修改成功';
$code = SYS_CODE_SUCCESS;
if ($info['editType'] == 1) {
} else if ($info['editType'] == 2) {
if ($info['edit_type'] == 1) {//更新状态
if ($row['status'] == $info['status']) {
return $this->show_json(SYS_CODE_FAIL, '未修改状态!');
}
$statuAry = $this->mdOwners->statusAry();
$status_name = $statuAry[$row['status']];
$status_name_up = $statuAry[$info['status']];
$log = '更新状态(' . $status_name . ')为(' . $status_name_up . ')';
$up_data['status'] = $info['status'];
$ret = $this->mdOwners->update($up_data, array('id' => $info['id']));
if (!$ret) {
$code = SYS_CODE_FAIL;
$msg = '修改状态失败';
} else {
$msg = '修改状态成功';
$this->addLog(array('own_id' => $info['id'], 'type' => 0, 'log' => $log));
}
} else if ($info['edit_type'] == 2) {
//更新车主信息
$ret = $this->mdOwners->update(['name' => $info['name'], 'birth_day' => $info['birth_day'], 'sex' => $info['sex'],
'brand_id' => $info['brand_id'], 's_id' => $info['s_id'], 'v_id' => $info['v_id'], 'car_num' => $info['car_num'],
@@ -282,7 +305,7 @@ class Owners extends HD_Controller
$msg = '修改车主信息成功';
$this->addLog(array('own_id' => $info['id'], 'type' => 0, 'log' => '更新车主信息'));
}
} else if ($info['editType'] == 3) {
} else if ($info['edit_type'] == 3) {
$id = $info['id'];
//客户标签
if (!$info['tag']) {
+47 -7
View File
@@ -1,5 +1,37 @@
<div class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
<div id="vue-edit">
<div class="am-g">
<div class="col-sm-12" style="margin-bottom: 20px;">
<div class="col-sm-2">
<div class="my-panel">
<div class="text-center">
状态
</div>
<div class="text-center" style="padding-top: 5px;">
<select id="status" v-model="info.status" disabled="disabled">
<template v-for="(v,i) in show_info.statusAry">
<option :value="i">{{v}}</option>
</template>
</select>
</div>
</div>
</div>
<div class="am-form-inline" style="padding-right: 10px;padding-top: 12px;">
<div class="text-right">
<div class="am-form-group ml10">
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
@click="editType(1)" v-if="info.edit_type==1">取消编辑</a>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
@click="editType(1)" v-else>编辑状态</a>
</div>
<div class="am-form-group ml10" v-if="info.edit_type==1">
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
@click="saveEdit()">修改状态</a>
</div>
</div>
</div>
</div>
</div>
<div class="am-u-lg-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
@@ -149,7 +181,7 @@
<tr>
<td>
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
<div class="text-left pt10" v-if="edit_index==2">
<div class="text-left pt10" v-if="info.edit_type==2">
<div class="am-form-group ml10">
<a href="javascript:void(0)"
class="am-btn am-btn-sm am-btn-success"
@@ -219,7 +251,7 @@
</td>
</tr>
</template>
<tr v-if="edit_index==3">
<tr v-if="info.edit_type==3">
<td>
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
<div class="text-left pt10">
@@ -315,7 +347,6 @@
vue_obj = new Vue({
el: '#vue-edit',
data: {
edit_index: 0,
info: {},
show_info: {},
logs: [],
@@ -375,10 +406,20 @@
},
editType: function (index) {
var vm = this;
if (vm.edit_index == index) {
vm.edit_index = 0;
if (index == 1) {
if (vm.info.edit_type == 1) {
$("#status").attr("disabled", "disabled");
vm.info.edit_type = 0;
} else {
$("#status").removeAttr("disabled");
vm.info.edit_type = 1;
}
} else {
vm.edit_index = index;
if (vm.info.edit_type == index) {
vm.info.edit_type = 0;
} else {
vm.info.edit_type = index;
}
}
},
logModal: function () {
@@ -424,7 +465,6 @@
},
saveEdit: function () {
var vm = this;
vm.info.editType = vm.edit_index;
$.ajax({
url: '/receiver/owners/edit',
type: 'post',
+18 -1
View File
@@ -1,4 +1,19 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?= !strlen($params['status']) ? 'active' : '' ?>">
<a href="javascript:void (0);" data-open="/receiver/owners">全部</a>
</li>
<? foreach ($show_info['statusAry'] as $key => $val) { ?>
<li role="presentation"
class="<?= strlen($params['status']) && $params['status'] == $key ? 'active' : '' ?>">
<a href="javascript:void (0);" data-open="/receiver/owners?status=<?= $key ?>">
<?= $val ?>
</a>
</li>
<? } ?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form id="vue-app" class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/owners">
@@ -120,6 +135,7 @@
<th width="5%"><span>性别</span></th>
<th width="5%"><span>年龄</span></th>
<th width="5%"><span>企微好友</span></th>
<th width="5%"><span>状态</span></th>
<th width="9%"><span>购车时间</span></th>
<th width="9%"><span>交付时间</span></th>
<th width="9%"><span>最后操作时间</span></th>
@@ -135,12 +151,13 @@
<td>{{v.sex}}</td>
<td>{{v.age}}</td>
<td>{{v.wxqy}}</td>
<td>{{v.status_name}}</td>
<td>{{v.order_time}}</td>
<td>{{v.ck_time}}</td>
<td>{{v.u_time}}</td>
</tr>
<tr>
<td colspan="10">
<td colspan="11">
<div class="row">
<div class="col-md-4 align-l">
</div>
@@ -18,13 +18,19 @@ class Receiver_owners_model extends HD_Model
/**
* Notes:状态
* Created on: 2022/6/13 10:31
* Created on: 2022/7/22 10:31
* Created by: dengbw
* @param string $id
* @return array
*/
public function statusAry()
public function statusAry($id = '')
{
return [1 => '正常', 0 => '禁用'];
$arr = [0 => '待回访', 1 => '已回访'];
if (strlen($id)) {
return $arr[$id];
} else {
return $arr;
}
}
/**