operations.salecategory.Edit.js 1.75 KB
webpackJsonp([120],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';
	var $ = __webpack_require__(1),
		common = __webpack_require__(2);

	var e = new common.edit('#basicForm', {
		bucket: 'taobaocms'
	});
	e.init();

	/*new common.dropDown({
		el: '#maxsort',
		ajax: 'sortlist'
	});

	new common.dropDown({
		el: '#middlesort',
		ajax: 'sortSubList',
		params: function() {
			return {param: $('#maxsort').val()}//common.util.__input('maxsort')

		}
	});*/

	var tabTree = new common.tabTree(".sortTree");
	tabTree.init();

	var tabTreeArr = [];
	tabTreeArr.push(tabTree);

	//添加物理类目
	$(document).on('click', '.add-sort-btn',function() {
		var $sortGroup = $($('#sortWrap').html());
		$('.sort-wrap').find('.row:last').find('.add-sort-btn').hide().end().find('.del-sort-btn').show();
		$sortGroup.appendTo($('.sort-wrap'));
		tabTree = new common.tabTree(".sortTree:last");
		tabTreeArr.push(tabTree);
		tabTree.init();
	});


	//删除物理类目
	$(document).on('click', '.del-sort-btn', function() {
		$(this).parents('.row').remove();
		$('.sort-wrap').find('.row:last').find('.add-sort-btn').show().end().find('.del-sort-btn').show();
		if ($('.sort-wrap').find('.row').size() == 1) {
			$('.sort-wrap').find('.row:last').find('.add-sort-btn').show().end().find('.del-sort-btn').hide();
		}
	});

	$('#save_brand').on('click', function() {
		e.submit($('#basicForm').attr('action'), function(option) {
			console.log(option.data);
			$.each(tabTreeArr, function(i, item) {
				
			});
			option.success = function(res) {
				res = res.data;
				if (res.code == '200') {
					e.$tip(res.message, function() {
						history.go(-1);
					}, 'growl-success');
				} else {
					e.$tip(res.message);
				}
				return false;
			}
		});
	})

/***/ }
]);