index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // pages/login/login.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. frameStyle: { useTop: true, name: '商户人员', leftArrow: true, useBar: false },
  9. // 主体高度
  10. infoHeight: '',
  11. // 查询条件
  12. shoopingtext: '',
  13. list: [],
  14. // 弹框
  15. dialog: { title: '详细信息', show: false, type: '1' },
  16. // 详细信息
  17. info: { id: '2', name: '测试商户2', phone: '13174420325', address: '吉林省长春市', status: '0' },
  18. },
  19. back: function () {
  20. wx.navigateBack({ url: '/pages/home/index' })
  21. },
  22. // 详细信息
  23. toView: function (e) {
  24. const { id } = e.currentTarget.dataset;
  25. console.log(id);
  26. // this.setData({ info: {} })
  27. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  28. },
  29. // 检查信息登记
  30. toInspect: function (e) {
  31. const { id } = e.currentTarget.dataset;
  32. console.log(id);
  33. wx.navigateTo({ url: `/pages/user_merchant/inspect?id=${id}` })
  34. },
  35. // 信息纠错
  36. toError: function (e) {
  37. const { id } = e.currentTarget.dataset;
  38. console.log(id);
  39. wx.navigateTo({ url: `/pages/user_merchant/error?id=${id}` })
  40. },
  41. // 既往检查历史
  42. toHistory: function (e) {
  43. const { id } = e.currentTarget.dataset;
  44. console.log(id);
  45. wx.navigateTo({ url: `/pages/user_merchant/history?id=${id}` })
  46. },
  47. /**
  48. * 生命周期函数--监听页面加载
  49. */
  50. onLoad: function (options) {
  51. // 计算高度
  52. this.searchHeight();
  53. // 查询信息
  54. this.search();
  55. },
  56. // 查询条件
  57. search: function () {
  58. let name = this.data.shoopingtext;
  59. if (name) {
  60. console.log(name);
  61. }
  62. let data = [{ id: '1', name: '测试商户1', phone: '13174420325', address: '吉林省长春市', status: '0' },]
  63. this.setData({ list: data })
  64. },
  65. shoppinginput: function (e) {
  66. this.setData({ shoopingtext: e.detail.value })
  67. },
  68. // 计算高度
  69. searchHeight: function () {
  70. let frameStyle = this.data.frameStyle;
  71. let client = app.globalData.client;
  72. // 减去状态栏
  73. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  74. // 是否减去底部菜单
  75. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  76. if (infoHeight) this.setData({ infoHeight: infoHeight })
  77. },
  78. /**
  79. * 生命周期函数--监听页面初次渲染完成
  80. */
  81. onReady: function () {
  82. },
  83. /**
  84. * 生命周期函数--监听页面显示
  85. */
  86. onShow: function () {
  87. },
  88. /**
  89. * 生命周期函数--监听页面隐藏
  90. */
  91. onHide: function () {
  92. },
  93. /**
  94. * 生命周期函数--监听页面卸载
  95. */
  96. onUnload: function () {
  97. },
  98. /**
  99. * 页面相关事件处理函数--监听用户下拉动作
  100. */
  101. onPullDownRefresh: function () {
  102. },
  103. /**
  104. * 页面上拉触底事件的处理函数
  105. */
  106. onReachBottom: function () {
  107. },
  108. /**
  109. * 用户点击右上角分享
  110. */
  111. onShareAppMessage: function () {
  112. }
  113. })