paydetail.js 1.4 KB

var oid=GetQueryString("oid");
console.log(oid);

new Vue({
	el:'#paydetail',
	filters:{
		stoptype:function(type){
			return type=='1'?'自提':type=='2'?'堂食':""
		},
		payment:function(pay){
			return pay=='1'?'余额支付':pay=='2'?'微信支付':""
		}
	},
	data:{
		orderinfo:[],
		ordergood:[]
	},
	created: function() {
		this.details();
	},
	methods: {
		//获取信息
		details: function() {
			var that = this;
			var url = '/UserCenter/orderDetail'
			var params = {
				oid:oid
				
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				var data=res.data;
				console.log(data)
				that.orderinfo=data.order_info;
				that.ordergood=data.order_goods;
				console.log(that.orderinfo);
				console.log(that.ordergood);

			})
		},
        //取消订单
        cancel:function(){

            var url = '/UserCenter/cancelOrder'
            var params = {
                unique_id: localStorage.getItem('unique_id'),
                oid: oid
            }
            ajaxsend(url, params, function(res) {
                console.log(res);
                if(res.status==true) {
                    alert("取消成功");
                    window.location.reload();
                }else if(res.status==false){
                    alert("取消失败");
                    window.location.reload();
                }

            })
        }
	
	}

})