Merge branch 'develop' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into develop
Showing
4 changed files
with
119 additions
and
109 deletions
@@ -5,6 +5,8 @@ var $ = require('jquery'), | @@ -5,6 +5,8 @@ var $ = require('jquery'), | ||
5 | common = require('../common/common'), | 5 | common = require('../common/common'), |
6 | util = require('../common/util'); | 6 | util = require('../common/util'); |
7 | 7 | ||
8 | +var hasClickEvent = false//判断保存按钮是否有点击事件; | ||
9 | + | ||
8 | $(document).on('click', '#searchSku', function() { | 10 | $(document).on('click', '#searchSku', function() { |
9 | var val = $.trim($("#skuInput").val()); | 11 | var val = $.trim($("#skuInput").val()); |
10 | if(!val.match(/^[0-9]+$/)) { | 12 | if(!val.match(/^[0-9]+$/)) { |
@@ -12,6 +14,7 @@ $(document).on('click', '#searchSku', function() { | @@ -12,6 +14,7 @@ $(document).on('click', '#searchSku', function() { | ||
12 | return; | 14 | return; |
13 | } | 15 | } |
14 | if(val) { | 16 | if(val) { |
17 | + $("#add-list").hide(); | ||
15 | common.util.__ajax({ | 18 | common.util.__ajax({ |
16 | url:'/meterManage/productSize/queryProdSizeList', | 19 | url:'/meterManage/productSize/queryProdSizeList', |
17 | data:{productSku:val} | 20 | data:{productSku:val} |
@@ -19,20 +22,6 @@ $(document).on('click', '#searchSku', function() { | @@ -19,20 +22,6 @@ $(document).on('click', '#searchSku', function() { | ||
19 | if(res.data.list && res.data.list.length > 0) { | 22 | if(res.data.list && res.data.list.length > 0) { |
20 | var e = new common.edit("#add-list"); | 23 | var e = new common.edit("#add-list"); |
21 | 24 | ||
22 | - e.on('validate', function() { | ||
23 | - var flag = false; | ||
24 | - $("input[name='noMeasureIds']").not("input:checked").each(function () { | ||
25 | - $("." + $(this).val()).each(function() { | ||
26 | - if(!$(this).val()){ | ||
27 | - flag = true; | ||
28 | - return false; | ||
29 | - } | ||
30 | - }); | ||
31 | - if(flag) return false; | ||
32 | - }); | ||
33 | - if (flag) | ||
34 | - return "请将没有勾选无需测量的列填写完整!"; | ||
35 | - }); | ||
36 | var item = res.data.list[0]; | 25 | var item = res.data.list[0]; |
37 | var headList = []; | 26 | var headList = []; |
38 | var j = 0;//创造一个变量以供赋值 | 27 | var j = 0;//创造一个变量以供赋值 |
@@ -45,16 +34,18 @@ $(document).on('click', '#searchSku', function() { | @@ -45,16 +34,18 @@ $(document).on('click', '#searchSku', function() { | ||
45 | } | 34 | } |
46 | }); | 35 | }); |
47 | for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列 | 36 | for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列 |
48 | - var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];// 码数组里的数据 | 37 | + var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];//参考尺码数组里的数据 |
49 | var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>'; | 38 | var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>'; |
50 | headList.push({ | 39 | headList.push({ |
51 | display: sizeAttributes.sizeAttributeName + "<br>" + chkbox, | 40 | display: sizeAttributes.sizeAttributeName + "<br>" + chkbox, |
52 | name: "sizeValue", | 41 | name: "sizeValue", |
53 | render: function (item) { | 42 | render: function (item) { |
54 | - if (j == item.prdSizeAttributeBoList.length) j = 0;//防止越界 | ||
55 | - var sizeVal = item.prdSizeAttributeBoList[j].sizeValue ? item.prdSizeAttributeBoList[j].sizeValue : ""; | 43 | + var prdList = item.prdSizeAttributeBoList; |
44 | + if (j == prdList.length) j = 0;//防止越界 | ||
45 | + var sizeVal = prdList[j].sizeValue ? prdList[j].sizeValue : ""; | ||
56 | //j++;// | 46 | //j++;// |
57 | - return '<input class="form-control sizeInfo '+ item.prdSizeAttributeBoList[j++].sizeAttributeId +'" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>'; | 47 | + return '<input class="form-control sizeInfo '+ prdList[j++].sizeAttributeId |
48 | + +'" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>'; | ||
58 | } | 49 | } |
59 | }); | 50 | }); |
60 | } | 51 | } |
@@ -66,53 +57,76 @@ $(document).on('click', '#searchSku', function() { | @@ -66,53 +57,76 @@ $(document).on('click', '#searchSku', function() { | ||
66 | columns:headList | 57 | columns:headList |
67 | }); | 58 | }); |
68 | grid.init(item.sizeRelationsList); | 59 | grid.init(item.sizeRelationsList); |
69 | - $("#add-saveArea").show(); | 60 | + //$("#add-saveArea").show(); |
70 | $("#add-head").html(common.util.__template2($("#modifySize-template").html(), item)); | 61 | $("#add-head").html(common.util.__template2($("#modifySize-template").html(), item)); |
71 | $("#noMeasureIds").val(item.noMeasureIds? item.noMeasureIds.join("|"):""); | 62 | $("#noMeasureIds").val(item.noMeasureIds? item.noMeasureIds.join("|"):""); |
63 | + $("#add-list").show(); | ||
72 | e.init(); | 64 | e.init(); |
73 | - $(document).on('click', '#add-saveBtn', function() { | ||
74 | - e.submit("/meterManage/productSize/saveProdSizeInfo",function(option){ | ||
75 | - //option.data;= | 65 | + if(!hasClickEvent) { |
66 | + hasClickEvent = true; | ||
67 | + $(document).on('click', '#add-saveBtn', function () { | ||
68 | + | ||
69 | + var flag = false; | ||
70 | + $("input[name='noMeasureIds']").not("input:checked").each(function () { | ||
71 | + $("." + $(this).val()).each(function() { | ||
72 | + if(!$(this).val()){ | ||
73 | + flag = true; | ||
74 | + return false; | ||
75 | + } | ||
76 | + }); | ||
77 | + if(flag) return false; | ||
78 | + }); | ||
79 | + if (flag) { | ||
80 | + util.__tip("请将没有勾选无需测量的列填写完整!", "warning"); | ||
81 | + return false; | ||
82 | + } | ||
76 | 83 | ||
77 | - option.data.productSkn = item.productSkn; | ||
78 | - option.data.noMeasureIds = $("#noMeasureIds").val()?$("#noMeasureIds").val().split("|"):[]; | ||
79 | - option.data.noMeasureIds = JSON.stringify(option.data.noMeasureIds); | ||
80 | - option.data.sizeInfoList = []; | 84 | + var noMeasureIds = JSON.stringify($("#noMeasureIds").val()?$("#noMeasureIds").val().split("|"):[]);//无需测量的列 |
85 | + //尺码信息列表 | ||
86 | + var sizeInfoList = []; | ||
81 | for(var i = 0; i < $(".sizeInfo").length; i++){ | 87 | for(var i = 0; i < $(".sizeInfo").length; i++){ |
82 | - var info = $($(".sizeInfo")[i]); | ||
83 | - option.data.sizeInfoList[i] = ({ | 88 | + var info = $($(".sizeInfo")[i]);//当前尺码input对象 |
89 | + var prdList = grid.rows[info.data("index")].prdSizeAttributeBoList;//当前列的对象的尺码列表 | ||
90 | + var attrIndex = parseInt(i%prdList.length);//在当前列的索引 | ||
91 | + sizeInfoList[i] = ({ | ||
84 | productSkn: item.productSkn, | 92 | productSkn: item.productSkn, |
85 | sizeId:grid.rows[info.data("index")].sizeId, | 93 | sizeId:grid.rows[info.data("index")].sizeId, |
86 | - sizeAttributeId:grid.rows[info.data("index")].prdSizeAttributeBoList[parseInt(i%grid.rows[info.data("index")].prdSizeAttributeBoList.length)].sizeAttributeId, | 94 | + sizeAttributeId:prdList[attrIndex].sizeAttributeId, |
87 | sizeValue:info.val() | 95 | sizeValue:info.val() |
88 | }); | 96 | }); |
89 | } | 97 | } |
90 | - option.data.sizeInfoList = JSON.stringify(option.data.sizeInfoList); | ||
91 | - option.data.productSizeReferList = []; | 98 | + //商品参考尺码 |
99 | + var productSizeReferList = []; | ||
92 | for(var i = 0; i < $(".refInfo").length; i++) { | 100 | for(var i = 0; i < $(".refInfo").length; i++) { |
93 | var ref = $($(".refInfo")[i]); | 101 | var ref = $($(".refInfo")[i]); |
94 | - option.data.productSizeReferList.push({ | 102 | + productSizeReferList.push({ |
95 | sizeId: grid.rows[ref.data("index")].sizeId, | 103 | sizeId: grid.rows[ref.data("index")].sizeId, |
96 | gender: item.gender, | 104 | gender: item.gender, |
97 | referenceName: ref.val() | 105 | referenceName: ref.val() |
98 | }); | 106 | }); |
99 | } | 107 | } |
100 | - option.data.productSizeReferList = JSON.stringify(option.data.productSizeReferList); | ||
101 | - | ||
102 | - option.success=function(res){ | ||
103 | - util.__tip(res.data.message, 'success'); | ||
104 | - grid.reload(); | ||
105 | - }; | ||
106 | - option.error=function(res){ | ||
107 | - //dialog.close(); | ||
108 | - util.__tip(res.message); | ||
109 | - } | 108 | + common.util.__ajax({ |
109 | + url:"/meterManage/productSize/saveProdSizeInfo", | ||
110 | + data:{ | ||
111 | + productSkn: item.productSkn, | ||
112 | + noMeasureIds: noMeasureIds, | ||
113 | + sizeInfoList: JSON.stringify(sizeInfoList), | ||
114 | + productSizeReferList: JSON.stringify(productSizeReferList) | ||
115 | + } | ||
116 | + },function() { | ||
117 | + }); | ||
118 | + return false; | ||
110 | }); | 119 | }); |
111 | - return false; | ||
112 | - }); | 120 | + } |
113 | }else { | 121 | }else { |
114 | util.__tip("未搜索到sku:" + val); | 122 | util.__tip("未搜索到sku:" + val); |
115 | } | 123 | } |
116 | },true); | 124 | },true); |
117 | } | 125 | } |
126 | +}); | ||
127 | + | ||
128 | +$("#skuInput").keydown(function() { | ||
129 | + if(event.keyCode == "13") { | ||
130 | + $("#searchSku").click(); | ||
131 | + } | ||
118 | }); | 132 | }); |
@@ -9,12 +9,10 @@ var $ = require('jquery'), | @@ -9,12 +9,10 @@ var $ = require('jquery'), | ||
9 | 9 | ||
10 | new common.edit("#filter").init(); | 10 | new common.edit("#filter").init(); |
11 | 11 | ||
12 | -//new common.dropDown({el: "#brand-filter", "ajax": "getSelectItems"}); | ||
13 | new common.dropDown({el: "#hasMeasure-filter"}); | 12 | new common.dropDown({el: "#hasMeasure-filter"}); |
14 | new common.dropDown({el: "#brand-filter", ajax: "brand",params:function(){ | 13 | new common.dropDown({el: "#brand-filter", ajax: "brand",params:function(){ |
15 | return {status:1}; | 14 | return {status:1}; |
16 | }}); | 15 | }}); |
17 | -//new common.dropDown({el: "#category-filter", "ajax": "getHelpCategory"}); | ||
18 | 16 | ||
19 | var tabTree=new common.tabTree("#category-filter",{ | 17 | var tabTree=new common.tabTree("#category-filter",{ |
20 | columns: [{ | 18 | columns: [{ |
@@ -26,8 +24,6 @@ var tabTree=new common.tabTree("#category-filter",{ | @@ -26,8 +24,6 @@ var tabTree=new common.tabTree("#category-filter",{ | ||
26 | datas:[{id:"",name:""}] | 24 | datas:[{id:"",name:""}] |
27 | }); | 25 | }); |
28 | tabTree.init(); | 26 | tabTree.init(); |
29 | -//tabTree.getAddress()&&tabTree.getAddress()[0].id | ||
30 | -//tabTree.isfeeze=true; | ||
31 | 27 | ||
32 | var g = new common.grid({ | 28 | var g = new common.grid({ |
33 | el: "#content-list", | 29 | el: "#content-list", |
@@ -90,67 +86,65 @@ var Bll = { | @@ -90,67 +86,65 @@ var Bll = { | ||
90 | toast:function(url, item, hint) { | 86 | toast:function(url, item, hint) { |
91 | var e = new common.edit("#nidaye"); | 87 | var e = new common.edit("#nidaye"); |
92 | 88 | ||
93 | - e.on('validate', function() { | ||
94 | - var flag = false; | ||
95 | - $("input[name='noMeasureIds']").not("input:checked").each(function () { | ||
96 | - $("." + $(this).val()).each(function() { | ||
97 | - if(!$(this).val()){ | ||
98 | - flag = true; | ||
99 | - return false; | ||
100 | - } | ||
101 | - }); | ||
102 | - if(flag) return false; | ||
103 | - }); | ||
104 | - if (flag) | ||
105 | - return "请将没有勾选无需测量的列填写完整!"; | ||
106 | - }); | ||
107 | - | ||
108 | var dialog=new common.dialog({ | 89 | var dialog=new common.dialog({ |
109 | title:hint, | 90 | title:hint, |
110 | - content:'<div id="nidaye"><input type="hidden" id="noMeasureIds" for="checkbox">'+ common.util.__template2($("#modifySize-template").html(), item) +'<div id="faGrid" style="height: 600px;overflow:auto;"></div></div>', | 91 | + content:'<div id="nidaye"><input type="hidden" id="noMeasureIds" for="checkbox">' |
92 | + + common.util.__template2($("#modifySize-template").html(), item) | ||
93 | + + '<div id="faGrid" style="height: 600px;overflow:auto;"></div></div>', | ||
111 | width: "90%", | 94 | width: "90%", |
112 | button:[{ | 95 | button:[{ |
113 | value:"提交", | 96 | value:"提交", |
114 | callback:function(){ | 97 | callback:function(){ |
115 | - e.submit(url,function(option){ | ||
116 | - //option.data;= | ||
117 | - | ||
118 | - option.data.productSkn = item.productSkn; | ||
119 | - option.data.noMeasureIds = $("#noMeasureIds").val()?$("#noMeasureIds").val().split("|"):[]; | ||
120 | - option.data.noMeasureIds = JSON.stringify(option.data.noMeasureIds); | ||
121 | - option.data.sizeInfoList = []; | ||
122 | - for(var i = 0; i < $(".sizeInfo").length; i++){ | ||
123 | - var info = $($(".sizeInfo")[i]); | ||
124 | - option.data.sizeInfoList[i] = ({ | ||
125 | - productSkn: item.productSkn, | ||
126 | - sizeId:grid.rows[info.data("index")].sizeId, | ||
127 | - sizeAttributeId:grid.rows[info.data("index")].prdSizeAttributeBoList[parseInt(i%grid.rows[info.data("index")].prdSizeAttributeBoList.length)].sizeAttributeId, | ||
128 | - sizeValue:info.val() | ||
129 | - }); | ||
130 | - } | ||
131 | - option.data.sizeInfoList = JSON.stringify(option.data.sizeInfoList); | ||
132 | - option.data.productSizeReferList = []; | ||
133 | - for(var i = 0; i < $(".refInfo").length; i++) { | ||
134 | - var ref = $($(".refInfo")[i]); | ||
135 | - option.data.productSizeReferList.push({ | ||
136 | - sizeId: grid.rows[ref.data("index")].sizeId, | ||
137 | - gender: item.gender, | ||
138 | - referenceName: ref.val() | ||
139 | - }); | ||
140 | - } | ||
141 | - option.data.productSizeReferList = JSON.stringify(option.data.productSizeReferList); | 98 | + var flag = false; |
99 | + $("input[name='noMeasureIds']").not("input:checked").each(function () { | ||
100 | + $("." + $(this).val()).each(function() { | ||
101 | + if(!$(this).val()){ | ||
102 | + flag = true; | ||
103 | + return false; | ||
104 | + } | ||
105 | + }); | ||
106 | + if(flag) return false; | ||
107 | + }); | ||
108 | + if (flag) { | ||
109 | + util.__tip("请将没有勾选无需测量的列填写完整!", "warning"); | ||
110 | + return false; | ||
111 | + } | ||
142 | 112 | ||
143 | - option.success=function(res){ | ||
144 | - dialog.close(); | ||
145 | - util.__tip(res.data.message, 'success'); | ||
146 | - g.reload(); | ||
147 | - }; | ||
148 | - option.error=function(res){ | ||
149 | - //dialog.close(); | ||
150 | - util.__tip(res.message); | 113 | + var noMeasureIds = JSON.stringify($("#noMeasureIds").val()?$("#noMeasureIds").val().split("|"):[]);//无需测量的列 |
114 | + //尺码信息列表 | ||
115 | + var sizeInfoList = []; | ||
116 | + for(var i = 0; i < $(".sizeInfo").length; i++){ | ||
117 | + var info = $($(".sizeInfo")[i]);//当前尺码input对象 | ||
118 | + var prdList = grid.rows[info.data("index")].prdSizeAttributeBoList;//当前列的对象的尺码列表 | ||
119 | + var attrIndex = parseInt(i%prdList.length);//在当前列的索引 | ||
120 | + sizeInfoList[i] = ({ | ||
121 | + productSkn: item.productSkn, | ||
122 | + sizeId:grid.rows[info.data("index")].sizeId, | ||
123 | + sizeAttributeId:prdList[attrIndex].sizeAttributeId, | ||
124 | + sizeValue:info.val() | ||
125 | + }); | ||
126 | + } | ||
127 | + //商品参考尺码 | ||
128 | + var productSizeReferList = []; | ||
129 | + for(var i = 0; i < $(".refInfo").length; i++) { | ||
130 | + var ref = $($(".refInfo")[i]); | ||
131 | + productSizeReferList.push({ | ||
132 | + sizeId: grid.rows[ref.data("index")].sizeId, | ||
133 | + gender: item.gender, | ||
134 | + referenceName: ref.val() | ||
135 | + }); | ||
136 | + } | ||
137 | + common.util.__ajax({ | ||
138 | + url:url, | ||
139 | + data:{ | ||
140 | + productSkn: item.productSkn, | ||
141 | + noMeasureIds: noMeasureIds, | ||
142 | + sizeInfoList: JSON.stringify(sizeInfoList), | ||
143 | + productSizeReferList: JSON.stringify(productSizeReferList) | ||
151 | } | 144 | } |
145 | + },function() { | ||
146 | + g.reload(); | ||
152 | }); | 147 | }); |
153 | - return false; | ||
154 | }}, | 148 | }}, |
155 | { | 149 | { |
156 | value:"取消" | 150 | value:"取消" |
@@ -167,16 +161,18 @@ var Bll = { | @@ -167,16 +161,18 @@ var Bll = { | ||
167 | } | 161 | } |
168 | }); | 162 | }); |
169 | for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列 | 163 | for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列 |
170 | - var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];// 码数组里的数据 | 164 | + var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];//参考尺码数组里的数据 |
171 | var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>'; | 165 | var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>'; |
172 | headList.push({ | 166 | headList.push({ |
173 | display: sizeAttributes.sizeAttributeName + "<br>" + chkbox, | 167 | display: sizeAttributes.sizeAttributeName + "<br>" + chkbox, |
174 | name: "sizeValue", | 168 | name: "sizeValue", |
175 | render: function (item) { | 169 | render: function (item) { |
176 | - if (j == item.prdSizeAttributeBoList.length) j = 0;//防止越界 | ||
177 | - var sizeVal = item.prdSizeAttributeBoList[j].sizeValue ? item.prdSizeAttributeBoList[j].sizeValue : ""; | 170 | + var prdList = item.prdSizeAttributeBoList; |
171 | + if (j == prdList.length) j = 0;//防止越界 | ||
172 | + var sizeVal = prdList[j].sizeValue ? prdList[j].sizeValue : ""; | ||
178 | //j++;// | 173 | //j++;// |
179 | - return '<input class="form-control sizeInfo '+ item.prdSizeAttributeBoList[j++].sizeAttributeId +'" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>'; | 174 | + return '<input class="form-control sizeInfo '+ prdList[j++].sizeAttributeId |
175 | + +'" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>'; | ||
180 | } | 176 | } |
181 | }); | 177 | }); |
182 | } | 178 | } |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | */ | 4 | */ |
5 | exports.domain = require('../config/common.js').domain; | 5 | exports.domain = require('../config/common.js').domain; |
6 | //exports.domain = 'http://172.16.6.162:8088/platform'; //李建 | 6 | //exports.domain = 'http://172.16.6.162:8088/platform'; //李建 |
7 | -//exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境 | 7 | +//exports.domain = 'http://192.168.102.216:8180/platform'; //开发环境 |
8 | 8 | ||
9 | exports.res = [ | 9 | exports.res = [ |
10 | 10 |
@@ -27,17 +27,17 @@ | @@ -27,17 +27,17 @@ | ||
27 | <input type="text" class="form-control" id="skuInput" /> | 27 | <input type="text" class="form-control" id="skuInput" /> |
28 | </div> | 28 | </div> |
29 | <div class="panel-col"> | 29 | <div class="panel-col"> |
30 | - <input type="button" class="btn" value="搜索" id="searchSku" /> | 30 | + <input type="button" class="btn btn-info" value="搜索" id="searchSku" /> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | - <div id="add-list"> | 35 | + <div id="add-list" hidden> |
36 | <input type="hidden" id="noMeasureIds" for="checkbox"> | 36 | <input type="hidden" id="noMeasureIds" for="checkbox"> |
37 | <div id="add-head"></div> | 37 | <div id="add-head"></div> |
38 | <div id="content-list"></div> | 38 | <div id="content-list"></div> |
39 | - <div id="add-saveArea" hidden="hidden"> | ||
40 | - <input type="button" class="btn" value="保存" id="add-saveBtn" /> | 39 | + <div id="add-saveArea"> |
40 | + <input type="button" class="btn btn-primary" value="保存" id="add-saveBtn" /> | ||
41 | </div> | 41 | </div> |
42 | </div> | 42 | </div> |
43 | </div> | 43 | </div> |
-
Please register or login to post a comment