$(function()
{
// 商品导航
$('.goods-nav li a').on('click', function()
{
$('.goods-nav li a').removeClass('goods-nav-active');
$(this).addClass('goods-nav-active');
})
// 添加属性类型
$attribute_tag = $('.goods-attribute-items');
$('.attribute-type-add-sub').on('click', function()
{
var index = (($(this).attr('index') || null) == null) ? parseInt($attribute_tag.find('.goods-attribute').length) : parseInt($(this).attr('index'));
var parent_name = $attribute_tag.data('name') || 'attribute';
var attribute_type_title = $attribute_tag.data('attribute-type-title');
var attribute_type_name = $attribute_tag.data('attribute-type-name');
var attribute_type_format = $attribute_tag.data('attribute-type-format');
var attribute_type_placeholder = $attribute_tag.data('attribute-type-placeholder');
var attribute_type_type_name = $attribute_tag.data('attribute-type-type-name');
var attribute_type_type_format = $attribute_tag.data('attribute-type-type-format');
var attribute_type_type_show = $attribute_tag.data('attribute-type-type-show');
var attribute_type_type_choose = $attribute_tag.data('attribute-type-type-choose');
var attribute_add_sub_text = $attribute_tag.data('attribute-add-sub-text');
var drag_sort_text = $attribute_tag.data('drag-sort-text');
var html = '
';
html += '
';
html += '';
html += '
';
html += ' '+attribute_type_name+' '
html += '';
html += '
';
html += '
';
html += ' '+attribute_type_type_name+' ';
html += '';
html += '';
html += '';
html += '';
html += '
';
html += '
';
html += '
';
html += ' '+attribute_add_sub_text+'';
html += ' '+drag_sort_text+'';
html += '
';
$attribute_tag.append(html);
$(this).attr('index', index+1);
$('ul.attribute-items-ul-'+index).dragsort({ dragSelector: 'i.drag-sort-submit', placeHolderTemplate: ''});
});
// 添加属性
$(document).on("click", ".attribute-add-sub", function()
{
var name = $(this).attr('name');
var index = ($(this).attr('index') == undefined) ? parseInt($(this).parent().find('table').length) : parseInt($(this).attr('index'));
var drag_sort_text = $attribute_tag.data('drag-sort-text');
var attribute_name = $attribute_tag.data('attribute-name');
var attribute_placeholder = $attribute_tag.data('attribute-placeholder');
var attribute_format = $attribute_tag.data('attribute-format');
var html = '
';
html += ' ';
html += '';
html += ' '+drag_sort_text+'';
html += '
';
$($(this).data('tag')).append(html);
$(this).attr('index', index+1);
});
// 属性类型删除
$(document).on("click", ".attribute-type-rem-sub", function()
{
$(this).parent().parent().remove();
});
// 具体属性删除
$(document).on("click", ".attribute-rem-sub", function()
{
$(this).parent().remove();
});
// 类型选择
$(document).on("change", '.attribute-type-se label input[type="radio"]', function()
{
var $par_obj = $(this).parent().parent().find('label');
$par_obj.removeClass('br-sed');
$(this).parent().addClass('br-sed');
});
// 手机详情添加
$(document).on('click', '.content-app-items-add-sub', function()
{
var $content_tag = $('.content-app-items');
var i = (($(this).attr('index') || null) == null) ? parseInt($content_tag.find('li').length) : parseInt($(this).attr('index'));
var index = parseInt(Math.random()*1000001)+i;
var images_name = $content_tag.data('images-name');
var content_name = $content_tag.data('content-name');
var images_text = $content_tag.data('images-text');
var content_text = $content_tag.data('content-text');
var images_default = $content_tag.data('images-default');
var delete_text = $content_tag.data('delete-text');
var drag_sort_text = $content_tag.data('drag-sort-text');
var select_images_text = $content_tag.data('select-images-text');
var select_images_format = $content_tag.data('select-images-format');
var html = '
';
html += '
';
html += '';
html += '';
html += '';
html += '';
html += '';
html += '';
html += '
';
html += '
';
html += '';
html += '';
html += '
';
html += '
';
html += ' '+delete_text+'';
html += ' '+drag_sort_text+'';
html += '