jquery之提示信息

//生成优惠券并分发
function saveCouponAssign(){
    //发行券种
    var couponTypeId = $("#couponTypeId").combobox("getValue");
    //生成张数
    var publishAmount = $('#publishAmount').val();
    //开始日期
    var beginDate = $('#beginDate').datebox("getValue");
    //结束日期
    var endDate = $('#endDate').datebox("getValue");
    //券号前缀
    var numberPrefix = $('#numberPrefix').val();
    //券号长度
    var numberLength = $('#numberLength').val();
    //发行描述
    var publishNotes = $('#publishNotes').val();

    if(couponTypeId==''){
        $('#couponTypeNot').css('display','');
        return;
    }else{
        $('#couponTypeNot').css('display','none');
    }
    if(publishAmount==''){
        $('#publishAmountNot').css('display','');
        return;
    }else{
        $('#publishAmountNot').css('display','none');
    }
    if(isNaN(publishAmount)){
        $.messager.alert('提示信息','生成张数请输入数字!','info');
        return;
    }
    if(beginDate==''){
        $('#beginDateNot').css('display','');
        return;
    }else{
        $('#beginDateNot').css('display','none');
    }
    if(endDate==''){
        $('#endDateNot').css('display','');
        return;
    }else{
        $('#endDateNot').css('display','none');
    }
    if(beginDate && endDate && parseFloat(beginDate.replace(/\-/g,""))>parseFloat(endDate.replace(/\-/g,""))){
        $.messager.alert('提示信息','开始日期要小于或等于结束日期','info');
        return;
    }
    if(numberPrefix==''){
        $('#numberPrefixNot').css('display','');
        return;
    }else{
        $('#numberPrefixNot').css('display','none');
    }
    if(numberPrefix.length<2 || numberPrefix.length>4){
        $('#numberPrefixLimit').css('display','');
        return;
    }else{
        $('#numberPrefixLimit').css('display','none');
    }

    if(numberLength==''){
        $('#numberLengthNot').css('display','');
        return;
    }else{
        $('#numberLengthNot').css('display','none');
    }
    if(isNaN(numberLength)){
        $.messager.alert('提示信息','券号长度请输入数字!','info');
        return;
    }
    if(parseInt(numberLength)<6){
        $('#numberLengthLimit').css('display','');
        return;
    }else{
        $('#numberLengthLimit').css('display','none');
    }
    if(parseInt(numberLength)>32){
        $('#numberLengthLimit').css('display','');
        return;
    }else{
        $('#numberLengthLimit').css('display','none');
    }

    //页面查询条件start
    var loginName = $.trim($('#loginName').val());
    var mobile = $.trim($('#mobile').val());
    var memberRankId = $.trim($("#memberRankId").combobox("getValue"));
    var memberTagIds = $.trim($("#memberTagIds").combobox("getValue"));
    var sex = $.trim($("#sex").combobox("getValue"));
    var provinceId = $.trim($("#provinceId").combobox("getValue"));
    var cityId = $.trim($("#cityId").combobox("getValue"));
    var areaId = $.trim($("#areaId").combobox("getValue"));
    var regTimeBg = $.trim($("#regTimeBg").datebox("getValue"));
    var regTimeEd = $.trim($("#regTimeEd").datebox("getValue"));
    var sumFeesBg = $.trim($('#sumFeesBg').val());
    var sumFeesEd = $.trim($('#sumFeesEd').val());
    var sumOrdersBg = $.trim($('#sumOrdersBg').val());
    var sumOrdersEd = $.trim($('#sumOrdersEd').val());
    var currentPointsBg = $.trim($('#currentPointsBg').val());
    var currentPointsEd = $.trim($('#currentPointsEd').val());
    //页面查询条件end

    var type = "save";
    if($('#publishId').val()!=''){
        type = "update";
    }

    var data = {publishId:$('#publishId').val(),memberId:$('#memberId').val(),type:type,couponTypeId:couponTypeId,publishAmount:publishAmount,
            beginDate:beginDate,endDate:endDate,numberPrefix:numberPrefix,numberLength:numberLength,
            publishNotes:publishNotes,isDelete:'N',loginName:loginName,mobile:mobile,memberRankId:memberRankId,
            memberTagIds:memberTagIds,sex:sex,provinceId:provinceId,cityId:cityId,areaId:areaId,
            regTimeBg:regTimeBg,regTimeEd:regTimeEd,sumFeesBg:sumFeesBg,sumFeesEd:sumFeesEd,sumOrdersBg:sumOrdersBg,
            sumOrdersEd:sumOrdersEd,currentPointsBg:currentPointsBg,currentPointsEd:currentPointsEd};

    doAjax({
        url:appPath+'/page/couponAssign/updateCouponAssign',
        type:'post',
        data:data,
        success:function(data){
            if(data=='ok'){
                $.messager.alert('提示信息','生成优惠券并分发成功','info');
            }
            reloadGrid();
            $('#addAssignsDlg').window('close');
        },
        error:function(XMLHttpRequest, textStatus, errorThrown){
            $.messager.alert('提示信息','抱歉,生成优惠券并分发失败,'+textStatus,'error');
            reloadGrid();
        }
    });
}
  <tr>
                    <td class="queryTitle" width="100">券号前缀</td>
                    <td class="queryContent" width="100">
                        <input class="inputText" type="text" id="numberPrefix" />
                        <label id="numberPrefixNot" style="color: red;display: none;">* 券号前缀不能为空</label>
                        <label id="numberPrefixLimit" style="color: red;display: none;">* 券号前缀为2~4位</label>
                    </td>
                    <td class="queryTitle" width="100">券号长度</td>
                    <td class="queryContent" width="100">
                        <input class="inputText" type="text" id="numberLength" />
                        <label id="numberLengthNot" style="color: red;display: none;">* 券号长度不能为空</label>
                        <label id="numberLengthLimit" style="color: red;display: none;">* 券号长度不能少于6位,且不能大于32位</label>
                    </td>
                </tr>
上一篇:浏览器-09 javascript引擎和Chromium网络栈


下一篇:Ubuntu 16.04 安装垃圾清理工具 BleachBit