index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // pages/tabber/news/index.js
  2. const app=getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. selectInfo: {},
  9. inputValue:"",
  10. show:false,
  11. vtype:"订单号",
  12. ktype:0,
  13. columns: ['订单号', '物流单号', '水洗码', '封签号', '手机号','用户姓名'],
  14. pageindex: 1
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. class Select {
  21. in = 1
  22. getSelet(){
  23. console.log(2);
  24. return 10
  25. }
  26. }
  27. var b = new Select();
  28. console.log(b.getSelet());
  29. this.serch();
  30. },
  31. onPullDownRefresh:function(){
  32. this.setData({pageindex: 1})
  33. this.serch();
  34. },
  35. /**
  36. * 页面上拉触底事件的处理函数
  37. */
  38. onReachBottom: function () {
  39. this.setData({pageindex:this.data.pageindex+=1})
  40. this.serch()
  41. },
  42. click(){
  43. this.setData({
  44. show:!this.data.show
  45. })
  46. },
  47. onChange(event) {
  48. const { picker, value, index } = event.detail;
  49. this.setData({
  50. vtype:value,
  51. show:!this.data.show,
  52. ktype:index
  53. })
  54. console.log(`当前值:${value}, 当前索引:${index}`);
  55. },
  56. onCancel() {
  57. Toast('取消');
  58. },
  59. /**
  60. * 生命周期函数--监听页面初次渲染完成
  61. */
  62. onReady: function () {
  63. },
  64. goto:function(e){
  65. wx.navigateTo({
  66. url: "/pages/serah/detal?id="+e.currentTarget.dataset.id
  67. })
  68. },
  69. bindinput(e){
  70. this.setData({
  71. inputValue: e.detail.value
  72. })
  73. },
  74. serch(){
  75. var that=this;
  76. app.api.useApi(app.globalData.baseAppUrl + "api/admin/SearchOrder", {
  77. key: that.data.inputValue,
  78. logistics_status:0,
  79. network_id:"",
  80. created_at:"",
  81. page: that.data.pageindex
  82. }, "post").then(function (res) {
  83. console.log(res);
  84. if (res.code != 200) {
  85. wx.showLoading({
  86. title: res.message.msg,
  87. })
  88. that.setData({pageindex: that.data.pageindex -= 1})
  89. setTimeout(function () {
  90. wx.hideLoading();
  91. }, 1000);
  92. } else {
  93. wx.hideLoading();
  94. if (that.data.pageindex == 1) {
  95. that.setData({selectInfo: []})
  96. }
  97. if (res.message.data.length > 0) {
  98. that.setData({selectInfo: that.data.selectInfo.concat(res.message.data)})
  99. } else {
  100. that.setData({pageindex: that.data.pageindex -= 1})
  101. }
  102. }
  103. }).catch(function (err) {
  104. console.log(222);
  105. })
  106. }
  107. })