const app = getApp()
import { Base } from '../../utils/base';
import apiList from '../../utils/apiList';
const base = new Base();
Page({
	data: {
		status: '1', //支付状态
		repair_order_id: '',
		failData: '',
	},
	onLoad: function (options) {
		this.setData({
			status: options.status,
			repair_order_id: options.repair_order_id

		})
        console.log('支付状态-----' + options.status)
        console.log('支付状态-----' + options.repair_order_id)
    },
    back(){
		app.globalData.tjgs_fresh = true
        wx.switchTab({
            url: '/pages/tabbar/my/my',
        })
    },
    payAgain(){
        let that = this;
        let params = {
			url: apiList.material_signPay,
			type: "GET",
			data: {
				repair_order_id: this.data.repair_order_id
			},
			callback: (data) => {
				console.log(data)
				wx.requestPayment({
					'timeStamp': data.timeStamp,
					'nonceStr': data.nonceStr,
					'package': data.package,
					'signType': data.signType,
					'paySign': data.paySign,
					'success': function (res) {
						console.log(res);
						that.setData({
                            status: 1
                        })
					},
					'fail': function (res) {
						that.setData({
                            status: 0
                        })
					}
				})
			},
		}
		wx.showLoading({
			title: '努力加载中...',
		})
		base.newRequest(params)
    }

})