var vm = new Vue({
    el: '#rrapp',
    data: {
        coupon: {sendType: 0, status: 1, couponType: 0},
        ruleValidate: {
            name: [
                {required: true, message: '优惠券名称不能为空', trigger: 'blur'}
            ]
        },
    },
    methods: {
        saveOrUpdate: function (event) {
            var url = vm.coupon.id == null ? "../coupon/save" : "../coupon/update";
            Ajax.request({
                url: url,
                params: JSON.stringify(vm.coupon),
                contentType: "application/json",
                type: 'POST',
                successCallback: function () {
                    alert('操作成功', function (index) {
                        vm.reload();
                    });
                }
            });
        },
    },
    mounted() {
        Ajax.request({
            url: "../coupon/info/" + 20,
            async: true,
            successCallback: function (r) {
                vm.coupon = r.coupon;
            }
        });
    }
});