homePage.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // pages/homePage/homePage.js
  2. import {
  3. get,
  4. post
  5. } from '../../utils/http.js'
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. list: [{
  12. id: 0,
  13. name: '入库',
  14. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxrep/warehousing.png',
  15. },
  16. {
  17. id: 1,
  18. name: '出库',
  19. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxrep/exWarehouse.png',
  20. },
  21. {
  22. id: 2,
  23. name: '供应商退货',
  24. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxrep/supplier.png',
  25. },
  26. {
  27. id: 3,
  28. name: '客户退货',
  29. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxrep/customer.png',
  30. },
  31. ]
  32. },
  33. /**
  34. * 生命周期函数--监听页面加载
  35. */
  36. onLoad(options) {
  37. this.getPhoneInfo()
  38. wx.getUserProfile({
  39. desc: '用于展示', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  40. success: (res) => {
  41. console.log(res);
  42. this.setData({
  43. userInfo: res.userInfo,
  44. hasUserInfo: true
  45. })
  46. }
  47. })
  48. },
  49. /**
  50. * 生命周期函数--监听页面初次渲染完成
  51. */
  52. onReady() {
  53. },
  54. /**
  55. * 生命周期函数--监听页面显示
  56. */
  57. onShow() {
  58. },
  59. /**
  60. * 生命周期函数--监听页面隐藏
  61. */
  62. onHide() {
  63. },
  64. /**
  65. * 生命周期函数--监听页面卸载
  66. */
  67. onUnload() {
  68. },
  69. /**
  70. * 页面相关事件处理函数--监听用户下拉动作
  71. */
  72. onPullDownRefresh() {
  73. },
  74. /**
  75. * 页面上拉触底事件的处理函数
  76. */
  77. onReachBottom() {
  78. },
  79. /**
  80. * 用户点击右上角分享
  81. */
  82. onShareAppMessage() {
  83. },
  84. getPhoneInfo(){
  85. post('get_phone_info', {imei:"356727085900775"}, res => {
  86. console.log(res);
  87. })
  88. },
  89. onDetails(e){
  90. let item = e.currentTarget.dataset.item
  91. if (item!=0) {
  92. wx.showToast({
  93. title: '敬请期待!',
  94. icon: 'none'
  95. })
  96. }
  97. let urls = "/pages/scanCode/scanCode"
  98. if (item.id==1) {
  99. urls = ''
  100. }else if (item.id==2) {
  101. urls = ''
  102. }else if (item.id==3) {
  103. urls = ''
  104. }
  105. console.log(item,'eee',urls);
  106. wx.navigateTo({
  107. url: urls,
  108. })
  109. },
  110. /**
  111. * 去入库
  112. */
  113. onWarehousing() {
  114. wx.navigateTo({
  115. url: '/pages/warehousing/warehousing',
  116. })
  117. },
  118. })