refund-order.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // pages/refund-order/refund-order.js
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. search:'',
  9. url: app.globalData.urlImages,
  10. first:0,
  11. orderType:'-3',
  12. orderlist:[]
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. app.setBarColor();
  19. app.setUserInfo();
  20. this.getorderlist();
  21. },
  22. searchSubmit: function () {
  23. this.setData({
  24. orderlist: [],
  25. first: 0,
  26. });
  27. var e = this.data.nowstatus;
  28. this.getorderlist(e);
  29. },
  30. searchInput: function (e) {
  31. this.setData({
  32. search: e.detail.value
  33. });
  34. },
  35. getorderlist: function () {
  36. var header = {
  37. 'content-type': 'application/x-www-form-urlencoded',
  38. };
  39. var that = this;
  40. var search = that.data.search;
  41. var limit = 8;
  42. var orderType = that.data.orderType;
  43. var first = that.data.first;
  44. var startpage = limit * first;
  45. wx.request({
  46. url: app.globalData.url + '/routine/auth_api/get_user_order_list?uid=' + app.globalData.uid,
  47. data: { type: orderType, search: search, first: startpage, limit: limit },
  48. method: 'get',
  49. header: header,
  50. success: function (res) {
  51. var $data = res.data.data;
  52. if (!startpage && !$data.length){
  53. wx.showToast({
  54. title: '暂无订单',
  55. icon: 'none',
  56. duration: 2000
  57. })
  58. } else {
  59. var len = $data.length;
  60. for (var i = 0; i < len; i++) {
  61. that.data.orderlist.push($data[i]);
  62. }
  63. that.setData({
  64. first: first + 1,
  65. orderlist: that.data.orderlist
  66. });
  67. }
  68. },
  69. fail: function (res) {
  70. console.log('submit fail');
  71. },
  72. complete: function (res) {
  73. console.log('submit complete');
  74. }
  75. });
  76. },
  77. /**
  78. * 生命周期函数--监听页面初次渲染完成
  79. */
  80. onReady: function () {
  81. },
  82. /**
  83. * 生命周期函数--监听页面显示
  84. */
  85. onShow: function () {
  86. },
  87. /**
  88. * 生命周期函数--监听页面隐藏
  89. */
  90. onHide: function () {
  91. },
  92. /**
  93. * 生命周期函数--监听页面卸载
  94. */
  95. onUnload: function () {
  96. },
  97. /**
  98. * 页面相关事件处理函数--监听用户下拉动作
  99. */
  100. onPullDownRefresh: function () {
  101. },
  102. /**
  103. * 页面上拉触底事件的处理函数
  104. */
  105. onReachBottom: function () {
  106. this.getorderlist();
  107. },
  108. /**
  109. * 用户点击右上角分享
  110. */
  111. onShareAppMessage: function () {
  112. }
  113. })