index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. ticketType:item.ticketType,
  32. ticketTypeName:item.ticketTypeName
  33. }
  34. ], //当前添加的2人
  35. list: [] // 一共添加的人
  36. });
  37. uni.navigateTo({
  38. //url: "/pages/news/details?id=" + id
  39. url: "/pages/buytickets/selectSite?select=true&id=" +item.vehicleId
  40. })
  41. },
  42. lower() {
  43. console.log("--------")
  44. if (this.listForm.pageIndex <= this.listForm.totalPage ) {
  45. this.passengerMessage();
  46. } else {
  47. return;
  48. }
  49. },
  50. passengerMessage() {
  51. if(this.$refs.common){
  52. this.$refs.common.showLoading();
  53. }
  54. this.listForm.openId=this.carhelp.getOpenId()
  55. API.passengerMessage(this.listForm).then((res) => {
  56. this.initBl=true
  57. this.isLoading=true
  58. var response=res.data;
  59. if (response) {
  60. if (this.listForm.pageIndex == 1) {
  61. this.recordList = response.data;
  62. this.listForm.pageIndex = response.pageNumber;
  63. this.listForm.totalPage = response.totalPage;
  64. } else {
  65. this.recordList = [
  66. ...this.recordList,
  67. ...response.data
  68. ];
  69. }
  70. }
  71. this.listForm.pageIndex++;
  72. this.$refs.common.showLoading(false);
  73. }).catch(error => {
  74. this.$refs.common.showLoading(false,error);
  75. })
  76. }
  77. },
  78. onLoad() {
  79. this.clientHeight = document.body.clientHeight;
  80. },
  81. onReady() {
  82. this.passengerMessage();
  83. },
  84. onShow() {
  85. if(this.initBl){
  86. this.recordList= [],
  87. this.listForm= {
  88. totalPage: 1,
  89. pageIndex: 1,
  90. pageSize: 20
  91. }
  92. this.passengerMessage();
  93. }
  94. }
  95. }