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.

667 lines
27 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostFeeDetail.aspx.cs" Inherits="TradeManage.SysManage.PostFeeDetail" %>
<!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/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/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script type="text/javascript">
var Model = null;
var Model2 = null;
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
var ExpressID = 0;
var UserType = "<%=Session["UserType"]%>";
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
ExpressID = $.url.param("ExpressID");
if (ExpressID == undefined) { ExpressID = 0; }
GetMoney();
//GetCountryList();
ReadData();
//if (UserType != "S")
//{
// $("#cmdAdd").hide();
// $("#cmdSave").hide();
//}
$("#listWeightType").change(function () {
var WeightType = $(this).val();
if (WeightType == "2") {
$("#txtFeePrice_Title").text("费用(元/克)");
} else {
$("#txtFeePrice_Title").text("固定费用(元)");
}
});
$("#cmdAdd").click(function () {
Model2 = null;
ShowFancybox(null);
});
$("#cmdSave").click(function () {
Save();
});
$("#cmdSave2").click(function () {
SaveDetail();
});
$("#listFeeType").change(function () {
CreateDataGrid();
datagrid1.DataBind(Model.ListModel);
});
$("#chk_EWeight").click(function () {
var IsUse = $("#chk_EWeight")[0].checked;
if (IsUse == true) {
$("#txtEWeight").val("");
$("#txtEWeight").attr("disabled", "disabled");
}
else {
$("#txtEWeight").removeAttr("disabled");
}
});
$("#cmdBack").click(function () {
window.parent.CloseTab("快递物流", "物流费用");
//window.location = "PostFeeList.aspx";
});
$("#" + datagrid1.TableID + " input[CommandName]").live("click", function () {
var index = $(this).parentsUntil("tr").parent().attr("index");
Model2 = datagrid1.Get_Model(index);
var ColName = $(this).attr("CommandName");
if (ColName == "cmdEdit") {
ShowFancybox(Model2);
}
});
});
function DelCol(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 (param.Id > 0) {
$.ajax({
url: "SysManageService.asmx/DeletePostFeeDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
}
});
}
datagrid1.Del_Row(rowindex);
}
function GetMoney() {
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/GetMoneyList",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
$(data.d).each(function () {
if (this.MCode == "CNY")
$("#selectmoney").append("<option value='" + this.MCode + "' selected='selected'>" + this.MName + "</option>");
else
$("#selectmoney").append("<option value='" + this.MCode + "'>" + this.MName + "</option>");
});
}
});
}
//#region 读取国家
function GetCountryList() {
$.ajax({
url: "../BaseData.asmx/GetCountryList",
async: false,
success: function (data) {
var html = new Sys.StringBuilder();
html.append("<option value='0'>全部</option>");
$(data.d).each(function () {
html.append("<option value='" + this.Code + "'>" + this.Name + "</option>");
});
$('#listCountry').html(html.toString());
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
Array.clear(datagrid1.Columns);
// var col = new nblf.ui.DataGridColumn();
// col.HeaderText = "国家";
// col.CellTemplate = "<span>{Bind CountryCode}</span>";
// Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "国家";
col.CellTemplate = "<span>{Bind CountryName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "重量范围(克)";
col.CellTemplate = "<span>{Bind StartWeight}</span>-<span>{Bind EndWeight}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "费率/g";
col.CellTemplate = "<span>{Bind FeeRate}{Bind MoneyCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "固定费用";
col.CellTemplate = "<span>{Bind FeePrice}{Bind MoneyCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "挂号费";
col.CellTemplate = "<span>{Bind CodeFee}{Bind MoneyCode}</span>";
Array.add(datagrid1.Columns, col);
//col = new nblf.ui.DataGridColumn();
//col.HeaderText = "折扣";
//col.CellTemplate = "<span>{Bind PostOff}折</span>";
//Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "分区1";
col.CellTemplate = "<span>{Bind Groups}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "分区2";
col.CellTemplate = "<span>{Bind Groups2}</span>";
Array.add(datagrid1.Columns, col);
//if ($("#listFeeType").val() == "1") {
// $("#tr1").show();
// $("#tr2").hide();
// //$("#tr3").hide();
//} else {
col = new nblf.ui.DataGridColumn();
col.HeaderText = "计费方式";
col.CellTemplate = "<span>{Bind WeightTypeName}</span>";
Array.add(datagrid1.Columns, col);
// $("#tr1").hide();
// $("#tr2").show();
// //$("#tr3").show();
//}
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "200px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>&nbsp;&nbsp;<input onclick='DelCol(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = false;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.CheckBox;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
//#endregion
//#region 读取数据
var FeeId = 0;
function ReadData() {
var param = new Object();
param.ExpressID = ExpressID;
$.ajax({
url: "SysManageService.asmx/GetModel_JC_PostFee",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
Model = data.d;
FeeId = Model.Id;
$("#txtExpressName").text(Model.ExpressName);
$("#listFeeType").val(Model.FeeType);
$("#txtFeeDesc").val(Model.FeeDesc);
if (Model.OffNum !== null) {
$("#a_off").html(Model.OffNum);
}
else {
$("#a_off").html("无");
}
$(Model.ListModel).each(function () {
if (this.SWeight != null) this.StartWeight = this.SWeight;
if (this.EWeight != null) this.EndWeight =this.EWeight;
if (this.EndWeight == "0") this.EndWeight = "不限";
if (this.WeightType == 1) {
this.WeightTypeName = "首重";
this.FeePriceName=FormatNumber(this.FeePrice,2);
}
if (this.WeightType == 2){
this.WeightTypeName = "续重";
this.FeePriceName=FormatNumber(this.FeePrice,2);
}
if (this.WeightType == 3){
this.WeightTypeName = "区间";
this.FeePriceName=FormatNumber(this.FeePrice,2);
}
});
CreateDataGrid();
datagrid1.DataBind(Model.ListModel);
}
});
}
//#endregion
//#region 弹出
function ShowFancybox(Model2) {
$.fancybox({
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#WindowAdd',
'onStart': function () {
if (Model2 == null) {
Clear();
} else {
if (Model2.Country != null) $("#txtCountry").val(Model2.CountryName);
if (Model2.StartWeight != null) $("#txtSWeight").val(Model2.StartWeight);
if (Model2.EndWeight != null) $("#txtEWeight").val(Model2.EndWeight);
if (Model2.EWeight == 0) {
$("#chk_EWeight")[0].checked = true;
$("#txtEWeight").val("");
$("#txtEWeight").attr("disabled", "disabled");
}
else {
$("#chk_EWeight")[0].checked = false;
$("#txtEWeight").removeAttr("disabled");
}
if (Model2.FeeRate != null) $("#txtFeeRate").val(FormatNumber(Model2.FeeRate, 2));
if (Model2.WeightType != null) $("#listWeightType").val(Model2.WeightType);
if (Model2.WeightType == "2") {
$("#txtFeePrice_Title").text("费率(元/克)");
} else {
$("#txtFeePrice_Title").text("固定费用(元)");
}
if (Model2.CodeFee != null) $("#txtCodePrice").val(FormatNumber(Model2.CodeFee, 2));
if (Model2.Groups!=null)
$("#txtGroup").val(Model2.Groups);
$("#txtGroup2").val(Model2.Groups2);
if (Model2.MoneyCode!=null)
$("#selectmoney").val(Model2.MoneyCode);
else
$("#selectmoney").val("CNY");
if (Model2.FeePrice != null) $("#txtFeePrice").val(Model2.FeePriceName);
}
}
});
}
//#endregion
//#region 保存
function Save() {
Model.FeeType = $("#listFeeType").val();
Model.FeeDesc = $("#txtFeeDesc").val();
var param = new Object();
param.Model = Model;
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/Save_JC_PostFee",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
alert("保存成功");
//window.location = "PostFeeList.aspx";
}
});
}
//#endregion
//#region 清除
function Clear() {
$("#txtGroup").val("");
$("#txtCountry").val("");
$("#txtSWeight").val("");
$("#txtEWeight").val("");
$("#txtFeeRate").val("");
$("#txtCodePrice").val("");
$("#listWeightType").val("1");
$("#txtFeePrice_Title").text("固定费用(元)");
$("#txtFeePrice").val("");
}
//#endregion
//#region 保存明细
function SaveDetail() {
if (Model2 == null) {
Model2 = new Object();
Array.add(Model.ListModel, Model2);
}
if ($("#txtCountry").val() == "")
{
alert("请填写国家");
return;
}
Model2.FeeId = FeeId;
Model2.Country = $("#txtCountry").val();
Model2.ExpressId = ExpressID;
// Model2.CountryName = $("#listCountry :checked").text();
// if (Model2.Country == "0") Model2.CountryName = "不限";
Model2.StartWeight = $("#txtSWeight").val();
Model2.EndWeight = $("#txtEWeight").val();
Model2.FeeRate = $("#txtFeeRate").val();
Model2.CodeFee = $("#txtCodePrice").val();
if (Model2.FeeRate != "") Model2.FeeRate = parseFloat(Model2.FeeRate);
Model2.WeightType = $("#listWeightType").val();
Model2.FeePrice = $("#txtFeePrice").val();
if (Model2.StartWeight != "") {
Model2.SWeight = parseFloat(Model2.StartWeight)
Model2.StartWeight = FormatNumber(Model2.StartWeight, 3);
}
if (Model2.EndWeight != "") {
Model2.EWeight = parseFloat(Model2.EndWeight)
Model2.EndWeight = FormatNumber(Model2.EndWeight, 3);
if (Model2.EndWeight == "0") Model2.EndWeight = "不限";
}
if (Model2.WeightType == 1) {
Model2.WeightTypeName = "首重";
Model2.FeePriceName = FormatNumber(Model2.FeePrice, 2);
}
if (Model2.WeightType == 2) {
Model2.WeightTypeName = "续重";
Model2.FeePriceName = FormatNumber(Model2.FeePrice, 2);
}
if (Model2.FeeRate != "") Model2.FeeRate = parseFloat(Model2.FeeRate);
if (Model2.FeePrice != "") Model2.FeePrice = parseFloat(Model2.FeePrice);
if (Model2.StartWeight == "") { alert("初始重量不能为空"); return; }
if (Model2.EndWeight == "" && $("#chk_EWeight")[0].checked == false) { alert("结束重量不能为空"); return; }
//if ($("#listFeeType").val() == "1") {
if (Model2.FeeRate == ""&&Model2.FeePrice == "") { alert("费率费用不能都为空"); return; }
// } else {
// if (Model2.FeePrice == "") { alert("费用不能为空"); return; }
// }
Model2.Groups = $("#txtGroup").val();
Model2.Groups2 = $("#txtGroup2").val();
Model2.MoneyCode = $("#selectmoney").val();
// Model2.FeePriceName = FormatNumber(Model2.FeePrice, 2);
var param = new Object();
param.Model = Model2;
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/Save_PostFeeDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d == "0")
{
alert("国家在系统中找不到,请先去国家管理里添加新的国家");
return;
}
alert("保存成功");
ReadData();
$.fancybox.close();
}
});
}
function ajaxFileUpload() {
var filename = $("#fileToUpload").val();
if (IsExcel(filename) == false) { alert("请选择excel文件要以.xls 格式的文件"); return; }
$.ajaxFileUpload({
url: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=ServerCookies',
secureuri: false,
fileElementId: 'fileToUpload',
dataType: 'json',
success: function (data, status) {
ImportData("ServerCookies/" + data.FileName);
},
error: function (data, status, e) {
alert(e);
}
});
}
function ImportData(FileName) {
var param = new Object();
param.FileName = FileName;
param.ExpressID = ExpressID;
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/ImportPostFeeDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
alert(data.d);
ReadData();
},
error: function (xhr, status) {
if (status != "success") alert(xhr.responseText);
}
});
}
function DeletePostFee() {
var selectlist = datagrid1.GetSelectListModel();
if (selectlist == null || selectlist.length == 0) {
alert("请选择要删除的记录");
return;
}
if (window.confirm('确定要删除吗?') == false) return;
var param = new Object();
param.list = selectlist;
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/DeletePostFeeDetailList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
alert("删除成功");
ReadData();
},
error: function (xhr, status) {
if (status != "success") alert(xhr.responseText);
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div class="title_ico">
快递费率
</div>
<table class="tableAll" style="width: 100%;">
<colgroup>
<col style="width: 80px;" />
<col style="width: 150px;" />
<col style="width: 80px;" />
<col />
</colgroup>
<tr>
<td class="f1">物流渠道
</td>
<td>
<span id="txtExpressName"></span>
</td>
<td class="f1">
折扣</td>
<td><a id="a_off"></a>
<select id="listFeeType" class="selectClass" style="width: 150px;display:none">
<option value="1">按每克费率计算</option>
<option value="2">按首重续重计算</option>
</select>
</td>
</tr>
<tr>
<td class="f1">费用说明:
</td>
<td colspan="3">
<textarea id="txtFeeDesc" rows="8" class="multieditTextbox" style="width: 99%;"></textarea>
</td>
</tr>
<tr>
<td colspan="4">
<input id="cmdAdd" class="btnClass btnClassAdd" type="button" value="新增" />&nbsp; <input id="btn_del" class="btnClass btnClassAdd" type="button" value="删除运费" onclick="DeletePostFee();"/> <input id="fileToUpload" accept="excel/xls" name="fileToUpload" type="file" style="width:250px" /> <input
id="btn_Excel1" type="button" class="btnClass btnClassEdit" value="导入运费" onclick="ajaxFileUpload();"/> <a href="../Scripts/运费模板.xls"
style="cursor: pointer; color: Blue; "> 运费导入格式下载</a>
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" class="btnClass btnClassSave" type="button" value="保存" />
<input id="cmdBack" class="btnClass btnClassBack" type="button" value="返回" />
</td>
</tr>
</table>
<div style="display: none;">
<div id="WindowAdd" title="编辑" style="width: 400px; height: auto;">
<table class="tableAll" style="width: 99%;">
<colgroup>
<col style="width: 80px;" />
<col />
</colgroup>
<tr>
<td class="f1">国家
</td>
<td> <input id="txtCountry" style='width:150px;text-align: left;' /><font color="red">注:不限国家就填不限</font>
<%-- <select id="listCountry" class="selectClass" style="width: 156px; top: 0px; left: 0px;"></select>--%>
</td>
</tr>
<tr>
<td class="f1">初始重量(克)
</td>
<td>
<input id="txtSWeight" style='width:150px;text-align: left;' min='0' max='99999999' increment='3' value='' />
</td>
</tr>
<tr>
<td class="f1">结束重量(克)
</td>
<td>
<input id="txtEWeight" style='width:150px;text-align: left;' min='0' max='99999999' increment='3' value='' />
<input id="chk_EWeight" type="checkbox" /><label for="chk_EWeight">不限</label>
</td>
</tr>
<tr id="tr1">
<td class="f1">费率(元/克)
</td>
<td>
<input id="txtFeeRate" style='width:100px;text-align: left;' min='0' max='99999999' increment='3' value='' />
</td>
</tr>
<tr id="tr2" >
<td class="f1">计费方式
</td>
<td>
<select id="listWeightType" class="selectClass" style="width: 153px; ">
<option value="1">首重</option>
<option value="2">续重</option>
<option value="3">区间</option>
</select>
</td>
</tr>
<tr id="tr3">
<td id="txtFeePrice_Title" class="f1">固定费用(元)
</td>
<td>
<input id="txtFeePrice" style='width:100px;text-align: left;' min='0' max='99999999' increment='3' value='' />
</td>
</tr>
<tr>
<td class="f1">挂号费用(元)
</td>
<td>
<input id="txtCodePrice" style='width:100px;text-align: left;' min='0' max='99999999' increment='3' value='' />
</td>
</tr>
<tr>
<td class="f1">分区1
</td>
<td>
<input id="txtGroup" style='width:100px;text-align: left;' value='' />
</td>
</tr>
<tr>
<td class="f1">分区2
</td>
<td>
<input id="txtGroup2" style='width:100px;text-align: left;' value='' />
</td>
</tr>
<tr>
<td class="f1">货币单位:
</td>
<td>
<select id="selectmoney" class="selectClass" style="width:150px; ">
</select>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave2" class="btnClass btnClassSave" type="button" value="确定" />
</td>
</tr>
</table>
</div>
</div>
</body>
</html>