Authored by shuaiguo

Merge branch 'refs/heads/feature/6.9.24' into gray

@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 <option value="Degressdiscount">分件折扣</option> 17 <option value="Degressdiscount">分件折扣</option>
18 <option value="Cheapestfree">满X免1</option> 18 <option value="Cheapestfree">满X免1</option>
19 <option value="SpecifiedAmount">X件X元</option> 19 <option value="SpecifiedAmount">X件X元</option>
  20 + <option value="LoopCashReduce">每满减</option>
20 </select> 21 </select>
21 </div> 22 </div>
22 </div> 23 </div>
@@ -39,6 +39,27 @@ var operationEdit={ @@ -39,6 +39,27 @@ var operationEdit={
39 } 39 }
40 ] 40 ]
41 }, 41 },
  42 + LoopCashReduce:{
  43 + enName:'LoopCashReduce',
  44 + cnName : '每满减',
  45 + param_list : [
  46 + {
  47 + name:'maxLoopNumber' ,
  48 + display_name : '循环上限',
  49 + type : 'text',
  50 + default_value : '10000',
  51 + post_label: '倍',
  52 + required: true
  53 + },
  54 + {
  55 + name:'reduce' ,
  56 + display_name : '满减',
  57 + type : 'text',
  58 + default_value : '',
  59 + required: true
  60 + }
  61 + ]
  62 + },
42 Gift:{ 63 Gift:{
43 enName:'Gift', 64 enName:'Gift',
44 cnName:'赠品', 65 cnName:'赠品',
@@ -188,7 +209,10 @@ var operationEdit={ @@ -188,7 +209,10 @@ var operationEdit={
188 for(var _index in _data.param_list){ 209 for(var _index in _data.param_list){
189 _param=_data.param_list[_index]; 210 _param=_data.param_list[_index];
190 var _html=_htmlObj.clone(); 211 var _html=_htmlObj.clone();
191 - _html.children("label").html(_param.display_name); 212 + var $label = _html.children("label").html(_param.display_name);
  213 + if(_param.required) {
  214 + $label.append($("<span class=\" red \" style=\"padding-left: 5px\">*</span>"));
  215 + }
192 var _input; 216 var _input;
193 switch(_param.type){ 217 switch(_param.type){
194 case "text": 218 case "text":
@@ -211,7 +235,11 @@ var operationEdit={ @@ -211,7 +235,11 @@ var operationEdit={
211 } 235 }
212 _input.attr("id",_param.name); 236 _input.attr("id",_param.name);
213 _input.attr("name",_param.name); 237 _input.attr("name",_param.name);
214 - _html.children("div").html(_input); 238 + var $inputParent = _html.children("div").html(_input);
  239 + if(_param.post_label) {
  240 + $inputParent.css({'display': 'flex', 'align-items': 'center'});
  241 + $inputParent.append($('<span>倍</span>').css('padding-left', '10px'))
  242 + }
215 if(_param.remark){ 243 if(_param.remark){
216 var _remark=$("<label class=\"control-label red\"></label>"); 244 var _remark=$("<label class=\"control-label red\"></label>");
217 _remark.html(_param.remark); 245 _remark.html(_param.remark);
@@ -259,9 +287,13 @@ var operationEdit={ @@ -259,9 +287,13 @@ var operationEdit={
259 case this.config.SpecifiedAmount.enName: 287 case this.config.SpecifiedAmount.enName:
260 _selectObj=this.config.SpecifiedAmount; 288 _selectObj=this.config.SpecifiedAmount;
261 break; 289 break;
  290 + case this.config.LoopCashReduce.enName:
  291 + _selectObj=this.config.LoopCashReduce
  292 + break;
262 } 293 }
263 this.template(firstGroup,_selectObj); 294 this.template(firstGroup,_selectObj);
264 }, 295 },
  296 + LoopCashReduce: function() {},
265 bindEvent:function(){ 297 bindEvent:function(){
266 var _g=this; 298 var _g=this;
267 $('#save_operation').off(); 299 $('#save_operation').off();
@@ -311,6 +343,18 @@ var operationEdit={ @@ -311,6 +343,18 @@ var operationEdit={
311 return false; 343 return false;
312 } 344 }
313 345
  346 + if(reqData["promotionType"] === 'LoopCashReduce') {
  347 + if(!(/^[1-9]\d*(\.\d{1})?$/.test(_temp.reduce))) {
  348 + common.util.__tip("满减金额为大于0且最多精确到小数点后1位", "warning");
  349 + return false;
  350 + }
  351 + if(!(/^[1-9]\d*(\.{0})$/.test(_temp.maxLoopNumber))) {
  352 + common.util.__tip("循环上限填写倍数为大于1的整数", "warning");
  353 + return false;
  354 + }
  355 +
  356 + }
  357 +
314 _actionParam = JSON.stringify(_temp); 358 _actionParam = JSON.stringify(_temp);
315 reqData["actionParam"]=_actionParam; 359 reqData["actionParam"]=_actionParam;
316 } 360 }