<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="code" uri="/WEB-INF/tld/code4dropdown.tld"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head>
<title>LMS 系统工作台</title>
<meta name="menuId" content="lms-clueslist"/>
<script>
$(
function(){
$("#btn_query").on("click", function(){
$("#searchForm").submit();
});
$("#btn_clear").click(function(){
$(':input','#searchForm')
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('selected');
})
$("select").each(function(){
$(this).val($(this).attr("data-select"));
});
var provinceId = "${data.province}";
var cityId = "${data.city}";
var areaId = "${data.area}";
$.get
JSON("${rc.contextPath}/region/listpivs", function(json){
$('#select_prov').append($('<option>全部</option>').attr('value',''));
$('#select_city').append($('<option>全部</option>').attr('value',''));
$('#select_area').append($('<option>全部</option>').attr('value',''));
$.each(json, function(i,val){
$('#select_prov').append(function(){
var p = $('<option></option>').attr('value',val.id).html(val.name);
return p;
});
});
if(provinceId != ""){
$('#select_prov').val(provinceId);
provChange(provinceId);
cityChange(cityId);
}
});
var provChange = function(id){
$('#select_city').empty();
$('#select_area').empty();
$('#select_city').append($('<option>全部</option>').attr('value',''));
$('#select_area').append($('<option>全部</option>').attr('value',''));
$.get
JSON("${rc.contextPath}/region/listcitys/"+id, function(json){
$.each(json, function(i,val){
$('#select_city').append(function(){
var p = $('<option></option>').attr('value',val.id).html(val.name);
return p;
});
});
if(cityId != ""){
$('#select_city').val(cityId);
cityChange(cityId);
}
});
}
var cityChange = function(id){
$('#select_area').empty();
$('#select_area').append($('<option>全部</option>').attr('value',''));
$.getJSON("${rc.contextPath}/region/listcitys/"+id, function(json){
$.each(json, function(i,val){
$('#select_area').append(function(){
var p = $('<option></option>').attr('value',val.id).html(val.name);
return p;
});
});
if(cityId != ""){
$('#select_area').val(areaId);
}
});
}
$('#select_prov').on("change",function(){provChange($(this).val())});
$('#select_city').on("change",function(){cityChange($(this).val())});
/*table 中的checkbox 的全选功能 */
$("#allCheck").click(function() {
//console.log("select all");
if ($("#allCheck").prop("checked")) {
$("input[name='selectCustomer']").each(function() {
$(this).prop("checked", true);
})
} else {
$("input[name='selectCustomer']").each(function() {
$(this).prop("checked", false);
})
}
});
/*
发送邮件*/
$("#sendEmail").on("click",function(){
//console.log("send mail");
var customerArrEmail = "";
$("input[name='selectCustomer']").each(function(){
if( $(this).prop("checked")){
var customerEmail = $(this).parent().parent().find("td:eq(3)").find("input").val();
if(customerEmail != "")
customerArrEmail += customerEmail+";";
}
});
console.log(customerArrEmail);
$("#emailVal").val(customerArrEmail);
$("#phoneVal").val("");
$("#sendOption").submit();
});
/*
发送短信*/
$("#sendPhone").on("click",function(){
var customerArrPhone = "";
$("input[name='selectCustomer']").each(function(){
if( $(this).prop("checked")){
var customerPhone = $(this).parent().parent().find("td:eq(2)").html();
if(customerPhone != "")
customerArrPhone += customerPhone+";";
}
});
console.log(customerArrPhone);
if(customerArrPhone == ""){
customerArrPhone = "phone";
}
$("#phoneVal").val(customerArrPhone);
$("#emailVal").val("");
$("#sendOption").submit();
});
/*创建线索*/
$("#btn_createsales").on("click",function(){
location.href = "${rc.contextPath}/saleclues/new";
});
/*得到checkbox中所选择的客户Id */
function getSelectedIds(){
var customerArr = [];
if($("#allCheck").prop("checked")){
$("input[name='hobby']").each(function(){
/* var customerId = $(this).val();
cu stomerArr += customerId+",";*/
customerArr.push($(this).val());
});
}else{
$("input[name='hobby']").each(function(){
if( $(this).prop("checked")){
/* var customerId = $(this).val();
cus tomerArr += customerId+",";*/
customerArr.push($(this).val());
}
});
}
return customerArr.join(",");
}
/*分配 */
var d;
$('#allotsaleclues').click(function(){
d = dialog(this);
d.open();
});
$("#confirmButton").click(function(){
var selectedIds = getSelectedIds();
if(selectedIds != ""){
$.ajax({
url:"<c:url value='/saleclues/allotsaleclues'/>",
type:"post",
dataType:"json",
data:{
selectedIds:selectedIds,
newOrgId:3
},
success:function(data){
if(data.type == "1"){
console.log('bb');
//alert(data.msg);
d.close();
}else
alert(data.msg);
}
})
}else
alert("请选择数据");
});
$("#
cancelButton").click(function(){
d.close();
})
/*分配 */
/*回收*/
var d2;
$('#recyclesaleclues').click(function(){
d2 = dialog(this);
d2.open();
});
$("#confirmButton2").click(function(){
var selectedIds = getSelectedIds();
if(selectedIds != ""){
$.ajax({
url:"<c:url value='/saleclues/recyclesaleclues'/>",
type:"post",
dataType:"json",
data:{
selectedIds:selectedIds
},
success:function(data){
if(data.type == "1"){
console.log('bb');
//alert(data.msg);
d2.close();
}else
alert(data.msg);
}
})
}else
alert("请选择数据");
});
$("#cancelButton2").click(function(){
d2.close();
})
/*回收 */
/*关闭*/
var d3;
$('#closesaleclues').click(function(){
d3 = dialog(this);
d3.open();
});
$("#confirmButton3").click(function(){
var selectedIds = getSelectedIds();
if(selectedIds != ""){
$.ajax({
url:"<c:url value='/saleclues/closesaleclues'/>",
type:"post",
dataType:"json",
data:{
selectedIds:selectedIds,
reason:'客户反悔了'
},
success:function(data){
if(data.type == "1"){
console.log('bb');
//alert(data.msg);
d3.close();
}else
alert(data.msg);
}
})
}else
alert("请选择数据");
});
$("#cancelButton3").click(function(){
d3.close();
})
/*关闭*/
});
</script>
</head>
<body>
<div
class="main-data">
<h3 class="clear-x-margin">查询条件</h3>
<div class="data-box">
<form class="form-format" style="padding-top: 15px" id="searchForm" method="post" action="${rc.contextPath}/saleclues/doquery">
<div class="full-line">
<div class="form-line split4">
<label>客户姓名:</label>
<input value="${data.customerName}" type="text" name="customerName" />
</div>
<div class="form-line split4">
<label>联系电话:</label> <input value="${data.mobile}" type="text" name="mobile" />
</div>
<div class="form-line split4">
<label>客户来源:</label>
<select name="customerSourceCd" data-select="${data.customerSourceCd}">
<code:dropdown codetype="SOURCEFROM" first="全部" value="${data.sourceCd}"/>
</select>
</div>
<div class="form-line split4">
<label>所属分站:</label>
<select name="orgId" data-select="${data.orgId}">
<code:dropdown first="全部" isorg="true"/>
</select>
</div>
</div>
<div class="full-line">
<div class="form-line split4">
<label>所在省份:</label>
<select name="province" id="select_prov" data-select="${data.province}">
</select>
</div>
<div class="form-line split4">
<label>所在城市:</label>
<select name="city" id="select_city" data-select="${data.city}">
</select>
</div>
<div class="form-line split4">
<label>所在区县:</label>
<select name="area" id="select_area" data-select="${data.area}">
</select>
</div>
<div class="form-line split4">
<label>旺旺ID:</label> <input value="${data.wangwangId}" type="text" name="wangwangId"/>
</div>
</div>
<div class="full-line">
<div class="form-line split4">
<label>小区名称:</label> <input value="${data.communityName}" type="text" name="communityName"/>
</div>
<div class="form-line split4">
<label>交房时间:</label>
<select name="deliveryDateCd" data-select="${data.deliveryDateCd}">
<code:dropdown codetype="DELIVERYDT" first="全部"/>
</select>
</div>
<div class="form-line split4">
<label>线索状态:</label>
<select name="statusCd" class="
hasCustomSelect" data-select="${data.statusCd}">
<code:dropdown codetype="SALECLUESSTATUS" first="全部"/>
</select>
</div>
<div class="form-line split4">
<label>跟进人:</label> <select name="select_person" data-select="${data.select_person}">
</select>
</div>
</div>
<div class="form-line split4">
<label>创建时间:</label>
<input id="id_picker_from" name="createDtBegin" value="${data.createDtBegin}" type="text" data-beatpicker="true" data-beatpicker-extra="customOptions" data-beatpicker-module="clear,footer" />
</div>
<div class="form-line split4">
<label>至:</label>
<input id="id_picker_to" name="createDtEnd" value="${data.createDtEnd}" type="text" data-beatpicker="true" data-beatpicker-extra="customOptions" data-beatpicker-module="clear,footer" />
</div>
<div class="form-line full-line align-right">
<div class="cls"></div>
<span class="submit-button" style="margin-right: 2px" id="btn_query"><font>查询</font><i class="submit-radius"></i></span>
<span class="submit-button" style="margin-right: 38px" id="btn_clear"><font>清空条件</font><i class="submit-radius"></i></span>
</div>
</form>
</div>
</div>
<div class="main-data">
<h3 class="clear-x-margin">查询结果</h3>
<table class="tbl-box">
<tr class="tbl-title">
<td><input type="checkbox" id="allCheck" name="allCheck" value="1">全选</td>
<td>客户名称</td>
<td>联系电话</td>
<td>所在省份</td>
<td>所在城市</td>
<td>所属分站</td>
<td>小区名称</td>
<td>交房时间</td>
<td>客户来源</td>
<td>旺旺ID</td>
<td>跟进人</td>
<td>线索状态</td>
<td>跟进次数</td>
<td>创建时间</td>
<td>编辑 操作</td>
</tr>
<c:forEach var="qr" items="${queryresult}">
<tr class="tbl-item">
<td><input type="checkbox" name="selectCustomer" value="${qr.id}" ></td>
<td>${qr.house.customer.name}</td>
<td>${qr.house.customer.mobile}</td>
<td>${qr.house.province}<input type="hidden" value="${qr.house.customer.email}"></td>
<td>${qr.house.city }</td>
<td>${qr.orgId}</td>
<td>${qr.house.communityName}</td>
<td>${qr.house.deliveryDateCd}</td>
<td>${qr.house.customer.sourceCd}</td>
<td>${qr.house.customer.wangwangId }</td>
<td>${qr.followBy}</td>
<td>${qr.statusCd}</td>
<td>${qr.followcount}</td>
<td><fmt:timeZone value="GMT+8"><fmt:formatDate value="${qr.createDt}" pattern="yyyy-MM-dd"/></fmt:timeZone></td>
<td>
<a href="${rc.contextPath}/saleclues/viewsaleclues/${qr.id}">编辑</a>
<a href="${rc.contextPath}/saleclues/salecd/${qr.id}">邀约</a>
</td>
</tr>
</c:forEach>
<tr class="tbl-footer">
<td colspan="15" class="page-button">
<jsp:include page="../../includes/paging-buttons.jsp"/>
</td>
</tr>
</table>
<div class="cls"></div>
</div>
<form action="<c:url value='/marketingtools/sendmessagesandemail'/>" id="sendOption" method="post">
<input id="emailVal" name="email" type="hidden" value=""/>
<input id="phoneVal" name="phone" type="hidden" value=""/>
<div class="main-data">
<div class="data-box">
<div class="form-line full-line align-left">
<div class="cls"></div>
<span class="submit-button" id="btn_createsales" style="float: left; margin-left: 38px"><font>创建</font><i class="submit-radius"></i></span>
<span id="allotsaleclues" class="submit-button" style="float: left; margin-left: 5px" bind-dialog="allotDialog"><font>分配线索</font><i class="submit-radius"></i></span>
<span id="recyclesaleclues" class="submit-button" style="float: left; margin-left: 5px" bind-dialog="recycleDialog"><font>回收线索</font><i class="submit-radius"></i></span>
<a href="<c:url value='/saleclues/deriveSaleclues?'/>${paramx}">
<span class="submit-button" style="float: left; margin-left: 5px"><font>导出至文件</font><i class="submit-radius"></i></span>
</a>
<span id="closesaleclues" class="submit-button" style="float: left; margin-left: 5px" bind-dialog="closeDialog"><font>关闭线索</font><i class="submit-radius"></i></span>
<span class="submit-button" id="sendEmail" style="float: right; margin-right: 38px"><font>发送邮件</font><i class="submit-radius"></i></span>
<span class="submit-button" id="sendPhone" style="float: right; margin-right: 5px"><font>发送短信</font><i class="submit-radius"></i></span>
</div>
</div>
</div>
</form>
<!--分配线索弹窗 -->
<div class="dialog hide" id="allotDialog">
<div class="dialog-title"><span>提 示</span><font class="close-fn">X</font></div>
<div class="dialog-body" style="height:200px;">
<h2>确认分配线索?</h2>
</div>
<div class="dialog-bottom">
<div class="form-line center" style="margin:auto">
<span id="confirmButton" class="submit-button" style="margin-right:20px"><font>确认</font><i class="submit-radius"></i></span>
<span id="cancelButton" class="submit-button" style="margin-right:20px"><font>取消</font><i class="submit-radius"></i></span>
</div>
</div>
</div>
<!--分配线索弹窗 -->
<!--回收线索弹窗 -->
<div class="dialog hide" id="recycleDialog">
<div class="dialog-title"><span>提 示 </span><font class="close-fn">X</font></div>
<div class="dialog-body" style="height:200px;">
<h2>确认回收线索?</h2>
</div>
<div class="dialog-bottom">
<div class="form-line center" style="margin:auto">
<span id="confirmButton2" class="submit-button" style="margin-right:20px"><font>确认</font><i class="submit-radius"></i></span>
<span id="cancelButton2" class="submit-button" style="margin-right:20px"><font>取消</font><i class="submit-radius"></i></span>
</div>
</div>
</div>
<!--回收线索弹窗 -->
<!--关闭线索弹窗 -->
<div class="dialog hide" id="closeDialog">
<div class="dialog-title"><span>提 示 </span><font class="close-fn">X</font></div>
<div class="dialog-body" style="height:200px;">
<h2>确认关闭线索?</h2>
</div>
<div class="dialog-bottom">
<div class="form-line center" style="margin:auto">
<span id="confirmButton3" class="submit-button" style="margin-right:20px"><font>确认</font><i class="submit-radius"></i></span>
<span id="cancelButton3" class="submit-button" style="margin-right:20px"><font>取消</font><i class="submit-radius"></i></span>
</div>
</div>
</div>
<!--关闭线索弹窗 -->
</body>
</html>