partner.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const pages = require('../../mixin/pages')
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. ...pages.data(),
  9. listUrl: '/api/user/goods/shop/list',
  10. searchForm: {
  11. key_words: ''
  12. }
  13. },
  14. ...pages.methods,
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad(options) {
  19. app.fetchUserDataCallback = () => {
  20. this.setTabBarList()
  21. }
  22. this.fetchOrderList()
  23. },
  24. /**
  25. * 生命周期函数--监听页面初次渲染完成
  26. */
  27. onReady() {
  28. },
  29. /**
  30. * 生命周期函数--监听页面显示
  31. */
  32. onShow() {
  33. this.setTabBarList()
  34. },
  35. /**
  36. * 生命周期函数--监听页面隐藏
  37. */
  38. onHide() {
  39. },
  40. /**
  41. * 生命周期函数--监听页面卸载
  42. */
  43. onUnload() {
  44. },
  45. /**
  46. * 页面相关事件处理函数--监听用户下拉动作
  47. */
  48. onPullDownRefresh() {
  49. if (this.data.freshing) {
  50. return
  51. }
  52. this.setData({
  53. freshing: true
  54. })
  55. this.bindCallBack()
  56. },
  57. /**
  58. * 页面上拉触底事件的处理函数
  59. */
  60. onReachBottom() {
  61. this.fetchOrderList()
  62. },
  63. bindCallBack() {
  64. this.refreshOrderList()
  65. },
  66. jumpLeavingAMessage() {
  67. wx.navigateTo({
  68. url: '/pages/leavingAMessage/leavingAMessage'
  69. })
  70. },
  71. jumpBusinessDetail(e) {
  72. const { item } = e.currentTarget.dataset
  73. wx.navigateTo({
  74. url: '/pages/businessDetail/businessDetail?shop_id=' + item.id
  75. })
  76. },
  77. setTabBarList() {
  78. const { shop_status } = app.globalData.userInfo
  79. this.getTabBar().init()
  80. if (shop_status === 1 && this.getTabBar().data.list.findIndex(item => item.pagePath === 'pages/news/news') === -1) {
  81. this.getTabBar().setData({ list: app.globalData.tabBarList })
  82. }
  83. }
  84. })