index.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. order_count: 0,
  16. shopsind: 0,
  17. shopslist: [{
  18. id:0,title:'全部'
  19. }],
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. class Select {
  26. in = 1
  27. getSelet(){
  28. console.log(2);
  29. return 10
  30. }
  31. }
  32. var b = new Select();
  33. console.log(b.getSelet());
  34. this.serch();
  35. this.getshopslist()
  36. },
  37. onPullDownRefresh:function(){
  38. this.setData({pageindex: 1})
  39. this.serch();
  40. },
  41. /**
  42. * 页面上拉触底事件的处理函数
  43. */
  44. onReachBottom: function () {
  45. this.setData({pageindex:this.data.pageindex+=1})
  46. this.serch()
  47. },
  48. getshopslist(){
  49. let that = this
  50. wx.showLoading()
  51. app.api.useApi(app.globalData.baseAppUrl + "api/admin/SearchOrder", {
  52. key: '',
  53. logistics_status:0,
  54. network_id:"",
  55. created_at:"",
  56. page: 1
  57. }, "post").then(function (res) {
  58. wx.hideLoading()
  59. if(res.code==200){
  60. that.setData({
  61. shopslist:that.data.shopslist.concat(res.message.data.networker)
  62. })
  63. }
  64. }).catch(function (err) {
  65. console.log(222);
  66. })
  67. },
  68. click(){
  69. this.setData({
  70. show:!this.data.show
  71. })
  72. },
  73. onChange(event) {
  74. const { picker, value, index } = event.detail;
  75. this.setData({
  76. vtype:value,
  77. show:!this.data.show,
  78. ktype:index
  79. })
  80. console.log(`当前值:${value}, 当前索引:${index}`);
  81. },
  82. onCancel() {
  83. Toast('取消');
  84. },
  85. /**
  86. * 生命周期函数--监听页面初次渲染完成
  87. */
  88. onReady: function () {
  89. },
  90. goto:function(e){
  91. wx.navigateTo({
  92. url: "/pages/serah/detal?id="+e.currentTarget.dataset.id
  93. })
  94. },
  95. bindinput(e){
  96. this.setData({
  97. inputValue: e.detail.value
  98. })
  99. },
  100. shopschange(e){
  101. this.setData({shopsind: e.detail.value})
  102. this.serch()
  103. },
  104. serch(){
  105. var that=this;
  106. app.api.useApi(app.globalData.baseAppUrl + "api/admin/SearchOrder", {
  107. key: that.data.inputValue,
  108. logistics_status:0,
  109. network_id:that.data.shopsind!=0?that.data.shopslist[that.data.shopsind].id:'',
  110. created_at:"",
  111. page: that.data.pageindex
  112. }, "post").then(function (res) {
  113. console.log(res);
  114. if (res.code != 200) {
  115. wx.showLoading({
  116. title: res.message.msg,
  117. })
  118. that.setData({pageindex: that.data.pageindex -= 1})
  119. setTimeout(function () {
  120. wx.hideLoading();
  121. }, 1000);
  122. } else {
  123. wx.hideLoading();
  124. that.setData({order_count:res.message.data.order_count})
  125. if (that.data.pageindex == 1) {
  126. that.setData({selectInfo: []})
  127. }
  128. if (res.message.data.list.length > 0) {
  129. that.setData({selectInfo: that.data.selectInfo.concat(res.message.data.list)})
  130. } else {
  131. that.setData({pageindex: that.data.pageindex -= 1})
  132. }
  133. }
  134. }).catch(function (err) {
  135. console.log(222);
  136. })
  137. }
  138. })