order_search.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. value: '',
  10. showInput: "0rpx",
  11. detail:"详情>",
  12. totalList:[],
  13. showList:[] ,
  14. phone:""
  15. },
  16. onClickdetail(){
  17. wx.navigateTo({
  18. url: '../../pages/order_details/order_details'
  19. })
  20. },
  21. // 电话输入
  22. mobileInput(e) {
  23. // console.log(e);
  24. if (e.detail.value) {
  25. this.setData({
  26. showInput: "40rpx"
  27. })
  28. } else {
  29. this.setData({
  30. showInput: "0rpx"
  31. })
  32. }
  33. this.setData({phone:e.detail.value})
  34. },
  35. // 清空
  36. clear() {
  37. this.setData({
  38. value: "",
  39. showInput: "0rpx"
  40. })
  41. },
  42. Search() {
  43. // console.log("213213123131");
  44. console.log(1);
  45. // 获取后拼接/phone
  46. wx.request({
  47. url: `http://8.130.90.145:4849/user/select/` + this.data.phone,
  48. method: 'GET',
  49. header: {
  50. 'content-type': 'application/json' // 默认值
  51. },
  52. success: (res => {
  53. // 遍历数组 查他的手机相等不等你输入的手机号
  54. console.log(res);
  55. this.setData({
  56. totalList : res.data.data
  57. })
  58. this.setData({
  59. showList : this.data.totalList
  60. })
  61. })
  62. })
  63. },
  64. /**
  65. * 生命周期函数--监听页面加载
  66. */
  67. onLoad(options) {
  68. wx.setNavigationBarTitle({ title: '搜索' })
  69. wx.request({
  70. url: `http://8.130.90.145:4849/user/list` ,
  71. method: 'GET',
  72. header: {
  73. 'content-type': 'application/json' // 默认值
  74. },
  75. success: (res => {
  76. // 遍历数组 查他的手机相等不等你输入的手机号
  77. console.log(res);
  78. this.setData({
  79. totalList : res.data.data
  80. })
  81. this.setData({
  82. showList : this.data.totalList
  83. })
  84. })
  85. })
  86. },
  87. /**
  88. * 生命周期函数--监听页面初次渲染完成
  89. */
  90. onReady() {
  91. },
  92. /**
  93. * 生命周期函数--监听页面显示
  94. */
  95. onShow() {
  96. },
  97. /**
  98. * 生命周期函数--监听页面隐藏
  99. */
  100. onHide() {
  101. },
  102. /**
  103. * 生命周期函数--监听页面卸载
  104. */
  105. onUnload() {
  106. },
  107. /**
  108. * 页面相关事件处理函数--监听用户下拉动作
  109. */
  110. onPullDownRefresh() {
  111. },
  112. /**
  113. * 页面上拉触底事件的处理函数
  114. */
  115. onReachBottom() {
  116. },
  117. /**
  118. * 用户点击右上角分享
  119. */
  120. onShareAppMessage() {
  121. }
  122. })