vipamount-edit.js 1.44 KB
var $ = require('jquery');
var edit=require('../common/edit');


var e=new edit("#basicForm");



e.on("bind",function(){
    $("select").change(function() {
        if ($(this).is($("#type1"))) {
           $("#type").val($("#type1").val());
        }
        
    });
});

e.on("bind",function(){
    $("select").change(function() {
        if ($(this).is($("#num1"))) {
           $("#num").val($("#num1").val());
        }
        
    });
});

e.init();
//提交
var submit=function(callback){
    e.submit($("#basicForm").attr("action"),function(option){
        option.success=function(res){
            res=res.data;
            if(res.code=="200"){
                e.$tip('提交成功',function(){
                    location.href="/market/vipamount/index";
                },'growl-success');
            }else{
                e.$tip(res.message);
            }
            return false;
        },
        option.error=function(res){
            e.$tip("提交失败");
        }

        
        option.data.startTime = new Date(option.data.startTime.replace('-',',')).getTime() / 1000; 
        option.data.endTime = new Date(option.data.endTime.replace('-',',')).getTime() / 1000; 
        console.log(option.data);
        callback&&callback(option.data);
    });
};

$("#save_brand").click(function(){

    submit(function(data){
        //修改数据
        /*if(data.status=="2"){
            data.status=0;
        }*/
    });
    return false;
});