index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. list: [
  13. { id: '1', name: '测试商户1', phone: '13174420325', address: '吉林省长春市', status: '0' },
  14. { id: '2', name: '测试商户2', phone: '13174420325', address: '吉林省长春市', status: '0' },
  15. ],
  16. // 弹框
  17. dialog: { title: '详细信息', show: false, type: '1' },
  18. // 详细信息
  19. info: { id: '2', name: '测试商户2', phone: '13174420325', address: '吉林省长春市', status: '0' },
  20. },
  21. back: function () {
  22. wx.navigateBack({ url: '/pages/home/index' })
  23. },
  24. // 添加人员
  25. toAdd: function () {
  26. wx.navigateTo({ url: `/pages/merchant/detail` })
  27. },
  28. // 详细信息
  29. toView: function (e) {
  30. const { id } = e.currentTarget.dataset;
  31. console.log(id);
  32. // this.setData({ info: {} })
  33. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  34. },
  35. // 信息变更
  36. toEdit: function (e) {
  37. const { id } = e.currentTarget.dataset;
  38. wx.navigateTo({ url: `/pages/merchant/detail?id=${id}` })
  39. },
  40. // 县区登记审批
  41. toCheck: function (e) {
  42. const { id } = e.currentTarget.dataset;
  43. console.log(id);
  44. wx.showModal({
  45. title: '登记审批',
  46. content: '是否同意登记的商户进驻系统?',
  47. cancelText: '不同意',
  48. confirmText: '同意',
  49. success: (res) => {
  50. if (res.confirm) {
  51. wx.showToast({ title: `县区登记审批`, icon: 'success', duration: 2000 })
  52. }
  53. else if (res.cancel) {
  54. wx.showToast({ title: `县区登记审批`, icon: 'success', duration: 2000 })
  55. }
  56. }
  57. })
  58. },
  59. // 位置信息登记
  60. toSeat: function (e) {
  61. const { id } = e.currentTarget.dataset;
  62. wx.navigateTo({ url: `/pages/merchant/seat?id=${id}` })
  63. },
  64. // 检查信息登记
  65. toInspect: function (e) {
  66. const { id } = e.currentTarget.dataset;
  67. console.log(id);
  68. wx.navigateTo({ url: `/pages/merchant/inspect?id=${id}` })
  69. },
  70. // 账号注销
  71. toCancel: function (e) {
  72. const { id } = e.currentTarget.dataset;
  73. console.log(id);
  74. wx.showToast({ title: `商户注销成功`, icon: 'success', duration: 2000 })
  75. },
  76. /**
  77. * 生命周期函数--监听页面加载
  78. */
  79. onLoad: function (options) {
  80. // 计算高度
  81. this.searchHeight()
  82. },
  83. // 计算高度
  84. searchHeight: function () {
  85. let frameStyle = this.data.frameStyle;
  86. let client = app.globalData.client;
  87. // 减去状态栏
  88. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  89. // 是否减去底部菜单
  90. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  91. if (infoHeight) this.setData({ infoHeight: infoHeight })
  92. },
  93. /**
  94. * 生命周期函数--监听页面初次渲染完成
  95. */
  96. onReady: function () {
  97. },
  98. /**
  99. * 生命周期函数--监听页面显示
  100. */
  101. onShow: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面隐藏
  105. */
  106. onHide: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面卸载
  110. */
  111. onUnload: function () {
  112. },
  113. /**
  114. * 页面相关事件处理函数--监听用户下拉动作
  115. */
  116. onPullDownRefresh: function () {
  117. },
  118. /**
  119. * 页面上拉触底事件的处理函数
  120. */
  121. onReachBottom: function () {
  122. },
  123. /**
  124. * 用户点击右上角分享
  125. */
  126. onShareAppMessage: function () {
  127. }
  128. })