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.

446 lines
17 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CK_GoodsApplyAllNew.aspx.cs" Inherits="TradeManageNew.CangKu.CK_GoodsApplyAllNew" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="referrer" content="no-referrer"/>
<title>申请SKU汇总
</title>
<link rel="stylesheet" type="text/css" href="../css2/icon.css"/>
<link rel="stylesheet" type="text/css" href="../css2/DataGrid.css" />
<link href="../css2/gray/easyui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../font-awesome/css/font-awesome.min.css" />
<link href="../css2/New.css?a=1" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../themes/uploadify.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/Global2.js?t=1" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/My97DatePicker/WdatePicker.js?t=1"></script>
<link href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" />
<script src="../Scripts/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js?t=1" type="text/javascript"></script>
<script type="text/javascript">
var name = "<%=Session["Name"]%>";
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var UserId = "<%=Session["UserId"]%>";
var WindowLoadModel = new WindowLoad();
var Model = null;
var isGroupLeader = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
newId = 0;
GetYYUser();
//CreateDataGrid();
ReadData(true);
//查询
$("#btn_sch").bind("click", function () {
ReadData(true);
});
//打开页面时直接查询是否组长
$.ajax({
url: "../CangKuServerNew.asmx/isYYGroupLeader",
async: false,
success: function (data) {
debugger
if (data.d==1) {
isGroupLeader = 1;
}
}
});
});
// 查询
//#region 查询
var YYUserList = [];
var YYUserIdList = [];
function GetYYUser() {
var param = new Object();
//param.Id = newId;
param.isShowAllGroup = 1;
$.ajax({
url: "../CangKuServerNew.asmx/GetList_YYUser",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
var html = new Sys.StringBuilder();
//html.append("<option value='-1'>选择</option>");
$(data.d).each(function () {
var YYUserModel = {};
YYUserModel["ID"] = this.ID;
YYUserModel["Name"] = this.Name;
YYUserList.push(YYUserModel);
YYUserIdList.push(this.ID);
html.append("<option value='" + this.ID + "'>" + this.Name + "</option>");
});
//判断数量
if (data.d.length >1) {
$('#selec_YYUser').html("<option value='1'>全部</option>"+html.toString());
}
else {
$('#selec_YYUser').html(html.toString());
}
}
});
}
//#endregion
// 编辑
//#region 编辑
function EditDetail(goods) {
var param = new Object();
//param.Id = newId;
param.UserId = UserId;
param.GoodsId = goods;
param.Quantity = $(`#input_${goods}`).val();
$.ajax({
url: "../CangKuServerNew.asmx/Save_CK_GoodsApplyNew",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d == "") {
alert("保存成功");
$.fancybox.close();
} else {
alert(data.d);
}
}
});
}
//#endregion
// 查询
//#region 查询
function ReadData(isAllYYUser) {
if (isAllYYUser) {
CreateDataGrid();
}
var param = new Object();
param.Name = $("#select_sku").val();
var newYYUserIdList = [];
if ($("#selec_YYUser").val() == 1) {
newYYUserIdList = YYUserIdList;
}
else {
newYYUserIdList.push($("#selec_YYUser").val());
}
param.YYUserIdList = newYYUserIdList;
//param.YYUserId = $("#selec_YYUser").val();
param.isShowAll = $("#isShowAll").val();
param.Sort = datagrid1.ViewSortDirection;
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = isAllYYUser == true ? 1 : datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "../CangKuServerNew.asmx/GetGoodsInfoListForSKUApply",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
var newList = [];
if (data.d.QuantityPrice != 0) {
$("#QuantityPrice").html(`$${data.d.QuantityPrice}`);
}
else {
$("#QuantityPrice").html("$0");
}
if (data.d.GoodsApplyList != null) {
var GoodsApplyModel = {};
var allSKUNum = 0;
var allQuantityPrice = 0;
for (const item of data.d.GoodsApplyList) {
//GoodsApplyModel[item.UserId] = `${item.AllQuantity}/$${item.QuantityPrice}`;
allSKUNum += item.AllQuantity;
allQuantityPrice += item.QuantityPrice;
//if (isGroupLeader == 1 || UserId == 1) {
GoodsApplyModel[item.UserId] = `${item.AllQuantity}/$${item.QuantityPrice}`;
//}
//else {
// GoodsApplyModel[item.UserId] = `${item.AllQuantity}`;
// GoodsApplyModel["OneAllPrice"] = `$${item.QuantityPrice}`;
//}
}
//if (isGroupLeader == 1 || UserId == 1) {
GoodsApplyModel["AllSKUNum"] = `${allSKUNum}/$${allQuantityPrice.toFixed(2)}`;
//} else {
//GoodsApplyModel["OneAllPrice"] = `$${allQuantityPrice}`;
//GoodsApplyModel["AllSKUNum"] = `${allSKUNum}`;
/*}*/
newList.push(GoodsApplyModel);
}
if (data.d.DataSource != null) {
for (const item of data.d.DataSource) {
if (item.goodsApplyList != null) {
var allSKUNum = 0;
var allQuantityPrice = 0;
for (const item2 of item.goodsApplyList) {
//运营
//if (UserId != 1) {
// item["OneAllPrice"] = `$${item2.OneAllPrice}`;
// item[item2.UserId] = `${item2.Quantity}`;
//}
//admin
//else {
item[item2.UserId] = `${item2.Quantity}/$${item2.OneAllPrice}`;
item[`ApplyPlatName_${item2.UserId}`] = `${item2.ApplyPlatName}`;
//}
allSKUNum += item2.Quantity;
allQuantityPrice += item2.OneAllPrice;
}
//if (UserId != 1) {
// item["AllSKUNum"] = `${allSKUNum}`;
// item["OneAllPrice"] = `$${allQuantityPrice}`;
//} else {
item["AllSKUNum"] = `${allSKUNum}/$${allQuantityPrice}`;
//}
} else {
item["AllSKUNum"] = "0/0";
}
newList.push(item);
}
}
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(newList);
}
});
}
//#endregion
// 计算
//#region 计算
function StartCalculateAllGoosd() {
WindowLoadModel.Show();
$.ajax({
url: "../CangKuServerNew.asmx/StartCalculateAllGoosd2",
success: function (data) {
WindowLoadModel.Hide();
}
});
}
//#endregion
// DataGrid
//#region 初始化DataGrid
function CreateDataGrid() {
datagrid1.Columns = [];
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "缩略图";
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编码";
col.Width = "180px";
col.Align = "left";
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind GoodsCode}</a><br/><span>{Bind GoodsName}</span>";
Array.add(datagrid1.Columns, col);
//库存+在途
col = new nblf.ui.DataGridColumn();
col.HeaderText = "海外库存";
col.CellTemplate = "<div id='hwys' style='background-color: #d1dade;width:60px;height:25px;margin-left:15px' CommandName='cmdKC'><span style='color: #5e5e5e;font-weight: 600;font-size:13pt;margin-top:5px'>{Bind GoodsOutNum}</span></div>";
col.Width = "90px";
//col.CellFormatter = function (value) {
// debugger
// if (value == "" && value != 0) {
// this.CellTemplate = "<span></span>";
// }
//};
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "类别";
col.CellTemplate = "<span>{Bind SortName}</span>";
col.Width = "270px";
Array.add(datagrid1.Columns, col);
//col = new nblf.ui.DataGridColumn();
//col.HeaderText = "平台";
//col.CellTemplate = "<span>{Bind ApplyPlatName}</span>";
//col.Width = "270px";
//Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "单价";
col.CellTemplate = "<span>${Bind ApplyPrice}</span>";
col.Width = "270px";
Array.add(datagrid1.Columns, col);
var newYYuser = $('#selec_YYUser').val();
if (newYYuser == 1) {
for (const y of YYUserList) {
col = new nblf.ui.DataGridColumn();
col.HeaderText = `${y.Name}` ;
col.CellTemplate = `<a CommandName='cmdLook' class='linka'>{Bind ${y.ID}}</a><br/><span>{Bind ApplyPlatName_${y.ID}}</span>`;//`<span>{Bind ${y.ID}}</span>`;
col.Width = "90px";
Array.add(datagrid1.Columns, col);
}
//表格统计
col = new nblf.ui.DataGridColumn();
col.HeaderText = "AllSKUNum";
col.CellTemplate = `<span>{Bind AllSKUNum}</span>`;
col.Width = "90px";
Array.add(datagrid1.Columns, col);
} else {
var newName = "";
var newID = 0;
for (const y of YYUserList) {
if (y.ID == newYYuser) {
newName = y.Name;
newID = y.ID;
}
}
col = new nblf.ui.DataGridColumn();
col.HeaderText = newName;
col.CellTemplate = `<a CommandName='cmdLook' class='linka'>{Bind ${newID}}</a><br/><span>{Bind ApplyPlatName_${newID}}</span>`;// `<span>{Bind ${newID}}</span>`;
col.Width = "90px";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "AllSKUNum";
col.CellTemplate = `<span>{Bind AllSKUNum}</span>`;
col.Width = "90px";
Array.add(datagrid1.Columns, col);
}
datagrid1.SortExpression = "";
datagrid1.ViewSortDirection = "";
// datagrid1.Height = $(document).height() - 330;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.IsFixHeader = true;
// datagrid1.Height = $(document).height() - 300;
datagrid1.SelectMode = nblf.ui.SelectMode.CheckBox;
datagrid1.Init();
datagrid1.Sorting(function () {
ReadData(false);
});
datagrid1.add_PageIndexChanged(function () { ReadData(false); });
}
//#endregion
</script>
<style>
.td_f1 {
font-size: 11pt;
text-align: center;
}
.auto-style1 {
height: 34px;
}
.DataGridRowStyle:first-child img {
display: none;
}
.DataGridRowStyle:first-child #hwys{
display: none;
}
.DataGridRowStyle:first-child #yySave{
display: none;
}
</style>
</head>
<body class="headbody">
<table class="tableAll" style="width: 100%;">
<tr>
<td width="100%" valign="top">
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td class="td_f1" width="10%">运营人员</td>
<td>
<select id='selec_YYUser' style="width: 99%;" columnrequired="false"></select>
</td>
<td class="td_f1" width="15%;">是否展示全部申请sku信息</td>
<td class="td_f1" width="15%"><select id='isShowAll' style="width: 99%;" columnrequired="false">
<option value='0'>全部</option>
<option value='1'>只展示已申请sku</option>
<option value='2'>只展示未申请</option>
</select>
</td>
<td class="td_f1" width="10%">产品</td>
<td class="td_f1" width="15%">
<input id="select_sku" class="editTextbox" style="width: 99%;" type="text" />
</td>
<td><input id="btn_sch" class="layui-btnblue" type ="button" value="查询" />申请总额:<a id="QuantityPrice" style="color:red;font-size:15px"></a><input id="btn_StartCalculateAllGoosd" class="layui-btnblue" type ="button" value="重新计算单价" onclick="StartCalculateAllGoosd();" /></td>
<td></td>
</tr>
<tr>
<td valign="top" colspan="7" class="auto-style1">
<div id="DataGrid1" class="DataGridStyle" ></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>