sendHistory.js 1.51 KB
/**
 * Created by ty on 2016/5/23.
 */

'use strict';
var $ = require('jquery'),
    common = require('../common/common');

var couponId = location.href.substring(location.href.lastIndexOf("/") + 1);

//下拉框
new common.dropDown({el: '#filter-status'});
var Bll = {
    getTime: function (time) {
        var t = new Date(time * 1000);
        return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");

    }
};
//grid
var g = new common.grid({
    el: '#content-list',
    hash: false,
    async: false,
    parms: function () {
        return {
            couponId: couponId
            //status:common.util.__input("filter-status")
        };
    },
    columns: [
        {display: "单券号", name: "couponCode"},
        {display: "用户ID", name: "uid"},
        {
            display: '发放时间', render: function (item) {
            return Bll.getTime(item.createTime);
        }
        }
    ]
});
g.init("/couponLogs/queryUserCouponLogsList");
$("#count").html(g.total);

$(document).on("click", "#filter-btn", function () {
    g.reload(1);
});

//导出
$(document).on('click', '#export-btn', function () {
    var total = g.total;
    if (total <= 0) {
        common.util.__tip("当前0条数据,无需导出!", "warning")
    } else {
        var queryConf = JSON.stringify({couponId: couponId});
        window.open("/ajax/down?queryConf=" + queryConf + "&type=couponLogsExport");
    }
});

//输入限制
$(document).on("keyup", ".number", function () {
    $(this).val($(this).val().replace(/\D/g, ''));
});