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.

501 lines
19 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CK_GoodsApply.aspx.cs" Inherits="TradeManageNew.CangKu.CK_GoodsApply" %>
<!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;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
newId = 0;
GetYYUser();
//CreateDataGrid();
ReadData(true);
//查询
$("#btn_sch").bind("click", function () {
ReadData(true);
});
//查询
$("#btn_clear1").bind("click", function () {
if (window.confirm('确定要清除全部数据吗?') == false) return;
ClearData(true);
});
$("#btn_clear2").bind("click", function () {
if (window.confirm('确定要清除错误数据吗?') == false) return;
ClearData(false);
});
});
// 清除
//#region 清除
function ClearData(isDeleteAll) {
var param = new Object();
param.UserId = UserId;
param.isDeleteAll = isDeleteAll;
WindowLoadModel.Show();
$.ajax({
url: "../CangKuServerNew.asmx/ClaerApply",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
WindowLoadModel.Hide();
alert("删除成功");
}
});
}
//#endregion
// 查询
//#region 查询
var YYUserList = [];
function GetYYUser() {
var param = new Object();
//param.Id = newId;
param.isShowAllGroup = 0;
$.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);
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();
ReadData(false);
} else {
alert(data.d);
}
}
});
}
//#endregion
// 查询
//#region 查询
function ReadData(isAllYYUser) {
if (isAllYYUser) {
CreateDataGrid();
}
var param = new Object();
param.Name = $("#select_sku").val();
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/GetGoodsInfoListForEditSKUApply",
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 (UserId != 1) {
GoodsApplyModel[item.UserId] = `${item.AllQuantity}`;
GoodsApplyModel["OneAllPrice"] = `$${item.QuantityPrice}`;
}
else {
GoodsApplyModel[item.UserId] = `${item.AllQuantity}/$${item.QuantityPrice}`;
}
}
if (UserId != 1) {
GoodsApplyModel["OneAllPrice"] = `$${allQuantityPrice}`;
GoodsApplyModel["AllSKUNum"] = `${allSKUNum}`;
} else {
GoodsApplyModel["AllSKUNum"] = `${allSKUNum}/$${allQuantityPrice}`;
}
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}`;
}
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 id='ApplyPrice'>${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 = `<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 = "";
for (const y of YYUserList) {
if (y.ID == newYYuser) {
newName = y.Name;
}
}
col = new nblf.ui.DataGridColumn();
col.HeaderText = newName;
col.CellTemplate = `<input id="input_{Bind GoodsId}" type="text" value="{Bind ${newYYuser}}">`;// `<input id="input_{Bind GoodsId}">{Bind ${newYYuser}}</input>`;
col.Width = "90px";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "总价";
col.CellTemplate = `<span>{Bind OneAllPrice}</span>`;;// `<input id="input_{Bind GoodsId}">{Bind ${newYYuser}}</input>`;
col.Width = "90px";
Array.add(datagrid1.Columns, col);
if (UserId != 1) {
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.CellTemplate = `<input id="yySave" class='btnClass dgbtnEdit' type='button' value='保存' onclick='EditDetail({Bind GoodsId});' ></input>&nbsp;`;
col.Width = "300px";
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
//#region 初始化DataGrid
function CreateDataGridOld(conList) {
datagrid1.Columns = [];
for (const item of conList) {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = item;
//CommandName='cmdLook'
col.CellTemplate = `<span>{Bind ${item}}</span>`;// "<span>{Bind Id}</span>";//Id UserId GoodsId Quantity InDate GoodsCode UserName
col.SortExpression = "";
Array.add(datagrid1.Columns, col);
}
datagrid1.SortExpression = "";
datagrid1.ViewSortDirection = "";
datagrid1.IsFixHeader = false;
// datagrid1.Height = $(document).height() - 330;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.IsFixHeader = false;
// 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;
}
.DataGridRowStyle:first-child #ApplyPrice{
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 colspan="5">
<input id="btn_clear1" class="layui-btnblue" type ="button" value="清除所有申请数据" />
<input id="btn_clear2" class="layui-btnblue" type ="button" value="清除错误数据" />
</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>