express-orderid.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // pages/express-orderid/express-orderid.js
  2. var api = require('../../api.js');
  3. var app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. },
  10. goto: function (e) {
  11. wx.redirectTo({
  12. url: "/pages/express-company/express-company?order_id=" + this.data.order_id
  13. });
  14. },
  15. getExpress: function(e){
  16. this.setData({
  17. express_num: e.detail.value
  18. })
  19. },
  20. submit: function(){
  21. var that = this;
  22. if (that.data.express_name == undefined) {
  23. wx.showToast({
  24. title: '快递公司必填',
  25. icon: 'none'
  26. })
  27. return;
  28. }
  29. if (that.data.express_num == undefined) {
  30. wx.showToast({
  31. title: '运单号必填',
  32. icon: 'none'
  33. })
  34. return;
  35. }
  36. app.request({
  37. url: api.order.express_num,
  38. data:{
  39. order_id: that.data.order_id,
  40. express_name: that.data.express_name,
  41. express_num: that.data.express_num
  42. },
  43. success: function(res){
  44. if (res.code == 0) {
  45. // wx.navigateBack({
  46. // delta: 2,
  47. // });
  48. wx.redirectTo({
  49. url: '/pages/order-refund-detail/order-refund-detail?id=' + that.data.order_id,
  50. })
  51. }
  52. }
  53. })
  54. },
  55. /**
  56. * 生命周期函数--监听页面加载
  57. */
  58. onLoad: function (options) {
  59. var that = this;
  60. that.setData({
  61. order_id: options.order_id
  62. })
  63. if (options.express_name){
  64. that.setData({
  65. express_name: options.express_name
  66. })
  67. }
  68. },
  69. /**
  70. * 生命周期函数--监听页面初次渲染完成
  71. */
  72. onReady: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面显示
  76. */
  77. onShow: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面隐藏
  81. */
  82. onHide: function () {
  83. },
  84. /**
  85. * 生命周期函数--监听页面卸载
  86. */
  87. onUnload: function () {
  88. },
  89. /**
  90. * 页面相关事件处理函数--监听用户下拉动作
  91. */
  92. onPullDownRefresh: function () {
  93. },
  94. /**
  95. * 页面上拉触底事件的处理函数
  96. */
  97. onReachBottom: function () {
  98. },
  99. /**
  100. * 用户点击右上角分享
  101. */
  102. onShareAppMessage: function () {
  103. }
  104. })