goods-params.js 1.92 KB
/*var $ = require('jquery'),
	common = require('../../common/common');

var specialAttrBo = window.NETSALEDATA.specialAttrBo || {
	productSkn: window.NETSALEDATA.baseProductInfo.baseProduct.productSkn,
	washTipsList: [],
	materialList: []
};
var washTipsList = specialAttrBo.washTipsList;
var materialList = specialAttrBo.materialList;

var e = new common.edit("#taoyu1");

common.util.__ajax({
	url: '/netSale/queryAllBySortId4Select',
	data: {
		param: window.NETSALEDATA.baseProductInfo.baseProduct.maxSortId
	}
}, function(res) {
	$("#material-group").html(common.util.__template2($("#material-params").html(), res || {}));
	var materials = [];
	for (var i = 0; i < materialList.length; i++) {
		materials[i] = materialList[i].id;
	}
	$("#material").val(materials.join("|"));
	e.init();

	$(document).on('change', '.material', function() {
		var items = $("#material").val().split("|");
		for (var i = 0; i < items.length; i++) {
			materialList[i] = {
				"id": parseInt(items[i])
			};
		}
	});
});

common.util.__ajax({
	url: '/netSale/getAll4Select',
	data: {}
}, function(res) {
	$("#washTip-group").html(common.util.__template2($("#washTip-params").html(), res || {}));
	var washTips = [];
	for (var i = 0; i < washTipsList.length; i++) {
		washTips[i] = washTipsList[i].sortId;
	}
	$("#washTips").val(washTips.join("|"));
	e.init();

	$(document).on('change', '.washTips', function() {
		var items = $("#washTips").val().split("|");
		for (var i = 0; i < items.length; i++) {
			washTipsList[i] = {
				"sortId": parseInt(items[i])
			};
		}
	});
}, true);


$("#propertySave").on('click', function() {

	var washTips = $("#washTips").val() || "";
	var productMaterial = $("#material").val() || "";

	common.util.__ajax({
		url: '/netSale/saveProductParam',
		data: {
			productSkn: specialAttrBo.productSkn,
			washTips: washTips.replace(/\|/g, ","),
			productMaterial: productMaterial.replace(/\|/g, ",")
		}
	}, function() {
		// body...
	});
});*/