// index.js
let myPro = require("../../utils/wxRequest.js");
let util = require("../../utils/util.js");
Page({
    data: {
		pageTitle: '支付成功',
		showBack: true,
		showHeader: false
    },
    onLoad: function (options) {
        // Do some initialize when page load.
		let that = this;
		that.setData({
			order_id: options.order_id
		});
    },
    onShow: function () {
        // Do something when page show.
		let that = this;
		// 获取订单信息
		that.getOrderDetail();
    },
	// 获取订单信息
	getOrderDetail(){
		let that = this;
		let params = {
			order_id: that.data.order_id
		};
		myPro.wxRequest("user/v2/order/detail","GET",params).then(res=>{
			that.setData({
				orderInfo: res.result
			});
		}).catch(err=>{
			console.log('报错信息',err);
			wx.showToast({
				title: err,
				icon: "none"
			});
		})
	},
	// 去订单详情
	toOrderDetail(event){
		let that = this;
		wx.redirectTo({
			url: "/pages/user/order/detail/index?order_id="+that.data.order_id
		});
	},
    onReady: function () {
        // Do something when page ready.
    },
    onHide: function () {
        // Do something when page hide.
    },
    onUnload: function () {
        // Do something when page close.
    },
    onPullDownRefresh: function () {
        // Do something when pull down.
		
    },
    onReachBottom: function () {
        // Do something when page reach bottom.
    },
    onPageScroll: function () {
        // Do something when page scroll
		
    },
    onResize: function () {
        // Do something when page resize
    },
});
