2022-07-13 15:15:08 +08:00
|
|
|
{extend name="../../base/view/common/base" /}
|
|
|
|
<!-- 主体 -->
|
|
|
|
{block name="body"}
|
|
|
|
<div class="p-3">
|
|
|
|
<form class="layui-form gg-form-bar border-x border-t">
|
|
|
|
<div class="layui-input-inline" style="width:150px;">
|
|
|
|
<select name="source_id">
|
|
|
|
<option value="">请选择渠道来源</option>
|
|
|
|
{volist name=":customer_source()" id="v"}
|
|
|
|
<option value="{$v.id}">{$v.title}</option>
|
|
|
|
{/volist}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="layui-input-inline" style="width:150px;">
|
|
|
|
<select name="industry_id">
|
|
|
|
<option value="">请选择行业</option>
|
|
|
|
{volist name=":get_industry()" id="v"}
|
|
|
|
<option value="{$v.id}">{$v.title}</option>
|
|
|
|
{/volist}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="layui-input-inline" style="width:240px;">
|
|
|
|
<input type="text" name="keywords" placeholder="输入关键字" class="layui-input" autocomplete="off" />
|
|
|
|
</div>
|
|
|
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
|
|
|
</form>
|
|
|
|
<table class="layui-hide" id="test" lay-filter="test"></table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/html" id="toolbarDemo">
|
|
|
|
<div class="layui-btn-container">
|
|
|
|
<span class="layui-btn layui-btn-normal layui-btn-sm" title="添加客户" lay-event="add">+ 添加公海客户</span>
|
|
|
|
</div>
|
|
|
|
</script>
|
|
|
|
{/block}
|
|
|
|
<!-- /主体 -->
|
|
|
|
|
|
|
|
<!-- 脚本 -->
|
|
|
|
{block name="script"}
|
|
|
|
<script>
|
|
|
|
const moduleInit = ['tool','employeepicker'];
|
|
|
|
function gouguInit() {
|
|
|
|
var table = layui.table, tool = layui.tool ,form = layui.form, employeepicker = layui.employeepicker;
|
|
|
|
layui.pageTable = table.render({
|
|
|
|
elem: '#test',
|
|
|
|
title: '客户列表',
|
|
|
|
toolbar: '#toolbarDemo',
|
|
|
|
url: "/customer/index/sea", //数据接口
|
|
|
|
cellMinWidth: 240,
|
|
|
|
page: true, //开启分页
|
|
|
|
limit: 20,
|
|
|
|
cols: [
|
|
|
|
[ //表头
|
|
|
|
{
|
|
|
|
field: 'id',title: '编号',align: 'center',width: 80,templet: function (d) {
|
|
|
|
return'C' + d.id;
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
field: 'name',
|
|
|
|
title: '客户名称',
|
2022-08-02 15:58:19 +08:00
|
|
|
templet: '<div><a data-href="/customer/index/view/id/{{d.id}}.html" class="side-a">{{d.name}}</a></div>'
|
2022-07-13 15:15:08 +08:00
|
|
|
},{
|
|
|
|
field: 'user',
|
|
|
|
title: '联系人',
|
|
|
|
align: 'center',
|
|
|
|
width: 80
|
|
|
|
},{
|
|
|
|
field: 'mobile',
|
|
|
|
title: '手机号码',
|
|
|
|
align: 'center',
|
|
|
|
width: 100
|
|
|
|
},{
|
|
|
|
field: 'qq',
|
|
|
|
title: 'QQ号',
|
|
|
|
align: 'center',
|
|
|
|
width: 100
|
|
|
|
},{
|
|
|
|
field: 'wechat',
|
|
|
|
title: '微信号',
|
|
|
|
align: 'center',
|
|
|
|
width: 90
|
|
|
|
},{
|
|
|
|
field: 'source',
|
|
|
|
title: '来源渠道',
|
|
|
|
align: 'center',
|
|
|
|
width: 100
|
|
|
|
}, {
|
|
|
|
field: 'industry',
|
|
|
|
title: '客户所属行业',
|
|
|
|
align: 'center',
|
|
|
|
width: 120
|
|
|
|
},{
|
|
|
|
field: 'right',
|
|
|
|
fixed:'right',
|
|
|
|
title: '操作',
|
|
|
|
width: 168,
|
|
|
|
align: 'center',
|
|
|
|
templet: function (d) {
|
|
|
|
var html = '<div class="layui-btn-group">';
|
|
|
|
var btn0='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="distribute">分配</span>';
|
|
|
|
var btn1='<span class="layui-btn layui-btn-xs" lay-event="get">领取</span>';
|
|
|
|
var btn2='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">转入废弃池</span>';
|
|
|
|
return html+btn0+btn1+btn2+'</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
//表头工具栏事件
|
|
|
|
table.on('toolbar(test)', function(obj){
|
|
|
|
if (obj.event === 'add') {
|
|
|
|
tool.side("/customer/index/add?sea=1");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//监听行工具事件
|
|
|
|
table.on('tool(test)', function(obj) {
|
|
|
|
var data = obj.data;
|
|
|
|
if(obj.event === 'view'){
|
|
|
|
tool.side('/customer/index/view?id='+data.id);
|
|
|
|
}
|
|
|
|
if (obj.event === 'distribute') {
|
|
|
|
//选择归属人人弹窗
|
|
|
|
employeepicker.init({
|
|
|
|
type:0,
|
|
|
|
department_url: "/api/index/get_department_tree",
|
|
|
|
employee_url: "/api/index/get_employee",
|
|
|
|
callback:function(ids,names,dids,departments){
|
|
|
|
layer.confirm('确定要把该客户分配给'+names+'?', {
|
|
|
|
icon: 3,
|
|
|
|
title: '提示'
|
|
|
|
}, function(index) {
|
|
|
|
let callback = function (e) {
|
|
|
|
layer.msg(e.msg);
|
|
|
|
if (e.code == 0) {
|
|
|
|
obj.del();
|
|
|
|
}
|
|
|
|
}
|
2022-08-06 00:49:20 +08:00
|
|
|
tool.post("/customer/api/distribute", {id: data.id,uid:ids,did:dids}, callback);
|
2022-07-13 15:15:08 +08:00
|
|
|
layer.close(index);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (obj.event === 'get') {
|
|
|
|
layer.confirm('确定要领取该客户?', {
|
|
|
|
icon: 3,
|
|
|
|
title: '提示'
|
|
|
|
}, function(index) {
|
|
|
|
let callback = function (e) {
|
|
|
|
layer.msg(e.msg);
|
|
|
|
if (e.code == 0) {
|
|
|
|
obj.del();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tool.post("/customer/index/get", {id: data.id}, callback);
|
|
|
|
layer.close(index);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (obj.event === 'del') {
|
|
|
|
layer.confirm('确定要把客户转入废弃池吗?', {
|
|
|
|
icon: 3,
|
|
|
|
title: '提示'
|
|
|
|
}, function(index) {
|
|
|
|
let callback = function (e) {
|
|
|
|
layer.msg(e.msg);
|
|
|
|
if (e.code == 0) {
|
|
|
|
obj.del();
|
|
|
|
}
|
|
|
|
}
|
2022-08-03 22:18:36 +08:00
|
|
|
tool.delete("/customer/index/to_trash", {id: data.id,type:1}, callback);
|
2022-07-13 15:15:08 +08:00
|
|
|
layer.close(index);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
});
|
|
|
|
|
|
|
|
//监听搜索提交
|
|
|
|
form.on('submit(webform)', function(data) {
|
|
|
|
layui.pageTable.reload({
|
|
|
|
where: {
|
|
|
|
keywords: data.field.keywords,
|
|
|
|
industry_id: data.field.industry_id,
|
|
|
|
source_id: data.field.source_id
|
|
|
|
},
|
|
|
|
page: {
|
|
|
|
curr: 1
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{/block}
|
|
|
|
<!-- /脚本 -->
|