index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import * as API from '@/apis/news.js'
  2. export default {
  3. data() {
  4. return {
  5. isLoading:false,
  6. initBl:false,
  7. clientHeight: 0,
  8. list: [
  9. 1, 2, 3, 4, 6, 7
  10. ],
  11. recordList: [],
  12. listForm: {
  13. totalPage: 1,
  14. pageIndex: 1,
  15. pageSize: 20
  16. }
  17. }
  18. },
  19. methods: {
  20. gotoInfo(item) {
  21. this.carhelp.set("form", {
  22. name: 'buytickets',
  23. id: this.id,
  24. buy: true,
  25. oplist: [
  26. {
  27. id:item.id,
  28. upStationName:item.stationName,
  29. upStationId:item.stationId,
  30. imageUrl:item.imageUrl,
  31. ticketType2:item.ticketType
  32. }
  33. ], //当前添加的2人
  34. list: [] // 一共添加的人
  35. });
  36. uni.navigateTo({
  37. //url: "/pages/news/details?id=" + id
  38. url: "/pages/buytickets/selectSite?id=" +item.vehicleId
  39. })
  40. },
  41. lower() {
  42. console.log("--------")
  43. if (this.listForm.pageIndex <= this.listForm.totalPage ) {
  44. this.passengerMessage();
  45. } else {
  46. return;
  47. }
  48. },
  49. passengerMessage() {
  50. if(this.$refs.common){
  51. this.$refs.common.showLoading();
  52. }
  53. this.listForm.openId=this.carhelp.getOpenId()
  54. API.passengerMessage(this.listForm).then((res) => {
  55. this.initBl=true
  56. this.isLoading=true
  57. var response=res.data;
  58. if (response) {
  59. if (this.listForm.pageIndex == 1) {
  60. this.recordList = response.data;
  61. this.listForm.pageIndex = response.pageNumber;
  62. this.listForm.totalPage = response.totalPage;
  63. } else {
  64. this.recordList = [
  65. ...this.recordList,
  66. ...response.data
  67. ];
  68. }
  69. }
  70. this.listForm.pageIndex++;
  71. this.$refs.common.showLoading(false);
  72. }).catch(error => {
  73. this.$refs.common.showLoading(false,error);
  74. })
  75. }
  76. },
  77. onLoad() {
  78. this.clientHeight = document.body.clientHeight;
  79. },
  80. onReady() {
  81. this.passengerMessage();
  82. },
  83. onShow() {
  84. if(this.initBl){
  85. this.recordList= [],
  86. this.listForm= {
  87. totalPage: 1,
  88. pageIndex: 1,
  89. pageSize: 20
  90. }
  91. this.passengerMessage();
  92. }
  93. }
  94. }