_brand.html
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div class="page">
<div class="fixed-bar">
<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
<div class="subject">
<h3>品牌详情</h3>
<h5>品牌添加与管理</h5>
</div>
</div>
</div>
<!--表单数据-->
<form method="post" id="addEditBrandForm" onSubmit="return checkName();">
<input type="hidden" id="qclurl" value="{$qclurl}" name="qclurl">
<div class="ncap-form-default">
<dl class="row">
<dt class="tit">
<label for="ac_name"><em>*</em>品牌名称</label>
</dt>
<dd class="opt">
<input type="text" placeholder="名称" onkeydown="strkeydown(event, this, 'submitBtn')" id="nname" class="input-txt" name="name" value="{$brand.name}" onblur="getbrandzm(this)">
<span class="err cr" id="err_name"></span>
<p class="notic"></p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="ac_name"><em>*</em>品牌名称首字母</label>
</dt>
<dd class="opt">
<input type="text" placeholder="品牌名称首字母" onkeydown="strkeydown(event, this, 'submitBtn')" id="zm" class="input-txt" name="zm" value="{$brand.zm}" maxlength="1">
<span class="err cr" id="err_zm"></span>
<p class="notic">根据名称自动获取,如果获取为空,请手动输入!</p>
</dd>
</dl>
<dl class="row" style="display: none">
<dt class="tit" colspan="2">
<label class="" for="s_sort">所属分类</label>
</dt>
<dd class="opt">
<div id="gcategory">
<select name="parent_cat_id" id="parent_id_1" onkeydown="strkeydown(event, this, 'submitBtn')" onchange="get_category(this.value,'parent_id_2','0');" class="form-control">
<option value="0">请选择分类</option>
<foreach name="cat_list" item="v" >
<option value="{$v[id]}" <if condition="$v[id] eq $brand[parent_cat_id]"> selected="selected" </if>>{$v[name]}</option>
</foreach>
</select>
<select name="cat_id" id="parent_id_2" onkeydown="strkeydown(event, this, 'submitBtn')" class="form-control" style="width:250px;">
<option value="0">请选择分类</option>
</select>
</div>
</dd>
</dl>
<!--<dl class="row">
<dt class="tit">品牌logo:</dt>
<dd class="opt">
<div class="ncsc-goods-default-pic">
<div class="goodspic-uplaod">
<div style="">
<img id="original_img2" src="{:getImg($brand.logo,'__PUBLIC__/images/default_goods_image_120.gif')}" style="width:120px;border:#eee solid 1px" onmouseover="layer.tips('<img src={:getImg($brand.logo,'__PUBLIC__/images/default_goods_image_720.gif')}>',this, {tips: [1, '#fff']});" onmouseout="layer.closeAll();">
</div>
<input type="hidden" id="logo" name="logo"
onkeydown="strkeydown(event, this, 'submitbtn')"
value="{$brand.logo}" class="type-file-text">
<p class="hint">请上传图片格式文件,<Font color="red">大小建议为:120*85像素。</Font> </p>
<div class="handle">
<div class="ncsc-upload-btn">
<a onClick="GetUploadify_new(1,'logo','brand','{$erpid}','brand','id','logo','{$curid}','call_back')" >
<p><i class="icon-upload-alt"></i>图片上传</p>
</a>
</div>
</div>
</div>
</div>
</dd>
</dl>-->
<dl class="row imgbox">
<dt class="tit">
<label for="point_rate">图片类型</label>
</dt>
<dd class="opt">
<input id="radio0" type="radio" name="imgtype" value="0" onkeydown="strkeydown(event, this, 'sumbitbtn')" <if condition="$brand[imgtype] eq 0"> checked </if>><label for="radio0">本地上传</label>
<input id="radio1" type="radio" name="imgtype" value="1" onkeydown="strkeydown(event, this, 'sumbitbtn')" <if condition="$brand[imgtype] eq 1"> checked </if>><label for="radio1">网上地址</label>
</dd>
</dl>
<dl class="row" id="imgbg">
<dt class="tit">品牌logo:</dt>
<dd class="opt">
<div class="ncsc-goods-default-pic">
<div class="goodspic-uplaod">
<div style="">
<img id="original_img2" src="{:getImg($brand.logo,'__PUBLIC__/images/default_goods_image_120.gif')}" style="width:120px;border:#eee solid 1px" onmouseover="layer.tips('<img src={:getImg($brand.logo,'__PUBLIC__/images/default_goods_image_720.gif')}>',this, {tips: [1, '#fff']});"
onmouseout="layer.closeAll();">
</div>
<input type="hidden" id="logo" name="logo" onkeydown="strkeydown(event, this, 'submitbtn')" value="{$brand.logo}" class="type-file-text">
<p class="hint">请上传图片格式文件,
<Font color="red">大小建议为:200*85像素。</Font>
</p>
<div class="handle">
<div class="ncsc-upload-btn">
<a onClick="GetUploadify_new(1,'logo','brand','{$erpid}','brand','id','logo','{$curid}','call_back')">
<p><i class="icon-upload-alt"></i>图片上传</p>
</a>
</div>
</div>
</div>
</div>
</dd>
</dl>
<dl class="row dn" id="imghtt">
<dt class="tit">
<label for="t_mane">品牌logo地址:</label>
</dt>
<dd class="opt">
<input type="text" placeholder="网上地址" class="input-txt" name="httimg" maxlength="500" onkeydown="strkeydown(event, this, 'submitbtn')" id="httimg" value="{$brand.logo}" onblur="autoname()">
<span class="err cr" id="error_httimg"></span>
<p class="notic">网上图片,直接复制进行使用<a class="a_httimg dn" href="{$brand.logo}" target="_blank" class="cr">点击预览</a></p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="t_mane"><em>*</em>显示</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="goods_category1" class="cb-enable <if condition=" $brand[is_hot] eq 1 ">selected</if>">是</label>
<label for="goods_category0" class="cb-disable <if condition=" $brand[is_hot] eq 0 ">selected</if>">否</label>
<input id="goods_category1" name="is_hot" value="1" onkeydown="strkeydown(event, this, 'submitbtn')" type="radio" <if condition="$brand[is_hot] eq 1"> checked="checked"</if>>
<input id="goods_category0" name="is_hot" value="0" onkeydown="strkeydown(event, this, 'submitbtn')" type="radio" <if condition="$brand[is_hot] eq 0"> checked="checked"</if>>
</div>
<p class="notic">是否前台显示</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="ac_sort">排序</label>
</dt>
<dd class="opt">
<input type="text" placeholder="排序" maxlength="9" onkeydown="strkeydown(event, this, 'submitBtn')" onkeyup="this.value=this.value.replace(/\D/g,'')" name="sort" value="{$brand.sort}" class="input-txt">
<span class="err cr"></span>
<p class="notic"></p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="ac_sort">品牌描述</label>
</dt>
<dd class="opt">
<textarea rows="4" maxlength="160" cols="60" name="desc" class="input-txt">{$brand.desc}</textarea>
<span class="err cr" id="err_desc"></span>
<p class="notic">最大160个字</p>
</dd>
</dl>
<div class="bot"><a href="JavaScript:void(0);" onClick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
</div>
<input type="hidden" name="id" value="{$brand.id}">
<input type="hidden" name="p" value="{$_GET[p]}">
</form>
</div>
<script>
function checkForm() {
layer.msg('加载中...', {
icon: 16,
shade: [0.5, '#f5f5f5'],
scrollbar: false,
offset: '10px',
time: 100000
});
get_event_log('1','新增品牌');
$('#addEditBrandForm').submit();
}
// 判断输入框是否为空
function checkName() {
var name = $("#nname").val();
if ($.trim(name) == '') {
set_err_msg("请输入品牌名称", "nname")
return false;
}
var zm = $("#zm").val();
if ($.trim(zm) == '') {
set_err_msg("请输入品牌名称首页字母", "zm")
return false;
}
//图片路径
var txt = "__PUBLIC__/images/default_goods_image_120.gif";
if ($("#radio0").attr('checked')) {
txt = $("#logo").val();
}
if ($("#radio1").attr('checked')) {
txt = $("#httimg").val();
}
// if (txt == "") {
// layer.msg("请上传图片或输入图片地址", {
// icon: 2,
// time: 1000
// });
// if ($("#radio0").attr('checked')) {
// $("#logo").parent().find("span").text("请上传图片");
// return false;
// } else {
// $("#httimg").focus();
// $("#httimg").parent().find("span").text("请输入图片地址");
// return false;
// }
// }
return true;
}
//获取首字母
function getbrandzm() {
$.ajax({
type: 'GET',
url: "{:U('Admin/Goods/getbrandzm')}",
data: {
brandname: $("#nname").val()
},
success: function(data) {
$("#zm").val(data);
}
});
}
// 上传商品图片成功回调函数
function call_back(fileurl_tmp) {
var getqclurl = $("#qclurl").val();
$("#logo").val(fileurl_tmp);
$("#original_img2").attr('onmouseover', "layer.tips('<img src=" + getqclurl + fileurl_tmp + ">',this,{tips: [1, '#fff']});");
$("#original_img2").attr('src', getqclurl + fileurl_tmp);
}
function set_err_msg(text, elem) {
layer.msg(text, {
icon: 2,
time: 1000
});
$("#" + elem).focus();
$("#" + elem).parent().find("span").text(text);
}
//图片类型
function img_sh() {
if ($("#radio0").attr('checked')) {
$("#imghtt").hide();
$("#imgbg").show();
} else {
$("#imghtt").show();
$("#imgbg").hide();
}
//单选框
$("#radio0").click(function() {
if ($("#radio0").attr('checked')) {
$("#imghtt").hide();
$("#imgbg").show();
}
});
$("#radio1").click(function() {
if ($("#radio1").attr('checked')) {
$("#imghtt").show();
$("#imgbg").hide();
}
});
}
window.onload = function() {
var brand_cat_id = parseInt('{$brand.cat_id}');
if (brand_cat_id > 0) {
get_category($("#parent_id_1").val(), 'parent_id_2', brand_cat_id);
}
img_sh();
$("#httimg").blur(function() {
//预览图片
if ($("#httimg").val() != "") {
$(".a_httimg").removeClass("dn");
$(".a_httimg").attr('href', $("#httimg").val())
}
});
}
</script>
</body>
</html>