discount.js 2.3 KB
new Vue({
	el:'#discount',
	data: {	
	 discount:[]
	},
	created: function() {
		this.details();
	},
	methods: {
		//获取信息
		details: function() {
			var that = this;
			var url = '/DiscountCoupon/index'
			var params = {
				status:1,
				unique_id: localStorage.getItem('unique_id')
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				if(res.state=="fail"){
//					alert("暂无数据");
					that.discount=[];
				}else if(res.state=="success"){
					that.discount=res.data;
					console.log(that.discount)
				}

			})
		},
		unuse:function(event){
			var that = this;
			var el = event.currentTarget;
			$(el).addClass("active");
			$(el).siblings().removeClass("active");
			var url = '/DiscountCoupon/index'
			var params = {
				status:1,
				unique_id: localStorage.getItem('unique_id')
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				if(res.state=="fail"){
//					alert("暂无数据");
					that.discount=[];
				}else if(res.state=="success"){
					that.discount=res.data;
					console.log(that.discount)
				}

			})
		},
		alreadyuse:function(event){
			var that = this;
			var el = event.currentTarget;
			$(el).addClass("active");
			$(el).siblings().removeClass("active");
			var url = '/DiscountCoupon/index'
			var params = {
				status:2,
				unique_id: localStorage.getItem('unique_id')
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				if(res.state=="fail"){
//					alert("暂无数据");
					that.discount=[];
				}else if(res.state=="success"){
					that.discount=res.data;
					console.log(that.discount)
				}

			})
		},
		expired:function(){
			var that = this;
			var el = event.currentTarget;
			$(el).addClass("active");
			$(el).siblings().removeClass("active");
			var url = '/DiscountCoupon/index'
			var params = {
				status:3,
				unique_id: localStorage.getItem('unique_id')
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				if(res.state=="fail"){
//					alert("暂无数据");
					that.discount=[];
				}else if(res.state=="success"){
					that.discount=res.data;
					console.log(that.discount)
				}

			})
		}

	},
	
	
})