ComplianceServer/oldcode/WEB/Views/Sms/BatchMsg/Index.cshtml

341 lines
15 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using WX.CRM.WebHelper;
@{
ViewBag.Title = "资源导入";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<!--遮罩层-->
<style type="text/css">
#CoverBg {
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index: 1001;
-moz-opacity: 0.2;
opacity: .20;
filter: alpha(opacity=20);
}
#CoverShow {
display: none;
position: absolute;
top: 45%;
left: 40%;
width: 20%;
height: 10%;
padding: 8px;
border: 8px solid #E8E9F7;
background-color: white;
z-index: 1002;
overflow: auto;
}
.formtable td {
padding: 3px;
}
</style>
<div id="CoverBg"></div>
<div id="CoverShow"><br />&nbsp;&nbsp;<img height="20" src="~/Content/Images/loading.gif" />数据正在处理中……</div>
<div class="mvctool bgb">
短信类型:<select id="SltSmsSubType">
<option>-请选择-</option>
</select>
短信平台:<select id="SltSmsAccount">
<option>-请选择-</option>
</select>
@Html.ToolButtonPlain("btnSave", "icon-check", "提交", false, "")
</div>
<div id="divContent" style="width:100%; overflow-y:auto">
<form id="frmUpload" method="post" action="/Sms/BatchMsg/RecFile" enctype="multipart/form-data">
<input id="hidSubTypeID" name="hidSubTypeID" type="hidden" value="0" />
<input id="hidClientCode" name="hidClientCode" type="hidden" value="" />
<div class="easyui-tabs" style="height: auto; padding: 0px; margin: 0px;" id="BatcResIDS">
<div title="客户ID批量提交" style="padding: 5px;">
<table class="formtable">
<tr>
<td>客户ID</td>
<td style="vertical-align:middle;">
<textarea id='txtResIDS' name="txtResIDS" style="width:400px;height:170px;"></textarea>
<input id="txtResIdFromSql" name="txtResIdFromSql" type="hidden" value="" />
<input type="button" value="查询" id="btnFindResId" class="btn btn-primary" />
<span style="color:red;">建议不超过200个客户ID</span>
</td>
</tr>
<tr>
<td>短信内容:</td>
<td>
<textarea id='txtContent1' name="txtContent1" onkeyup="CountLength(this)" onkeydown="CountLength(this)" style="width:400px;height:170px;"></textarea>
<span style="color:red;">短信内容最多70个字符多于70个字符的请拆成2条短信发送</span>
</td>
</tr>
<tr>
<td colspan="2" style="height:40px;">
全部<input id="radAll" type="radio" onclick="checkAll(1)" name="all"> &nbsp;
主号码<input id="radPAll" type="radio" onclick="checkAll(2)" name="all">&nbsp;
取消<input id="radCancel" type="radio" onclick="checkAll(3)" name="all">
</td>
</tr>
<tr>
<td colspan="2" style="line-height:20px;">选择手机号码:<div id="isTelPhone"></div></td>
</tr>
<tr>
<td colspan="2" style="line-height:20px;"> 选择非手机号码:<div id="notTelPhone"></div></td>
</tr>
</table>
</div>
<div title="客户ID文件批量提交" style="padding: 5px;">
<table>
<tr>
<td>文件:</td>
<td>
<br />
文本文件格式如下:<br />
<img src="~/Content/Images/number_txt.bmp" alt="" /><br />
<input id="FileMobile" name="FileMobile" type="file" />
<br />
</td>
</tr>
<tr>
<td>短信内容:</td>
<td>
<textarea id='txtContent2' onkeyup="CountLength(this)" onkeydown="CountLength(this)" name="txtContent2" style="width:400px;height:170px;"></textarea>
<span style="color:red;">短信内容最多70个字符多于70个字符的请拆成2条短信发送</span>
</td>
</tr>
</table>
</div>
<div title="号码批量提交" style="padding: 5px;">
<table>
<tr>
<td>手机号码:</td>
<td>
<textarea id='bmtxtResIDS' name="bmtxtResIDS" style="width:400px;height:170px;"></textarea>
<span style="color:red;">建议不超过200个手机号码</span>
</td>
</tr>
<tr>
<td>短信内容:</td>
<td>
<textarea id='bmtxtContent2' name="bmtxtContent2" onkeyup="CountLength(this)" onkeydown="CountLength(this)" style="width:400px;height:170px;"></textarea>
<span style="color:red;">短信内容最多70个字符多于70个字符的请拆成2条短信发送</span>
</td>
</tr>
</table>
</div>
<div title="号码文件批量提交" style="padding: 5px;">
<table>
<tr>
<td>文件:</td>
<td>
<br />
文本文件格式如下:<br />
<img src="~/Content/Images/number_txt.bmp" alt="" /><br />
<input id="bmFileMobile" name="bmFileMobile" type="file" />
<br />
</td>
</tr>
<tr>
<td>短信内容:</td>
<td>
<textarea id='bmtxtContent1' name="bmtxtContent1" onkeyup="CountLength(this)" onkeydown="CountLength(this)" style="width:400px;height:170px;"></textarea>
<span style="color:red;">短信内容最多70个字符多于70个字符的请拆成2条短信发送</span>
</td>
</tr>
</table>
</div>
<div title="短信地址推送与反馈客户ID批量提交" style="padding: 5px;">
<table>
<tr>
<td width="70">文件:</td>
<td>
<br />
文本文件格式如下:<br />
<img src="~/Content/Images/number_txt.bmp" alt="" /><br />
<input id="FileMobile2" name="FileMobile2" type="file" />
<br />
</td>
</tr>
<tr>
<td>短信内容里填参数"@@@@code",代表用户标志码,发送时会替换为用户标志码!</td>
<td>
<textarea id='txtFKResIDS' name="txtFKResIDS" onkeyup="CountLength(this)" onkeydown="CountLength(this)" style="width:400px;height:170px;"></textarea>
<span style="color:red;">短信内容最多70个字符多于70个字符的请拆成2条短信发送</span>
</td>
</tr>
</table>
</div>
</div>
</form>
<div class="bas_datagrid">
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
<ul class="toolBar_ul">
<li>&nbsp;</li>
</ul>
</div>
@Html.Raw(ViewBag.gridTable)
</div>
</div>
<script type="text/javascript">
$(function () {
$("#divContent").css("height", $(window).height() - 50 + "px");
$(window).resize(function () {//自动适应大小
$("#divContent").css("height", $(window).height() - 50 + "px");
});
});
function CountLength(obj) {
$(obj).parent().find("span").html("已输入文字:" + obj.value.length + "个");
//document.getElementById("SPMessage").innerHTML = "已输入文字:" + obj.value.length + "个";
}
function checkAll(key) {
if (key == 1) {
$("#isTelPhone").find("input").attr("checked", "checked");
}
else if (key == 2) {
$("#isTelPhone").find("input").removeAttr("checked");
$("#isTelPhone").find("input[isPrimaryNum='1']").attr("checked", "checked");
}
else {
$("#isTelPhone").find("input").removeAttr("checked");
}
}
var selectTitle = "";
$(document).ready(function () {
$("#btnFindResId").click(function () {
if ($("#txtResIDS").val() == "") {
$.messager.alert("提示", "请你输入客户ID!", "error");
return false;
}
$.r_ajax({
url: "/Csvr/BatchMsg/GetAllResId",
type: "Post",
data: { resIds: $("#txtResIDS").val() },
dataType: "json",
loading: true,
success: function (data) {
if (data.result == "1") {
var residHtml = "";
var nottelPhone = "";
$(data.ResIds).each(function (i, n) {
if (n.isCallPhone == false) {
residHtml += "<input id=\"CBLNumber_" + i + "\" type=\"checkbox\" isPrimaryNum='" + n.ISPRIMARYNUM + "' value=\"" + n.RESID + "\" name=\"CBLNumber_" + i + "\">";
residHtml += "<label for=\"CBLNumber_" + i + "\" " + (n.ISPRIMARYNUM == "1" ? "style='font-weight:bold;'" : "") + " >" + (n.ISPRIMARYNUM == "1" ? "主号码" : "非主号") + " : " + n.RESID + "&nbsp;" + n.LASTNUM3 + "</label><br/>";
} else {
nottelPhone += "<input id=\"CBLNumber_" + i + "\" type=\"checkbox\" value=\"" + n.RESID + "\" name=\"CBLNumber_" + i + "\">";
nottelPhone += "<label for=\"CBLNumber_" + i + "\" " + (n.ISPRIMARYNUM == "1" ? "style='font-weight:bold;'" : "") + " >" + (n.ISPRIMARYNUM == "1" ? "主号码" : "非主号") + " : " + n.RESID + "&nbsp;" + n.LASTNUM3 + "</label><br/>";
}
});
$("#isTelPhone").html(residHtml);
$("#notTelPhone").html(nottelPhone);
} else {
$.messager.alert("提示", data.message, "error");
}
}
});
});
$("#SltSmsSubType").change(function () {
var subTypeId = $("#SltSmsSubType").val();
InitSltSmsAccount(subTypeId);
});
$('#BatcResIDS').tabs({
border: true,
onSelect: function (title) {
InitSltSmsSubType(title);
}
});
$('#BatcResIDS').tabs("select", "客户ID文件批量提交"); /*此若选第一个道次不执InitSltSmsSubType(stitle)*/
$("#btnSave").click(function () {
var subTypeID = $("#SltSmsSubType").val();
var clientCode = $("#SltSmsAccount").val();
if (subTypeID == "0" || subTypeID == "" || subTypeID == undefined) {
$.messageBox5s('提示', "请选择正确的短信类型!");
return;
}
if (clientCode == "0" || clientCode == "" || clientCode == undefined) {
$.messageBox5s('提示', "请选择正确的短信平台!");
return;
}
if (selectTitle == "客户ID批量提交") {
var resid = "";
$("#isTelPhone input:checked").each(function () {
resid += $(this).val() + ",";
});
$("#notTelPhone input:checked").each(function () {
resid += $(this).val() + ",";
});
if (resid.length > 0)
resid = resid.substr(0, resid.length - 1);
$("#txtResIdFromSql").val(resid);
if ($("#txtResIdFromSql").val() == "") {
$.messager.alert("提示", "请你选中下面要发送短信的号码!", "error");
return false;
}
}
$("#CoverBg").show();
$("#CoverShow").show();
$("#hidSubTypeID").val(subTypeID);
$("#hidClientCode").val(clientCode);
$("#frmUpload").ajaxSubmit({
url: "/Sms/BatchMsg/RecFile/" + selectTitle,
type: "post",
enctype: 'multipart/form-data',
dataType: 'text',
success: function (data, statusText) {
$("#CoverBg").hide();
$("#CoverShow").hide();
if (data == "ok") {
$("#frmUpload").resetForm();
$("#isTelPhone").empty();
$("#notTelPhone").empty();
$.messageBox5s('提示', "客户ID或号码提交成功");
} else {
$.messageBox5s('提示', data);
}
loadtablegrid();
}, error: function (data) {
$("#CoverBg").hide();
$("#CoverShow").hide();
$.messageBox5s('提示', data);
}
});
})
loadtablegrid();
});
/*初始化发送列表*/
function loadtablegrid() {
$("#tablist").tablegrid({
url: '/Res/BatchMsg/GetHtmlList',
height: 200,
loadNow: true
});
}
/*初始化短信类型与发送平台*/
function InitSltSmsSubType(stitle) {
selectTitle = stitle;
$("#SltSmsSubType").get(0).options.length = 0;//清空历史值
$("#SltSmsAccount").get(0).options.length = 0;//清空历史值
$("<option></option>").val("0").text("-请选择-").appendTo($("#SltSmsAccount"));
$.getJSON("/Sms/BatchMsg/SmsSubTypeList/" + selectTitle, function (data) {
$.each(data, function (i, item) {
$("<option></option>").val(item["SUBTYPEID"]).text(item["SUBTYPENAME"]).appendTo($("#SltSmsSubType"));
});
});
}
function InitSltSmsAccount(subTypeId) {
$("#SltSmsAccount").get(0).options.length = 0;//清空历史值
$.getJSON("/Sms/BatchMsg/SmsCountList/" + subTypeId, function (data) {
$.each(data, function (i, item) {
$("<option></option>").val(item["CLIENTCODE"]).text(item["CLIENTNAME"]).appendTo($("#SltSmsAccount"));
});
});
}
</script>