Commit cebcb90f authored by 季圣华's avatar 季圣华
Browse files

更新商品录入信息

parent 91f0bdd8
...@@ -1095,103 +1095,105 @@ ...@@ -1095,103 +1095,105 @@
} }
//保存信息 //保存信息
$("#saveMaterial").unbind().bind({ $("#saveMaterial").off("click").on("click",function() {
click:function() if(!$('#Name').val()){
$.messager.alert('提示','品名不能为空!','warning');
return;
}
if(!$('#Model').val()){
$.messager.alert('提示','型号不能为空!','warning');
return;
}
if(checkIsExist()){
return;
}
var parent=1;
if($("#CategoryId_f").val()!=""&&$("#CategoryId_f").val()!=null)
{ {
if(!$('#materialFM').form('validate')){ parent=$("#CategoryId_f").val();
return; }
} if($("#CategoryId_s").val()!=""&&$("#CategoryId_s").val()!=null)
if(checkIsExist()){ {
return; parent=$("#CategoryId_s").val();
} }
var parent=1; if($("#CategoryId_t").val()!=""&&$("#CategoryId_t").val()!=null)
if($("#CategoryId_f").val()!=""&&$("#CategoryId_f").val()!=null) {
{ parent=$("#CategoryId_t").val();
parent=$("#CategoryId_f").val(); }
} //构造价格列表json
if($("#CategoryId_s").val()!=""&&$("#CategoryId_s").val()!=null) var priceStrategy = [];
{ var basicList = {};
parent=$("#CategoryId_s").val(); var otherList = {};
} basicList.Unit = $("#basicUnit").text();
if($("#CategoryId_t").val()!=""&&$("#CategoryId_t").val()!=null) basicList.RetailPrice = $("#basicRetailPrice").val();
{ basicList.LowPrice = $("#basicLowPrice").val();
parent=$("#CategoryId_t").val(); basicList.PresetPriceOne = $("#basicPresetPriceOne").val();
} basicList.PresetPriceTwo = $("#basicPresetPriceTwo").val();
//构造价格列表json otherList.Unit = $("#otherUnit").text();
var priceStrategy = []; otherList.RetailPrice = $("#otherRetailPrice").val();
var basicList = {}; otherList.LowPrice = $("#otherLowPrice").val();
var otherList = {}; otherList.PresetPriceOne = $("#otherPresetPriceOne").val();
basicList.Unit = $("#basicUnit").text(); otherList.PresetPriceTwo = $("#otherPresetPriceTwo").val();
basicList.RetailPrice = $("#basicRetailPrice").val(); var basic = {};
basicList.LowPrice = $("#basicLowPrice").val(); var other = {};
basicList.PresetPriceOne = $("#basicPresetPriceOne").val(); basic.basic = basicList;
basicList.PresetPriceTwo = $("#basicPresetPriceTwo").val(); other.other = otherList;
otherList.Unit = $("#otherUnit").text(); priceStrategy.push(basic);
otherList.RetailPrice = $("#otherRetailPrice").val(); priceStrategy.push(other);
otherList.LowPrice = $("#otherLowPrice").val();
otherList.PresetPriceOne = $("#otherPresetPriceOne").val();
otherList.PresetPriceTwo = $("#otherPresetPriceTwo").val();
var basic = {};
var other = {};
basic.basic = basicList;
other.other = otherList;
priceStrategy.push(basic);
priceStrategy.push(other);
$.ajax({ $.ajax({
type:"post", type:"post",
url: url, url: url,
dataType: "json", dataType: "json",
async : false, async : false,
data: ({ data: ({
CategoryId : parent, CategoryId : parent,
Name : $.trim($("#Name").val()), Name : $.trim($("#Name").val()),
Color : $.trim($("#Color").val()), Color : $.trim($("#Color").val()),
Packing : $.trim($("#Packing").val()), Packing : $.trim($("#Packing").val()),
SafetyStock : $.trim($("#SafetyStock").val()), SafetyStock : $.trim($("#SafetyStock").val()),
Model : $.trim($("#Model").val()), Model : $.trim($("#Model").val()),
Standard : $.trim($("#Standard").val()), Standard : $.trim($("#Standard").val()),
Mfrs : $.trim($("#Mfrs").val()), Mfrs : $.trim($("#Mfrs").val()),
OtherField1 : $.trim($("#OtherField1").val()), OtherField1 : $.trim($("#OtherField1").val()),
OtherField2 : $.trim($("#OtherField2").val()), OtherField2 : $.trim($("#OtherField2").val()),
OtherField3 : $.trim($("#OtherField3").val()), OtherField3 : $.trim($("#OtherField3").val()),
Unit : $.trim($("#Unit").val()), Unit : $.trim($("#Unit").val()),
RetailPrice : $.trim($("#RetailPrice").val()), RetailPrice : $.trim($("#RetailPrice").val()),
LowPrice : $.trim($("#LowPrice").val()), LowPrice : $.trim($("#LowPrice").val()),
PresetPriceOne : $.trim($("#PresetPriceOne").val()), PresetPriceOne : $.trim($("#PresetPriceOne").val()),
PresetPriceTwo : $.trim($("#PresetPriceTwo").val()), PresetPriceTwo : $.trim($("#PresetPriceTwo").val()),
UnitId : $("#manyUnit").val(), UnitId : $("#manyUnit").val(),
FirstOutUnit : $.trim($("#FirstOutUnit").val()), FirstOutUnit : $.trim($("#FirstOutUnit").val()),
FirstInUnit : $.trim($("#FirstInUnit").val()), FirstInUnit : $.trim($("#FirstInUnit").val()),
PriceStrategy : JSON.stringify(priceStrategy), //价格列表 PriceStrategy : JSON.stringify(priceStrategy), //价格列表
Remark : $.trim($("#Remark").val()), Remark : $.trim($("#Remark").val()),
clientIp:'<%=clientIp %>' clientIp:'<%=clientIp %>'
}), }),
success: function (tipInfo) success: function (tipInfo)
{
if(tipInfo)
{ {
if(tipInfo) $('#materialDlg').dialog('close');
{
$('#materialDlg').dialog('close');
var opts = $("#tableData").datagrid('options'); var opts = $("#tableData").datagrid('options');
showMaterialDetails(opts.pageNumber,opts.pageSize); showMaterialDetails(opts.pageNumber,opts.pageSize);
} }
else else
{
$.messager.show({
title: '错误提示',
msg: '保存商品信息失败,请稍后重试!'
});
}
},
//此处添加错误处理
error:function()
{ {
$.messager.alert('提示','保存商品信息异常,请稍后再试!','error'); $.messager.show({
return; title: '错误提示',
msg: '保存商品信息失败,请稍后重试!'
});
} }
}); },
} //此处添加错误处理
error:function()
{
$.messager.alert('提示','保存商品信息异常,请稍后再试!','error');
return;
}
});
}); });
var mId=0,mName=""; var mId=0,mName="";
...@@ -1473,27 +1475,23 @@ ...@@ -1473,27 +1475,23 @@
}); });
//导入excel表格 //导入excel表格
$("#saveimport").unbind().bind({ $("#saveimport").off("click").on("click",function() {
click:function() if($("#materialFile").val().length == 0) {
{ $.messager.alert('提示','请选择文件!','info');
if($("#materialFile").val().length == 0) return;
{
$.messager.alert('提示','请选择文件!','info');
return;
}
$("#importExcelFM").submit();
$('#importExcelDlg').dialog('close');
$.messager.progress({
title:'请稍候',
msg:'数据处理ing...'
});
setTimeout(function(){
$.messager.progress('close');
var opts = $("#tableData").datagrid('options');
showMaterialDetails(opts.pageNumber,opts.pageSize);
},3300);
} }
$("#importExcelFM").submit();
$('#importExcelDlg').dialog('close');
$.messager.progress({
title:'请稍候',
msg:'数据处理ing...'
});
setTimeout(function(){
$.messager.progress('close');
var opts = $("#tableData").datagrid('options');
showMaterialDetails(opts.pageNumber,opts.pageSize);
},3300);
}); });
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment