// pages/editboCaiProfit/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { totalProfit:'', orderId:'' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options.orderId); this.setData({ boCaiProfit:options.totalProfit, orderId:options.orderId }) }, cancelForm(){ wx.navigateBack({ delta: -1, }) }, formSubmit(e) { var that = this; wx.showLoading({ title: '提交中...', }) console.log(e.detail); if(app.isEmptyCheck(e.detail.value.textarea)){ wx.showToast({ title: '内容不能为空', icon: 'error', duration: 1000 }) wx.hideLoading(); return } let currData = {}; currData["totalProfit"] = e.detail.value.textarea; currData["orderId"] = that.data.orderId; wx.request({ url: app.globalData.ip + "/user/apply/order/changeTotalProfit", header: app.globalData.header, method: "POST", data: currData, success: function (res) { console.log(res); if(res.statusCode == 404){ wx.showToast({ title: '暂不支持修改', icon: 'error', duration: 1000 }) }else{ wx.showToast({ title: '修改成功', icon: 'success', duration: 1000 }) wx.hideLoading(); } setTimeout(() => { wx.navigateBack({ delta: 1, }) },1000) }, fail:function(res){ console.log(app.globalData.ip); console.log(res); wx.showToast({ title: '修改失败', icon: 'success', duration: 1000 }) wx.hideLoading(); } }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })