606 lines
22 KiB
Plaintext
606 lines
22 KiB
Plaintext
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BUY_GN.aspx.cs" Inherits="NGTools.Pages.Z_System.BUY_GN" %>
|
|||
|
|
|||
|
<!DOCTYPE html>
|
|||
|
|
|||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|||
|
<head runat="server">
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|||
|
<title>购买模块</title>
|
|||
|
<link rel="stylesheet" type="text/css" href="../../Scripts/EASYUI/themes/default/easyui.css" />
|
|||
|
<link rel="stylesheet" type="text/css" href="../../Scripts/EASYUI/themes/icon.css" />
|
|||
|
<!--2个js文件 ,要先引入jquery,然后再引入easyui-->
|
|||
|
<script src="../../Scripts/EASYUI/jquery.min.js" type="text/javascript" charset="utf-8"></script>
|
|||
|
<script src="../../Scripts/EASYUI/jquery.easyui.min.js"></script>
|
|||
|
<script src="../../MYJS/MyTools.js"></script>
|
|||
|
<script src="../../Scripts/EASYUI/locale/easyui-lang-zh_CN.js"></script>
|
|||
|
</head>
|
|||
|
<body class="easyui-layout">
|
|||
|
|
|||
|
<div id="AllMenu" data-options="region:'west',title:'请选择要开通的功能模块'" class="easyui-panel" style="width: 560px; text-align: right">
|
|||
|
|
|||
|
<table id="dg" style="width: 558px; height: auto" data-options="onClickRow: onClickRow,singleSelect:false">
|
|||
|
<thead>
|
|||
|
<tr>
|
|||
|
</tr>
|
|||
|
</thead>
|
|||
|
</table>
|
|||
|
|
|||
|
</div>
|
|||
|
<div id="selectMenu" class="easyui-panel" data-options="region:'center',title:'订单信息',split:true">
|
|||
|
<div class="easyui-layout" data-options="fit:true">
|
|||
|
|
|||
|
<div style="width: 180px; height: 50px" data-options="region:'west',title:'订单列表'">
|
|||
|
<div id="treeWestT" class="easyui-panel" title="已激活" style="width: 180px; height: 30px"></div>
|
|||
|
<div id="treeWest" class="easyui-accordion" title="" style="width: 180px; height: 45%"></div>
|
|||
|
<div id="treeWest2T" class="easyui-panel" title="未激活" style="width: 180px; height: 30px"></div>
|
|||
|
<div id="treeWest2" class="easyui-accordion" title="" style="width: 180px; height: 45%"></div>
|
|||
|
</div>
|
|||
|
<div id="menuSelected" data-options="region:'center',title:''" style="width: 500px; height: auto">
|
|||
|
<div style="width: 500px; height: 50px" data-options="region:'north',title:''">
|
|||
|
<a class="easyui-lable">用户名称:</a> <a id="buyer" class="easyui-lable"><%=Session["userName"] %></a>
|
|||
|
<a class="easyui-lable">联系电话:</a>
|
|||
|
<a id="phoneNo" class="easyui-lable"><%=Session["phoneNo"] %></a>
|
|||
|
<a class="easyui-lable">订单号:</a> <a id="orderNo" class="easyui-lable"></a>
|
|||
|
<br />
|
|||
|
<a class="easyui-lable">选中功能总价(¥):</a> <a id="selectTotalJG" class="easyui-lable"></a>
|
|||
|
<a id="titleSJJG" class="easyui-lable">优惠后价格(¥):</a> <a id="SJtotalJG" class="easyui-lable"></a>
|
|||
|
|
|||
|
</div>
|
|||
|
<table id="dgs" style="width: 500px; height: auto">
|
|||
|
<thead>
|
|||
|
<tr>
|
|||
|
</tr>
|
|||
|
</thead>
|
|||
|
</table>
|
|||
|
</div>
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div id="tb" style="height: auto;text-align :right ; display: none">
|
|||
|
|
|||
|
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" onclick="getBuy()">确定开通已选功能</a>
|
|||
|
|
|||
|
</div>
|
|||
|
<div id="tbs" style="height: auto; display: none">
|
|||
|
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" onclick="saveGN()">提交订单</a>
|
|||
|
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" onclick="ActiveGN()">激活订单</a>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
<div id="ActiveGN" class="easyui-dialog" data-options="closed:true" style="height: 300px; width: 300px; padding-left: 20px" title="激活功能">
|
|||
|
<br />
|
|||
|
<div class="">
|
|||
|
<a style="width: 100px; text-align: right">用户账号:</a>
|
|||
|
<input id="txtYHZH" name="username" prompt="请输入用户账号" type="text" class="easyui-textbox" value="" />
|
|||
|
</div>
|
|||
|
<br />
|
|||
|
<div class="">
|
|||
|
<a style="width: 100px; text-align: right">订单号:</a>
|
|||
|
<input class="easyui-textbox" prompt="请输入订单号" id="txtOrderID" value="" />
|
|||
|
</div>
|
|||
|
<br />
|
|||
|
<div class="">
|
|||
|
<a style="width: 100px; text-align: right">金额(¥):</a>
|
|||
|
<input class="easyui-textbox" prompt="请输入金额" id="txtJe" value="" />
|
|||
|
</div>
|
|||
|
<br />
|
|||
|
|
|||
|
<br />
|
|||
|
<div style="width: 200px; text-align: center; padding-left: 20px">
|
|||
|
<a id="btnModPass" href="javascript:void(0)" class="easyui-linkbutton" onclick="ActiveOK()" style="width: 100px">激活</a>
|
|||
|
</div>
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
</body>
|
|||
|
|
|||
|
<script>
|
|||
|
|
|||
|
var totalJG = 0;
|
|||
|
var MDFlag = true;
|
|||
|
|
|||
|
function ActiveGN() {
|
|||
|
$("#ActiveGN").dialog('open');
|
|||
|
$("#txtYHZH").textbox('setValue', '<%=Session ["userAccount"]%>');
|
|||
|
$("#txtOrderID").textbox('setValue', document.getElementById("orderNo").innerHTML);
|
|||
|
$("#txtJe").textbox('setValue', totalJG);
|
|||
|
}
|
|||
|
|
|||
|
function ActiveOK() {
|
|||
|
|
|||
|
if ('<%=Session ["userName"]%>' == "廖德云") {
|
|||
|
|
|||
|
|
|||
|
|
|||
|
var orderID = $("#txtOrderID").textbox('getValue');
|
|||
|
$.ajax({
|
|||
|
type: "post",
|
|||
|
url: 'buy_gn.aspx?action=activeOrderNo' + "&t=" + Date.parse(new Date()),
|
|||
|
//dataType: "json",
|
|||
|
data: { userID: '<%=Session ["userAccount"]%>', orderID: orderID },
|
|||
|
//async: true,//异步请求,默认为true。如果需要发送同步请求发送false
|
|||
|
success: function (data) {
|
|||
|
$.messager.alert("提示", JSON.stringify(data));
|
|||
|
|
|||
|
var url = '../../ASHX/getTreeCombox.ashx?action=getOrder&type=yjh';
|
|||
|
|
|||
|
getTree($('#treeWest'), url);
|
|||
|
var url = '../../ASHX/getTreeCombox.ashx?action=getOrder&type=wjh';
|
|||
|
getTree($('#treeWest2'), url);
|
|||
|
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$(function () { //动态加载二级菜单
|
|||
|
//初始化网格 根数据
|
|||
|
|
|||
|
getGN();
|
|||
|
|
|||
|
var url = '../../ASHX/getTreeCombox.ashx?action=getOrder&type=yjh';
|
|||
|
|
|||
|
getTree($('#treeWest'), url);
|
|||
|
var url = '../../ASHX/getTreeCombox.ashx?action=getOrder&type=wjh';
|
|||
|
getTree($('#treeWest2'), url);
|
|||
|
|
|||
|
$('#treeWest').tree({
|
|||
|
onClick: function (node) {
|
|||
|
var url = '../../ASHX/getTreeCombox.ashx?action=getDataGrid';
|
|||
|
var parm = "buy_detail,order_id~" + node.id;// 格式 表名,条件字段名~条件字段值
|
|||
|
var toobar = '#tbs';
|
|||
|
$.ajax({
|
|||
|
type: "post",
|
|||
|
url: url + "&t=" + Date.parse(new Date()),
|
|||
|
dataType: "json",
|
|||
|
data: { par: parm },
|
|||
|
//async: true,//异步请求,默认为true。如果需要发送同步请求发送false
|
|||
|
success: function (data) {
|
|||
|
$('#dgs').datagrid('loadData', data.rows); //动态取数据
|
|||
|
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
$('#treeWest2').tree({
|
|||
|
onClick: function (node) {
|
|||
|
var url = '../../ASHX/getTreeCombox.ashx?action=getDataGrid';
|
|||
|
var parm = "buy_detail,order_id~" + node.id;// 格式 表名,条件字段名~条件字段值
|
|||
|
document.getElementById("orderNo").innerHTML = node.id;
|
|||
|
|
|||
|
var toobar = '#tbs';
|
|||
|
$.ajax({
|
|||
|
type: "post",
|
|||
|
url: url + "&t=" + Date.parse(new Date()),
|
|||
|
dataType: "json",
|
|||
|
data: { par: parm },
|
|||
|
//async: true,//异步请求,默认为true。如果需要发送同步请求发送false
|
|||
|
success: function (data) {
|
|||
|
$('#dgs').datagrid('loadData', data.rows); //动态取数据
|
|||
|
totalJG = 0;
|
|||
|
MDFlag = true;
|
|||
|
for (var i = 0; i < data.rows.length; i++) {
|
|||
|
totalJG += parseInt(data.rows[i].Buy_XJ);
|
|||
|
if (data.rows[i].Buy_Type != "无限制") {
|
|||
|
MDFlag = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
document.getElementById("selectTotalJG").innerHTML = totalJG;
|
|||
|
|
|||
|
var totalNum = $('#dg').datagrid('getRows').length;
|
|||
|
|
|||
|
//alert(totalNum + "_" + data.rows.length + "_" + MDFlag);
|
|||
|
|
|||
|
if (totalNum == data.rows.length) {
|
|||
|
if (MDFlag) {
|
|||
|
totalJG = 6000;
|
|||
|
document.getElementById("titleSJJG").innerHTML = "全站买断优惠价:";
|
|||
|
}
|
|||
|
else {
|
|||
|
totalJG = totalJG * 0.7;
|
|||
|
document.getElementById("titleSJJG").innerHTML = "全站购买7折优惠:";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
totalJG = totalJG * 0.8;
|
|||
|
document.getElementById("titleSJJG").innerHTML = "8折优惠:";
|
|||
|
}
|
|||
|
document.getElementById("SJtotalJG").innerHTML = totalJG;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//alert(totalJG);
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
|
|||
|
$('#dgs').datagrid({
|
|||
|
loadMsg: '正在加载数据请稍后...',
|
|||
|
pageSize: 50,
|
|||
|
pageList: [50, 100],
|
|||
|
fitColumns: true,
|
|||
|
pagination: true,
|
|||
|
striped: true, //奇偶行是否区分
|
|||
|
singleSelect: false,//单选模式
|
|||
|
rownumbers: true,//行号
|
|||
|
fitColumns: true,
|
|||
|
//height: window.innerHeight - 45 - 58,
|
|||
|
toolbar: '#tbs',
|
|||
|
fit: true,
|
|||
|
columns: [[
|
|||
|
{ field: 'Menu_ID', width: 150, align: 'center', title: '模块序号' },
|
|||
|
{ field: 'Menu_Name', width: 150, align: 'center', title: '模块名称' },
|
|||
|
{ field: 'Buy_Type', width: 150, align: 'center', title: '购买类型' },
|
|||
|
{ field: 'Buy_Num', width: 150, align: 'center', title: '购买数量' },
|
|||
|
{ field: 'Buy_DJ', width: 150, align: 'center', title: '单价(元)' },
|
|||
|
{ field: 'buy_date', width: 150, align: 'center', title: '购买日期' },
|
|||
|
{ field: 'Buy_XJ', width: 150, align: 'center', title: '小计(元)' }
|
|||
|
]] //动态取标题
|
|||
|
})
|
|||
|
|
|||
|
});
|
|||
|
var editIndex = undefined;
|
|||
|
function endEditing() {
|
|||
|
if (editIndex == undefined) { return true }
|
|||
|
if ($('#dg').datagrid('validateRow', editIndex)) {
|
|||
|
$('#dg').datagrid('endEdit', editIndex);
|
|||
|
editIndex = undefined;
|
|||
|
return true;
|
|||
|
} else {
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function onCheckAllMR(rows) {
|
|||
|
|
|||
|
$('#dg').datagrid('addEditor',
|
|||
|
[ //添加cardNo列editor
|
|||
|
{
|
|||
|
field: 'Buy_Type', editor: { type: 'combobox', options: { valueField: 'ID', textField: 'text', data: buytype, required: false } }
|
|||
|
},
|
|||
|
{
|
|||
|
field: 'Buy_Num', editor: { type: 'textbox', options: { required: false, } }
|
|||
|
}
|
|||
|
|
|||
|
]);
|
|||
|
for (var i = 0; i < rows.length; i++) {
|
|||
|
|
|||
|
|
|||
|
//让选中行进入编辑状态
|
|||
|
if (editIndex != i) {
|
|||
|
if (endEditing()) {
|
|||
|
$('#dg').datagrid('selectRow', i)
|
|||
|
.datagrid('beginEdit', i);
|
|||
|
editIndex = i;
|
|||
|
} else {
|
|||
|
$('#dg').datagrid('selectRow', i);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
var editors = $('#dg').datagrid('getEditors', i);
|
|||
|
//获取行编辑器第一个对象
|
|||
|
var editor1 = editors[0];
|
|||
|
var editor2 = editors[1];
|
|||
|
|
|||
|
editor1.target.combobox('setValue', "无限制");
|
|||
|
editor2.target.textbox('setValue', 1);
|
|||
|
$('#dg').datagrid('endEdit', i);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function onUncheckAllMR(rows) {
|
|||
|
|
|||
|
|
|||
|
$('#dg').datagrid('addEditor',
|
|||
|
[ //添加cardNo列editor
|
|||
|
{
|
|||
|
field: 'Buy_Type', editor: { type: 'combobox', options: { valueField: 'ID', textField: 'text', data: buytype, required: false } }
|
|||
|
},
|
|||
|
{
|
|||
|
field: 'Buy_Num', editor: { type: 'textbox', options: { required: false, } }
|
|||
|
}
|
|||
|
]);
|
|||
|
|
|||
|
for (var i = 0; i < rows.length; i++) {
|
|||
|
|
|||
|
//让选中行进入编辑状态
|
|||
|
if (editIndex != i) {
|
|||
|
if (endEditing()) {
|
|||
|
$('#dg').datagrid('selectRow', i)
|
|||
|
.datagrid('beginEdit', i);
|
|||
|
editIndex = i;
|
|||
|
} else {
|
|||
|
$('#dg').datagrid('selectRow', i);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
var editors = $('#dg').datagrid('getEditors', i);
|
|||
|
//获取行编辑器第一个对象
|
|||
|
var editor1 = editors[0];
|
|||
|
var editor2 = editors[1];
|
|||
|
|
|||
|
editor1.target.combobox('setValue', "");
|
|||
|
editor2.target.textbox('setValue', "");
|
|||
|
//$('#dg').datagrid('endEdit', i);
|
|||
|
$('#dg').datagrid('unselectRow', i);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
function saveGN() {
|
|||
|
|
|||
|
var rows = $("#dgs").datagrid('getRows');
|
|||
|
//alert(JSON.stringify(rows));
|
|||
|
if (rows.length > 0) {
|
|||
|
var url = "";
|
|||
|
url = '../../ASHX/getTreeCombox.ashx?action=SaveDataGrid' + "&t=" + Date.parse(new Date());
|
|||
|
var parm = "buy_detail@" + JSON.stringify(rows) + "@" + '<%=Session["userAccount"]%>' + "_" + '<%=Session["userOrgID"]%>' + "_" + document.getElementById("orderNo").innerHTML + "@"; // 格式 表名,条件字段名~条件字段值
|
|||
|
|
|||
|
if (confirm("确定更新选中的这行数据吗?")) {
|
|||
|
$.ajax({
|
|||
|
type: "post",
|
|||
|
url: url,
|
|||
|
//dataType: "json",
|
|||
|
//async: true,//异步请求,默认为true。如果需要发送同步请求发送false
|
|||
|
data: { par: parm },
|
|||
|
success: function (data) {
|
|||
|
$.messager.alert("提示", JSON.stringify(data));
|
|||
|
}
|
|||
|
})
|
|||
|
//getChanges();
|
|||
|
}
|
|||
|
else {
|
|||
|
reject();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
function getBuy() {
|
|||
|
totalJG = 0;
|
|||
|
MDFlag = true;
|
|||
|
$("#dgs").datagrid('loadData', { total: 0, rows: [] });
|
|||
|
|
|||
|
|
|||
|
var rows = $('#dg').datagrid('getChecked');
|
|||
|
//alert(rows.length)
|
|||
|
for (var i = 0; i < rows.length; i++) {
|
|||
|
var buyDJ = 0;
|
|||
|
var buyXJ = 0;
|
|||
|
switch (rows[i].Buy_Type) {
|
|||
|
case "无限制":
|
|||
|
buyDJ = rows[i].MDJG;
|
|||
|
buyXJ = parseInt(buyDJ);
|
|||
|
break;
|
|||
|
case "买次数":
|
|||
|
buyDJ = rows[i].CSJG;
|
|||
|
buyXJ = parseInt(rows[i].Buy_Num == "" ? "0" : rows[i].Buy_Num) * parseInt(buyDJ);
|
|||
|
MDFlag = false;
|
|||
|
|
|||
|
break;
|
|||
|
case "包月":
|
|||
|
buyDJ = rows[i].BNJG;
|
|||
|
buyXJ = parseInt(rows[i].Buy_Num == "" ? "0" : rows[i].Buy_Num) * parseInt(buyDJ);
|
|||
|
MDFlag = false;
|
|||
|
break;
|
|||
|
default:
|
|||
|
}
|
|||
|
if (rows[i].Buy_Type == "") {
|
|||
|
continue;
|
|||
|
}
|
|||
|
totalJG += parseInt(buyXJ);
|
|||
|
|
|||
|
//alert(buyDJ+buyXJ);
|
|||
|
$("#dgs").datagrid('appendRow',
|
|||
|
{
|
|||
|
Menu_ID: rows[i].Menu_ID,
|
|||
|
Menu_Name: rows[i].Menu_Name,
|
|||
|
Buy_Type: rows[i].Buy_Type,
|
|||
|
Buy_Num: rows[i].Buy_Num,
|
|||
|
buy_date: dateToString(new Date(), 'yyyy-MM-dd'),
|
|||
|
Buy_DJ: buyDJ,
|
|||
|
Buy_XJ: buyXJ,
|
|||
|
});
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
document.getElementById("selectTotalJG").innerHTML = totalJG;
|
|||
|
|
|||
|
var totalNum = $('#dg').datagrid('getRows').length;
|
|||
|
if (totalNum == rows.length) {
|
|||
|
if (MDFlag) {
|
|||
|
totalJG = 6000;
|
|||
|
document.getElementById("titleSJJG").innerHTML = "全站买断优惠价:";
|
|||
|
}
|
|||
|
else {
|
|||
|
totalJG = totalJG * 0.7;
|
|||
|
document.getElementById("titleSJJG").innerHTML = "全站购买7折优惠:";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
totalJG = totalJG * 0.8;
|
|||
|
document.getElementById("titleSJJG").innerHTML = "8折优惠:";
|
|||
|
}
|
|||
|
document.getElementById("SJtotalJG").innerHTML = totalJG;
|
|||
|
|
|||
|
$("#dgs").datagrid('appendRow',
|
|||
|
{
|
|||
|
Menu_ID: "合计",
|
|||
|
Menu_Name: "",
|
|||
|
Buy_Type: "",
|
|||
|
Buy_Num: "",
|
|||
|
buy_date: "",
|
|||
|
Buy_DJ: "",
|
|||
|
Buy_XJ: totalJG,
|
|||
|
});
|
|||
|
var dingdanNo = document.getElementById("orderNo");
|
|||
|
dingdanNo.innerHTML = '<%=Session["userAccount"]%>' + getRandom(10); //调用随机数函数生成10位数的随机数
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//获取指定位数的随机数
|
|||
|
function getRandom(num) {
|
|||
|
var random = Math.floor((Math.random() + Math.floor(Math.random() * 9 + 1)) * Math.pow(10, num - 1));
|
|||
|
return random;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function onClickRow(rowIndex, rowData) {
|
|||
|
$('#dg').datagrid('addEditor',
|
|||
|
[ //添加cardNo列editor
|
|||
|
{
|
|||
|
field: 'Buy_Type', editor: { type: 'combobox', options: { valueField: 'ID', textField: 'text', data: buytype, required: false } }
|
|||
|
},
|
|||
|
{
|
|||
|
field: 'Buy_Num', editor: { type: 'textbox', options: { required: false, } }
|
|||
|
}
|
|||
|
|
|||
|
]);
|
|||
|
|
|||
|
|
|||
|
//让选中行进入编辑状态
|
|||
|
if (editIndex != rowIndex) {
|
|||
|
if (endEditing()) {
|
|||
|
$('#dg').datagrid('selectRow', rowIndex)
|
|||
|
.datagrid('beginEdit', rowIndex);
|
|||
|
editIndex = rowIndex;
|
|||
|
} else {
|
|||
|
$('#dg').datagrid('selectRow', editIndex);
|
|||
|
}
|
|||
|
}
|
|||
|
//获取当前修改行编辑器的数据
|
|||
|
var editors = $('#dg').datagrid('getEditors', rowIndex);
|
|||
|
//获取行编辑器第一个对象
|
|||
|
var editor1 = editors[0];
|
|||
|
var editor2 = editors[1];
|
|||
|
//console.log(rowData);
|
|||
|
//为对象的数字框添加onChange事件
|
|||
|
editor1.target.combobox({
|
|||
|
onSelect: function (node) {
|
|||
|
switch (node.text) {
|
|||
|
|
|||
|
case "无限制":
|
|||
|
//设置combobox的值正常(0)
|
|||
|
editor2.target.textbox('setValue', 1);
|
|||
|
$('#dg').datagrid('selectRow', editIndex);
|
|||
|
break;
|
|||
|
case "买次数":
|
|||
|
editor2.target.textbox('setValue', 30);
|
|||
|
$('#dg').datagrid('selectRow', editIndex);
|
|||
|
break;
|
|||
|
case "包月":
|
|||
|
editor2.target.textbox('setValue', 12);
|
|||
|
$('#dg').datagrid('selectRow', editIndex);
|
|||
|
break;
|
|||
|
case "不购买":
|
|||
|
$('#dg').datagrid('unselectRow', editIndex);
|
|||
|
break;
|
|||
|
default:
|
|||
|
}
|
|||
|
},
|
|||
|
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
var buytype = [
|
|||
|
{ "ID": "不购买", "text": "不购买" },
|
|||
|
{ "ID": "无限制", "text": "无限制" },
|
|||
|
{ "ID": "买次数", "text": "买次数" },
|
|||
|
{ "ID": "包月", "text": "包月" }
|
|||
|
]
|
|||
|
|
|||
|
function getGN() {
|
|||
|
|
|||
|
|
|||
|
$.ajax({
|
|||
|
type: "post",
|
|||
|
url: 'buy_gn.aspx?action=getDataGrid' + "&t=" + Date.parse(new Date()),
|
|||
|
dataType: "json",
|
|||
|
//async: true,//异步请求,默认为true。如果需要发送同步请求发送false
|
|||
|
success: function (data) {
|
|||
|
//alert(JSON.stringify(data))
|
|||
|
$('#dg').datagrid({
|
|||
|
loadMsg: '正在加载数据请稍后...',
|
|||
|
pageSize: 50,
|
|||
|
pageList: [50, 100],
|
|||
|
fitColumns: true,
|
|||
|
pagination: true,
|
|||
|
striped: true, //奇偶行是否区分
|
|||
|
singleSelect: false,//单选模式
|
|||
|
rownumbers: true,//行号
|
|||
|
fitColumns: true,
|
|||
|
onCheckAll: onCheckAllMR,
|
|||
|
onUncheckAll: onUncheckAllMR,
|
|||
|
//height: window.innerHeight - 45 - 58,
|
|||
|
toolbar: '#tb',
|
|||
|
fit: true,
|
|||
|
columns: [data.title] //动态取标题
|
|||
|
});
|
|||
|
$('#dg').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', data.rows); //动态取数据
|
|||
|
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
//为网格添加分页
|
|||
|
function pagerFilter(data) {
|
|||
|
//$.messager.alert("提示",JSON.stringify(data));
|
|||
|
if (typeof data.length == 'number' && typeof data.splice == 'function') { // 判断数据是否是数组
|
|||
|
data = {
|
|||
|
total: data.length,
|
|||
|
rows: data
|
|||
|
}
|
|||
|
}
|
|||
|
var dg = $(this);
|
|||
|
var opts = dg.datagrid('options');
|
|||
|
var pager = dg.datagrid('getPager');
|
|||
|
pager.pagination({
|
|||
|
onSelectPage: function (pageNum, pageSize) {
|
|||
|
opts.pageNumber = pageNum;
|
|||
|
opts.pageSize = pageSize;
|
|||
|
pager.pagination('refresh', {
|
|||
|
pageNumber: pageNum,
|
|||
|
pageSize: pageSize
|
|||
|
});
|
|||
|
dg.datagrid('loadData', data);
|
|||
|
}
|
|||
|
});
|
|||
|
if (!data.originalRows) {
|
|||
|
data.originalRows = (data.rows);
|
|||
|
}
|
|||
|
var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
|
|||
|
var end = start + parseInt(opts.pageSize);
|
|||
|
data.rows = (data.originalRows.slice(start, end));
|
|||
|
return data;
|
|||
|
};
|
|||
|
|
|||
|
</script>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</html>
|