470 lines
18 KiB
Plaintext
470 lines
18 KiB
Plaintext
@using WX.CRM.WebHelper;
|
||
@using WX.CRM.Model.Entity;
|
||
@{
|
||
ViewBag.Title = "订单列表";
|
||
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
|
||
}
|
||
|
||
<link href="/layui-v2.5.4/css/layui.css" rel="stylesheet" />
|
||
<link href="/layui-v2.5.4/css/workbench.css" rel="stylesheet" />
|
||
<link href="/layui-v2.5.4/css/common.css" rel="stylesheet" />
|
||
<script src="/layui-v2.5.4/layui.js"></script>
|
||
|
||
<div class="mvctool">
|
||
@Html.ToolButton("btnQuery", "icon-search", "查询", true)
|
||
@Html.Action("ToolBar", "Control", ViewBag.ToolBar as ToolBar)
|
||
</div>
|
||
<div class="bas_datagrid">
|
||
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
|
||
<ul class="toolBar_ul">
|
||
<li>@Html.Action("UserComBoxByRole", "Control", new { controlName = "nb1", onLoadSucced = "onLoadSucced()", roleCodes = ViewBag.roleCodes, saledeptid = "", salegroupid = ViewBag.userGroupId, iseid = "0", inneruserid = ViewBag.inneruserid })</li>
|
||
<li>客户ID:<input type="text" id="txt_resId" name="txt_resID" style="width: 150px" /> </li>
|
||
<li style="display:none">
|
||
系列:<select name="slt_productId"><option value="0">全部</option><option value="1008">智赢系列</option><option value="1007">爱赢系列</option></select>
|
||
</li>
|
||
<li>
|
||
|
||
产品大类:<select id="slt_midproductId" name="slt_midproductId" style="width:150px;" onChange="changeMidProduct(this.value)">
|
||
<option value="">--请选中产品大类--</option>
|
||
@foreach (var item in ViewBag.midproductList as List<SelectListItem>)
|
||
{
|
||
<option value="@item.Value">@item.Text</option>
|
||
}
|
||
</select>
|
||
|
||
</li>
|
||
<li>
|
||
产品小类:<select id="slt_subProductId" name="slt_subProductId" style="width:180px;">
|
||
<option value="0">--请选中产品小类--</option>
|
||
</select>
|
||
</li>
|
||
<li>
|
||
备注:<input type="text" id="txt_remark" name="txt_remark" />
|
||
</li>
|
||
<li>
|
||
订单状态:<select id="slt_orderStatus" name="slt_orderStatus" style="height:22px;">
|
||
<option value="" selected>全部</option>
|
||
<option value="180">新订单</option>
|
||
<option value="200">已支付</option>
|
||
<option value="220">已开通</option>
|
||
<option value="205">已升级</option>
|
||
<option value="90">已退款</option>
|
||
<option value="80">已过期</option>
|
||
<option value="70">已取消</option>
|
||
<option value="60">已关闭</option>
|
||
</select>
|
||
</li>
|
||
<li>姓名:<input type="text" id="txt_cname" name="txt_cname" style="width: 80px" /></li>
|
||
<li>开通时间:@Html.WdatePickerText("txt_ostime", "")-@Html.WdatePickerText("txt_oetime", "")</li>
|
||
<li>赠送到期时间:@Html.WdatePickerText("txt_overstarttime", "")-@Html.WdatePickerText("txt_overendtime", "")</li>
|
||
</ul>
|
||
</div>
|
||
@Html.Raw(ViewBag.gridTable)
|
||
</div>
|
||
|
||
<div id="addDiv" class="layui-form" style="display:none;padding:10px 20px 20px 0px;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">客户ID:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="resid" name="resid" lay-verify="required" autocomplete="off" placeholder="请输入客户ID" class="layui-input">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">备注:</label>
|
||
<div class="layui-input-block">
|
||
<textarea placeholder="请输入内容" class="layui-textarea" lay-verify="remark" id="remark" name="remark"></textarea>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="batchDiv" class="layui-form" style="display:none;padding:10px 20px 20px 0px;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">客户ID:</label>
|
||
<div class="layui-input-block">
|
||
<textarea placeholder="请输入客户ID,一行一个客户ID" class="layui-textarea" rows="30" lay-verify="resids" id="resids" name="resids"></textarea>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="editDiv" class="layui-form" style="display:none;padding:10px 20px 20px 0px;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">客户ID:</label>
|
||
<div class="layui-input-block">
|
||
<span class="layui-form-mid" id="residSpan"></span>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">备注:</label>
|
||
<div class="layui-input-block">
|
||
<textarea placeholder="请输入内容" class="layui-textarea" lay-verify="remark" id="remarkEdit" name="remark"></textarea>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="changeDiv" class="layui-form" style="display:none;padding:10px 20px 20px 0px;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">客服:</label>
|
||
<div class="layui-input-block">
|
||
<select name="slt_eid" id="slt_eid">
|
||
@foreach (var item in ViewBag.kfList as List<SelectListItem>)
|
||
{
|
||
<option value="@item.Value">@item.Text</option>
|
||
}
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
$(function () {
|
||
loadtablegrid();
|
||
|
||
$(window).resize(function () {//自动适应大小
|
||
$('#tablist').tablegrid('resize', {
|
||
height: $(window).height() - 110
|
||
});
|
||
});
|
||
|
||
$("#btnQuery").click(function () {
|
||
$('#tablist').tablegrid("Search");
|
||
});
|
||
});
|
||
|
||
function onLoadSucced() {
|
||
$('#tablist').tablegrid("Search");
|
||
}
|
||
|
||
function frameReturnByClose() {
|
||
$("#modalwindow").window('close');
|
||
}
|
||
function frameReturnByReload(flag) {
|
||
$("#tablist").tablegrid("Load");
|
||
}
|
||
function frameReturnByMes(mes) {
|
||
$.messageBox5s('提示', mes);
|
||
}
|
||
|
||
function loadtablegrid() {
|
||
$('#tablist').tablegrid({
|
||
url: '/weixin/AfterSales/OrderList2',
|
||
height: $(window).height() - 110,
|
||
loadNow: false,
|
||
isCheckMore: true,
|
||
data: GetControlValue,
|
||
onLoadError: function () {
|
||
$.messager.alert("警告", "信息加载失败!", "error");
|
||
}
|
||
});
|
||
}
|
||
function GetControlValue() {
|
||
return { saleDeptId: $("#nb1_uc_org_depts").val(), groupId: $("#nb1_uc_org_groups").val(), userId: $("#nb1_uc_org_ids").val() };
|
||
}
|
||
|
||
function changeselect(productId) {
|
||
if (productId == 0) {
|
||
$("#slt_subProductId").unbind();
|
||
$("#slt_subProductId").html("<option value='0'>--请选中产品小类--</option>");
|
||
return;
|
||
}
|
||
$.r_post("/SzzyOrder/GetAllSubProductList?productId=" + productId, function (data) {
|
||
$("#slt_subProductId").unbind();
|
||
|
||
$("#slt_subProductId").html("<option value='0'>--请选中产品小类--</option>");
|
||
|
||
$(data).each(function (n, m) {
|
||
$("#slt_subProductId").append("<option value='" + m.Value + "'>" + m.Text + "</option>");
|
||
});
|
||
}, "json");
|
||
}
|
||
|
||
function changeMidProduct(productId) {
|
||
if (productId == 0) {
|
||
//$("#slt_subProductId").unbind();
|
||
$("#slt_subProductId").html("<option value='0'>--请选中产品小类--</option>");
|
||
return;
|
||
}
|
||
$.r_post("/JzOrder/GetAllSubProductList?productId=0&midproductId=" + productId, function (data) {
|
||
//$("#slt_subProductId").unbind();
|
||
|
||
$("#slt_subProductId").html("<option value='0'>--请选中产品小类--</option>");
|
||
|
||
$(data).each(function (n, m) {
|
||
$("#slt_subProductId").append("<option value='" + m.Value + "'>" + m.Text + "</option>");
|
||
});
|
||
|
||
}, "json");
|
||
}
|
||
|
||
</script>
|
||
|
||
<script>
|
||
layui.config({
|
||
base: '/layui-v2.5.4/',
|
||
}).extend({
|
||
excel: 'excel.min',
|
||
});
|
||
layui.use(['form', 'layer', 'excel'], function () {
|
||
var layer = layui.layer;
|
||
var form = layui.form;
|
||
var excel = layui.excel;
|
||
|
||
$("#btnCreate").click(function () {
|
||
layer.open({
|
||
title: '添加',
|
||
type: 1,
|
||
content: $('#addDiv'),
|
||
area: ['30%', '50%'],
|
||
btn: ['确定', '关闭'],
|
||
btnAlign: 'c',
|
||
yes: function () {
|
||
var resid = $("#resid").val();
|
||
var remark = $("#remark").val();
|
||
if (remark != '') {
|
||
if (remark.length > 50) {
|
||
layer.msg('备注字数太多了');
|
||
return;
|
||
}
|
||
}
|
||
//layer.msg("level:" + level + ",islimit:" + islimit);
|
||
$.ajax({
|
||
url: "/WeiXin/AfterSales/Save2",
|
||
type: "Post",
|
||
data: { resid, remark },
|
||
dataType: "json",
|
||
loading: true,
|
||
success: function (data) {
|
||
if (data.result) {
|
||
layer.closeAll();
|
||
layer.msg("执行成功!");
|
||
$("#btnQuery").click();
|
||
}
|
||
else {
|
||
if (data.retmsg == "notexists") {
|
||
layer.msg("该客户不存在,请确认!");
|
||
}
|
||
else if (data.retmsg == "exists") {
|
||
layer.msg("该客户已经被添加过了,请确认!");
|
||
}
|
||
else if (data.retmsg == "notorder") {
|
||
layer.msg("该客户还没开通订单,请确认!");
|
||
}
|
||
else {
|
||
layer.msg("执行失败,请稍后重试!");
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
$("#Other1").click(function () {
|
||
layer.open({
|
||
title: '批量添加',
|
||
type: 1,
|
||
content: $('#batchDiv'),
|
||
area: ['30%', '50%'],
|
||
btn: ['确定', '关闭'],
|
||
btnAlign: 'c',
|
||
yes: function () {
|
||
var resids = $("#resids").val();
|
||
if (resids == '') {
|
||
layer.msg('客户ID不能为空');
|
||
return;
|
||
}
|
||
|
||
$.post('/WeiXin/AfterSales/BatchSave', { resids }, function (rsp) {
|
||
if (rsp.result) {
|
||
$("#resids").val('');
|
||
layer.closeAll();
|
||
layer.msg("执行成功!");
|
||
$("#btnQuery").click();
|
||
}
|
||
else {
|
||
if (rsp.retmsg == 'error') {
|
||
layer.msg("执行失败,请稍后重试!");
|
||
}
|
||
else {
|
||
layer.msg(rsp.retmsg + ",已经存在,请确认!");
|
||
}
|
||
}
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
$("#Other2").click(function () {
|
||
var selects = $('#tablist').tablegrid('getSelections');
|
||
if (selects == "") {
|
||
layer.msg('请选择');
|
||
return;
|
||
}
|
||
var resids = "";
|
||
layer.open({
|
||
title: '调整',
|
||
type: 1,
|
||
content: $('#changeDiv'),
|
||
area: ['30%', '50%'],
|
||
btn: ['确定', '关闭'],
|
||
btnAlign: 'c',
|
||
yes: function () {
|
||
$(selects).each(function (i, n) {
|
||
if (n.ID != undefined)
|
||
resids += n.ID + ",";
|
||
});
|
||
resids = resids.substring(0, resids.length - 1);
|
||
|
||
var eid = $("#slt_eid").val();
|
||
|
||
if (eid == '' || eid == null) {
|
||
layer.msg('请选择客服');
|
||
return;
|
||
}
|
||
|
||
$.post('/WeiXin/AfterSales/Change', { resids, eid }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.closeAll();
|
||
layer.msg("执行成功!");
|
||
$("#btnQuery").click();
|
||
}
|
||
else {
|
||
if (rsp.retmsg == 'error') {
|
||
layer.msg("执行失败,请稍后重试!");
|
||
}
|
||
else {
|
||
layer.msg(rsp.retmsg + ",已经存在,请确认!");
|
||
}
|
||
}
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
$("#btnEdit").click(function () {
|
||
var row = $('#tablist').tablegrid('getSelected');
|
||
if (row == null) {
|
||
layer.msg('请选择');
|
||
return;
|
||
}
|
||
$("#residSpan").html(row.RESID);
|
||
$("#remarkEdit").val(row.REMARK);
|
||
layer.open({
|
||
title: '编辑',
|
||
type: 1,
|
||
content: $('#editDiv'),
|
||
area: ['30%', '50%'],
|
||
btn: ['确定', '关闭'],
|
||
btnAlign: 'c',
|
||
yes: function () {
|
||
|
||
var resid = row.RESID;
|
||
|
||
var remark = $("#remarkEdit").val();
|
||
if (remark != '') {
|
||
if (remark.length > 50) {
|
||
layer.msg('备注字数太多了');
|
||
return;
|
||
}
|
||
}
|
||
|
||
$.post('/WeiXin/AfterSales/Edit', { resid, remark }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.closeAll();
|
||
layer.msg("执行成功!");
|
||
$("#btnQuery").click();
|
||
}
|
||
else {
|
||
layer.msg("执行失败,请稍后重试!");
|
||
}
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
$("#btnDelete").click(function () {
|
||
var row = $('#tablist').tablegrid('getSelected');
|
||
if (row != null) {
|
||
$.r_post('/WeiXin/AfterSales/Delete', { id: row.ID }, function (msg) {
|
||
if (msg.result) {
|
||
layer.msg("执行成功!");
|
||
$("#btnQuery").click();
|
||
}
|
||
else {
|
||
layer.msg("执行失败,请稍后重试!");
|
||
}
|
||
});
|
||
}
|
||
else {
|
||
layer.msg("请选择");
|
||
}
|
||
});
|
||
|
||
$("#btnExport").click(function () {
|
||
|
||
var saleDeptId = $("#nb1_uc_org_depts").val()
|
||
var groupId = $("#nb1_uc_org_groups").val()
|
||
var userId = $("#nb1_uc_org_ids").val()
|
||
|
||
var para = GetParams("tb");
|
||
|
||
console.log(para);
|
||
|
||
$.r_post('/weixin/AfterSales/OrderList2Export?saleDeptId=' + saleDeptId + "&groupId=" + groupId + "&userId=" + userId, para, function (res) {
|
||
console.log(res);
|
||
res.data.unshift({
|
||
RESID: '客户ID'
|
||
, SUBPRODUCTNAME: '产品'
|
||
, CNAME: '客户姓名'
|
||
, LastServiceTime: '最后跟进时间'
|
||
, INNERUSERID: '跟进员工'
|
||
, REMARK: '销售备注'
|
||
, ORDERSTATUSNAME: '订单状态'
|
||
, OTIME: '开通时间'
|
||
, OverTime: '赠送到期'
|
||
, IsOverTime: '剩余天数'
|
||
, Uname: '下单人'
|
||
, Gname: '下单人组别'
|
||
});
|
||
var data = excel.filterExportData(res.data, ['RESID', 'SUBPRODUCTNAME', 'CNAME', 'LastServiceTime', 'INNERUSERID', 'REMARK', 'ORDERSTATUSNAME', 'OTIME', 'OverTime', 'IsOverTime', 'Uname', 'Gname']);
|
||
excel.exportExcel({ sheet1: data }, '客服部列表.xlsx', 'xlsx');
|
||
});
|
||
|
||
});
|
||
|
||
form.verify({
|
||
remark: function (value) {
|
||
if (value != '') {
|
||
if (value.length > 200) {
|
||
return '备注字数太多了';
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
<script type="text/javascript">
|
||
function GetIframeHtml(src) {
|
||
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
|
||
}
|
||
|
||
//获取datagrid头部及字段
|
||
function getDataGridHeader() {
|
||
var columns = $('#tablist').tablegrid("getHead");
|
||
return columns;
|
||
}
|
||
function Create_Click() { }
|
||
function Delete_Click() {
|
||
@*var row = $('#tablist').tablegrid('getSelected');
|
||
if (row != null) {
|
||
|
||
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }*@
|
||
}
|
||
function Edit_Click() { }
|
||
function Other1_Click() { }
|
||
function Other2_Click() { }
|
||
function ExportAll_Click() { }
|
||
</script>
|