//保存商品属性
function Attributesnext()
{
//循环获取属性集值和属性文本框值后保存到数据库的Json
var attributesInfo = "[";
var data = $("#hideattributesInfo").val();
data = data.substr(0, data.length - 1);
var arr0 = data.split(‘;‘);
for (var i = 0; i < arr0.length;i++)
{
var arr1 = arr0[i].split(‘:‘);
var AttributeSetsID = arr1[0];
attributesInfo = attributesInfo + "{\"AttributeSetsID\":"+"\""+ $("#tableSkuAttributes").find
("#td"+AttributeSetsID).attr("value")+"\",";
attributesInfo = attributesInfo + "\"AttributeSetsValues\":" + "\"" + $("#tableSkuAttributes").find("#td" +
AttributeSetsID).html() + "\",";
attributesInfo = attributesInfo+ "\"children\":[" ;
var arr2 = arr1[1].split(‘,‘);
for (var j = 0; j < arr2.length;j++)
{
var AttributeID = arr2[j];
attributesInfo = attributesInfo + "{\"AttributeID\":" + "\"" + $("#tableSkuAttributes").find("#txt" +
AttributeID).attr("value1") + "\",";
// attributesInfo = attributesInfo + "\"AttributeValues\":" + "\"" + $("#tableSkuAttributes").find("#txt" +
AttributeSetsID).val() + "\",";
attributesInfo = attributesInfo + "\"AttributeValues\":" + "\"" + $("#tableSkuAttributes").find("#txt" +
AttributeID).val() + "\"},";
}
attributesInfo = attributesInfo.substr(0, attributesInfo.length - 1);
attributesInfo = attributesInfo + "]},"
}
attributesInfo = attributesInfo.substr(0, attributesInfo.length - 1);
attributesInfo = attributesInfo + "]";
$.post("../Handler/AddGoods.ashx?type=SaveAttribut&GoodsCode=" + $("#GoodsCode").val() + "&GoodsVersions=" +
$("#GoodsVersions").val() + "&PackingList=" + $("#PackingList").val(), { Introduction: aa }, function (data) {
var result = $.parseJSON(data);
// alert(data.d);
if (result == "1") {
window.location.href = "GoodsManage.aspx";
} else {
top.Dialog.alert("操作失敗");
}
})
alert(attributesInfo);
}