ajax_search_goods.html
5.18 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
<div class="hDiv">
<div class="hDivBox" >
<table cellspacing="0" cellpadding="0" >
<thead>
<tr>
<th abbr="article_title" axis="col3" class="w50" align="left">
<div style="text-align: left; " class=""><input type="checkbox" onclick="$('input[name*=\'goods_id\']').prop('checked', this.checked);"></div>
</th>
<th abbr="ac_id" axis="col4" class="w200" align="left">
<div style="text-align: center; " class="">商品编号</div>
</th>
<th abbr="article_time" axis="col6" class="w400" align="left">
<div style="text-align: center; " class="">商品名称</div>
</th>
<th abbr="ac_id" axis="col4" class="w120" align="left">
<div style="text-align: center; " class="">价格</div>
</th>
<th abbr="article_show" axis="col5" class="w120" align="center">
<div style="text-align: center;" class="">库存</div>
</th>
<!--<th axis="col1" class="w100" align="center">-->
<!--<div style="text-align: center;">操作</div>-->
<!--</th>-->
<!--<th style="width:100%" axis="col7">
<div></div>
</th>-->
</tr>
</thead>
</table>
</div>
</div>
<div class="bDiv" style="height: auto;">
<div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
<table>
<tbody id="all_goodsist">
<volist name="goodsList" id="list">
<tr id="tr{$list.goods_id}">
<td class="w50" align="left">
<div style="text-align: left; ">
<input type="checkbox" data-id="{$list.goods_id}" name="goods_id[]" value="{$list.goods_id}"/>
</div>
</td>
<td class="w200" align="left">
<div style="text-align: center; ">{$list.goods_sn}</div>
</td>
<td class="w400" align="left">
<div style="text-align: center; ">{$list.goods_name}</div>
</td>
<td class="w120" align="left">
<div style="text-align: center;">{$list.shop_price}</div>
</td>
<td class="w120" align="left">
<div style="text-align: center;">{$list.store_count}</div>
</td>
<td class="caozuo w100 dny delshow" align="center">
<div style="text-align: center;display: none">
<a class="btn red" onclick="delgoods(this,{$list.goods_id})"><i class="fa fa-trash-o"></i>删除</a>
</div>
</td>
<!--<td class="" style="width: 100%;" align="">
<div> </div>
</td>-->
</tr>
</volist>
</tbody>
</table>
</div>
<div class="iDiv" style="display: none;"></div>
</div>
<!--分页位置-->
<div class="te_le">
{$page}
</div>
<script>
var list = $('#list').val();
var table = '';
if (list != '') {
brr = list.split(',');
} else {
brr = new Array();
}
// 点击分页触发的事件
$(".pagination a").click(function () {
if ($("#all_goodsist input[type='checkbox']:checked").length > 0) {
$("#all_goodsist input[type='checkbox']").each(function () {
if ($(this).is(':checked')) {
if ($(this).attr('id') == 'check') {
return true;
}
var id = $(this).val();
if ($.inArray(id, brr) == -1) {
$(this).parent().parent().css('display', 'none');
$(this).parent().parent().parent().removeAttrs('class');
$(this).parent().parent().parent().find('.delshow div').css('display', '');
table += $(this).parent().parent().parent().prop('outerHTML');
list += id + ',';
}
}
});
$('#list').val(list);
$('#goods_table').append(table);
}
cur_page = $(this).data('p');
ajax_get_table('search-form2', cur_page);
});
$(document).ready(function () {
$('table>tbody>tr').each(function () {
var id = $(this).attr('id').replace('tr','');
// 已选的商品打勾
if ($.inArray(id, brr) != -1) {
$(this).find('input[type="checkbox"]').attr('checked', 'checked');
}
});
// 选中商品点击删除提交html中的商品
$("input[type='checkbox']:checked").click(function () {
var id = $(this).val();
list = trim(list.replace(id + ',', ''));
$('#list').val(list);
brr = list.split(',');
});
$('#good_count').empty().html("(共{$pager->totalRows}条记录)");
});
</script>