7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
636 lines
23 KiB
HTML
636 lines
23 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="renderer" content="webkit">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<title>新增款号-e订通后台</title>
|
|
<link rel="stylesheet" href="layuiadmin/layui/css/layui.css">
|
|
<link rel="stylesheet" href="index.css">
|
|
<style>
|
|
table.mytable {
|
|
font-family: verdana,arial,sans-serif;
|
|
font-size:11px;
|
|
color:#333333;
|
|
border-width: 1px;
|
|
border-color: #e2e2e2;
|
|
border-collapse: collapse;
|
|
}
|
|
table.mytable th {
|
|
border-width: 1px;
|
|
padding: 8px;
|
|
border-style: solid;
|
|
border-color: #e2e2e2;
|
|
background-color: #f2f2f2;
|
|
}
|
|
table.mytable td {
|
|
border-width: 1px;
|
|
padding: 8px;
|
|
border-style: solid;
|
|
border-color: #e2e2e2;
|
|
background-color: #ffffff;
|
|
}
|
|
</style>
|
|
<script src="layuiadmin/layui/layui.js"></script>
|
|
<script src="js/function.js"></script>
|
|
</head>
|
|
<body>
|
|
<form class="layui-form">
|
|
<input type="hidden" id="id" name="id" value=0>
|
|
<input type="hidden" id="gg_num" name="gg_num" value=0>
|
|
<input type="hidden" id="size_group_title" name="size_group_title" value="">
|
|
<input type="hidden" id="size_group_id" name="size_group_id" value=0>
|
|
<div style="padding:10px;">
|
|
<span id="div_pic">
|
|
</span>
|
|
<div class="layui-row">
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" id="lang_xh">圆牌号</label>
|
|
<div class="layui-input-inline"><input type="text" class="layui-input" id="xh" name="xh" placeholder="请输入圆牌号" value=""></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">是否删除款</label>
|
|
<div class="layui-form-mid layui-word-aux" id="ka"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-row">
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">款号</label>
|
|
<div class="layui-input-inline"><input type="text" class="layui-input" id="no" name="no" lay-verify="no" placeholder="请输入款号" value=""></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">款式名</label>
|
|
<div class="layui-input-block"><input type="text" class="layui-input" id="title" name="title" value=""></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span id="div_keyword_select"></span>
|
|
|
|
<div class="layui-row">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">颜色</label>
|
|
<div class="layui-input-block"><input type="text" class="layui-input" id="color" name="color" readonly> <Br><a class="layui-btn layui-btn-sm layui-btn-normal btn_color_pick">选取</a><a class="layui-btn layui-btn-sm layui-btn-danger btn_color_clear">清空</a></div>
|
|
</div>
|
|
</div>
|
|
<span id="div_color_zd"></span>
|
|
<span id="div_gg"></span>
|
|
<div class="layui-row">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">尺码</label>
|
|
<div class="layui-input-block" style="border:0;padding:0px;">
|
|
<div class="layui-tab layui-tab-card" lay-filter="tab_size">
|
|
<ul class="layui-tab-title" id="div_size_group">
|
|
loading...
|
|
</ul>
|
|
<div class="layui-tab-content" id="div_size">
|
|
loading...
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-row">
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">配码等级</label>
|
|
<div class="layui-input-inline"><input type="text" class="layui-input" id="pm_dj" name="pm_dj" ></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">单位</label>
|
|
<div class="layui-input-inline"><input type="text" class="layui-input" id="unit_title" name="unit_title" ></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-row">
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">价格</label>
|
|
<div class="layui-input-inline" id="div_price"></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">参与排行</label>
|
|
<div class="layui-input-inline"><input type="checkbox" id="in_ph" name="in_ph" lay-skin="switch" lay-text="是|否" checked></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-row">
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">添加时间</label>
|
|
<div class="layui-input-inline"><input type="text" class="layui-input" name="add_date" id="lay_date"></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">饰品款</label>
|
|
<div class="layui-input-inline"><input type="checkbox" id="is_sp" name="is_sp" lay-skin="switch" lay-text="是|否"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span id="div_keyword_zdy"></span>
|
|
<div class="layui-row">
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">备注</label>
|
|
<div class="layui-input-inline"><textarea name="remark" id="remark" style="border:1px solid #e6e6e6;width:300px;" rows=3></textarea></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">搭配款</label>
|
|
<div class="layui-input-block"><input type="text" class="layui-input" id="dpk" name="dpk" value=""></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label"> </label>
|
|
<div class="layui-input-inline" style="width:200px"><button id="form1_submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="form1_submit" style="font-weight:bold;width:200px;"> 保 存 </button></div>
|
|
<div class="layui-input-inline" style="width:100px"><button id="form1_reset" class="layui-btn" type="button" style="font-weight:bold;width:100px;"> 重 置 </button></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<script>
|
|
//全局变量
|
|
var gg_zd=[];
|
|
var color=color_title="";
|
|
//设置颜色选取框的值
|
|
function set_color_value(v){
|
|
document.getElementById("color").value=v;
|
|
}
|
|
//设置主图
|
|
function set_main_pic(color){
|
|
layui.use(['form','layer','element'],function(){
|
|
var form = layui.form,
|
|
$ = layui.jquery;
|
|
var element = layui.element;
|
|
var layer = layui.layer;
|
|
var id=$("#id").val();
|
|
var url="./?_m=kh&_a=set_main_pic&id="+id+"&c="+color;
|
|
//alert(JSON.stringify(post_data));
|
|
$.ajax({
|
|
url:url,
|
|
contentType: "application/json",
|
|
method: 'GET',
|
|
success: function (res) {
|
|
var json_data=$.parseJSON(res);
|
|
if(json_data.code==1){
|
|
//保存成功
|
|
layer.msg("保存成功!");
|
|
//隐藏按钮
|
|
var obj=$("#div_pic").find(".btn_main_pic");
|
|
for(var i=0;i<obj.length;i++){
|
|
if(obj[i].value==color)
|
|
obj[i].style.display="none";
|
|
else
|
|
obj[i].style.display="block";
|
|
}
|
|
}else{
|
|
//保存失败
|
|
layer.msg("保存失败!");
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
//添加图片
|
|
function add_pic(color){
|
|
layui.use(['form','layer','element'],function(){
|
|
var form = layui.form,
|
|
$ = layui.jquery;
|
|
var element = layui.element;
|
|
var layer = layui.layer;
|
|
var id=$("#id").val();
|
|
var index = layui.layer.open({
|
|
title : "修改图片",
|
|
area: ['400px', '500px'],
|
|
type : 2,
|
|
content : "kh_add_pic.htm?id="+id+"&color="+color,
|
|
success : function(layero, index){
|
|
//
|
|
}
|
|
})
|
|
})
|
|
}
|
|
//删除图片
|
|
function del_pic(color){
|
|
layui.use(['form','layer','element'],function(){
|
|
var form = layui.form,
|
|
$ = layui.jquery;
|
|
var element = layui.element;
|
|
var layer = layui.layer;
|
|
var id=$("#id").val();
|
|
var url="./?_m=kh&_a=save_add_pic&del_pic=y&id="+id+"&c="+color;
|
|
layer.confirm('确定删除吗?',{icon:3, title:'提示信息'},function(index){
|
|
$.get(url,{},function(data){
|
|
window.location.reload();
|
|
})
|
|
});
|
|
})
|
|
}
|
|
//添加规格
|
|
function add_gg(){
|
|
layui.use(['form','layer','element'],function(){
|
|
var form = layui.form,
|
|
$ = layui.jquery;
|
|
var element = layui.element;
|
|
var layer = layui.layer;
|
|
var num=parseInt($("#gg_num").val());
|
|
var tr_gg='<tr id="'+num+'">';
|
|
//颜色
|
|
tr_gg+='<td><select name="gg_color_'+num+'"><option value="">--</option>';
|
|
var arr_color=color.split(",");
|
|
var arr_color_title=color_title.split(",");
|
|
for(var i=0;i<arr_color.length;i++){
|
|
tr_gg+='<option value="'+arr_color[i]+'">'+arr_color_title[i]+'</option>';
|
|
}
|
|
tr_gg+='</select></td>';
|
|
//字段
|
|
tr_gg+='<td><input type="text" class="layui-input" name="gg_title_'+num+'" value="" style="width:100px;"></td>';
|
|
for(var i=0;i<gg_zd.length;i++){
|
|
tr_gg+='<td><input type="text" class="layui-input" name="gg_'+gg_zd[i].zd+'_'+num+'" value="" style="width:100px;"></td>';
|
|
}
|
|
//删除按钮
|
|
tr_gg+='<td><a href="javascript:del_gg('+num+')" class="layui-icon">ဆ</a></td>';
|
|
tr_gg+='</tr>';
|
|
$("#gg_num").val(num+1);
|
|
$("#table_gg tbody:last").append(tr_gg);
|
|
form.render();
|
|
})
|
|
}
|
|
//删除规格行
|
|
function del_gg(num){
|
|
layui.use(['form','layer','element'],function(){
|
|
var form = layui.form,
|
|
$ = layui.jquery;
|
|
$("tr[id='"+num+"']").remove();
|
|
})
|
|
}
|
|
layui.use(['form','layer','laydate','element'],function(){
|
|
var form = layui.form,
|
|
laydate = layui.laydate,
|
|
$ = layui.jquery;
|
|
var element = layui.element;
|
|
var layer = layui.layer;
|
|
//var layer = parent.layer;
|
|
//alert(parent.layer);
|
|
//
|
|
var id=get_url_param("id");
|
|
$("#id").val(id);
|
|
var url="./?_m=kh&_a=add&id="+id;
|
|
//
|
|
$.ajax(
|
|
{
|
|
url:url,
|
|
contentType: "application/json",
|
|
method: 'POST',
|
|
success: function (res) {
|
|
var id=$("#id").val();
|
|
var json_data=$.parseJSON(res);
|
|
//全局变量赋值
|
|
color=json_data.color;
|
|
color_title=json_data.color_title;
|
|
gg_zd=json_data.gg_zd;
|
|
gg_num=json_data.gg_zd_value.length;
|
|
$("#gg_num").val(gg_num);
|
|
//alert(JSON.stringify(json_data));
|
|
//----------------初始化
|
|
//图片
|
|
var html1='<div class="layui-row" style="padding:10px;">';
|
|
if(json_data.pic){
|
|
for(var i=0;i<json_data.pic.length;i++){
|
|
html1+='<div class="layui-col-md2" align="center"><table border="0" cellpadding="0" cellspacing="0"><tr><td align="center" bgcolor="#FFFFFF" height="100"><button type="button" class="layui-btn layui-btn-primary" value="'+json_data.pic[i].color+'" style="width:160px;height:160px;padding:4px;" onclick="add_pic(this.value);"><img src="'+json_data.pic[i].pic+'" width="'+json_data.pic[i].w+'" height="'+json_data.pic[i].h+'" border="0"></a></td></tr><tr><td align="center" style="padding:4px;">'+json_data.pic[i].color+'-'+json_data.pic[i].color_title;
|
|
//设置主图按钮
|
|
var d1=(json_data.main_pic!=json_data.pic[i].color)?"block":"none";
|
|
html1+=' <div class="layui-btn-group"><button type="button" onclick="set_main_pic(this.value);" class="layui-btn layui-btn-xs btn_main_pic" value="'+json_data.pic[i].color+'" style="display:'+d1+'">主</button></div>';
|
|
//删图按钮
|
|
if(json_data.pic[i].pic!="images/no_pic_80.gif")
|
|
html1+=' <div class="layui-btn-group"><button type="button" onclick="del_pic(this.value);" class="layui-btn layui-btn-xs" value="'+json_data.pic[i].color+'">删</button></div>';
|
|
html1+='</td></tr></table></div>';
|
|
}
|
|
}
|
|
html1+="</div>";
|
|
$("#div_pic").append(html1);
|
|
//语言xh
|
|
$("#lang_xh").html(json_data.lang_xh);
|
|
$("#xh").prop('placeholder','请输入'+json_data.lang_xh);
|
|
//圆牌号
|
|
$("#xh").val(json_data.xh);
|
|
//是否删除款
|
|
html1=(json_data.ka=="y")?"是":"否";
|
|
$("#ka").html(html1);
|
|
//款号
|
|
$("#no").val(json_data.no);
|
|
$("#dpk").val(json_data.dpk);
|
|
//款式名
|
|
$("#title").val(json_data.title);
|
|
//选项
|
|
var html1="";
|
|
for(var i=0;i<json_data.select_dz.length;i++){
|
|
if(i%2==0)
|
|
html1+='<div class="layui-row">';
|
|
html1+='<div class="layui-col-xs6 layui-col-sm6 layui-col-md6"><div class="layui-form-item"><label class="layui-form-label">'+json_data.select_dz[i].title+'</label><div class="layui-input-inline"><select id="'+json_data.select_dz[i].no+'" name="'+json_data.select_dz[i].no+'" lay-search><option value="">--</option>';
|
|
var op=json_data.select_dz[i].op;
|
|
for(var j=0;j<op.length;j++){
|
|
html1+='<option value="'+op[j].no+'"';
|
|
if(op[j].no==json_data.select_dz[i].value)
|
|
html1+='selected';
|
|
html1+='>'+op[j].title+'</option>';
|
|
}
|
|
html1+='</select></div></div></div>';
|
|
if((i+1)%2==0)
|
|
html1+='</div>';
|
|
}
|
|
//alert(html1);
|
|
$("#div_keyword_select").html(html1);
|
|
var html1="";
|
|
for(var i=0;i<json_data.select_zdy.length;i++){
|
|
html1+='<div class="layui-row"><div class="layui-form-item"><label class="layui-form-label">'+json_data.select_zdy[i].title+'</label><div class="layui-input-inline"><input id="'+json_data.select_zdy[i].no+'" name="'+json_data.select_zdy[i].no+'" type="text" class="layui-input"" value="'+json_data.select_zdy[i].value+'" /></div></div>';
|
|
}
|
|
$("#div_keyword_zdy").html(html1);
|
|
|
|
|
|
|
|
//颜色
|
|
var str_color="";
|
|
var arr_color=[];
|
|
var arr_color_title=[];
|
|
if(json_data.color){
|
|
arr_color=json_data.color.split(',');
|
|
arr_color_title=json_data.color_title.split(',');
|
|
for(var i=0;i<arr_color.length;i++){
|
|
str_color+=arr_color[i]+"-"+arr_color_title[i]+",";
|
|
}
|
|
str_color=str_color.substring(0,str_color.length-1);
|
|
}
|
|
$("#color").val(str_color);
|
|
//-------------------------------尺码
|
|
//尺码组
|
|
$("#size_group_title").val(json_data.size_group_title);
|
|
$("#size_group_id").val(json_data.size_group_id);
|
|
//尺码
|
|
var html_size_group=html_size="";
|
|
for(var i=0;i<json_data.size_all.length;i++){
|
|
html_size_group+='<li';
|
|
if(json_data.size_all[i].id==json_data.size_group_id){
|
|
html_size_group+=' class="layui-this"';
|
|
}
|
|
html_size_group+=' lay-id="'+json_data.size_all[i].id+'">'+json_data.size_all[i].title+'</li>';
|
|
var arr_size_bx=json_data.size_all[i].size_bx;
|
|
html_size+='<div class="layui-tab-item';
|
|
if(json_data.size_all[i].id==json_data.size_group_id){
|
|
html_size+=' layui-show';
|
|
}
|
|
html_size+='">';
|
|
for(var j=0;j<arr_size_bx.length;j++){
|
|
html_size+='<div class="layui-row" style="padding:4px;">';
|
|
//杯型
|
|
if(arr_size_bx[j].bx){
|
|
html_size+='<div class="layui-input-inline" style="width:40px;line-height:35px;" align="left">'+arr_size_bx[j].bx+': </div>';
|
|
}
|
|
if(arr_size_bx[j].price){
|
|
//价格
|
|
//取得默认价格
|
|
var tmp_price="";
|
|
for(var i1=0;i1<json_data.size.length;i1++){
|
|
if(json_data.size[i1].bx==arr_size_bx[j].bx){
|
|
tmp_price=json_data.size[i1].price;
|
|
}
|
|
}
|
|
html_size+='<div class="layui-input-inline" style="width:80px;"><input type="text" class="layui-input" id="price_'+json_data.size_all[i].id+'_'+j+'" name="price_'+json_data.size_all[i].id+'_'+j+'" placeholder="¥" value="'+tmp_price+'"></div>';
|
|
}
|
|
//取得该杯型的选中尺码
|
|
arr_checked_size=[];
|
|
for(var i1=0;i1<json_data.size.length;i1++){
|
|
if(json_data.size[i1].bx==arr_size_bx[j].bx){
|
|
arr_checked_size=json_data.size[i1].size.split(",");
|
|
}
|
|
}
|
|
//尺码
|
|
var arr_size1=arr_size_bx[j].size.split(",");
|
|
html_size+='';
|
|
for(var k=0;k<arr_size1.length;k++){
|
|
var arr_tmp=arr_size1[k].split("|");
|
|
html_size+='<input type="checkbox" name="size_'+json_data.size_all[i].id+'_'+j+'_'+arr_tmp[0]+'" lay-skin="primary" title="'+arr_tmp[1]+'"';
|
|
if(id>0){
|
|
if(json_data.size_all[i].id==$("#size_group_id").val()){
|
|
if($.inArray(arr_tmp[0],arr_checked_size)>=0)
|
|
html_size+=" checked";
|
|
}else{
|
|
html_size+=" checked";
|
|
}
|
|
}else{
|
|
html_size+=" checked";
|
|
}
|
|
html_size+=' /> ';
|
|
}
|
|
html_size+="</div>";
|
|
}
|
|
html_size+='</div>';
|
|
}
|
|
//alert(html_size_group);
|
|
//alert(html_size);
|
|
$("#div_size_group").html(html_size_group);
|
|
$("#div_size").html(html_size);
|
|
//element.render('tab_size');
|
|
|
|
$("#pm_dj").val(json_data.pm_dj);
|
|
$("#unit_title").val(json_data.unit_title);
|
|
//价格
|
|
var html_price="<div class='layui-row'>";
|
|
if(json_data.is_multi_price=="y"){
|
|
for(var i1=0;i1<json_data.arr_multi_price.length;i1++){
|
|
html_price+=""+json_data.arr_multi_price[i1].v+":<input type='text' class='layui-input' id='"+json_data.arr_multi_price[i1].k+"' name='"+json_data.arr_multi_price[i1].k+"' placeholder='¥' value='"+json_data.arr_multi_price[i1].value+"'> ";
|
|
}
|
|
}else{
|
|
html_price+="<input type='text' class='layui-input' id='price' name='price' placeholder='¥' value='"+json_data.price+"'>";
|
|
}
|
|
html_price+="</div>";
|
|
$("#div_price").html(html_price);
|
|
//添加时间
|
|
laydate.render({
|
|
elem: '#lay_date',
|
|
type: 'datetime',
|
|
value: json_data.add_date
|
|
});
|
|
//是否参与排行
|
|
if(json_data.in_ph=="n")
|
|
$("#in_ph").prop('checked',false);
|
|
//是否饰品款
|
|
if(json_data.is_sp=="y")
|
|
$("#is_sp").prop('checked',true);
|
|
//自定义输入字段
|
|
var html1="";
|
|
for(var i=0;i<json_data.select_zdy.length;i++){
|
|
if(i%2==0)
|
|
html1+='<div class="layui-row">';
|
|
html1+='<div class="layui-col-xs6 layui-col-sm6 layui-col-md6"><div class="layui-form-item"><label class="layui-form-label">'+json_data.select_zdy[i].title+'</label><div class="layui-input-block"><input type="text" class="layui-input" id="'+json_data.select_zdy[i].no+'" name="'+json_data.select_zdy[i].no+' value="'+json_data.select_zdy[i].value+'"></div></div></div>';
|
|
if((i+1)%2==0)
|
|
html1+='</div>';
|
|
}
|
|
//规格
|
|
if(json_data.is_gg!="n" && id>0){
|
|
var html1='<div class="layui-row"><div class="layui-form-item"><label class="layui-form-label">'+json_data.lang_gg+'</label>';
|
|
html1+='<div class="layui-input-block">';
|
|
html1+='<div><button class="layui-btn layui-btn-sm layui-btn-normal" type="button" onclick="add_gg()">添加</button></div>';
|
|
html1+='<div><table class="mytable" id="table_gg">';
|
|
//表头
|
|
html1+='<thead><tr><th>颜色</th><th>规格</th>';
|
|
for(var i=0;i<json_data.gg_zd.length;i++){
|
|
html1+='<th>'+json_data.gg_zd[i].title+'</th>';
|
|
}
|
|
html1+='<th>操作</th></tr></thead><tbody>';
|
|
//已经设置的值
|
|
for(var i=0;i<json_data.gg_zd_value.length;i++){
|
|
html1+='<tr id="'+i+'">';
|
|
//颜色
|
|
html1+='<td><select name="gg_color_'+i+'"><option value="">--</option>';
|
|
var arr_color=json_data.color.split(",");
|
|
var arr_color_title=json_data.color_title.split(",");
|
|
for(var j=0;j<arr_color.length;j++){
|
|
html1+='<option value="'+arr_color[j]+'"';
|
|
if(json_data.gg_zd_value[i].color==arr_color[j])
|
|
html1+=' selected';
|
|
html1+='>'+arr_color_title[j]+'</option>';
|
|
}
|
|
html1+='</select></td>';
|
|
var v1=json_data.gg_zd_value[i].zd;
|
|
//字段
|
|
for(var j=0;j<v1.length;j++){
|
|
html1+='<td><input type="text" class="layui-input" name="gg_'+v1[j].zd+'_'+i+'" value="'+v1[j].value+'" style="width:100px;"></td>';
|
|
}
|
|
html1+='<td><a href="javascript:del_gg('+i+')" class="layui-icon">ဆ</a></td>';
|
|
html1+='</tr>';
|
|
}
|
|
//内容
|
|
html1+='</tbody></table></div>';
|
|
html1+='</div></div></div>';
|
|
$("#div_gg").html(html1);
|
|
}
|
|
//到色字段
|
|
var len=json_data.color_zd.length;
|
|
if(len>0){
|
|
var html1='<div class="layui-row"><div class="layui-form-item"><label class="layui-form-label">到色属性</label><div class="layui-input-block">';
|
|
//表头
|
|
html1+='<div><div class="layui-input-inline" style="width:80px;height:30px;line-height:30px;background-color:#f2f2f2;" align="center">颜色</div>';
|
|
for(var i=0;i<json_data.color_zd.length;i++){
|
|
html1+='<div class="layui-input-inline" style="width:100px;height:30px;line-height:30px;background-color:#f2f2f2;" align="center">'+json_data.color_zd[i].title+'</div>';
|
|
}
|
|
html1+='</div>';
|
|
for(var j=0;j<arr_color_title.length;j++){
|
|
html1+='<div class="layui-row"><div class="layui-input-inline" style="width:80px;height:30px;line-height:30px;" align="center">'+arr_color_title[j]+'</div>';
|
|
for(var i=0;i<json_data.color_zd.length;i++){
|
|
//取值
|
|
var tmp_value="";
|
|
for(var i1=0;i1<json_data.color_zd_value.length;i1++){
|
|
if(json_data.color_zd_value[i1].color==arr_color[j]){
|
|
var zd_tmp=json_data.color_zd_value[i1].zd;
|
|
for(var i2=0;i2<zd_tmp.length;i2++){
|
|
if(zd_tmp[i2].zd==json_data.color_zd[i].zd)
|
|
tmp_value=zd_tmp[i2].value;
|
|
}
|
|
}
|
|
}
|
|
//
|
|
html1+='<div class="layui-input-inline" style="width:100px;"><input type="text" class="layui-input" id="color_zd_'+arr_color[j]+'_'+json_data.color_zd[i].zd+'" name="color_zd_'+arr_color[j]+'_'+json_data.color_zd[i].zd+'" value="'+tmp_value+'" style="height:25px;"></div>';
|
|
}
|
|
html1+='</div>';
|
|
}
|
|
html1+='</div></div></div>';
|
|
//alert(html1);
|
|
$("#div_color_zd").html(html1);
|
|
}
|
|
//备注
|
|
$("#remark").val(json_data.remark);
|
|
form.render();
|
|
},
|
|
error: function () {
|
|
layui.layer.msg("与服务器通信失败!");
|
|
}
|
|
}
|
|
);
|
|
//点击尺码组
|
|
element.on('tab(tab_size)', function(data){
|
|
//alert(JSON.stringify(data));
|
|
//设置尺码组的值
|
|
$("#size_group_title").val(this.innerHTML);
|
|
});
|
|
//选取颜色
|
|
$(".btn_color_pick").click(function(){
|
|
var index = layui.layer.open({
|
|
title : "选取颜色",
|
|
area: ['600px', '400px'],
|
|
type : 2,
|
|
content : "pick_color.htm?color="+encodeURIComponent($("#color").val()),
|
|
success : function(layero, index){
|
|
|
|
}
|
|
})
|
|
})
|
|
//清空颜色
|
|
$(".btn_color_clear").click(function(){
|
|
set_color_value('');
|
|
})
|
|
form.verify({
|
|
no:function(val){
|
|
if(val==''){
|
|
return "款号不能为空";
|
|
}
|
|
}
|
|
})
|
|
//重置
|
|
$("#form1_reset").click(function(){
|
|
var url="kh_add.htm";
|
|
window.location.href=url;
|
|
})
|
|
//提交
|
|
form.on("submit(form1_submit)",function(data){
|
|
//弹出loading
|
|
var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
|
|
//提交
|
|
var url="./?_m=kh&_a=save_add";
|
|
var post_data=data.field;
|
|
//alert(JSON.stringify(post_data));
|
|
$.ajax({
|
|
url:url,
|
|
contentType: "application/json",
|
|
method: 'GET',
|
|
data:post_data,
|
|
success: function (res) {
|
|
//alert(res);//调试模式
|
|
//layer.close(index);//调试模式
|
|
var json_data=$.parseJSON(res);
|
|
if(json_data.code==1){
|
|
//保存成功
|
|
//关闭loading
|
|
layer.close(index);
|
|
//
|
|
layer.msg("保存成功!");
|
|
//关闭本窗口
|
|
parent.layer.closeAll("iframe");
|
|
//刷新父页面
|
|
parent.tableIns.reload();
|
|
}else{
|
|
//保存失败
|
|
layer.close(index);
|
|
layer.msg("保存失败!("+json_data.msg+")");
|
|
}
|
|
}
|
|
})
|
|
return false;
|
|
})
|
|
})
|
|
</script>
|
|
</body>
|
|
</html> |