goods
parent
7790be58eb
commit
6a419a6658
|
|
@ -153,124 +153,117 @@
|
|||
</div>
|
||||
|
||||
<!-- 规格 -->
|
||||
<div id="goods-nav-operations" class="division-block goods-specifications">
|
||||
<div id="goods-nav-operations" class="division-block">
|
||||
<label class="block nav-detail-title">商品规格</label>
|
||||
<span class="business-operations-submit specifications-nav-title-add">+添加规格</span>
|
||||
<div class="spec-images-tips">
|
||||
<label class="am-checkbox c-p">
|
||||
<input type="checkbox" value="1" data-am-ucheck />
|
||||
<span class="fs-12">首个规格选择添加图片</span>
|
||||
</label>
|
||||
</div>
|
||||
<table class="am-table am-table-bordered am-table-centered specifications-table m-t-10 m-b-10">
|
||||
<thead class="title-nav">
|
||||
<tr>
|
||||
{{if !empty($specifications['type'])}}
|
||||
{{foreach $specifications.type as $type_v}}
|
||||
<th class="table-title table-title-{{$type_v.id}}">
|
||||
<i class="am-close am-close-spin title-nav-remove" data-index="{{$type_v.id}}">×</i>
|
||||
<input type="text" name="specifications_name_{{$type_v.id}}" placeholder="规格名" value="{{$type_v.name}}" />
|
||||
</th>
|
||||
<div class="goods-specifications">
|
||||
<div class="spec-images-tips">
|
||||
<label class="am-checkbox c-p">
|
||||
<input type="checkbox" value="1" data-am-ucheck />
|
||||
<span class="fs-12 msg-tips">首个规格选择添加图片</span>
|
||||
</label>
|
||||
</div>
|
||||
<table class="am-table am-table-bordered am-table-centered specifications-table m-t-10 m-b-10">
|
||||
<thead class="title-nav">
|
||||
<tr>
|
||||
{{if !empty($specifications['type'])}}
|
||||
{{foreach $specifications.type as $type_v}}
|
||||
<th class="table-title table-title-{{$type_v.id}}">
|
||||
<i class="am-close am-close-spin title-nav-remove" data-index="{{$type_v.id}}">×</i>
|
||||
<input type="text" name="specifications_name_{{$type_v.id}}" placeholder="规格名" value="{{$type_v.name}}" />
|
||||
</th>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
<th class="title-start">价格(元)</th>
|
||||
<th>库存</th>
|
||||
<th>规格编码</th>
|
||||
<th>条形码</th>
|
||||
<th>原价(元) </th>
|
||||
<th class="operation-btn">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if empty($specifications['value'])}}
|
||||
<tr>
|
||||
<td class="value-start">
|
||||
<input type="text" name="specifications_price[]" placeholder="价格" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="specifications_number[]" placeholder="库存" class="am-radius" min="1" max="100000000" pattern="^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$" data-validation-message="库存数量 1~100000000" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_coding[]" placeholder="规格编码" class="am-radius" maxlength="80" data-validation-message="规格编码最多80个字符" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_barcode[]" placeholder="条形码" class="am-radius" maxlength="80" data-validation-message="条形码最多80个字符" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_original_price[]" placeholder="原价" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" />
|
||||
</td>
|
||||
<td>
|
||||
<!--operation-->
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
|
||||
{{if !empty($specifications['value'])}}
|
||||
{{foreach $specifications.value as $line_k=>$line_v}}
|
||||
<tr {{if $line_k gt 0}} class="line-not-first"{{/if}}>
|
||||
{{foreach $line_v as $v}}
|
||||
{{if isset($v['data_type'])}}
|
||||
{{switch v.data_type}}
|
||||
{{case spec}}
|
||||
<td class="table-value table-value-{{$v.data.key}}">
|
||||
<input type="text" name="specifications_value_{{$v.data.key}}[]" placeholder="规格值" value="{{$v.data.value}}" />
|
||||
</td>
|
||||
{{/case}}
|
||||
|
||||
{{case base}}
|
||||
<td class="value-start">
|
||||
<input type="text" name="specifications_price[]" placeholder="价格" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" value="{{$v.data.price}}" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="specifications_number[]" placeholder="库存" class="am-radius" min="0" max="100000000" data-validation-message="库存数量 0~100000000" value="{{$v.data.inventory}}" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_coding[]" placeholder="规格编码" class="am-radius" maxlength="80" data-validation-message="规格编码最多80个字符" value="{{$v.data.coding}}" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_barcode[]" placeholder="条形码" class="am-radius" maxlength="80" data-validation-message="条形码最多80个字符" value="{{$v.data.barcode}}" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_original_price[]" placeholder="原价" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" value="{{if $v['data']['original_price'] gt 0}}{{$v.data.original_price}}{{/if}}" />
|
||||
</td>
|
||||
<td>
|
||||
{{if $line_k gt 0}}
|
||||
<span class="fs-12 cr-blue c-p m-r-5 line-copy">复制</span>
|
||||
<span class="fs-12 cr-red c-p line-remove">移除</span>
|
||||
{{else /}}
|
||||
<!--operation-->
|
||||
{{/if}}
|
||||
</td>
|
||||
{{/case}}
|
||||
{{/switch}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
<th class="title-start">价格(元)</th>
|
||||
<th>库存</th>
|
||||
<th>规格编码</th>
|
||||
<th>条形码</th>
|
||||
<th>原价(元) </th>
|
||||
<th class="operation-btn">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if empty($specifications['value'])}}
|
||||
<tr>
|
||||
<td class="value-start">
|
||||
<input type="text" name="specifications_price[]" placeholder="价格" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="specifications_number[]" placeholder="库存" class="am-radius" min="1" max="100000000" pattern="^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$" data-validation-message="库存数量 1~100000000" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_coding[]" placeholder="规格编码" class="am-radius" maxlength="80" data-validation-message="规格编码最多80个字符" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_barcode[]" placeholder="条形码" class="am-radius" maxlength="80" data-validation-message="条形码最多80个字符" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_original_price[]" placeholder="原价" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" />
|
||||
</td>
|
||||
<td>
|
||||
<!--operation-->
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
|
||||
{{if !empty($specifications['value'])}}
|
||||
{{foreach $specifications.value as $line_k=>$line_v}}
|
||||
<tr {{if $line_k gt 0}} class="line-not-first"{{/if}}>
|
||||
{{foreach $line_v as $v}}
|
||||
{{if isset($v['data_type'])}}
|
||||
{{switch v.data_type}}
|
||||
{{case spec}}
|
||||
<td class="table-value table-value-{{$v.data.key}}">
|
||||
<input type="text" name="specifications_value_{{$v.data.key}}[]" placeholder="规格值" value="{{$v.data.value}}" />
|
||||
</td>
|
||||
{{/case}}
|
||||
|
||||
{{case base}}
|
||||
<td class="value-start">
|
||||
<input type="text" name="specifications_price[]" placeholder="价格" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" value="{{$v.data.price}}" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="specifications_number[]" placeholder="库存" class="am-radius" min="0" max="100000000" data-validation-message="库存数量 0~100000000" value="{{$v.data.inventory}}" required />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_coding[]" placeholder="规格编码" class="am-radius" maxlength="80" data-validation-message="规格编码最多80个字符" value="{{$v.data.coding}}" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_barcode[]" placeholder="条形码" class="am-radius" maxlength="80" data-validation-message="条形码最多80个字符" value="{{$v.data.barcode}}" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specifications_original_price[]" placeholder="原价" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的销售金额" value="{{if $v['data']['original_price'] gt 0}}{{$v.data.original_price}}{{/if}}" />
|
||||
</td>
|
||||
<td>
|
||||
{{if $line_k gt 0}}
|
||||
<span class="fs-12 cr-blue c-p m-r-5 line-copy">复制</span>
|
||||
<span class="fs-12 cr-red c-p line-remove">移除</span>
|
||||
{{else /}}
|
||||
<!--operation-->
|
||||
{{/if}}
|
||||
</td>
|
||||
{{/case}}
|
||||
{{/switch}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</tbody>
|
||||
</table>
|
||||
<span class="business-operations-submit specifications-line-add">+添加一行</span>
|
||||
<ul class="spec-images-list">
|
||||
<li>
|
||||
<ul class="plug-file-upload-view spec-images-view" data-form-name="spec_images[]" data-max-number="1" data-dialog-type="images">
|
||||
<li>
|
||||
<input type="hidden" name="spec_images[]" value="" />
|
||||
<img src="{{$image_host}}/static/admin/default/images/default-images.png" />
|
||||
</li>
|
||||
</ul>
|
||||
<div class="plug-file-upload-submit" data-view-tag="ul.spec-images-view">+上传图片</div>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="plug-file-upload-view spec-images-view" data-form-name="spec_images[]" data-max-number="1" data-dialog-type="images">
|
||||
<li>
|
||||
<input type="hidden" name="spec_images[]" value="" />
|
||||
<img src="{{$image_host}}/static/admin/default/images/default-images.png" />
|
||||
</li>
|
||||
</ul>
|
||||
<div class="plug-file-upload-submit" data-view-tag="ul.spec-images-view">+上传图片</div>
|
||||
</li>
|
||||
</ul>
|
||||
</tbody>
|
||||
</table>
|
||||
<span class="business-operations-submit specifications-nav-title-add">+添加规格</span>
|
||||
<span class="business-operations-submit specifications-line-add">+添加一行</span>
|
||||
<ul class="spec-images-list">
|
||||
<!-- <li>
|
||||
<ul class="plug-file-upload-view spec-images-view" data-form-name="spec_images[]" data-max-number="1" data-delete='0' data-dialog-type="images">
|
||||
<li>
|
||||
<input type="hidden" name="spec_images[]" value="" />
|
||||
<img src="{{$image_host}}/static/admin/default/images/default-images.png" />
|
||||
</li>
|
||||
</ul>
|
||||
<div class="plug-file-upload-submit" data-view-tag="ul.spec-images-view">+上传图片</div>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 相册 -->
|
||||
|
|
|
|||
|
|
@ -16,4 +16,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT__}}static/{{$module_css}}" />
|
||||
{{/if}}
|
||||
</head>
|
||||
<script type="text/javascript">
|
||||
var __image_host__ = '{{$image_host}}';
|
||||
</script>
|
||||
<body>
|
||||
|
|
@ -66,8 +66,8 @@
|
|||
}
|
||||
.spec-images-tips {
|
||||
position: absolute;
|
||||
left: 100px;
|
||||
top: 60px;
|
||||
left: 9px;
|
||||
top: 30px;
|
||||
z-index: 2;
|
||||
padding: 2px 5px;
|
||||
white-space: nowrap;
|
||||
|
|
@ -101,10 +101,20 @@
|
|||
.spec-images-tips .am-checkbox {
|
||||
margin: 0px;
|
||||
min-height: auto;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
}
|
||||
.spec-images-tips .am-ucheck-icons {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
}
|
||||
.spec-images-tips .am-checkbox input[type="checkbox"] {
|
||||
margin: 0 0 0 -4px;
|
||||
}
|
||||
.spec-images-tips .msg-tips {
|
||||
vertical-align: super;
|
||||
}
|
||||
.spec-images-list {
|
||||
border: 1px solid #eee;
|
||||
padding: 10px;
|
||||
|
|
@ -112,6 +122,8 @@
|
|||
}
|
||||
.spec-images-list li {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
margin: 0 10px 3px 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ $(function()
|
|||
html += '<input type="text" name="specifications_value_'+index+'[]" placeholder="规格值" />';
|
||||
html += '</td>';
|
||||
$('.value-start').before(html);
|
||||
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 规格列移除
|
||||
|
|
@ -42,6 +45,9 @@ $(function()
|
|||
{
|
||||
$('.specifications-table tr.line-not-first').remove();
|
||||
}
|
||||
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 添加一行规格值
|
||||
|
|
@ -66,6 +72,9 @@ $(function()
|
|||
{
|
||||
$(this).attr('value', '');
|
||||
});
|
||||
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 规格行复制
|
||||
|
|
@ -77,6 +86,9 @@ $(function()
|
|||
$(this).attr('value', $(this).val());
|
||||
});
|
||||
$parent.after($parent.prop('outerHTML'));
|
||||
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 规格行移除
|
||||
|
|
@ -89,20 +101,63 @@ $(function()
|
|||
$('.specifications-table th.table-title').remove();
|
||||
$('.specifications-table td.table-value').remove();
|
||||
}
|
||||
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 规格首列事件
|
||||
$('.spec-images-tips').on('change', 'input', function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
console.log(1);
|
||||
} else {
|
||||
console.log(0);
|
||||
}
|
||||
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 规格第一列输入事件
|
||||
$('.specifications-table tbody tr').on('change', 'td:eq(0) input', function()
|
||||
{
|
||||
// 规格图片
|
||||
SpecImagesHandle();
|
||||
});
|
||||
|
||||
// 规格图片
|
||||
function SpecImagesHandle()
|
||||
{
|
||||
if($('.spec-images-tips input').prop('checked'))
|
||||
{
|
||||
var temp_spec_all = {}, spec_all = [];
|
||||
$('.specifications-table tbody tr').each(function(k, v)
|
||||
{
|
||||
var value = $(this).find('td:eq(0) input').val();
|
||||
temp_spec_all[value] = value;
|
||||
});
|
||||
spec_all = Object.keys(temp_spec_all);
|
||||
if(spec_all.length > 0)
|
||||
{
|
||||
for(var i in spec_all)
|
||||
{
|
||||
var temp_class = 'spec-images-items-'+spec_all[i];
|
||||
if($('ul.spec-images-list').find('.'+temp_class).length <= 0)
|
||||
{
|
||||
var html = '<li class="'+temp_class+'">';
|
||||
html += '<input type="text" value="'+spec_all[i]+'" disabled="disabled" />'
|
||||
html += '<ul class="plug-file-upload-view spec-images-view-'+spec_all[i]+'" data-form-name="spec_images[]" data-max-number="1" data-delete="0" data-dialog-type="images">';
|
||||
html += '<li>';
|
||||
html += '<input type="hidden" name="spec_images[]" value="" />';
|
||||
html += '<img src="'+__image_host__+'/static/admin/default/images/default-images.png" />';
|
||||
html += '</li>';
|
||||
html += '</ul>';
|
||||
html += '<div class="plug-file-upload-submit" data-view-tag="ul.spec-images-view-'+spec_all[i]+'">+上传图片</div>';
|
||||
html += '</li>';
|
||||
$('ul.spec-images-list').append(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$('ul.spec-images-list').html('');
|
||||
}
|
||||
}
|
||||
|
||||
// 手机详情添加
|
||||
$(document).on('click', '.content-app-items-add-sub', function()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue