accounting_rules.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const app = getApp()
  2. var http = require("../../utils/config.js");
  3. Page({
  4. data: {
  5. setting: '',
  6. areaList: [],
  7. index: 0,
  8. },
  9. getAreas: function () {
  10. wx.showLoading({
  11. title: '加载中...',
  12. })
  13. app.request('/areas', '', 'get').then(res => {
  14. console.log(res)
  15. let areaId = wx.getStorageSync('home').id
  16. let list = res.data
  17. let index = 0
  18. list.map((item, index) => {
  19. if (item.id == areaId) {
  20. index = index
  21. }
  22. })
  23. if (res.statusCode == 200) {
  24. this.setData({
  25. areaList: res.data,
  26. setting: list[index].setting,
  27. index
  28. })
  29. }
  30. wx.hideLoading()
  31. })
  32. },
  33. // 点击筛选区域
  34. bindPickerChange(e) {
  35. console.log(e, 'pppppp')
  36. let index=e.detail.value
  37. index=Number(index)
  38. this.setData({
  39. index,
  40. setting:this.data.areaList[index].setting
  41. })
  42. },
  43. onLoad: function (options) {
  44. },
  45. onReady: function () {
  46. },
  47. onShow: function () {
  48. this.getAreas()
  49. },
  50. onHide: function () {
  51. },
  52. onUnload: function () {
  53. },
  54. onPullDownRefresh: function () {
  55. },
  56. onReachBottom: function () {
  57. },
  58. onShareAppMessage: function () {
  59. }
  60. })