You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
15 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DD_GoodsDataAdd.aspx.cs" Inherits="TradeManageNew.DingDan.DD_GoodsDataAdd" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache, must-revalidate" />
<meta http-equiv="expires" content="0" />
<title></title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts2/Global.js" type="text/javascript"></script>
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/jquery.cookies.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<script type="text/javascript" src="../Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/LodopFuncs.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script src="../Scripts/JSLINQ.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var UserId = "<%=Session["UserId"]%>";
var WindowLoadModel = new WindowLoad();
var Model = null;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
//var CurrentDate = new Date();
//$("#txt_StartDate").val(CurrentDate.localeFormat("yyyy-MM-01"));
//$("#txt_StopDate").val(CurrentDate.localeFormat("yyyy-MM-dd"));
$("#txtInt1").MaskedTextBox();
TableAveColWidth("MainTable");
GetShopList();
GetGoodsList();
CreateDataGrid();
ReadData();
$("#cmdAdd").click(function () {
Model = new Object();
Model.Id = 0;
ClearControlValue("MainTable"); //清空内容
//var CurrentDate = new Date();
//$("#txtInDate").val(CurrentDate.localeFormat("yyyy-MM-dd"));
ShowFancybox("MainTable");
});
$("#cmdGet").click(function () {
ReadData();
});
$("#listShopId").change(function () {
GetGoodsList();
});
$("#cmdAdd2").click(function () {
window.open("DD_GoodsAdd.aspx");
});
$("#cmdSave").click(function () {
Save();
});
$("#cmdBack").click(function () {
$.fancybox.close();
});
$("#DataGrid1 [CommandName]").live("click", function () {
var CommandName = $(this).attr("CommandName");
var index = $(this).parentsUntil("tr").parent().attr("index");
Model = datagrid1.Get_Model(index);
if (CommandName == "cmdEdit") {
//有审核时用
//if (Model.State == 1 || Model.State == 2) { $("#cmdSave").hide(); }
//else { $("#cmdSave").show(); }
//if (Model.State == 2) { $("#tr1").show(); }
//else { $("#tr1").hide(); }
$("#listShopId").val(Model.ShopId);
GetGoodsList();
$("#listGoodsId").val(Model.GoodsId);
CreateGetModel("MainTable", Model);
ShowFancybox("MainTable");
}
if (CommandName == "cmdDel") {
Delete(Model.Id);
}
});
});
function GetShopList() {
$("#listShopId").empty();
//$("#listShopId").append("<option value='-1'>-选择-</option>");
var param = new Object();
param.PlatType = 0;
$.ajax({
url: "../BaseDataNew.asmx/GetShopList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async:false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function (i) {
$("#listShopId").append("<option value='" + this.ShopId + "'>" + this.ShopName + "</option>");
});
}
}
});
}
function GetGoodsList() {
$("#listGoodsId").empty();
$("#listGoodsId").append("<option value='-1'>-选择-</option>");
var param = new Object();
param.ShopId = $("#listShopId").val();
$.ajax({
url: "../DD_OrderServiceNew.asmx/GetListGoods3",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function (i) {
$("#listGoodsId").append("<option value='" + this.GoodsId + "'>" + this.GoodsCode + "</option>");
});
}
}
});
}
//#region 初始化DataGrid
function CreateDataGrid() {
col = new nblf.ui.DataGridColumn();
col.HeaderText = "店铺";
col.CellTemplate = "<span>{Bind ShopName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "日期";
col.CellTemplate = "<span>{Bind OrderDate,yyyy-MM-dd}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "编号";
col.CellTemplate = "<span>{Bind GoodsCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "广告费";
col.CellTemplate = "<span>{Bind Dec1}</span>";
Array.add(datagrid1.Columns, col);
// col = new nblf.ui.DataGridColumn();
// col.HeaderText = "成交金额";
// col.CellTemplate = "<span>{Bind Dec2}</span>";
// Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "点击量";
col.CellTemplate = "<span>{Bind Int1}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "大类排名";
col.CellTemplate = "<span>{Bind Int2}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "小类排名";
col.CellTemplate = "<span>{Bind Int3}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "160px";
col.CellTemplate = "<span CommandName='cmdEdit' style='color: #0000FF;cursor:pointer;text-decoration: underline;'>编辑</span>&nbsp;&nbsp;<span CommandName='cmdDel' style='color: #0000FF;cursor:pointer;text-decoration: underline;'>删除</span>";
Array.add(datagrid1.Columns, col);
//datagrid1.SetPageSize(20);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
CreateWhere("SelectHtml", param); //读取查询条件
param.cs+=" and Int5="+UserId+" ";
param.cs = Base64.encode(param.cs);
param.PageIndex = datagrid1.Get_PageIndex();
param.PageSize = datagrid1.Get_PageSize();
$.ajax({
url: "../DD_OrderServiceNew.asmx/GetListGoodsCodeData",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
}
});
}
//#endregion
//#region 删除
function Delete(Id) {
if (window.confirm("确定要删除吗?") == false) return;
var param = new Object();
param.Id = Id;
WindowLoadModel.Show();
$.ajax({
url: "../DD_OrderServiceNew.asmx/Delete_GoodsCodeData",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d == false) { alert("已经使用过,无法删除"); return; }
ReadData(); //刷新DataGrid
}
});
}
//#endregion
//#region 保存
function Save() {
var error = CreateSaveModel("MainTable", Model);
if (error != "") { alert(error); return; }
Model.GoodsCode = $("#listGoodsId").find("option:selected").text();
var param = new Object();
param.Model = Model;
WindowLoadModel.Show();
$.ajax({
url: "../DD_OrderServiceNew.asmx/Save_GoodsCodeData",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
ReadData();
alert("保存成功");
$.fancybox.close();
}
});
}
//#endregion
//#region 显示弹出窗体
function ShowFancybox(id) {
$.fancybox({
'scrolling': 'no',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#' + id,
'onClosed': function () {
}
}, 0);
}
//#endregion
</script>
</head>
<body>
<table id="SelectHtml" border="1" cellpadding="0" cellspacing="0" align="center" style="width: 100%"
class="tableAll">
<colgroup>
<col style="width: 60px;" />
<col style="width: 240px;" />
<col style="width: 60px;" />
<col style="width: 120px;" />
<col style="width: 60px;" />
<col style="width: 120px;" />
<col style="width: 60px;" />
<col style="width: 120px;" />
<col />
</colgroup>
<tr>
<td class="f1" >日期</td>
<td><input id="txt_StartDate" type="text" style="width: 100px; " onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" where="a.InDate>='@value'" />-<input id="txt_StopDate" type="text" style="width: 100px; " onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" where="a.InDate<= '@value 23:59:59'" /></td>
<td><input id="cmdGet" type="button" value = "查询" /></td>
</tr>
<tr>
<td colspan="9">
<input id="cmdAdd" type="button" value="新增" />&nbsp;&nbsp;
<input id="cmdAdd2" type="button" value="编号设置" /></td>
</tr>
<tr>
<td valign="top" colspan="9">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
<div style="display: none;">
<div id="MainTable" title="编辑" style="width: 400px; height: auto;">
<table class="tableAll" style="width: 100%;">
<colgroup>
<col style="width: 80px;" />
<col />
</colgroup>
<tr>
<td class="f1" >店铺</td>
<td><select id='listShopId' style="width: 99%;" columnname="ShopId" columndesc="店铺" columnrequired="true" ></select></td>
</tr>
<tr>
<td class="f1" >编号</td>
<td><select id='listGoodsId' style="width: 99%;" columnname="GoodsId" columndesc="编号" columnrequired="true" ></select></td>
</tr>
<tr>
<td class="f1" >日期</td>
<td><input id='txtOrderDate' type='text' style='width: 99%' onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" columnname="OrderDate" columndesc="日期" columnrequired="true" validtype="" columnformat="yyyy-MM-dd" /></td>
</tr>
<tr>
<td class="f1" >广告费</td>
<td><input id='txtDec1' type='text' style='width: 99%' precision="2" min="0" max="999999999" columnname="Dec1" columndesc="广告费" columnrequired="false" /></td>
</tr>
<tr>
<td class="f1" >点击量</td>
<td><input id='txtInt1' type='text' style='width: 99%' precision="0" min="0" max="9999999999" columnname="Int1" columndesc="点击量" columnrequired="false" /></td>
</tr>
<tr>
<td class="f1" >大类排名</td>
<td><input id='txtInt2' type='text' style='width: 99%' precision="0" min="0" max="999999999" columnname="Int2" columndesc="大类排名" columnrequired="false" /></td>
</tr>
<tr>
<td class="f1" >小类排名</td>
<td><input id='txtInt3' type='text' style='width: 99%' precision="0" min="0" max="999999999" columnname="Int3" columndesc="小类排名" columnrequired="false" /></td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" type="button" value="保存" />
<input id="cmdBack" type="button" value="返回" />
</td>
</tr>
</table>
</div>
</div>
</body>
</html>