Authored by 马力

Merge branch 'dev_促销优化'

... ... @@ -71,6 +71,12 @@ var g = new common.grid({
display: '操作',
name: "status",
render: function(items) {
//支付类型的促销不允许修改
if(items.promotionParams
&& items.promotionParams.promotionType
&& items.promotionParams.promotionType=="Payment"){
return "";
}
var HtmArr = [];
HtmArr.push('<a href="/promotionInfo/edit/' + items.id + '"" class="btn btn-info btn-xs">编辑</a>');
if(items.isDel==="N"){
... ...
... ... @@ -4,7 +4,9 @@ var edit = require('../../../../common/edit');
var jsonUtils=require('./jsonUtils');
var promotionInfoRefresh=require('./promotionInfoRefresh');
console.log("operationEdit in");
var regrex_special_prds = new RegExp(/^\d{1,9}(,\d{1,9})*$/);
var regrex_double =new RegExp(/\d+(\.\d+)?/);
var regrex_small_digit =new RegExp(/[0]\.\d{1,2}/);
var operationEdit={
tabLoader:null,
columnName:null,
... ... @@ -342,13 +344,60 @@ var operationEdit={
var _g=this;
var result=true;
switch(_reqData["promotionType"]){
//打折 请使用小数,例如:0.85,表示85折
case _g.config.Discount.enName:
var discount = _reqData["data"]["discount"];
result = regrex_small_digit.test(discount);
break;
//满减 double
case _g.config.Cashreduce.enName:
var reduce = _reqData["data"]["reduce"];
result = regrex_double.test(reduce);
break;
//赠品 多个使用英文逗号(,)分割,例如:"50017804,50019370"
case _g.config.Gift.enName:
var gift_list = _reqData["data"]["gift_list"];
result = regrex_special_prds.test(gift_list);
break;
/*
case _g.config.Changeshippingfee.enName:
break; //调整运费
//VIP固定折扣
case _g.config.Vipfixeddiscount.enName:
break;
//送优惠券
case _g.config.Givecoupon.enName:
break;
*/
//加价购
// goods_list 商品列表 多个使用英文逗号(,)分割,例如:"50017804,50019370"
//add_cost 支付金额 double
case _g.config.Needpaygift.enName:
var goods_list = _reqData["data"]["goods_list"];
var add_cost = _reqData["data"]["add_cost"];
result = regrex_double.test(add_cost) && regrex_special_prds.test(goods_list);
break;
//满X免1
case _g.config.Cheapestfree.enName:
break;
//分件折扣
case _g.config.Degressdiscount.enName:
var regrex=new RegExp(/(\d+:\d+(\.\d+)?)(;\d+:\d+(\.\d+)?)*/,'g');
//new RegExp(/^(\d+:\d+(\.\d+);)*(\d+:\d+(\.\d+)?)/)
//var regrex=new RegExp(/(\d+:\d+(\.\d+)?)(;\d+:\d+(\.\d+)?)*/);
//^\s*(\d+:\d+\.?\d*;)*(\d+:\d+\.?\d*)\s*$
var _regexp = new RegExp(/^(\d+:\d+(\.\d+)?;)*(\d+:\d+(\.\d+)?)$/);
var degress_discount_list=_reqData["data"]["degress_discount_list"];
result = regrex.test(degress_discount_list);
result = _regexp.test(degress_discount_list);
break;
//X件X元
case _g.config.SpecifiedAmount.enName:
var regrex=new RegExp(/^\d+:\d+(\.\d+)?$/,'g');
var regrex=new RegExp(/^\d+:\d+(\.\d+)?$/);
var specified_amount_list=_reqData["data"]["specified_amount_list"];
result = regrex.test(specified_amount_list);
break;
... ...
... ... @@ -33,7 +33,7 @@ var conditionValidate={
var value_l2,value_l3;
var regrex_int = new RegExp(/^\d+$/);
var regrex_float_2b = new RegExp(/^\d+(\.\d{1,2})?$/);
var regrex_special_prds = new RegExp(/^\d+(,\d+)*$/);
var regrex_special_prds = new RegExp(/^\d{1,9}(,\d{1,9})*$/);
var errorMsg={};
var int_22 = Number("22"), int_1 = Number("1"), int_2 = Number("2");
for(var key2 in conditions_l1){
... ...