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.

679 lines
28 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CK_BackGoods.aspx.cs" Inherits="TradeManage.CangKu.CK_BackGoods" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<title>订单修改</title>
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link href="../themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<link rel="stylesheet" type="text/css" href="../themes/uploadify.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/DateBox.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 type="text/javascript" src="../Scripts/uploadify/jquery.uploadify.js"></script>
<script src="../Scripts/ajaxfileupload.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>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script src="../Scripts/jquery.cookies.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox2.1/source/jquery.fancybox.css?v=2.1.5"
media="screen" />
<script type="text/javascript" src="../Scripts/fancybox2.1/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox2.1/source/jquery.fancybox.js?v=2.1.5"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script type="text/javascript">
var Id = 0;
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
$("#" + datagrid1.TableID + " [CommandName='cmdEdit']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
Id = model.Id;
$("#tr_2").show();
GetOrderModel();
fopen();
});
$("#" + datagrid1.TableID + " [CommandName='cmdImg']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
$("#img_big").attr("src", model.ImgUrl);
$("#img1").attr("src", model.ImgUrl);
if (model.ImgUrl2 != null && model.ImgUrl2 != "")
$("#img2").attr("src", "../" + model.ImgUrl2);
if (model.ImgUrl3 != null && model.ImgUrl3 != "")
$("#img3").attr("src", model.ImgUrl3);
if (model.ImgUrl4 != null && model.ImgUrl4 != "")
$("#img4").attr("src", model.ImgUrl4);
fopen2();
});
$("#img1,#img2,#img3,#img4").click(function () {
$("#img_big").attr("src", $(this).attr("src"));
});
$("#btn_add").bind("click", function () {
Id = 0;
$("#tr_2").hide();
$("#txt_postCode").val("");
$("#txt_ordercode").val("");
$("#select_backstate").val("");
$("#select_state2").val("");
ImgList1 = new Array();
$("#div_img1").html("");
fopen();
});
GetShopList();
$("#fileToUploadImage1").bind("change", function () {
ajaxFileUpload_fileToUploadImage1();
});
$(".img_del1").live("click", function () {
$(this).prev("a").remove();
$(this).remove();
var imgid = $(this).attr("no");
if (ImgList1 != null) {
$(ImgList1).each(function () {
if (imgid == this.id) {
Array.remove(ImgList1, this);
}
});
}
});
ReadData();
});
function GetShopList() {
$("#select_shop").empty();
$("#select_shop").append("<option value='0'>全部</option>");
var param = new Object();
param.DeptId = 0;
param.PlatType = 0;
WindowLoadModel.Show();
$.ajax({
url: "../BaseData.asmx/GetDeptShopList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$(data.d).each(function (i) {
$("#select_shop").append("<option value='" + this.ShopId + "'>" + this.ShopName + "</option>");
});
}
}
});
}
function ajaxFileUpload_fileToUploadImage1() {
var filename = $("#fileToUploadImage1").val();
if (filename == "" || filename == undefined) return;
if (IsImage(filename) == false) { alert("上传文件格式只限于bmp,png,gif,jpeg,jpg格式"); return; }
// WindowLoadModel.Show();
$.ajaxFileUpload({
url: '../GlobalAshx/AjaxFileUpload.ashx?DirectoryName=attached/images',
secureuri: false,
fileElementId: 'fileToUploadImage1',
dataType: 'json',
success: function (data, status) {
// WindowLoadModel.Hide();
if (data.Id == 0) {
alert("图片太大了不要超过400K");
$("#fileToUploadImage1").bind("change", function () {
ajaxFileUpload_fileToUploadImage1();
});
return;
}
var md = new Object();
md.FileUrl = data.FileUrl;
md.id = data.Id;
Array.add(ImgList1, md);
var Url = "../" + data.FileUrl;
$("#div_img1").append("<a><img alt='' imgurl='" + data.FileUrl + "' no='" + data.Id + "' src='" + Url + "' width='70px' height='70px' /></a><a class='img_del1' style='cursor:pointer;' no='" + data.Id + "'><img alt='删除' src='../images/del.gif' width='20px' height='20px' /></a>");
$("#fileToUploadImage1").bind("change", function () {
ajaxFileUpload_fileToUploadImage1();
});
}
})
return false;
}
function fopen2() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test2',
'onComplete': function () {
}
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
param.ShopId = $("#select_shop").val();
param.OrderCode = $("#txt_Code").val();
param.State = $("#select_state").val();
param.SDate = null;
if ($("#txt_SDate").val() != "")
param.SDate = $("#txt_SDate").val();
param.EDate = null;
if ($("#txt_EDate").val() != "")
param.EDate = $("#txt_EDate").val();
// if ($("#txt_Edate").val() != "")
//param.Edate = null;
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
param.Sort = "Id desc";
WindowLoadModel.Show();
$.ajax({
url: "CangKuServer.asmx/GetListBackGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
}
});
}
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "对应订单号";
col.CellTemplate = "<a href='../SysManage/DD_BackMoneyApply3.aspx?OrderCode={Bind OrderCode}' target='_blank' class='linka'>{Bind OrderCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编号[数量]";
col.CellTemplate = "<a>{Bind GoodsCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "数量";
col.CellTemplate = "<a>{Bind Num}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "跟踪码";
col.CellTemplate = "<a>{Bind TrackCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "验货入库状态";
col.CellTemplate = "<a>{Bind GoodsState}</a>";
col.CellFormatter = function (value) {
switch (value) {
case 0: return "未到货";
case 1: return "正常入库";
case 2: return "外箱破损重新包装入库";
case 3: return "破损报废";
case 4: return "丢失";
case 6: return "包装损坏,等下次重新包装后再入库";
case 5: return "无";
}
};
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "入库库位";
col.CellTemplate = "<a>{Bind PostionCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "处理状态";
col.CellTemplate = "<a>{Bind State}</a>";
col.CellFormatter = function (value) {
switch (value) {
case 0: return "未关联";
case 1: return "已关联";
}
};
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "录入日期";
col.CellTemplate = "<a>{Bind InDate,yyyy-MM-dd HH:mm}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "图片";
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind ImgUrl}' alt='' width='100px' height='70px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "150px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='处理'></input>&nbsp;&nbsp;<input onclick='Delobj(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
//datagrid1.Height = "260px";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
function Delobj(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;
if (model.Id > 0) {
$.ajax({
url: "CangKuServer.asmx/Delete_BackGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
}
function GetOrderModel() {
var param = new Object();
param.Id = Id;
WindowLoadModel.Show();
$.ajax({
url: "CangKuServer.asmx/GetModel_BackGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$("#txt_postCode").val(data.d.TrackCode);
$("#txt_ordercode").val(data.d.OrderCode);
$("#select_backstate").val(data.d.GoodsState);
$("#select_state2").val(data.d.State);
$("#txt_GoodsCode").val(data.d.GoodsCode);
$("#txt_Num").val(data.d.Num);
$("#txt_PostionCode").val(data.d.PostionCode);
$("#div_img1").html("");
// if (data.d.imglist != null)
// ImgList1 = data.d.imglist;
// else
// ImgList1 =new Array();
// $(ImgList1).each(function () {
// var url = "../" + this.FileUrl;
// $("#div_img1").append("<a href='" + url + "' target='_blank'><img alt='' imgurl='" + this.FileUrl + "' src='" + url + "' width='70px' height='70px' /></a><a class='img_del1' style='cursor:pointer;' no='" + this.id + "'><img alt='删除' src='../images/del.gif' width='20px' height='20px' /></a>");
//
// });
if (data.d.ImgUrl != null && data.d.ImgUrl != "")
$("#div_img1").append("<a href='../" + data.d.ImgUrl + "' target='_blank'><img alt='' imgurl='../" + data.d.ImgUrl + "' src='../" + data.d.ImgUrl + "' width='200px' height='200px' /></a>");
if (data.d.ImgUrl2 != null && data.d.ImgUrl2 != "")
$("#div_img1").append("<a href='../" + data.d.ImgUrl + "' target='_blank'><img alt='' imgurl='../" + data.d.ImgUrl2 + "' src='../" + data.d.ImgUrl2 + "' width='200px' height='200px'/></a>");
if (data.d.ImgUrl3 != null && data.d.ImgUrl4 != "")
$("#div_img1").append("<a href='../" + data.d.ImgUrl + "' target='_blank'><img alt='' imgurl='../" + data.d.ImgUrl3 + "' src='../" + data.d.ImgUrl3 + "' width='200px' height='200px' /></a>");
if (data.d.ImgUrl4 != null && data.d.ImgUrl4 != "")
$("#div_img1").append("<a href='../" + data.d.ImgUrl + "' target='_blank'><img alt='' imgurl='../" + data.d.ImgUrl4 + "' src='../" + data.d.ImgUrl4 + "' width='200px' height='200px' /></a>");
// $("#img1").attr("src", data.d.ImgUrl);
// if (data.d.ImgUrl2 != null && data.d.ImgUrl2 != "")
// $("#img2").attr("src", "../" + data.d.ImgUrl2);
// if (data.d.ImgUrl3 != null && data.d.ImgUrl3 != "")
// $("#img3").attr("src", data.d.ImgUrl3);
// if (data.d.ImgUrl4 != null && data.d.ImgUrl4 != "")
// $("#img4").attr("src", data.d.ImgUrl4);
}
}
});
}
var ImgList1 = new Array();
function Save_BackGoods() {
//
//
if ($("#txt_ordercode").val() == "") {
alert("请填写订单号");
return;
}
var param = new Object();
var Model = new Object();
Model.Id = Id;
Model.TrackCode = $("#txt_postCode").val();
Model.OrderCode = $("#txt_ordercode").val();
Model.GoodsState = $("#select_backstate").val();
Model.State = 1;
Model.imglist = ImgList1;
param.Model = Model;
WindowLoadModel.Show();
$.ajax({
url: "CangKuServer.asmx/Save_BackGoods3",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
WindowLoadModel.Hide();
if (data.d == 0) {
alert("对应的订单号找不到退货赔款记录,请确定是否正确");
return;
}
alert("保存成功");
ReadData();
$.fancybox.close();
}
});
}
function GetExcelData() {
var param = new Object();
param.ShopId = $("#select_shop").val();
param.OrderCode = $("#txt_Code").val();
param.State = $("#select_state").val();
param.SDate = null;
if ($("#txt_SDate").val() != "")
param.SDate = $("#txt_SDate").val();
param.EDate = null;
if ($("#txt_EDate").val() != "")
param.EDate = $("#txt_EDate").val();
// if ($("#txt_Edate").val() != "")
//param.Edate = null;
param.PageSize = 10000;
param.PageIndex = 1;
param.Sort = "Id desc";
var fname = "退货导出.xls";
WindowLoadModel.Show();
$.ajax({
url: "../CangKuServerNew.asmx/GetListBackGoodsExcel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
WindowLoadModel.Hide();
params = { FilePath: data.d, FileName: fname };
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
}
});
}
</script>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="修改订单" style="width:900px; height: 700px;">
<table border="1" cellpadding="0" cellspacing="0" style="width: 97%;" align="center"
class="tableAll">
<tr>
<td class="td1" colspan="4">
退货信息
</td>
</tr> <tr>
<td style="width: 120px; height: 17px;" class="f1">
图片:
</td>
<td colspan="3">
<%-- <input id="fileToUploadImage1" name="fileToUploadImage" type="file" /><br />--%>
<div id="div_img1">
</div>
</td>
</tr>
<tr>
<td style="width: 120px; height: 17px;" class="f1">
货物编号:
</td>
<td width="30%">
<input id="txt_GoodsCode" class="editTextbox" style="width: 95%;" disabled=disabled type="text" />
</td>
<td style="width: 120px; height: 17px;" class="f1">
数量:
</td>
<td width="30%">
<input id="txt_Num" class="editTextbox" style="width: 95%;" disabled=disabled type="text" />
</td>
</tr>
<tr>
<td style="width: 120px; height: 17px;" class="f1">
入库库位:
</td>
<td width="30%">
<input id="txt_PostionCode" class="editTextbox" style="width: 95%;" disabled=disabled type="text" />
</td>
<td style="width: 120px; height: 17px;" class="f1">
</td>
<td width="30%">
</td>
</tr>
<tr>
<td style="width: 120px; height: 17px;" class="f1">
退货运单号:
</td>
<td width="30%">
<input id="txt_postCode" class="editTextbox" style="width: 95%;" type="text" />
</td>
<td style="width: 120px; height: 17px;" class="f1">
仓库验货:
</td>
<td width="30%">
<select id="select_backstate" class="selectClass" style="width: 120px" disabled=disabled name="D11">
<option value="5">无</option>
<option value="0">未到货</option>
<option value="1">正常入库</option>
<option value="2">外箱破损重新包装入库</option>
<option value="3">破损报废</option>
<option value="4">丢失</option>
</select>
</td>
</tr>
<tr id="tr_2" style="display:none">
<td style="width: 120px; height: 17px;" class="f1">
对应订单号:</td>
<td width="30%">
<input id="txt_ordercode" class="editTextbox" style="width: 95%;" type="text" /></td>
<td style="width: 120px; height: 17px;" class="f1">
</td>
<td width="30%">
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSavePK" type="button" value="提交" class="btnClass btnClassSave" onclick="Save_BackGoods()" />
</td>
</tr>
</table>
</div>
<div id="test2" title="修改订单" style="width: 800px; height: 700px;">
<table border="1" cellpadding="0" cellspacing="0" style="width: 97%;" align="center"
class="tableAll">
<tr>
<td colspan="4">
<img width="780px" height="600px" id="img_big"/>
</td>
</tr>
<tr>
<td colspan="4">
<div>
<img width="50px" height="50px" id="img1"/>
<img width="50px" height="50px" id="img2"/> <img width="50px" height="50px" id="img3"/> <img width="50px" height="50px" id="img4"/></div>
</td>
</tr>
</table>
</div>
</div>
<div class="title_ico">
退货处理
</div>
<table id="tb1" class="tableAll" style="width:100%;" >
<tr>
<td class="f1" width="10%">店铺:</td>
<td width="20%" >
<select id="select_shop" class="selectClass" style="width: 120px" name="D20">
</select></td>
<td class="f1" style="width:10%;">录入日期:</td>
<td width="32%" >
<input id="txt_SDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" />-<input id="txt_EDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" /></td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="f1" width="10%">运单号/订单号:</td>
<td width="20%" > <input id="txt_Code" class="editTextbox" style="width: 120px;" type="text" />
</td>
<td class="f1" style="width:10%;">处理状态:</td>
<td width="32%" > <select id="select_state" class="selectClass" style="width:120px" name="D1">
<option value="-1">全部</option>
<option value="0">未关联</option>
<option value="1">已关联</option>
</select>
</td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" onclick="ReadData();"/></td>
</tr>
<tr>
<td colspan="5">
<input id="btn_add" class="btnClass btnClassAdd" style="display:none" type="button" value="新增退货" /><input id="Button1" class="btnClass btnClassExcelTemplate" type="button" value="导出Excel" onclick="GetExcelData();" />
</td>
</tr>
<tr>
<td valign="top" colspan="5">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</body>
</html>