mine.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // index.js
  2. var app = getApp()
  3. Page({
  4. data: {
  5. userId : '',
  6. userInfo: {},
  7. phone:'',
  8. orderList:{
  9. label:'我的采购订单',
  10. summary:"全部",
  11. state:"",
  12. icon:"icon-left",
  13. data:[
  14. {
  15. label:"待付款",
  16. state:"1",
  17. icon:"icon-icon-test",
  18. num:0,
  19. },
  20. {
  21. label: "待发货",
  22. state: "3",
  23. icon: "icon-daifahuo1",
  24. num: 0,
  25. },
  26. {
  27. label: "待收货",
  28. state: "4",
  29. icon: "icon-daishouhuo",
  30. num: 0,
  31. }
  32. ]
  33. },
  34. madeList: {
  35. label: '我的定制订单',
  36. summary: "全部",
  37. state: "",
  38. icon: "icon-left",
  39. data: [
  40. {
  41. label: "待付款",
  42. state: "",
  43. icon: "icon-icon-test",
  44. num: 0,
  45. },
  46. {
  47. label: "待发货",
  48. state: "",
  49. icon: "icon-daifahuo1",
  50. num: 0,
  51. },
  52. {
  53. label: "待收货",
  54. state: "",
  55. icon: "icon-daishouhuo",
  56. num: 0,
  57. }
  58. ]
  59. },
  60. },
  61. onLoad: function () {
  62. var that = this;
  63. var openid = getApp().globalData.openid;
  64. var un_id = getApp().globalData.un_id;
  65. var host = getApp().globalData.servsers;
  66. wx.showNavigationBarLoading();
  67. wx.request({
  68. url: host + "phoneapi/phoneall",
  69. data: {},
  70. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  71. header: {
  72. 'Accept': 'application/json'
  73. },
  74. success: function (res) {
  75. that.setData({
  76. phone: res.data.rows[0].phone,
  77. });
  78. if (res == null || res.data == null) {
  79. console.error('网络请求失败');
  80. return;
  81. }
  82. wx:wx.hideNavigationBarLoading(
  83. that.setData({
  84. hidden : ''
  85. })
  86. )
  87. }
  88. });
  89. that.setData({
  90. userInfo: getApp().globalData.userInfo,
  91. userId: getApp().globalData.un_id
  92. })
  93. },
  94. //重新加载
  95. onShow: function () {
  96. var that = this;
  97. var host = getApp().globalData.servsers;
  98. var un_id = getApp().globalData.un_id;
  99. var openid = getApp().globalData.openid;
  100. var userInfo = getApp().globalData.userInfo;
  101. var userRole = getApp().globalData.userRole;
  102. // if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
  103. // wx.navigateTo({
  104. // url: '/pages/authorize/authorize?link=mine',
  105. // })
  106. // } else {
  107. userInfo = getApp().globalData.userInfo;
  108. //查询用户身份
  109. // getApp().getUserRole(un_id);//获取用户角色
  110. // userRole = getApp().globalData.userRole;
  111. // }
  112. that.setData({
  113. userInfo: userInfo,
  114. userId: un_id,
  115. userRole: userRole
  116. })
  117. },
  118. orderList(e){
  119. console.log(e,"orderList")
  120. let state = e.currentTarget.dataset.state
  121. wx.navigateTo({
  122. url: '/newsShop/pages/orderList/orderList?state' + state,
  123. })
  124. }
  125. })