TG.WXCRM.V4/WEB/Views/ActivityProduct/ProductIndex.cshtml

257 lines
9.1 KiB
Plaintext
Raw 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
@using WX.CRM.IBLL.Res;
@using WX.CRM.Model.Entity;
@{
ViewBag.Title = "产品活动管理";
Layout = "~/Views/Shared/_content.cshtml";
}
<script src="/Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<link href="/Content/themes/blue/easyui.css" rel="stylesheet" />
<link href="/Content/Site.css" rel="stylesheet" />
<script src="/Scripts/common.js"></script>
<link href="/Content/data_grid_list.css" rel="stylesheet" />
<script src="/Scripts/op/jquery.rewrite.js"></script>
<style>
.layui-table td {
padding: 2px 0 !important;
}
.layui-form-label {
width: 100px;
}
.layui-input-block {
margin-left: 130px;
}
#start {
width: 100%;
}
#end {
width: 100%;
}
</style>
<div class="layui-card" id="topcard" style="width:100%;">
<div class="layui-card-body " id="contentBody">
<div class="layui-card-header layui-self-header">
<div style="float:left;position:relative;">
侧边栏产品管理列表
</div>
<div style="float:right;position:relative;">
@Html.Action("ToolBarNew", "Control", new
{
tool = ViewBag.ToolBar as ToolBar,
})
</div>
<div class="hrclass" style="position:relative;float: left;"></div>
</div>
<form class="layui-form selftopwhere" id="myform">
<div class="layui-form-item">
@* @Html.Action("UserSSOComBox", "Control", new { currentRight = WX.CRM.WebHelper.InitRights.CONST_产品活动管理 })*@
<label>状态</label>
<div class="layui-inline">
<select name="Status">
<option value="">全部</option>
<option value="1">启用</option>
<option value="0">禁用</option>
</select>
</div>
<label>活动</label>
<div class="layui-inline">
<select name="ActId">
<option value="">全部</option>
@foreach (var item in ViewBag.ActivityList as List<SelectListItem>)
{
<option value="@item.Value">@item.Text</option>
}
</select>
</div>
产品编码:
<div class="layui-inline">
<input type="text" name="productCode" autocomplete="off" class="layui-input">
</div>
产品名:
<div class="layui-inline">
<input type="text" name="productName" autocomplete="off" class="layui-input">
</div>
<div class="layui-inline" style="width:350px">
<input class="layui-btn layui-btn-sm layui-btn-ok" data-method="search" id="search" type="button" value="查询" />
<input class="layui-btn layui-btn-sm layui-btn-reset" type="reset" value="清空" />
</div>
</div>
</form>
<table class="layui-hide" id="list" lay-filter="wochao"></table>
</div>
</div>
<script>
var selectRows = [];
var winindex;
var layer;
var rowid;
var data;
var table;
var form;
var laydate;
//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
layui.use(['laypage', 'layer', 'table', 'laydate', 'form'], function () {
var form = layui.form;
var laydate = layui.laydate;
layer = layui.layer;
table = layui.table;
table.render({
id: 'listReload'//列表别名ID
, elem: '#list'
, url: 'GetActProductList'
, method: 'POST'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, page: true
, limit: 50
, height: "full-160"
, autoSort: false
//, size:"sm"
, cols: [[
{ field: 'checkobj', type: 'checkbox', fixed: 'left' }
,{ field: 'Id', title: '活动Id' }
, { field: 'ProductName', title: '产品名称' }
, { field: 'ProductCode', title: '产品名称' }
, { field: 'ActName', title: '管理活动' }
, { field: 'Day', title: '期限(天)' }
, { field: 'Price', title: '价格' }
, { field: 'IsFirst', title: '是否首选', templet: function (res) { if (res.IsFirst == 1) return "是"; else return "否" } }
, { field: 'Status', title: '状态', templet: function (res) { if (res.Status == 1) return "启用"; else return "禁用" } }
, { field: 'Ename', title: '最后操作人' }
]], where: $("#myform").serializeFormJSON()
,
done: function (res, curr, count) {
}
});
//监听行单击事件单击事件为rowDouble
table.on('row(wochao)', function (obj) {
var data = obj.data;
//console.log(data);
//标注选中样式
obj.tr.addClass('self-table-click').siblings().removeClass('self-table-click');
selectRow = data;
});
table.on('sort(wochao)', function (obj) {
console.log(obj.field);
console.log(obj.type);
table.reload('listReload',
{
initSort: obj
, where: {
sort: obj.field,
order: obj.type
}
})
});
var active = {
search: function () {
var param = $("#myform").serializeFormJSON();
table.reload('listReload', {
where: param,
page: {
curr: 1
}
});
},
add: function () {
var url = "/ActivityProduct/AddProduct";
layer.open({
title: '添加产品',
type: 2,
maxmin: true,
content: url,
area: ['80%', '80%']
});
},
update: function () {
var url = "/ActivityProduct/AddProduct?id=" + selectRow.Id;
layer.open({
title: '修改产品',
type: 2,
maxmin: true,
content: url,
area: ['80%', '80%']
});
},
delete: function () {
debugger
var selects = table.checkStatus('listReload');
if (selects.data.length > 0) {
var ids = "";
if (selects.data.length > 0) {
$(selects.data).each(function (i, n) {
ids += n.Id + ",";
});
ids = ids.substring(0, ids.length - 1);
//console.log(pkids);
}
if (ids == "") {
layer.msg("请选择行!");
return false;
}
var data = {
ids: ids
};
var apipath = '@Html.Raw(ViewBag.apiPath)';
layer.confirm("是否确认删除", function () {
$.ajax({
url: apipath +"/QwOnlinePay/DelActProduct",
type: "Post",
data: JSON.stringify(data),
dataType: "json",
contentType: "application/json",
loading: true,
success: function (data) {
if (data.code == 0) {
layer.closeAll();
layer.msg("执行成功!");
TableReload();
}
else {
layer.msg("执行失败,请稍后重试!");
}
}
});
});
}
}
};
$('.layui-btn').on('click', function () {
var othis = $(this), method = othis.data('method');
console.log(method);
active[method] ? active[method].call(this, othis) : '';
});
});
function Closed() {
layer.close(winindex);
}
function TableReload() {
table.reload('listReload', {
});
}
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='auto' frameborder='0'' src='" + src + "'></iframe>";
}
function onLoadSucced() {
}
function show_user(eid) {
debugger
parent.ChildAddTab('企业微信管理', '/Ww/MyWork/Index?eid=' + eid, '');
}
</script>