listDetails.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // lionfish_comshop/pages/groupCenter/listDetails.js
  2. var app =getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. isIpx: app.globalData.isIpx,
  9. list: [],
  10. state: 0
  11. },
  12. list_id: '',
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. let list_id = options.id || '';
  18. let state = options.state || 0;
  19. if (list_id) {
  20. this.setData({ state });
  21. wx.showLoading();
  22. this.list_id = list_id;
  23. this.getData(list_id);
  24. } else {
  25. wx.redirectTo({
  26. url: '/lionfish_comshop/pages/groupCenter/list',
  27. })
  28. }
  29. },
  30. getData: function (list_id) {
  31. let that = this;
  32. var token = wx.getStorageSync('token');
  33. app.util.request({
  34. 'url': 'entry/wxapp/index',
  35. 'data': {
  36. controller: 'community.get_head_deliverygoods',
  37. token: token,
  38. list_id: list_id
  39. },
  40. dataType: 'json',
  41. success: function (res) {
  42. wx.hideLoading();
  43. console.log(res);
  44. if (res.data.code == 0) {
  45. that.setData({
  46. list: res.data.data || []
  47. })
  48. }
  49. },
  50. fail: (err)=> {
  51. console.log(err);
  52. wx.hideLoading();
  53. }
  54. })
  55. },
  56. signAll: function () {
  57. let that = this;
  58. let token = wx.getStorageSync('token');
  59. let list_id = this.list_id;
  60. app.util.request({
  61. 'url': 'entry/wxapp/index',
  62. 'data': {
  63. controller: 'community.sub_head_delivery',
  64. token: token,
  65. list_id: list_id
  66. },
  67. dataType: 'json',
  68. success: function (res) {
  69. wx.hideLoading();
  70. console.log(res);
  71. if (res.data.code == 0) {
  72. wx.showToast({
  73. title: '收货成功',
  74. icon: false
  75. })
  76. setTimeout(()=>{
  77. wx.redirectTo({
  78. url: '/lionfish_comshop/pages/groupCenter/list',
  79. })
  80. }, 2000);
  81. } else {
  82. wx.showToast({
  83. title: '签收失败,请重试!',
  84. icon: false
  85. })
  86. }
  87. },
  88. fail: (err) => {
  89. console.log(err);
  90. wx.hideLoading();
  91. }
  92. })
  93. },
  94. /**
  95. * 生命周期函数--监听页面初次渲染完成
  96. */
  97. onReady: function () {
  98. },
  99. /**
  100. * 生命周期函数--监听页面显示
  101. */
  102. onShow: function () {
  103. },
  104. /**
  105. * 生命周期函数--监听页面隐藏
  106. */
  107. onHide: function () {
  108. },
  109. /**
  110. * 生命周期函数--监听页面卸载
  111. */
  112. onUnload: function () {
  113. },
  114. /**
  115. * 页面相关事件处理函数--监听用户下拉动作
  116. */
  117. onPullDownRefresh: function () {
  118. },
  119. /**
  120. * 页面上拉触底事件的处理函数
  121. */
  122. onReachBottom: function () {
  123. }
  124. })