serviceOrder.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. const app = getApp()
  2. const util = require("../../../utils/jmsUtil.js");
  3. const api = require('../../../api/jms.js');
  4. Page({
  5. noop() {
  6. },
  7. data: {
  8. userInfo: {
  9. userName: '',
  10. headImg: '',
  11. fraName: '',
  12. },
  13. serviceOrder: '',
  14. ticket: '',
  15. aftersale: '',
  16. wmsOrderCount: '',
  17. showFraWeekReportFlag: false,
  18. fraWeekReportId: null
  19. },
  20. onPageScroll(e) {
  21. },
  22. /**
  23. * 生命周期函数--监听页面加载
  24. */
  25. onLoad: function (options) {
  26. let userInfo = wx.getStorageSync('userInfo');
  27. console.log(userInfo);
  28. app.globalData.userInfo = userInfo;
  29. this.setData({
  30. userInfo: userInfo
  31. });
  32. },
  33. getHomeInfo() {
  34. util.request(api.GetHomeInfo, {}, 'GET').then(res => {
  35. if (res.errno === 0) {
  36. this.setData({
  37. serviceOrder: res.data.serviceOrder,
  38. ticket: res.data.ticket,
  39. aftersale: res.data.aftersale,
  40. wmsOrderCount: res.data.wmsOrderCount,
  41. showFraWeekReportFlag: res.data.showFraWeekReportFlag,
  42. fraWeekReportId: res.data.fraWeekReportId
  43. })
  44. } else {
  45. wx.showToast({
  46. title: res.errmsg,
  47. icon: 'none'
  48. })
  49. }
  50. });
  51. },
  52. closePopup() {
  53. console.log('closePopup');
  54. this.setData({
  55. showFraWeekReportFlag: false
  56. })
  57. },
  58. /**
  59. * 生命周期函数--监听页面显示
  60. */
  61. onShow: function () {
  62. this.getHomeInfo();
  63. },
  64. onHide: function () {
  65. console.log('onHide');
  66. },
  67. onUnload: function () {
  68. console.log('onunload');
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. exitLogin: function () {
  74. wx.showModal({
  75. title: '',
  76. confirmColor: '#b4282d',
  77. content: '退出登录?',
  78. success: function (res) {
  79. if (!res.confirm) {
  80. return;
  81. }
  82. // util.request(api.AuthLogout, {}, 'POST');
  83. app.globalData.hasLogin = false;
  84. wx.removeStorageSync('token');
  85. wx.removeStorageSync('userInfo');
  86. // wx.redirectTo({
  87. // url: '/pages/temp/login/login'
  88. // });
  89. wx.redirectTo({
  90. url: '/pages/index/index'
  91. });
  92. }
  93. })
  94. },
  95. goService() {
  96. wx.navigateTo({
  97. url: '/pages/temp/orderBoard/orderBoard'
  98. });
  99. },
  100. goTicket() {
  101. wx.navigateTo({
  102. url: '/pages/ticket/ticketList/ticketList'
  103. });
  104. },
  105. goRefund() {
  106. wx.navigateTo({
  107. url: '/pages/refund/refundList/refundList'
  108. });
  109. },
  110. goMall() {
  111. wx.navigateTo({
  112. url: '/pages/mall/catalog/catalog'
  113. });
  114. },
  115. goOrder() {
  116. wx.navigateTo({
  117. url: '/pages/mall/order/order'
  118. });
  119. },
  120. goWeekData(e) {
  121. let type=e.target.dataset.type
  122. if(type==2){
  123. let params={dataId:this.data.fraWeekReportId}
  124. util.request(api.readWeekReport, params, 'get').then(res => {
  125. if (res.errno === 0) {
  126. } else {
  127. wx.showToast({
  128. title: res.errmsg, icon: 'none'
  129. })
  130. }
  131. });
  132. }
  133. wx.navigateTo({
  134. url: '/pages/temp/fraWeekReport/fraWeekReport?id=' + this.data.fraWeekReportId,
  135. })
  136. },
  137. /**
  138. * 生命周期函数--监听页面初次渲染完成
  139. */
  140. onReady: function () {
  141. },
  142. /**
  143. * 用户点击右上角分享
  144. */
  145. onShareAppMessage: function () {
  146. },
  147. })