search_goods.html
19 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<include file="public/layout"/>
<style>
select {height: 27px;}
.bot { float: right;padding: 15px 0;width: 10%}
.vdisib {
display: inline-block; *display: inline; *zoom: 1; vertical-align: middle;
}
.flexigrid .bDiv td.dny { display: none;}
.sto_cate_show{position: absolute;bottom:60px; right: 80px; width: 250px; z-index: 100; background: #fff;
height: 390px; border:#E6E9EE solid 1px; display: none }
.sto_cate_show .header{height: 35px; line-height: 35px; background: #F8F8F8;position: relative;
padding: 0 15px; border-bottom:1px solid #efefef;}
.sto_cate_show .header .xx{ font-size: 24px; position: absolute; right: 5px;top:10px; width: 15px; height: 15px; display: inline-block; background-image:url(__PUBLIC__/images/icon.png); background-repeat:no-repeat; background-position: 0 -40px;cursor: pointer; }
.sto_cate_show .content{height: 310px; width: 100%; overflow-y:scroll; padding-top:10px }
.sto_cate_show .content p{padding:0 30px }
.sto_cate_show .content p.tit{height: 24px; line-height: 24px;padding:0 10px}
.sto_cate_show .foot{height: 35px; text-align: right; padding: 0 20px}
.btn_x{height: 25px; cursor: pointer; border: 1px solid #E6E9EE;
border-left: solid 1px #D7D7D7; line-height: 25px;
background-color: #f6f7fb;color: #434a54;
padding: 5px 15px; }
.btn_x:hover{background-color:#EC5151; color: #fff;border-color:#EC5151}
</style>
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div class="page" style="padding: 0px 1% 0 1%;">
<!-- 操作说明 -->
<div class="flexigrid">
<div class="mDiv">
<div class="ftitle vdisib">
<h5 class="vdisib">(共{$pager->totalRows}条记录)</h5>
<p style="color:red">注:1.导入的商品要求重量不能小等于0,且小数点后最多保留3位</p>
<p style="color:red">
2.导入的商品要求UPC编码必填,且要符合条码编写的校验</p>
</div>
<form class="navbar-form form-inline" id="search-form2" action="{:U('jddj/search_goods')}"
method="get">
<input type="hidden" name="distr_type" value="{$distr_type}">
<div class="sDiv">
<div class="sDiv2" style="margin-right: 10px;border:none;">
<select name="cat_id" id="cat_id">
<option value="">所有分类</option>
<foreach name="categoryList" item="v" key="k">
<option
<if condition="$cat_id eq $v['id']">selected="selected"</if>
value="{$v['id']}">{$v['name']}</option>
<foreach name="v.children" item="v1" key="k1">
<option <if condition="$cat_id eq $v1['id']">selected="selected"</if> value="{$v1['id']}"> |— {$v1['name']}</option>
<foreach name="v1.children" item="v2" key="k2">
<option <if condition="$cat_id eq $v2['id']">selected="selected"</if> value="{$v2['id']}"> |— {$v2['name']}</option>
</foreach>
</foreach>
</foreach>
</select>
</div>
<div class="sDiv2" style="margin-right: 10px;border:none;">
<select name="brand_id" id="brand_id">
<option value="">所有品牌</option>
<foreach name="brandList" item="v" key="k">
<option value="{$v['id']}"
<if condition="$v[id] eq $brand_id">selected</if>
>{$v['name']}</option>
</foreach>
</select>
</div>
<div class="sDiv2" style="margin-right: 10px;border:none;">
<select name="intro">
<option value="0">全部</option>
<option value="is_new">新品</option>
<option value="is_recommend">推荐</option>
</select>
</div>
<div class="sDiv2">
<!--<select name="status" class="select">-->
<!--<option value="">活动状态</option>-->
<!--</select>-->
<input size="30" name="keywords" value="{:urldecode(urldecode($keywords))}" class="qsbox"
placeholder="商品名称或者关键词" type="text">
<input class="btn" style="height: 27px" value="搜索" type="submit">
</div>
</div>
</form>
</div>
<div class="bDiv" style="height: auto;">
<div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
<table>
<tr>
<td align="left" width="6%">
<div style="text-align: left;" class="">选择</div>
</td>
<td width="15%" align="left">
<div style="text-align: left;">商品编号</div>
</td>
<td align="left" width="30%">
<div style="text-align: left;">商品名称</div>
</td>
<td width="15%" align="left">
<div style="text-align: left;">商品条码</div>
</td>
<td align="left" width="10%">
<div style="text-align: center;">市场价</div>
</td>
<td align="left" width="10%">
<div style="text-align: center;">手店价</div>
</td>
<td align="center" width="10%">
<div style="text-align: center;">库存</div>
</td>
</tr>
<tbody id="goods_table">
<volist name="goodsList" id="list">
<tr>
<td align="left" width="6%">
<div style="text-align: left;">
<input class="ginp" type="checkbox" name="goods_id[]" value="{$list.goods_id}"/>
</div>
</td>
<td align="left" width="15%">
<input type="hidden" name="goods_sn[]" value="{$list.goods_sn}">
<div style="text-align: left;">{$list.goods_sn}</div>
</td>
<td align="left" width="30%">
<input type="hidden" name="goods_name[]" value="{$list.goods_name}">
<div style="text-align: left;">{$list.goods_name}</div>
</td>
<td align="left" width="15%">
<input type="hidden" name="sku[]" value="{$list.sku}">
<div style="text-align: left;">{$list.sku}</div>
</td>
<td align="left" width="10%">
<input type="hidden" name="market_price[]" value="{$list.market_price}">
<div style="text-align: center;">¥{$list.market_price}</div>
</td>
<td align="left" width="10%">
<input type="hidden" name="market_price[]" value="{$list.shop_price}">
<div style="text-align: center;">¥{$list.shop_price}</div>
</td>
<td class="dny">
<div style="text-align: center;">
<input type="text" name="price[]" class="price" style="width: 100px"
autocomplete="off" value="">
</div>
</td>
<td align="left" width="10%" class="dn">
<div style="text-align: center;">{$list.store_count}</div>
</td>
<td class="dny" align="center">
<div style="text-align: center; ">
<a class="btn red" onclick="$(this).parent().parent().parent().remove();"><i
class="fa fa-trash-o"></i>删除</a>
</div>
</td>
</tr>
</volist>
</tbody>
</table>
</div>
<div class="iDiv" style="display: none;"></div>
</div>
<!--分页位置-->
<div style="width: 90%;float: left">{$page}</div>
<div class="bot" style="width: 100%; text-align: right">
<!-------选择分类-------->
选择导入到京东的分类:
<select name="jd_fir_id" id="jd_fir_id" onchange="sele_sec(this)">
<option value="">一级分类</option>
</select>
<select name="jd_sec__id" id="jd_sec_id" onchange="sele_thi(this)">
<option value="">二级分类</option>
</select>
<select name="jd_sec__id" id="jd_thi_id">
<option value="">三级分类</option>
</select>
选择导入到店内的分类:<span id="sto_cate"></span>
<a class="btn_x" style="height: 27px" onclick="show_sele_cate()">选择店内分类</a>
选择导入的品牌:<span id="s_brand"></span>
<a class="btn_x" style="height: 27px" onclick="selectbrand()">选择品牌</a>
<a onclick="select_goods();" class="ncap-btn-big ncap-btn-green">确认提交</a>
</div>
</div>
<!---选择店内分类的弹出框--->
<div class="sto_cate_show" id="sto_cate_show">
<p class="header">选择店内分类
<span class="xx" onclick="sto_cate_close()"></span>
</p>
<div class="content">
<p class="tit">内分类</p>
<p><label><input cid="" type="checkbox">7878</label></p>
<p><label><input cid="" type="checkbox">7878</label></p>
</div>
<p class="foot">
<input onclick="confirm_sto_cate()" class="btn" value="确定" type="button">
</p>
</div>
</div>
<script>
var sec_arr=new Array();
var sto_cate_list="";
var sbrand="";
//--------------选择导入商品----------------
function select_goods() {
if ($("input[type='checkbox']:checked").length == 0) {
layer.alert('请选择商品', {icon: 2}); //alert('请选择商品');
return false;
}
var fir_id=$("#jd_fir_id").val();
var sec_id=$("#jd_sec_id").val();
var thi_id=$("#jd_thi_id").val();
if(fir_id=="" || sec_id=="" || thi_id==""){
layer.alert('请选择商品要导入京东的分类,三级都要选', {icon: 2}); //alert('请选择商品');
return false;
}
if(sto_cate_list==""){
layer.alert('请选择商品要导入店内的分类', {icon: 2}); //alert('请选择店内的分类');
return false;
}
if(sbrand==""){
layer.alert('请选择商品要导入的品牌', {icon: 2}); //alert('请选择导入的品牌');
return false;
}
var goodsid="";
//将没选中的复选框所在的 tr remove 然后删除复选框
$(".ginp").each(function () {
if ($(this).is(':checked')) {
goodsid+=$(this).val()+","
}
});
goodsid = goodsid.substring(0, goodsid.length - 1);
var ii=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '200px', time:0}) ;
//开始新增商品
$.ajax({
type: "POST",
url: "/index.php/admin/jddj/insert_goods/gid/"
+goodsid+"/cat_id/"+thi_id+"/sto_cate_id/"+sto_cate_list+"/sbrand/"+sbrand, //
data:{fir_cat_id:fir_id,sec_cat_id:sec_id},
success: function(data) {
layer.close(ii);
sto_cate_list="";
$("#sto_cate").text("");
sbrand="";
$("#s_brand").text("");
if(data.code==0){
location.href=location.href;
layer.msg('导入成功', {icon: 2,time:2000});
}else{
layer.msg(data.msg, {icon: 2,time:4000});
}
}
});
}
//----------页面开始--------
$(document).ready(function () {
// 点击刷新数据
$('.fa-refresh').click(function () {
location.href = location.href;
});
//-----------获取第一级分类----------------
var ii=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '200px', time:0}) ;
//开始读取京东分类
$.ajax({
type: "POST",
url: "/index.php/admin/jddj/jd_categoty/pid/0", //
success: function(data) {
layer.close(ii);
var htm="";
var list=data.data;
for(var i=0;i<list.length;i++){
htm+="<option value='"+list[i].id+"' >"+list[i].categoryName+"</option>";
}
$("#jd_fir_id").append(htm);
}
});
//----------获取第一级分类------------
var ii=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '200px', time:0}) ;
//开始读取店内分类
$.ajax({
type: "POST",
url: "/index.php/admin/jddj/sto_categoty/pid/0", //
success: function(data) {
layer.close(ii);
var htm="";
var list=data.data;
for(var i=0;i<list.length;i++){
if(list[i]['pid']==0){
var item={pid:list[i]['id'],cname:list[i].shopCategoryName,ary:new Array()};
sec_arr.push(item);
}else{
sec_arr.forEach(function (item,ind) {
if(item.pid==list[i]['pid']) {
sec_arr[ind].ary.push(list[i]);
}
})
}
}
//导入html
sec_arr.forEach(function (item,ind) {
if(item.ary.length>0){
htm+="<p class='tit'>"+item.cname+"</p>";
item.ary.forEach(function (em,id) {
htm+="<p><label><input cid='"+em.id+"' cname='"+em.shopCategoryName+"'" +
" type='checkbox'>"+em.shopCategoryName+"</label></p>";
})
}else{
htm+="<p class='tit'><label><input cid='"+item.pid+"' cname='"+item.cname+"'" +
" type='checkbox'>"+item.cname+"</label></p>";
}
})
$(".sto_cate_show .content").html(htm);
}
});
});
//----------2级选择------------
function sele_sec(ob) {
var id=$(ob).val();
//获取第一级分类
var ii=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '200px', time:0}) ;
//开始新增商品
$.ajax({
type: "POST",
url: "/index.php/admin/jddj/jd_categoty/pid/"+id, //
success: function(data) {
layer.close(ii);
var htm="";
var list=data.data;
htm+="<option value='' >二级类目</option>";
for(var i=0;i<list.length;i++){
htm+="<option value='"+list[i].id+"' >"+list[i].categoryName+"</option>";
}
$("#jd_sec_id").html(htm);
}
});
}
//----------2级选择------------
function sele_thi(ob) {
var id=$(ob).val();
//获取第一级分类
var ii=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '200px', time:0}) ;
//开始新增商品
$.ajax({
type: "POST",
url: "/index.php/admin/jddj/jd_categoty/pid/"+id, //
success: function(data) {
layer.close(ii);
var htm="";
var list=data.data;
for(var i=0;i<list.length;i++){
if(i==0){
htm+="<option value='"+list[i].id+"' selected >"+list[i].categoryName+"</option>";
}else{
htm+="<option value='"+list[i].id+"' >"+list[i].categoryName+"</option>";
}
}
$("#jd_thi_id").html(htm);
}
});
}
//--------选择店内分类的---------
function show_sele_cate() {$("#sto_cate_show").show();}
function sto_cate_close() {$("#sto_cate_show").hide();}
function confirm_sto_cate() {
var str=""; var num=0;
$(".sto_cate_show .content").find('input').each(function () {
if($(this).is(':checked')) {
sto_cate_list+=$(this).attr('cid')+",";
str+=$(this).attr('cname')+",";
num++;
}
});
if(num>10){
layer.alert('不能超过10个分类', {icon: 2});
return false;
}
if(str!=""){
sto_cate_list = sto_cate_list.substring(0, sto_cate_list.length - 1);
str = str.substring(0, str.length - 1);
$("#sto_cate").text(str);
}
$("#sto_cate_show").hide();
}
var b_lid=0;
function selectbrand() {
var url = "{:U('Jddj/search_brand')}";
b_lid=layer.open({
type: 2,
title: '选择品牌',
shadeClose: true,
shade: 0.2,
area: ['60%', '90%'],
content: url,
});
}
//------品牌的回调---------
function s_callback(bid,bname) {
sbrand=bid;
$("#s_brand").text(bname);
layer.close(b_lid);
}
</script>
</body>
</html>