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.

436 lines
17 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_ProductCompare.aspx.cs" Inherits="TradeManage.HuoWu.HW_ProductCompare" %>
<!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="../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" />
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.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="../Scripts/Global.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script type="text/javascript">
var AddrModel = null;
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
var Id = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
ReadData();
$("#btn_Cancel").bind("click", $.fancybox.close);
$("#cmdAdd").click(function () {
// AddrModel = null;
GetCompareUseNum();
if (CNum >= 5)
{
alert("最多只能创建5个系列产品同时启用你可以取消某个系列启用状态或者删除某个系列");
return;
}
Id = 0;
Clear();
ShowFancybox();
});
$("#cmdSave").click(function () {
SaveCompare();
});
$("#btn_sch").click(function () {
ReadData();
});
$("#" + datagrid1.TableID + " input[CommandName= 'cmdEdit']").live("click", function () {
Clear();
var index = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(index);
Id = model.Id;
GetProductDetail();
$("#txtName").val(model.ProductName);
if (model.IsUse == 1)
$("#chk_Isuse").attr("checked", "checked");
else
$("#chk_Isuse").removeAttr("checked");
ShowFancybox();
});
$("#" + datagrid1.TableID + " input[CommandName= 'cmdLook']").live("click", function () {
var index = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(index);
var sId = model.Id;
window.location.href = "HW_ProductCompareCount.aspx?Id="+sId;
});
});
//#region 弹出
function ShowFancybox() {
$.fancybox({
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#WindowAdd',
'onStart': function () {
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "系列名称";
col.CellTemplate = "<span>{Bind ProductName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "是否启用";
col.CellTemplate = "<span>{Bind IsUseName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "";
col.CellTemplate = "<input CommandName='cmdLook' class='btnClass dgbtnView' type='button' value='查看数据分析'></input>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "200px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>&nbsp;<input onclick='Delete(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(50);
datagrid1.SetPageIndex(1);
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() {
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/GetListCP_ProductCompare",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.DataBind(data.d.DataSource);
}
});
}
function GetProductDetail() {
var param = new Object();
param.CompareId = Id;
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/GetCompareDetailList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null)
{
$(data.d).each(function (i) {
if (i == 0)
{
$("#txt_productId1").val(this.ProductId);
$("#txt_desc1").val(this.ProductDesc);
}
if (i == 1) {
$("#txt_productId2").val(this.ProductId);
$("#txt_desc2").val(this.ProductDesc);
}
if (i == 2) {
$("#txt_productId3").val(this.ProductId);
$("#txt_desc3").val(this.ProductDesc);
}
if (i == 3) {
$("#txt_productId4").val(this.ProductId);
$("#txt_desc4").val(this.ProductDesc);
}
if (i == 4) {
$("#txt_productId5").val(this.ProductId);
$("#txt_desc5").val(this.ProductDesc);
}
});
}
}
});
}
var CNum = 0;
function GetCompareUseNum() {
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/GetCompareUseNum",
async:false,
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
CNum = data.d;
}
}
});
}
//#endregion
//#region 清空
function Clear() {
$("#txtName").val("");
$("#txt_productId1").val("");
$("#txt_desc1").val("");
$("#txt_productId2").val("");
$("#txt_desc2").val("");
$("#txt_productId3").val("");
$("#txt_desc3").val("");
$("#txt_productId4").val("");
$("#txt_desc4").val("");
$("#txt_productId5").val("");
$("#txt_desc5").val("");
}
//#endregion
//#region 删除
function Delete(obj) {
if (window.confirm("确定要删除吗?") == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.Id = model.Id;
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/DeleteProductCompare",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
ReadData(); //刷新DataGrid
}
});
}
//#endregion
//#endregion
//#region 保存
function SaveCompare() {
if (jQuery.trim($("#txtName").val()) == "")
{
alert("请填写该比较的系列的名称")
return;
}
if ($("#chk_Isuse").is(":checked") == true) {
GetCompareUseNum();
if (CNum > 5) {
alert("最多只能创建5个系列产品同时启用你可以取消某个系列启用状态或者删除某个系列");
return;
}
}
var model = new Object();
model.Id = Id;
model.ProductName = $("#txtName").val();
if ($("#chk_Isuse").is(":checked") == true)
{
model.IsUse = 1;
}
else
model.IsUse = 0;
var list = new Array();
if (jQuery.trim($("#txt_productId1").val()) != "") {
var cmd = new Object();
cmd.ProductId = $("#txt_productId1").val();
cmd.ProductDesc = $("#txt_desc1").val();
Array.add(list, cmd);
}
if (jQuery.trim($("#txt_productId2").val()) != "") {
var cmd = new Object();
cmd.ProductId = $("#txt_productId2").val();
cmd.ProductDesc = $("#txt_desc2").val();
Array.add(list, cmd);
}
if (jQuery.trim($("#txt_productId3").val()) != "") {
var cmd = new Object();
cmd.ProductId = $("#txt_productId3").val();
cmd.ProductDesc = $("#txt_desc3").val();
Array.add(list, cmd);
}
if (jQuery.trim($("#txt_productId4").val()) != "") {
var cmd = new Object();
cmd.ProductId = $("#txt_productId4").val();
cmd.ProductDesc = $("#txt_desc4").val();
Array.add(list, cmd);
}
if (jQuery.trim($("#txt_productId5").val()) != "") {
var cmd = new Object();
cmd.ProductId = $("#txt_productId5").val();
cmd.ProductDesc = $("#txt_desc5").val();
Array.add(list, cmd);
}
if (list == null || list.length == 0)
{
alert("请至少填写一个商品productId")
return;
}
var param = new Object();
param.model = model;
param.list = list;
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/SaveProductCompare",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
ReadData();
alert("保存成功");
$.fancybox.close();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div class="title_ico">
速卖通竞争商品分析
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr >
<td>
<font color="red">注同时只能5组产品启用分析要新加的话必须取消或者删除一组</font></td>
</tr>
<tr >
<td>
<input id="cmdAdd" class="btnClass btnClassAdd" type="button" value="创建比较系列" />
</td>
</tr>
<tr>
<td valign="top">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
<div style="display: none;">
<div id="WindowAdd" title="编辑" style="width: 550px; height: 350px;">
<table id="tb2" class="tableAll" style="width: 95%;">
<tr>
<td class="f1"><span style="color: Red;">*</span>比较系列名称:
</td>
<td colspan="3">
<input id="txtName" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1" width="15%">商品1【productId】
</td>
<td width="35%">
<input id="txt_productId1" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1" width="15%">描述:
</td>
<td width="35%">
<input id="txt_desc1" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1" width="15%">商品2【productId】
</td>
<td width="35%">
<input id="txt_productId2" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1" width="15%">描述:
</td>
<td width="35%">
<input id="txt_desc2" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1" width="15%">商品3【productId】
</td>
<td width="35%">
<input id="txt_productId3" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1" width="15%">描述:
</td>
<td width="35%">
<input id="txt_desc3" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1" width="15%">商品4【productId】
</td>
<td width="35%">
<input id="txt_productId4" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1" width="15%">描述:
</td>
<td width="35%">
<input id="txt_desc4" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1" width="15%">商品5【productId】
</td>
<td width="35%">
<input id="txt_productId5" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1" width="15%">描述:
</td>
<td width="35%">
<input id="txt_desc5" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1">是否启用:
</td>
<td colspan="3">
<input id="chk_Isuse" type="checkbox" checked="checked"/>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" class="btnClass btnClassSave" type="button" value="保存" /> &nbsp;&nbsp;<input
id="btn_Cancel" type="button" class="btnClass btnClassClose" value="关 闭" />
</td>
</tr>
</table>
</div>
</div>
</body>
</html>