refundList.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. var app = getApp()
  2. Page({
  3. mixins: [require('../../mixin/globalMixin.js')],
  4. data: {
  5. containerHeight: 0,
  6. scrollTop: 0,
  7. currentTab: "0",
  8. navList: [{
  9. name: "全部",
  10. status: "0"
  11. }, {
  12. name: "处理中",
  13. status: "1"
  14. }, {
  15. name: "已退款",
  16. status: "2"
  17. }, {
  18. name: "已拒绝",
  19. status: "3"
  20. }],
  21. refundList: [],
  22. loading: true,
  23. page: 1,
  24. loadover: false,
  25. order_status: 12,
  26. no_order: 0,
  27. hide_tip: true,
  28. order: [],
  29. tip: '正在加载',
  30. pageNum: [1, 1, 1, 1],
  31. pageSize: 20,
  32. loadText: "没有更多订单了~",
  33. LoadingComplete: ["", "", "", ""]
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad: function(options) {
  39. let sysInfo = wx.getSystemInfoSync();
  40. this.setData({
  41. currentTab: options.orderStatus || "0",
  42. containerHeight: sysInfo.windowHeight - Math.round(sysInfo.windowWidth / 375 * 55)
  43. });
  44. this.getData();
  45. },
  46. getData: function() {
  47. this.setData({
  48. isHideLoadMore: true
  49. })
  50. this.data.no_order = 1
  51. let that = this;
  52. var token = wx.getStorageSync('token');
  53. app.util.request({
  54. 'url': 'entry/wxapp/index',
  55. 'data': {
  56. controller: 'order.refundorderlist',
  57. token: token,
  58. currentTab: that.data.currentTab,
  59. page: that.data.page,
  60. order_status: that.data.order_status
  61. },
  62. dataType: 'json',
  63. success: function(res) {
  64. if (res.data.code == 0) {
  65. let rushList = that.data.order.concat(res.data.data);
  66. that.setData({
  67. order: rushList,
  68. hide_tip: true,
  69. 'no_order': 0
  70. });
  71. } else {
  72. that.setData({
  73. isHideLoadMore: true
  74. })
  75. return false;
  76. }
  77. }
  78. })
  79. },
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onShow: function() {
  84. this.setData({
  85. pageNum: [1, 1, 1, 1, 1],
  86. loading: true
  87. }), this.getAllList();
  88. },
  89. /**
  90. * 获取列表
  91. */
  92. getAllList: function() {
  93. var that = this;
  94. Promise.all([this.getDataList({
  95. pageNum: 1,
  96. status: ""
  97. }), this.getDataList({
  98. pageNum: 1,
  99. status: 1
  100. }), this.getDataList({
  101. pageNum: 1,
  102. status: 3
  103. }), this.getDataList({
  104. pageNum: 1,
  105. status: 4
  106. })])
  107. .then(function(res) {
  108. that.setData({
  109. loading: false
  110. });
  111. wx.stopPullDownRefresh();
  112. })
  113. .catch(function() {});
  114. },
  115. /**
  116. * 切换导航
  117. */
  118. switchNav: function(t) {
  119. this.data.currentTab !== t.currentTarget.dataset.current && this.setData({
  120. currentTab: t.currentTarget.dataset.current
  121. });
  122. },
  123. /**
  124. * 监控改变
  125. */
  126. bindChange: function(t) {
  127. console.log(t.detail.current);
  128. this.setData({
  129. no_order: 0,
  130. page: 1,
  131. order: [],
  132. currentTab: t.detail.current + ""
  133. });
  134. this.getData();
  135. },
  136. /**
  137. * 获取数据列表
  138. */
  139. getDataList: function(t) {
  140. let data = {
  141. pageNum: t.pageNum,
  142. pageSize: this.data.pageSize,
  143. status: t.status
  144. };
  145. // 请求数据
  146. return data;
  147. },
  148. /**
  149. * 售后详情
  150. */
  151. goRefund: function (t) {
  152. var order_id = t.currentTarget.dataset.type;
  153. wx.navigateTo({
  154. url: "/lionfish_comshop/pages/order/refunddetail?id=" + order_id
  155. });
  156. },
  157. /**
  158. * 前往订单详情
  159. */
  160. goOrder: function(t) {
  161. var order_id = t.currentTarget.dataset.type;
  162. wx.navigateTo({
  163. url: "/lionfish_comshop/pages/order/order?id=" + order_id
  164. });
  165. },
  166. /**
  167. * 撤销申请
  168. */
  169. cancelApplication: function(t) {
  170. var a = this,
  171. n = t.detail;
  172. wx.showModal({
  173. title: "撤销申请",
  174. content: "您确定要撤销本次退款申请吗?",
  175. success: function(t) {
  176. t.confirm && (0, e.default)("/shop-return-order/refund/undo", {
  177. returnOrderNo: n
  178. }).then(function(t) {
  179. 0 === t.head.error ? (wx.showToast({
  180. title: "撤销成功",
  181. icon: "none"
  182. }), a.getAllList()) : (wx.showToast({
  183. title: "该退款申请已处理",
  184. icon: "none"
  185. }), a.getAllList());
  186. }).catch(function() {});
  187. }
  188. });
  189. },
  190. /**
  191. * 页面相关事件处理函数--监听用户下拉动作
  192. */
  193. onPullDownRefresh: function() {
  194. },
  195. getCurrentList: function() {
  196. if (this.data.no_order == 1) return false;
  197. this.data.page += 1;
  198. this.getData();
  199. this.setData({
  200. isHideLoadMore: false
  201. })
  202. },
  203. /**
  204. * 页面上拉触底事件的处理函数
  205. */
  206. onReachBottom: function() {
  207. }
  208. })