商品分类优化
parent
2d1d5ddd95
commit
38772e9f13
|
|
@ -55,6 +55,9 @@ class GoodsCategory extends Common
|
|||
// 是否
|
||||
$this->assign('common_is_text_list', lang('common_is_text_list'));
|
||||
|
||||
// 商品分类
|
||||
$this->assign('goods_category_list', GoodsService::GoodsCategory());
|
||||
|
||||
// 编辑器文件存放地址
|
||||
$this->assign('editor_path_type', 'goods_category');
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,28 @@
|
|||
<div class="am-popup-bd">
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation admin-save" action="{{:MyUrl('admin/goodscategory/save')}}" method="POST" request-type="ajax-reload" request-value="">
|
||||
<div class="am-form-group">
|
||||
<label class="block">父级</label>
|
||||
<select name="pid" class="am-radius c-p chosen-select forth-selection-form-category" data-placeholder="可选择..." data-validation-message="请选择商品分类">
|
||||
<option value="0">可选择...</option>
|
||||
{{if !empty($goods_category_list)}}
|
||||
{{foreach $goods_category_list as $v}}
|
||||
<option value="{{$v.id}}">一级 - {{$v.name}}</option>
|
||||
{{if !empty($v['items'])}}
|
||||
{{foreach $v.items as $vs}}
|
||||
<option style="padding-left: 30px;" value="{{$vs.id}}">二级 - {{$vs.name}}</option>
|
||||
{{if !empty($vs['items'])}}
|
||||
{{foreach $vs.items as $vss}}
|
||||
<option style="padding-left: 60px;" value="{{$vss.id}}">三级 - {{$vss.name}}</option>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-file">
|
||||
<label class="block">icon图标</label>
|
||||
<ul class="plug-file-upload-view goods-category-icon-images-view" data-form-name="icon" data-max-number="1" data-dialog-type="images">
|
||||
|
|
@ -77,7 +99,6 @@
|
|||
{{include file="lib/enable" /}}
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<input type="hidden" name="id" />
|
||||
<input type="hidden" name="pid" value="0" />
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -2047,6 +2047,12 @@ class GoodsService
|
|||
'big_images' => $attachment['data']['big_images'],
|
||||
];
|
||||
|
||||
// 父级id宇当前id不能相同
|
||||
if(!empty($params['id']) && $params['id'] == $data['pid'])
|
||||
{
|
||||
return DataReturn('父级不能与当前相同', -10);
|
||||
}
|
||||
|
||||
// 添加
|
||||
if(empty($params['id']))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -470,6 +470,16 @@ function FormDataFill(json, tag)
|
|||
});
|
||||
}
|
||||
|
||||
// 是否存在pid和当前id相同
|
||||
if($form.find('select[name="pid"]').length > 0)
|
||||
{
|
||||
$form.find('select[name="pid"]').find('option').removeAttr('disabled');
|
||||
if((json['id'] || null) != null)
|
||||
{
|
||||
$form.find('select[name="pid"]').find('option[value="'+json['id']+'"]').attr('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
// 多选插件事件更新
|
||||
if($('.chosen-select').length > 0)
|
||||
{
|
||||
|
|
@ -1378,7 +1388,13 @@ $(function()
|
|||
|
||||
// 父节点赋值
|
||||
var id = parseInt($(this).data('id')) || 0;
|
||||
$('#data-save-win').find('input[name="pid"]').val(id);
|
||||
$('#data-save-win').find('input[name="pid"], select[name="pid"]').val(id);
|
||||
|
||||
// 多选插件事件更新
|
||||
if($('.chosen-select').length > 0)
|
||||
{
|
||||
$('.chosen-select').trigger('chosen:updated');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -1461,6 +1477,12 @@ $(function()
|
|||
{
|
||||
$(this).blur();
|
||||
});
|
||||
|
||||
// 多选插件事件更新
|
||||
if($('.chosen-select').length > 0)
|
||||
{
|
||||
$('.chosen-select').trigger('chosen:updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue