You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.6 KiB

  1. // const app = getApp()
  2. // const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
  3. // Page({
  4. // data:{
  5. // navigationBarHeight,
  6. // }
  7. // })
  8. const app = getApp()
  9. const config = require("../../config/config")
  10. const Http = require("../../utils/HttpBasics.js")
  11. const navigationBarHeight = (getApp().statusBarHeight + 44) + "px"
  12. Page({
  13. data: {
  14. imgHttps: app.globalData.imgHttps,
  15. navigationBarHeight,
  16. inputValue: '',
  17. pageNum: 1,
  18. list: [],
  19. showFlog:false,
  20. id:"",//选中id
  21. },
  22. setSearchValue(e) {
  23. let value = e.detail.value
  24. this.setData({
  25. inputValue: value
  26. })
  27. },
  28. searchBtn() {
  29. this.setData({
  30. list: [],
  31. pageNum: 1
  32. })
  33. this.search()
  34. },
  35. cancel(){
  36. Http.get({
  37. url:config.api.Fcollect,
  38. data:{
  39. id:this.data.id
  40. }
  41. }).then(res=>{{
  42. tt.showToast({
  43. title: '已取消收藏', // 内容
  44. icon: "none"
  45. });
  46. }}).catch(err=>{
  47. tt.showToast({
  48. title: err.message?err.message:err.data,
  49. icon:"none"
  50. });
  51. })
  52. },
  53. hie(){
  54. this.setData({
  55. showFlog:false
  56. })
  57. },
  58. showHie(e){
  59. let id = e.currentTarget.dataset.id
  60. this.setData({
  61. showFlog:true,
  62. id:id
  63. })
  64. },
  65. search() {
  66. tt.showLoading({
  67. title: '加载中...', // 内容
  68. });
  69. Http.get({
  70. url: config.api.getOrderLsit,
  71. data: {
  72. productTitle: this.data.inputValue,
  73. pageNum: this.data.pageNum,
  74. pageSize: 8,
  75. orderStatus: 2
  76. }
  77. }).then(res => {
  78. console.log(res);
  79. let temp = this.data.list
  80. if (this.data.pageNum > 1) {
  81. temp.push(res.data.list)
  82. this.setData({
  83. list: temp
  84. })
  85. } else {
  86. this.setData({
  87. list: res.data.list
  88. })
  89. }
  90. tt.hideLoading();
  91. }).catch(err=>{
  92. tt.hideLoading();
  93. tt.showToast({
  94. title: err.message?err.message:err.data, // 内容
  95. icon:"none"
  96. });
  97. })
  98. },
  99. onLoad() {
  100. this.search()
  101. },
  102. onReachBottom: function() {
  103. this.setData({
  104. pageNum:this.data.pageNum+1
  105. })
  106. this.search()
  107. }
  108. })