Authored by dongjunjie

代销变价记录支持删除

@@ -44,6 +44,9 @@ module.exports=function(app) { @@ -44,6 +44,9 @@ module.exports=function(app) {
44 44
45 app.post("/product/queryProductPriceListBySkn","price_queryProductPriceListBySkn"); 45 app.post("/product/queryProductPriceListBySkn","price_queryProductPriceListBySkn");
46 46
  47 + /*删除变价记录*/
  48 + app.post("/product/deletePricePlan","price_deletePricePlan");
  49 +
47 app.post("/product/batchUpdateProductPrice", "price_batchUpdateProductPrice"); 50 app.post("/product/batchUpdateProductPrice", "price_batchUpdateProductPrice");
48 51
49 app.post("/goods/brandCooperation/list", "price_queryBrandCooperationList"); 52 app.post("/goods/brandCooperation/list", "price_queryBrandCooperationList");
@@ -54,6 +54,13 @@ module.exports={ @@ -54,6 +54,13 @@ module.exports={
54 {name: 'cgpriceEndTime', type: 'String'} 54 {name: 'cgpriceEndTime', type: 'String'}
55 ] 55 ]
56 }, 56 },
  57 + deletePricePlan:{
  58 + title:'删除变价记录',
  59 + url: '/product/deletePricePlan',
  60 + params: [
  61 + {name: 'param', type: 'Number'}
  62 + ]
  63 + },
57 batchUpdateProductPrice:{ 64 batchUpdateProductPrice:{
58 title: "批量变价接口", 65 title: "批量变价接口",
59 url: '/product/batchUpdateProductPrice', 66 url: '/product/batchUpdateProductPrice',
@@ -231,9 +231,11 @@ @@ -231,9 +231,11 @@
231 <th>价格生效-<font color="red">结束时间</font></th> 231 <th>价格生效-<font color="red">结束时间</font></th>
232 <th>变价时间</th> 232 <th>变价时间</th>
233 <th>变价人</th> 233 <th>变价人</th>
  234 + <th>操作</th>
234 </tr> 235 </tr>
235 </thead> 236 </thead>
236 <tbody> 237 <tbody>
  238 + [[if list.length > 0]]
237 [[each list as item index]] 239 [[each list as item index]]
238 <tr> 240 <tr>
239 <td>[[item.retailPrice]]</td> 241 <td>[[item.retailPrice]]</td>
@@ -242,8 +244,16 @@ @@ -242,8 +244,16 @@
242 <td>[[item.changePriceEndTime]]</td> 244 <td>[[item.changePriceEndTime]]</td>
243 <td>[[item.createTime]]</td> 245 <td>[[item.createTime]]</td>
244 <td>[[item.founderName]]</td> 246 <td>[[item.founderName]]</td>
  247 + <td>
  248 + [[if item.flag && item.flag == 1]]
  249 + <a data-planid="[[item.planId]]" data-skn="[[productSkn]]" href="javascript:;" class="btn btn-danger btn-xs deleteHistory">删除</a>
  250 + [[/if]]
  251 + </td>
245 </tr> 252 </tr>
246 [[/each]] 253 [[/each]]
  254 + [[else]]
  255 + <tr><td colspan="7">没有变价记录!</td></tr>
  256 + [[/if]]
247 </tbody> 257 </tbody>
248 </table> 258 </table>
249 </div> 259 </div>
@@ -115,6 +115,27 @@ var g = new common.grid({ @@ -115,6 +115,27 @@ var g = new common.grid({
115 }); 115 });
116 g.init('/product/queryProductPriceList'); 116 g.init('/product/queryProductPriceList');
117 117
  118 +//获取变价记录列表并渲染
  119 +function getHistoryList(skn) {
  120 + $.ajax({
  121 + type: 'POST',
  122 + dataType: 'json',
  123 + url: '/product/queryProductPriceListBySkn',
  124 + data: {param: skn},
  125 + success: function (rs) {
  126 + var data = rs;
  127 + $('.historyDetail').html($(common.util.__template2($("#template2").html(), data.data)));
  128 + if(data.code != 200){
  129 + common.util.__tip(rs.message);
  130 + }
  131 + },
  132 + error: function (rs) {
  133 + $('.historyDetail').html($(common.util.__template2($("#template2").html(), {})));
  134 + common.util.__tip(rs.message);
  135 + }
  136 + });
  137 +}
  138 +
118 //单个变价修改 139 //单个变价修改
119 $(document).on('click', '.modify-btn', function() { 140 $(document).on('click', '.modify-btn', function() {
120 var skn = $(this).data('skn'), 141 var skn = $(this).data('skn'),
@@ -224,22 +245,28 @@ $(document).on('click', '.history-btn', function () { @@ -224,22 +245,28 @@ $(document).on('click', '.history-btn', function () {
224 button:[{value:"关闭", css:"btn-primary"}] 245 button:[{value:"关闭", css:"btn-primary"}]
225 }; 246 };
226 new common.dialog(option); 247 new common.dialog(option);
227 - $.ajax({  
228 - type: 'POST',  
229 - dataType: 'json',  
230 - url: '/product/queryProductPriceListBySkn',  
231 - data: {param: skn},  
232 - success: function (rs) {  
233 - var data = rs;  
234 - $('.historyDetail').html($(common.util.__template2($("#template2").html(), data.data)));  
235 - if(data.code != 200){  
236 - common.util.__tip(data.message);  
237 - }  
238 - },  
239 - error: function (rs) {  
240 - $('.historyDetail').html($(common.util.__template2($("#template2").html(), {})));  
241 - common.util.__tip(rs.data.message);  
242 - } 248 + getHistoryList(skn);
  249 +});
  250 +//删除变价记录
  251 +$(document).on('click', '.deleteHistory', function () {
  252 + var skn = $(this).data('skn');
  253 + var planId = $(this).data('planid');
  254 + new common.dialog({
  255 + title: "删除变价记录确认",
  256 + width: "360px",
  257 + content: '确认删除该变价记录么?',
  258 + zIndex: 52,
  259 + button: [
  260 + {value: "确认", css:"btn-primary", callback: function () {
  261 + common.util.__ajax({
  262 + url: '/product/deletePricePlan',
  263 + data: {param:planId}
  264 + }, function () {
  265 + getHistoryList(skn);
  266 + });
  267 + }},
  268 + {value: "取消", css:"btn-default"}
  269 + ]
243 }); 270 });
244 }); 271 });
245 //筛选 272 //筛选