refundList.js 5.1 KB

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