|
|
1
|
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
|
2
|
+ "http://www.w3.org/TR/html4/loose.dtd">
|
|
|
3
|
+<html>
|
|
|
4
|
+<head>
|
|
|
5
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
|
6
|
+ <title></title>
|
|
|
7
|
+ <!--<style type="text/css">-->
|
|
|
8
|
+ <!--*{margin:0;padding:0;color: #838383;}-->
|
|
|
9
|
+ <!--table{font-size: 12px;margin: 10px;line-height: 30px; width: 80%; margin: 50px auto;}-->
|
|
|
10
|
+ <!--.txt{width:300px;height:21px;line-height:21px;border:1px solid #d7d7d7;}-->
|
|
|
11
|
+ <!--</style>-->
|
|
|
12
|
+ <script src="/pfcms/js/include_grass.js"></script>
|
|
|
13
|
+
|
|
|
14
|
+</head>
|
|
|
15
|
+<body>
|
|
|
16
|
+
|
|
|
17
|
+
|
|
|
18
|
+<div id="tt" class="easyui-layout" fit="true" >
|
|
|
19
|
+ <form name="publishArticleForm" id="publishArticleForm" method="post" >
|
|
|
20
|
+ <div style="margin-top: 20px;margin-left: 30px">
|
|
|
21
|
+ <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
|
|
|
22
|
+
|
|
|
23
|
+ <tr style="height: 60px">
|
|
|
24
|
+ <td >
|
|
|
25
|
+ <span style="color:red">*</span><label>手动搜索商品</label> <br>
|
|
|
26
|
+ <input id="skn" name="skn" class="easyui-textbox" style="width: 380px;"/>
|
|
|
27
|
+ <a id="searchGoodBtn" class="go-search btn btn-primary">搜索商品</a>
|
|
|
28
|
+ <a id="searchUfoBtn" class="go-search btn btn-primary">搜索UFO商品</a>
|
|
|
29
|
+ </td>
|
|
|
30
|
+ </tr>
|
|
|
31
|
+
|
|
|
32
|
+ </table>
|
|
|
33
|
+ </div>
|
|
|
34
|
+ </form>
|
|
|
35
|
+ <table id="labelGroupListTable"></table>
|
|
|
36
|
+</div>
|
|
|
37
|
+<div region="center" id="labelGroupList" style="margin-left: 20px">
|
|
|
38
|
+</div>
|
|
|
39
|
+
|
|
|
40
|
+
|
|
|
41
|
+<!--页面中一定要引入internal.js为了能直接使用当前打开dialog的实例变量-->
|
|
|
42
|
+<!--internal.js默认是放到dialogs目录下的-->
|
|
|
43
|
+<!--<script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script>-->
|
|
|
44
|
+<script type="text/javascript" src="../internal.js"></script>
|
|
|
45
|
+<script>
|
|
|
46
|
+ var checkedItems = [];
|
|
|
47
|
+ var checkedItemsObj = {};
|
|
|
48
|
+ var searchType = 1;
|
|
|
49
|
+ var checkType = 1;
|
|
|
50
|
+ $(function () {
|
|
|
51
|
+
|
|
|
52
|
+
|
|
|
53
|
+
|
|
|
54
|
+ function handleDialogOk(){
|
|
|
55
|
+ var skns = '';
|
|
|
56
|
+ if(checkedItems.length == 0){
|
|
|
57
|
+ return;
|
|
|
58
|
+ }
|
|
|
59
|
+ var goodsHtml='';
|
|
|
60
|
+ for (var i = 0; i < checkedItems.length; i++) {
|
|
|
61
|
+ goodsHtml+=buildgood(i,checkedItems[i]);
|
|
|
62
|
+ }
|
|
|
63
|
+ // editor.setContent(goodsHtml,true);
|
|
|
64
|
+ editor.focus();
|
|
|
65
|
+ editor.execCommand('inserthtml',goodsHtml);
|
|
|
66
|
+ dialog.close();
|
|
|
67
|
+
|
|
|
68
|
+ }
|
|
|
69
|
+
|
|
|
70
|
+ dialog.onok = handleDialogOk;
|
|
|
71
|
+
|
|
|
72
|
+ function buildgood(index,obj) {
|
|
|
73
|
+ debugger;
|
|
|
74
|
+ var data = checkedItemsObj[obj.productSkn];
|
|
|
75
|
+ var goodDiv = '<div class="yhproduct" data-option="'+data.product_skn+'">';
|
|
|
76
|
+ var goods = gooddiv(data);
|
|
|
77
|
+ var goodDivEnd = '</div>';
|
|
|
78
|
+ return goodDiv+goods+goodDivEnd;
|
|
|
79
|
+ }
|
|
|
80
|
+
|
|
|
81
|
+ function gooddiv(data) {
|
|
|
82
|
+
|
|
|
83
|
+ return '商品图:<img width=\"120\" height=\"60\" src="'+getImageUrl(data.default_images)+ '">' +
|
|
|
84
|
+ '<h5 style=\"margin-top: 0px;margin-bottom: 0px\">商品名:'+ data.product_name +'</h5>\n'+
|
|
|
85
|
+ '<h5 style=\"margin-top: 0px;margin-bottom: 0px\">价格:'+data.sales_price+'</h5>\n';
|
|
|
86
|
+ }
|
|
|
87
|
+
|
|
|
88
|
+ function getImageUrl(image) {
|
|
|
89
|
+ var result='';
|
|
|
90
|
+ if (image) {
|
|
|
91
|
+ if(image.indexOf('http://') == 0){
|
|
|
92
|
+ result = image.split("?")[0];
|
|
|
93
|
+ }else{
|
|
|
94
|
+ var fileMode = image.substring(15, 17);
|
|
|
95
|
+ if(fileMode=='01'){
|
|
|
96
|
+ result= "http://"+"img11.static.yhbimg.com"+"/goodsimg"+image;
|
|
|
97
|
+ }
|
|
|
98
|
+ if(fileMode=='02'){
|
|
|
99
|
+ result= "http://"+"img12.static.yhbimg.com"+"/goodsimg"+image;
|
|
|
100
|
+ }
|
|
|
101
|
+ }
|
|
|
102
|
+ }
|
|
|
103
|
+ else {
|
|
|
104
|
+ result = ""
|
|
|
105
|
+ }
|
|
|
106
|
+ if (result) {
|
|
|
107
|
+ return result + "?imageMogr2/thumbnail/320x320/extent/320x320/background/d2hpdGU=/position/center/quality/90";
|
|
|
108
|
+ } else {
|
|
|
109
|
+ return "";
|
|
|
110
|
+ }
|
|
|
111
|
+ }
|
|
|
112
|
+
|
|
|
113
|
+
|
|
|
114
|
+ // ---------------------------------------------/**/
|
|
|
115
|
+
|
|
|
116
|
+ $("#searchUfoBtn").linkbutton({
|
|
|
117
|
+ iconCls : "icon-search",
|
|
|
118
|
+ onClick : function() {
|
|
|
119
|
+ searchType=2;
|
|
|
120
|
+
|
|
|
121
|
+ $("#labelGroupListTable").datagrid("load", {
|
|
|
122
|
+ query: $("#skn").textbox("getValue"),
|
|
|
123
|
+ // sales: "Y",
|
|
|
124
|
+ type: "UFO"});
|
|
|
125
|
+ }
|
|
|
126
|
+ });
|
|
|
127
|
+ $("#searchGoodBtn").linkbutton({
|
|
|
128
|
+ iconCls : "icon-search",
|
|
|
129
|
+ onClick : function() {
|
|
|
130
|
+ searchType=1;
|
|
|
131
|
+
|
|
|
132
|
+ $("#labelGroupListTable").datagrid("load", {
|
|
|
133
|
+ query: $("#skn").textbox("getValue"),
|
|
|
134
|
+ status: 1,
|
|
|
135
|
+ // sales: "Y",
|
|
|
136
|
+ stocknumber: "1",
|
|
|
137
|
+ attribute_not: "2"});
|
|
|
138
|
+ }
|
|
|
139
|
+ });
|
|
|
140
|
+ $("#skn").textbox({
|
|
|
141
|
+ prompt: "请输入skn,多个以逗号隔开"
|
|
|
142
|
+ });
|
|
|
143
|
+
|
|
|
144
|
+ $("#labelGroupListTable").myDatagrid({
|
|
|
145
|
+ fit: true,
|
|
|
146
|
+ fitColumns: true,
|
|
|
147
|
+ striped: true,
|
|
|
148
|
+ onCheckAll: addcheckItem,
|
|
|
149
|
+ onCheck: addcheckItem,
|
|
|
150
|
+ onUncheckAll: removeAllItem,
|
|
|
151
|
+ onUncheck: removeSingleItem,
|
|
|
152
|
+ queryParams: {
|
|
|
153
|
+ query: $("#skn").textbox("getValue"),
|
|
|
154
|
+ status: 1,
|
|
|
155
|
+ // sales: "Y",
|
|
|
156
|
+ stocknumber: "1",
|
|
|
157
|
+ attribute_not: "2"
|
|
|
158
|
+ },
|
|
|
159
|
+ // url: serverContextPath+"/grassArticle/queryGoods",
|
|
|
160
|
+ url: contextPath+"/search/queryGoods",
|
|
|
161
|
+ method: 'POST',
|
|
|
162
|
+ loadFilter: function (data) {
|
|
|
163
|
+ var tmp = defaultLoadFilter(data);
|
|
|
164
|
+ tmp.rows = tmp.list;
|
|
|
165
|
+ return tmp;
|
|
|
166
|
+ },
|
|
|
167
|
+
|
|
|
168
|
+ columns: [[
|
|
|
169
|
+ {
|
|
|
170
|
+ title: "产品skn",
|
|
|
171
|
+ field: "product_skn",
|
|
|
172
|
+ width: 30,
|
|
|
173
|
+ align: "left",
|
|
|
174
|
+ checkbox:true
|
|
|
175
|
+ },
|
|
|
176
|
+ {
|
|
|
177
|
+ title: "产品图片",
|
|
|
178
|
+ field: "default_images",
|
|
|
179
|
+ width: 15,
|
|
|
180
|
+ align: "center",
|
|
|
181
|
+ formatter: function (value, rowData, rowIndex) {
|
|
|
182
|
+ var result='';
|
|
|
183
|
+ if (value) {
|
|
|
184
|
+ if(value.indexOf('http://') == 0){
|
|
|
185
|
+ result = item.default_images.split("?")[0];
|
|
|
186
|
+ }else{
|
|
|
187
|
+ var fileMode = value.substring(15, 17);
|
|
|
188
|
+ if(fileMode=='01'){
|
|
|
189
|
+ result= "http://"+"img11.static.yhbimg.com"+"/goodsimg"+value;
|
|
|
190
|
+ }
|
|
|
191
|
+ if(fileMode=='02'){
|
|
|
192
|
+ result= "http://"+"img12.static.yhbimg.com"+"/goodsimg"+value;
|
|
|
193
|
+ }
|
|
|
194
|
+ }
|
|
|
195
|
+ }
|
|
|
196
|
+ else {
|
|
|
197
|
+ result = ""
|
|
|
198
|
+ }
|
|
|
199
|
+ if (result) {
|
|
|
200
|
+ return "<img width=120 height=60 src='" + result + "?imageMogr2/thumbnail/320x320/extent/320x320/background/d2hpdGU=/position/center/quality/90'/>";
|
|
|
201
|
+ } else {
|
|
|
202
|
+ return "";
|
|
|
203
|
+ }
|
|
|
204
|
+ }
|
|
|
205
|
+ },
|
|
|
206
|
+
|
|
|
207
|
+ {
|
|
|
208
|
+ title: "产品名称",
|
|
|
209
|
+ field: "product_name",
|
|
|
210
|
+ width: 30,
|
|
|
211
|
+ align: "left"
|
|
|
212
|
+ },
|
|
|
213
|
+ {
|
|
|
214
|
+ title: "品牌",
|
|
|
215
|
+ field: "brand_name",
|
|
|
216
|
+ width: 20,
|
|
|
217
|
+ align: "left"
|
|
|
218
|
+ }, {
|
|
|
219
|
+ title: "现价",
|
|
|
220
|
+ field: "sales_price",
|
|
|
221
|
+ width: 25,
|
|
|
222
|
+ align: "left"
|
|
|
223
|
+
|
|
|
224
|
+ }, {
|
|
|
225
|
+ title: "吊牌价",
|
|
|
226
|
+ field: "market_price",
|
|
|
227
|
+ width: 25,
|
|
|
228
|
+ align: "left" ,
|
|
|
229
|
+ formatter: function (value, rowData, rowIndex) {
|
|
|
230
|
+ var result=rowData.market_price;
|
|
|
231
|
+ if(rowData.market_price==null || rowData.market_price==''){
|
|
|
232
|
+ result ="——————————"
|
|
|
233
|
+ }
|
|
|
234
|
+ return result;
|
|
|
235
|
+ }
|
|
|
236
|
+
|
|
|
237
|
+ }, {
|
|
|
238
|
+ title: "库存",
|
|
|
239
|
+ field: "stock_number",
|
|
|
240
|
+ width: 25,
|
|
|
241
|
+ align: "left" ,
|
|
|
242
|
+ formatter: function (value, rowData, rowIndex) {
|
|
|
243
|
+ var result=rowData.stock_number;
|
|
|
244
|
+ if(rowData.stock_number==null || rowData.stock_number==''){
|
|
|
245
|
+ result ="——————————"
|
|
|
246
|
+ }
|
|
|
247
|
+ return result;
|
|
|
248
|
+ }
|
|
|
249
|
+
|
|
|
250
|
+ }
|
|
|
251
|
+
|
|
|
252
|
+ ]],
|
|
|
253
|
+ cache: false,
|
|
|
254
|
+ pagination: true,
|
|
|
255
|
+ pageSize: 10,
|
|
|
256
|
+ pageList: [10],
|
|
|
257
|
+ idField: "id",
|
|
|
258
|
+ checkbox:true,
|
|
|
259
|
+ onLoadSuccess: function (data) {
|
|
|
260
|
+ debugger
|
|
|
261
|
+ for (var i=0; i<data.list.length;i++){
|
|
|
262
|
+ var rowdata = data.list[i]
|
|
|
263
|
+ checkedItemsObj[rowdata.product_skn] = rowdata;
|
|
|
264
|
+ }
|
|
|
265
|
+ resetSelectedCheckBox(data);
|
|
|
266
|
+
|
|
|
267
|
+ }
|
|
|
268
|
+ });
|
|
|
269
|
+ });
|
|
|
270
|
+
|
|
|
271
|
+ function findCheckedItem(ID) {
|
|
|
272
|
+ for (var i = 0; i < checkedItems.length; i++) {
|
|
|
273
|
+ if (checkedItems[i].productSkn == ID) return i;
|
|
|
274
|
+ }
|
|
|
275
|
+ return -1;
|
|
|
276
|
+ }
|
|
|
277
|
+ function addcheckItem() {
|
|
|
278
|
+ // if(searchType != checkType && checkedItems.length>0){
|
|
|
279
|
+ // checkedItems=[];
|
|
|
280
|
+ // }
|
|
|
281
|
+ checkType = searchType;
|
|
|
282
|
+ var i=0;
|
|
|
283
|
+ $("input[type='checkbox'][name='product_skn']:checked").each(function () {
|
|
|
284
|
+
|
|
|
285
|
+ var k = findCheckedItem($(this).val());
|
|
|
286
|
+ if (k == -1) {
|
|
|
287
|
+ var product = {};
|
|
|
288
|
+ product.productSkn = $(this).val();
|
|
|
289
|
+ product.productType = checkType;
|
|
|
290
|
+ checkedItems.push(product);
|
|
|
291
|
+ }
|
|
|
292
|
+ i++;
|
|
|
293
|
+
|
|
|
294
|
+ });
|
|
|
295
|
+ }
|
|
|
296
|
+
|
|
|
297
|
+ function removeAllItem(rows) {
|
|
|
298
|
+ $("input[type='checkbox'][name='product_skn']").each(function () {
|
|
|
299
|
+ if (!this.checked) {
|
|
|
300
|
+ var k = findCheckedItem($(this).val());
|
|
|
301
|
+ if (k != -1) {
|
|
|
302
|
+ checkedItems.splice(k, 1);
|
|
|
303
|
+ }
|
|
|
304
|
+ }
|
|
|
305
|
+ });
|
|
|
306
|
+ }
|
|
|
307
|
+ function resetSelectedCheckBox(data){
|
|
|
308
|
+ $("input[type='checkbox'][name='product_skn']").each(function () {
|
|
|
309
|
+ var cb=$(this);
|
|
|
310
|
+ $.each(checkedItems,function(index,value){
|
|
|
311
|
+ if(value.productSkn==cb.val()){
|
|
|
312
|
+ cb.attr("checked",true);
|
|
|
313
|
+ return false;
|
|
|
314
|
+ }
|
|
|
315
|
+ });
|
|
|
316
|
+ });
|
|
|
317
|
+ }
|
|
|
318
|
+ function removeSingleItem(rowIndex, rowData) {
|
|
|
319
|
+ var k = findCheckedItem(rowData.product_skn);
|
|
|
320
|
+ if (k != -1) {
|
|
|
321
|
+ checkedItems.splice(k, 1);
|
|
|
322
|
+ }
|
|
|
323
|
+ }
|
|
|
324
|
+ function removeSingleItemById(id) {
|
|
|
325
|
+ debugger
|
|
|
326
|
+ var k = findCheckedItem(id);
|
|
|
327
|
+ if (k != -1) {
|
|
|
328
|
+ checkedItems.splice(k, 1);
|
|
|
329
|
+ }
|
|
|
330
|
+ }
|
|
|
331
|
+
|
|
|
332
|
+</script>
|
|
|
333
|
+
|
|
|
334
|
+
|
|
|
335
|
+</body>
|
|
|
336
|
+</html> |