Authored by tanling

Merge branch 'test6.9.6' of http://git.yoho.cn/ufo/ufo-platform into test6.9.6

@@ -264,10 +264,10 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -264,10 +264,10 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
264 264
265 Storage storage = new Storage(); 265 Storage storage = new Storage();
266 storage.setId(csc.getSku()); 266 storage.setId(csc.getSku());
267 - BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate())).setScale(0, BigDecimal.ROUND_DOWN);; 267 + BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate())).setScale(0, BigDecimal.ROUND_DOWN);
268 BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate())).setScale(0, BigDecimal.ROUND_DOWN); 268 BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate())).setScale(0, BigDecimal.ROUND_DOWN);
269 - storage.setSuggestLowPrice(suggestLowPrice);  
270 - storage.setSuggestHighPrice(suggestHighPrice); 269 + storage.setSuggestLowPrice(changeToNineEnd(suggestLowPrice, 1));
  270 + storage.setSuggestHighPrice(changeToNineEnd(suggestHighPrice, 2));
271 normalIdList.add(csc.getId()); 271 normalIdList.add(csc.getId());
272 storageList.add(storage); 272 storageList.add(storage);
273 } 273 }
@@ -282,6 +282,32 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -282,6 +282,32 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
282 channelSkuCompareMapper.updateStatusByIds(normalIdList, CHANNEL_SKU_COMPARE_NORMAL, 0);//uid=0表示系统操作 282 channelSkuCompareMapper.updateStatusByIds(normalIdList, CHANNEL_SKU_COMPARE_NORMAL, 0);//uid=0表示系统操作
283 storageMapper.updateBatchSuggestPrice(storageList); 283 storageMapper.updateBatchSuggestPrice(storageList);
284 } 284 }
  285 + }
  286 +
  287 + /**
  288 + *
  289 + * @param old
  290 + * @param type 1:low 2:high
  291 + * @return
  292 + */
  293 + private static BigDecimal changeToNineEnd(BigDecimal old, int type) {
  294 + String oldStr = old.toString();
  295 + if(oldStr.endsWith("9")) {
  296 + return old;
  297 + }
  298 +
  299 + String newStr = oldStr.substring(0, oldStr.length()-1) + "9";
  300 + BigDecimal result = BigDecimal.valueOf(0);
  301 + if(type == 1) {//low
  302 + result = new BigDecimal(newStr).subtract(BigDecimal.valueOf(10));
  303 + if(result.compareTo(BigDecimal.valueOf(0)) < 0) {
  304 + return old;
  305 + }
  306 + }else if(type == 2) {//high
  307 + result = new BigDecimal(newStr);
  308 + }
  309 +
  310 + return result;
285 311
286 } 312 }
287 313
@@ -157,6 +157,7 @@ function loadMainList(){ @@ -157,6 +157,7 @@ function loadMainList(){
157 str = "<a role='audit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核</a>" + str; 157 str = "<a role='audit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核</a>" + str;
158 }else if(rowData.status==3){ 158 }else if(rowData.status==3){
159 str = "<a role='upperShelf' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>上架</a>"; 159 str = "<a role='upperShelf' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>上架</a>";
  160 + str += "<a role='reject' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>驳回</a>";
160 }else{ 161 }else{
161 str = "<a role='detail' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>查看</a>"; 162 str = "<a role='detail' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>查看</a>";
162 } 163 }
@@ -198,7 +199,28 @@ function loadMainList(){ @@ -198,7 +199,28 @@ function loadMainList(){
198 }else { 199 }else {
199 window.self.$.messager.alert("失败", "失败!", "error"); 200 window.self.$.messager.alert("失败", "失败!", "error");
200 } 201 }
201 - }); } 202 + });
  203 + }
  204 + });
  205 +
  206 + $(this).datagrid("getPanel").find("a[role='reject']").linkbutton({
  207 + onClick: function () {
  208 + var id = $(this).attr("dataId");
  209 + $.post(contextPath + "/selfShelves/updateAuditInfoById", {
  210 + id : id,
  211 + status : 2
  212 + }, function(data) {
  213 + if (data.code == 200) {
  214 + $("#mainListTable").datagrid("reload");
  215 + window.self.$.messager.show({
  216 + title : "提示",
  217 + msg : "驳回成功!"
  218 + });
  219 + }else {
  220 + window.self.$.messager.alert("失败", "失败!", "error");
  221 + }
  222 + });
  223 + }
202 }); 224 });
203 225
204 } 226 }