marketing.Vip.Index.js 2.08 KB
webpackJsonp([93],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';
	var $ = __webpack_require__(1),
	    common=__webpack_require__(2);
	var Bll={
	    getTime: function (time) {
	        var t = new Date(time * 1000);
	        return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
	    }
	};
	var g = new common.grid({
	    el: '#basicTable',
	    parms: function(){
	        return {
	            type: 1,
	            status: 1
	        };
	    },
	    columns:[
	        {display: '活动名称', name: 'title'},
	        {display: '活动类型', render: function() {
	            return '积分翻倍';
	        }},
	        {display: '倍数', name: 'num'},
	        {display: '活动时间', render: function(item) {
	            return Bll.getTime(item.startTime)+"至"+Bll.getTime(item.endTime)
	        }},
	        {display: '创建人员', name: 'addUserName'},
	        {display: '活动创建时间', render: function(item) {
	            return Bll.getTime(item.createTime)
	        }},
	        {display: '操作', render: function(item) {
	            if (item.validFlag == 1) {
	                $('#add-btn').addClass('disabled');
	                return '<a class="btn btn-info end-btn" data-id="' + item.id + '" href="javascript:;">停止</a>';
	            } else {
	                return '活动已结束';
	            }

	        }}
	    ],
	    callback: function(data) {
	        if (data.data.activity.data.list.length > 0) {
	            $('#add-btn').addClass('disabled');
	        }
	        return data.data.vipList.data;
	    }
	});
	g.init("/market/vipamount/list");

	$('#basicTable').on('click', '.end-btn', function() {
	    var activeId = $(this).data('id');
	    common.dialog.confirm("温馨提示", "您确定要停止此活动吗?", function(){
	        common.util.__ajax({
	            url:'/market/vipamount/save',
	            data: {
	                status: 1,
	                id: activeId
	            }
	        },function(){
	            $('#add-btn').removeClass('disabled');
	            g.reload();
	        });
	    });
	});



/***/ }
]);