147 行
5.0 KiB
HTML
可执行文件
147 行
5.0 KiB
HTML
可执行文件
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport"
|
||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||
<title>商品规格属性添加</title>
|
||
|
||
<!--引入layui样式-->
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
||
|
||
<style>
|
||
.pxll_allBox {
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.pxll_form_box {
|
||
display: flex;
|
||
flex-direction: inherit;
|
||
height: 45px;
|
||
align-items: baseline;
|
||
line-height: 45px;
|
||
}
|
||
|
||
.pxll_form_label {
|
||
width: 150px;
|
||
text-align: right;
|
||
}
|
||
.pxll_input{
|
||
height: 30px;
|
||
border: 1px solid silver;
|
||
border-radius: 5px;
|
||
width: 450px;
|
||
padding-left: 10px
|
||
}
|
||
.pxll_input_text{
|
||
width: 450px;
|
||
height: 200px;
|
||
border: 1px solid silver;
|
||
border-radius: 5px;
|
||
padding-left: 10px;
|
||
resize: none;
|
||
}
|
||
|
||
input:focus , textarea:focus{
|
||
border: 1px solid #5cadff;
|
||
}
|
||
|
||
|
||
</style>
|
||
|
||
|
||
</head>
|
||
<body style="padding: 0 20px 0 20px;">
|
||
<div class="pxll_allBox">
|
||
<div>
|
||
<form style="margin-top: 20px;" id="formSet">
|
||
<input type="hidden" name="id" value="{$info['id']}" id="id">
|
||
<div class="pxll_form_box">
|
||
<div class="pxll_form_label">
|
||
名称:
|
||
</div>
|
||
<input type="text" name="name" class="pxll_input" placeholder="请输入名称" id="name" value="{$info['name']}" onkeyup="this.value=this.value.replace(/\s+/g,'')">
|
||
</div>
|
||
<div class="pxll_form_box" style="height: 250px">
|
||
<div class="pxll_form_label">
|
||
批量添加属性值:
|
||
</div>
|
||
<textarea type="text" class="pxll_input_text" name="content" id="content" placeholder="批量添加属性值,请使用英文逗号分割。例如:'白色,黑色,蓝色,红色',原则上SKU属性值全局唯一不可以删除与编辑!(请避免出现重复值)" onkeyup="this.value=this.value.replace(/\s+/g,'')" onblur="javascript:this.value=this.value.replace(/,/ig,',');"></textarea>
|
||
</div>
|
||
|
||
<if condition="$info['id']">
|
||
<div class="pxll_form_box" style="height: 250px;">
|
||
<div class="pxll_form_label">
|
||
原属性值(不可操作):
|
||
</div>
|
||
<textarea type="text" class="pxll_input_text" readonly name="oldcontent" placeholder="批量添加属性值,请使用英文逗号分割。例如:'白色,黑色,蓝色,红色',原则上SKU属性值全局唯一不可以删除与编辑!" onkeyup="this.value=this.value.replace(/\s+/g,'')" onblur="javascript:this.value=this.value.replace(/,/ig,',');">{$info.content}</textarea>
|
||
</div>
|
||
</if>
|
||
|
||
<div style="text-align: center">
|
||
<button type="button" class="layui-btn" id="submission">提交</button>
|
||
<button type="button" class="layui-btn layui-btn-danger" id="cancel">取消</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
|
||
</body>
|
||
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
||
|
||
<script>
|
||
layui.use('layer', function () {
|
||
var layer = layui.layer;
|
||
|
||
$("#submission").click(function () {
|
||
var name, //规格属性名称
|
||
content; //属性值
|
||
|
||
var id = $("#id").val();
|
||
name = $("#name").val();
|
||
content = $("#content").val();
|
||
|
||
if (!name){
|
||
layer.tips("请输入规格属性名称","#name");
|
||
return
|
||
}
|
||
|
||
var newContent = content.replace(/,/g, "");
|
||
|
||
if (!id){
|
||
if (!newContent){
|
||
layer.tips("请输入有效属性值","#content");
|
||
return
|
||
}
|
||
}
|
||
$.ajax({
|
||
url:"{:U('Attributes/attributeSet')}",
|
||
type:"POST",
|
||
data:$("#formSet").serialize(),
|
||
success:function (res) {
|
||
if(res.status==1){
|
||
top.layer.msg(res.msg,{time:2000});
|
||
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
||
parent.layer.close(index); //再执行关闭
|
||
}else{
|
||
top.layer.msg(res.msg,{time:2000});
|
||
}
|
||
}
|
||
})
|
||
});
|
||
|
||
//取消按钮
|
||
$("#cancel").click(function () {
|
||
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
||
parent.layer.close(index); //再执行关闭
|
||
})
|
||
|
||
});
|
||
</script>
|
||
|
||
</html> |