let App = getApp(); Page({ /** * 页面的初始数据 */ data: { IMG_NAME: App.IMG_NAME, order_id: null, order: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.data.order_id = options.order_id; this.getOrderDetail(options.order_id) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, // 输入绑定 textareaInput(e) { this.setData({ refoundTexts: e.detail.value }) }, // 退款 send() { let that = this; if (!that.data.refoundTexts) { wx.showToast({ title: '输入退款原因', icon: 'none', }) return } App.AjaxRequest('post', { 'Authorization': 'Bearer ' + App.Getopenid() }, '/orders/refundOrder?orderId=' + that.data.order_id + '&reason=' + that.data.refoundTexts, {}, function (res) { if (res.code == 0) { wx.navigateBack() } }) }, /** * 获取订单详情 */ getOrderDetail(order_id) { let _this = this, params = { orderId: order_id } App.AjaxRequest('get', { 'Authorization': 'Bearer ' + App.Getopenid() }, '/orders/orderDetail', params, function (res) { if (res.code == 0) { console.log(res.data) _this.setData({ order: res.data }) } }) }, })