admin_customer_209

This commit is contained in:
dengbw
2023-02-09 17:08:43 +08:00
parent 15be428cc9
commit fe26174582
4 changed files with 280 additions and 29 deletions
+39 -3
View File
@@ -88,6 +88,8 @@ class Customer extends HD_Controller
);
}
}
$tag_data = $params['tags'] ? explode(',', $params['tags']) : '';
$show_info['tags'] = $this->get_tag(0, 0, $tag_data);
//渠道经理
$qdjl_lists = $this->app_licheb_users_model->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name');
$show_info['levelAry'] = $this->customers_model->get_sdata('level');
@@ -116,6 +118,7 @@ class Customer extends HD_Controller
!$params['of_id'] && $params['of_id'] = '';
!$params['of2_id'] && $params['of2_id'] = '';
!$params['biz_type'] && $params['biz_type'] = '';
!$params['tags'] && $params['tags'] = '';
$where = array('status>=0' => null);
if ($_SESSION['admin_info']['biz_id']) {
$biz_ids = implode(',', $_SESSION['admin_info']['biz_id']);
@@ -214,6 +217,37 @@ class Customer extends HD_Controller
}
}
}
if ($params['tags']) {
$pidAry = [];
$res_tag = $this->mdCustomerTag->select(["id in ({$params['tags']})" => null], 'id desc', 0, 0, 'pid,id');
foreach ($res_tag as $v) {
$v['pid'] && $pidAry[$v['pid']][] = $v['id'];
}
$str_c_ids = $res_tag_data = '';
foreach ($pidAry as $v) {
if ($v) {
$where_tag = [];
$str_ids = implode(',', $v);
$where_tag["t_id in({$str_ids})"] = null;
if ($str_c_ids) {
$where_tag["c_id in({$str_c_ids})"] = null;
}
$res_tag_data = $this->mdCustomerTagdata->select_groupby('c_id', $where_tag, "id desc", 0, 0, "c_id");
if (!$res_tag_data) {
break;
}
if ($res_tag_data) {
$str_c_ids = implode(',', array_column($res_tag_data, 'c_id'));
}
}
}
if ($res_tag_data) {
$str_cids = implode(',', array_column($res_tag_data, 'c_id'));
$where["id in({$str_cids})"] = null;
} else {
$where["id"] = -1;
}
}
return $where;
}
@@ -643,13 +677,15 @@ class Customer extends HD_Controller
return $id;
}
private function get_tag($id,$tag_type=0)
private function get_tag($id, $tag_type = 0, $tag_data = '')
{
$show = $res_td = [];
$res = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0, 'show<>' => 1, 'tag_type' => $tag_type], 'sort desc,id desc', 0, 0, 'id,name,type');
if ($res) {
$id && $res_td = $this->mdCustomerTagdata->select(['c_id' => $id], 'id desc', 0, 0, 't_id');//查找用户选择
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
if ($id) {
$res_td = $this->mdCustomerTagdata->select(['c_id' => $id], 'id desc', 0, 0, 't_id');//查找用户选择
$res_td && $tag_data = array_unique(array_column($res_td, 't_id'));
}
foreach ($res as $key => $val) {
$list = [];
$value = '';
+46 -9
View File
@@ -54,6 +54,7 @@ class Owners extends HD_Controller
!$params['brand_id'] && $params['brand_id'] = '';
!$params['s_id'] && $params['s_id'] = '';
!$params['v_id'] && $params['v_id'] = '';
!$params['tags'] && $params['tags'] = '';
if (strlen($params['status'])) {
$where["a.status"] = $params['status'];
} else {
@@ -117,6 +118,37 @@ class Owners extends HD_Controller
} else if ($params['city_id_admin']) {
$where["b.biz_id in(select id from lc_biz where city_id={$params['city_id_admin']})"] = null;
}
if ($params['tags']) {
$pidAry = [];
$res_tag = $this->mdOwnersTag->select(["id in ({$params['tags']})" => null], 'id desc', 0, 0, 'pid,id');
foreach ($res_tag as $v) {
$v['pid'] && $pidAry[$v['pid']][] = $v['id'];
}
$str_o_ids = $res_tag_data = '';
foreach ($pidAry as $v) {
if ($v) {
$where_tag = [];
$str_ids = implode(',', $v);
$where_tag["t_id in({$str_ids})"] = null;
if ($str_o_ids) {
$where_tag["o_id in({$str_o_ids})"] = null;
}
$res_tag_data = $this->mdOwnersTagdata->select_groupby('o_id', $where_tag, "id desc", 0, 0, "o_id");
if (!$res_tag_data) {
break;
}
if ($res_tag_data) {
$str_o_ids = implode(',', array_column($res_tag_data, 'o_id'));
}
}
}
if ($res_tag_data) {
$str_oids = implode(',', array_column($res_tag_data, 'o_id'));
$where["a.id in({$str_oids})"] = null;
} else {
$where["a.id"] = -1;
}
}
$lists = [];
$wxqyAry = $this->mdOwners->wxqyAry();
$statusAry = $this->mdOwners->statusAry();
@@ -145,8 +177,8 @@ class Owners extends HD_Controller
#$str_biz_ids = implode(',', array_unique(array_column($res, 'biz_id')));
#$map_bizs = $this->mdBiz->map('id', 'biz_name', ["id in({$str_biz_ids})" => null]);
$arr_biz_id = array_unique(array_column($res, 'biz_id'));
foreach ($arr_biz_id as $k => $v){
if ($v == null || $v == ''){
foreach ($arr_biz_id as $k => $v) {
if ($v == null || $v == '') {
unset($arr_biz_id[$k]);
}
}
@@ -155,8 +187,8 @@ class Owners extends HD_Controller
#$str_admin_ids = implode(',', array_unique(array_column($res, 'admin_id')));
#$map_admins = $this->mdLichebUsers->map('id', 'uname', ["id in({$str_admin_ids})" => null]);
$arr_admin_id = array_unique(array_column($res, 'admin_id'));
foreach ($arr_admin_id as $k => $v){
if ($v == null || $v == ''){
foreach ($arr_admin_id as $k => $v) {
if ($v == null || $v == '') {
unset($arr_admin_id[$k]);
}
}
@@ -202,6 +234,8 @@ class Owners extends HD_Controller
];
}
}
$tag_data = $params['tags'] ? explode(',', $params['tags']) : '';
$show_info['tags'] = $this->get_tag(0, $tag_data);
$show_info['searchTpAry'] = $this->searchTpAry;
$show_info['wxqyAry'] = $wxqyAry;
$show_info['statusAry'] = $statusAry;
@@ -454,11 +488,11 @@ class Owners extends HD_Controller
$temp['u_time'] = $value['u_time'];
$tag = $this->get_tag($value['id']);
foreach ($tag as $key2 => $val2){
foreach ($tag as $key2 => $val2) {
$tag_id_key = 'tag_id_' . $val2['id'];
$tag_name = $val2['name'];
$tag_value = $val2['value_name'];
if (!in_array($tag_id_key, array_keys($indexs_tags))){
if (!in_array($tag_id_key, array_keys($indexs_tags))) {
$indexs_tags[$tag_id_key] = $tag_name;
}
$temp[$tag_id_key] = $tag_value;
@@ -520,15 +554,18 @@ class Owners extends HD_Controller
* Created on: 2022/6/16 14:47
* Created by: dengbw
* @param $id
* @param $tag_data
* @return array
*/
private function get_tag($id)
private function get_tag($id, $tag_data = '')
{
$show = $res_td = [];
$res = $this->mdOwnersTag->select(['status' => 1, 'pid' => 0], 'sort desc,id desc', 0, 0, 'id,name,type');
if ($res) {
$id && $res_td = $this->mdOwnersTagdata->select(['o_id' => $id], 'id desc', 0, 0, 't_id');//查找用户选择
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
if ($id) {
$res_td = $this->mdOwnersTagdata->select(['o_id' => $id], 'id desc', 0, 0, 't_id');//查找用户选择
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
}
foreach ($res as $key => $val) {
$list = [];
$value = '';
+96 -13
View File
@@ -18,8 +18,6 @@
<div class="coms-table-wrap mt10">
<form id="vue-app" class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/customer">
<input name="status" value="<?= $params['status'] ?>" type="hidden">
<input type="hidden" id="id_tag" name="tag" value="<?= $params['tag'] ?>">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w80">客户搜索:</label>
@@ -152,8 +150,8 @@
<div class="am-form-group fl ml10">
<input type="button" @click="btnTimes" value="选择筛选时间" class="am-btn am-btn-success am-btn-sm">
</div>
<div class="am-form-group fl ml10" style="display: none">
<input type="button" @click="searchTag" value="客户画像" class="am-btn am-btn-success am-btn-sm">
<div class="am-form-group fl ml10">
<input type="button" @click="btnTags" value="搜索客户画像" class="am-btn am-btn-success am-btn-sm">
</div>
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
@@ -163,6 +161,8 @@
</div>
</div>
</div>
<input name="status" value="<?= $params['status'] ?>" type="hidden">
<input type="hidden" id="id_tags" name="tags" value="<?= $params['tags'] ?>">
</form>
<div class="coms-table-bd">
@@ -248,6 +248,37 @@
</div>
</div>
</div>
<div id="tags-modal" style="display: none;">
<div class="modal-body">
<template v-for="(v,i) in show_info.tags">
<tr>
<td class="table-td" style="width: 80%">
<table>
<tr v-if="v.type=='checkbox'">
<td style="min-width: 80px">{{v.name}}:</td>
<td>
<template v-for="(v2,i2) in v.list">
<input type="checkbox" :value='v2.checked'
v-model="v2.checked"> {{v2.name}}&nbsp;
</template>
</td>
</tr>
<tr v-else>
<td style="min-width: 80px">{{v.name}}:</td>
<td>
<template v-for="(v2,i2) in v.list">
<input type="radio" :value='v2.id'
v-model="v.value"> {{v2.name}}&nbsp;
</template>
</td>
</tr>
</table>
</td>
</tr>
</template>
</div>
</div>
</div>
<script>
@@ -294,7 +325,7 @@
lists: [],
qdjl_lists: [],
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
show_info: {levelAry: [], offlineSourcesAry: [], wxqyAry: [], csbizidAry: []},
show_info: {levelAry: [], offlineSourcesAry: [], wxqyAry: [], csbizidAry: [], tags: []},
of2Ary: [],
bizTypeAry: [],
export_button: 0,
@@ -347,17 +378,60 @@
}
});
},
btnTags: function () {
var vm = this;
layer.open({
type: 1,
area: ['50%'], //宽高
content: $('#tags-modal'),
title: '搜索客户画像',
shade: false,
btn: ['点击搜索', '重置画像', '取消搜索'],
yes: function (index) {
var ids = '';
vm.show_info.tags.map(function (item1) {
for (var i in item1.list) {
var item2 = item1.list[i];
if (item1.type == 'checkbox') {
if (item2.checked) {
ids = ids ? ids + ',' + item2.id : item2.id;
}
} else {
if (item1.value == item2.id) {
ids = ids ? ids + ',' + item2.id : item2.id;
}
}
}
});
if (ids.length < 1) {
return $.msg.tips('请选择需要搜索的数据!');
}
$('#id_tags').val(ids);
$('#vue-app').submit();
layer.close(index);
},
btn2: function () {
vm.show_info.tags.map(function (item1) {
for (var i in item1.list) {
var item2 = item1.list[i];
if (item1.type == 'checkbox') {
item2.checked = false;
} else {
item1.value = '';
}
}
});
$('#id_tags').val('');
return false;
},
btn3: function (index) {
layer.close(index);
}
});
},
saveEdit: function () {
$("form").submit();
},
searchTag: function () {
var tag = [];
tag.push('1_1');
tag.push('1_3');
tag.push('2_5');
$('#id_tag').val(tag);
$('#vue-app').submit();
},
init_citys: function () {
var vm = this;
$.ajax({
@@ -386,6 +460,7 @@
that.params.city_id_admin = '';
that.params.of_id = '';
that.params.of2_id = '';
$('#id_tags').val('');
$('#cf_time').val('');
$(".order-times").map(function () {
var id = this.value;
@@ -519,3 +594,11 @@
});
</script>
<style type="text/css">
.table-td {
width: 20%;
padding-top: 15px;
line-height: 37px;
font-size: 1.6rem;
}
</style>
+99 -4
View File
@@ -17,10 +17,9 @@
<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">
<input name="status" type='hidden' value="<?=$params['status']?>">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">客户搜索:</label>
<label class="am-para-label w100">车主搜索:</label>
<div class="am-para-inline w100">
<select name="search_tp" v-model="params.search_tp">
<option :value="i" v-for="(v,i) in show_info.searchTpAry">{{v}}</option>
@@ -146,6 +145,9 @@
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<input type="button" @click="btnTags" value="搜索车主画像" class="am-btn am-btn-success am-btn-sm">
</div>
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
</div>
@@ -154,11 +156,13 @@
</div>
</div>
</div>
<input name="status" type='hidden' value="<?=$params['status']?>">
<input type="hidden" id="id_tags" name="tags" value="<?= $params['tags'] ?>">
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
<span>共<?= intval($pager['totle']) ?>个车主</span>
</div>
<table class="am-table am-table-bordered">
<thead>
@@ -236,6 +240,37 @@
</div>
</div>
</div>
<div id="tags-modal" style="display: none;">
<div class="modal-body">
<template v-for="(v,i) in show_info.tags">
<tr>
<td class="table-td" style="width: 80%">
<table>
<tr v-if="v.type=='checkbox'">
<td style="min-width: 80px">{{v.name}}:</td>
<td>
<template v-for="(v2,i2) in v.list">
<input type="checkbox" :value='v2.checked'
v-model="v2.checked"> {{v2.name}}&nbsp;
</template>
</td>
</tr>
<tr v-else>
<td style="min-width: 80px">{{v.name}}:</td>
<td>
<template v-for="(v2,i2) in v.list">
<input type="radio" :value='v2.id'
v-model="v.value"> {{v2.name}}&nbsp;
</template>
</td>
</tr>
</table>
</td>
</tr>
</template>
</div>
</div>
</div>
<script>
@@ -284,7 +319,7 @@
attrvAry: [],
cityAry: [],
countyAry: [],
show_info: {searchTpAry: [], wxqyAry: []},
show_info: {searchTpAry: [], wxqyAry: [], tags: []},
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
},
mounted: function () {
@@ -352,6 +387,57 @@
}
});
},
btnTags: function () {
var vm = this;
layer.open({
type: 1,
area: ['50%'], //宽高
content: $('#tags-modal'),
title: '搜索车主画像',
shade: false,
btn: ['点击搜索', '重置画像', '取消搜索'],
yes: function (index) {
var ids = '';
vm.show_info.tags.map(function (item1) {
for (var i in item1.list) {
var item2 = item1.list[i];
if (item1.type == 'checkbox') {
if (item2.checked) {
ids = ids ? ids + ',' + item2.id : item2.id;
}
} else {
if (item1.value == item2.id) {
ids = ids ? ids + ',' + item2.id : item2.id;
}
}
}
});
if (ids.length < 1) {
return $.msg.tips('请选择需要搜索的数据!');
}
$('#id_tags').val(ids);
$('#vue-app').submit();
layer.close(index);
},
btn2: function () {
vm.show_info.tags.map(function (item1) {
for (var i in item1.list) {
var item2 = item1.list[i];
if (item1.type == 'checkbox') {
item2.checked = false;
} else {
item1.value = '';
}
}
});
$('#id_tags').val('');
return false;
},
btn3: function (index) {
layer.close(index);
}
});
},
saveEdit: function () {
$("form").submit();
},
@@ -364,6 +450,7 @@
that.params.brand_id = '';
that.params.wxqy = '';
that.params.city_id = '';
$('#id_tags').val('');
$(".order-times").map(function () {
var id = this.value;
this.checked = false;
@@ -562,3 +649,11 @@
});
});
</script>
<style type="text/css">
.table-td {
width: 20%;
padding-top: 15px;
line-height: 37px;
font-size: 1.6rem;
}
</style>