pub-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="pb-40">
  3. <empty v-if="list.length==0" text="暂无订单"></empty>
  4. <view class="mlr-36 item mt-30" v-for="(item,i) in list" :key="i">
  5. <view class="flex">
  6. <view class="bg-blue white ptb-20 plr-25 size-32 bold">
  7. 我的行程 余座:{{item.more_seats}}座
  8. </view>
  9. <view class="size-28 pr-30">
  10. {{item.statusText}}
  11. </view>
  12. </view>
  13. <view class="plr-30 ptb-30">
  14. <view class="flex1 flex-middle">
  15. <view class="center flex-column">
  16. <view class="mt-7" style="width: 28rpx;height: 28rpx;background: #6340FF;border-radius: 50%;"></view>
  17. <view class="size-28 mt-17">
  18. 起点
  19. </view>
  20. </view>
  21. <view class="ml-20">
  22. <view class="size-32 bold">
  23. {{item.start_city}}
  24. </view>
  25. <view class="size-28 mt-10">
  26. {{item.start_name}}(上车)
  27. </view>
  28. </view>
  29. </view>
  30. <view class="flex1 flex-middle mt-30">
  31. <view class="center flex-column">
  32. <view class="mt-7" style="width: 28rpx;height: 28rpx;background: #EA0000;border-radius: 50%;"></view>
  33. <view class="size-28 mt-17">
  34. 终点
  35. </view>
  36. </view>
  37. <view class="ml-20">
  38. <view class="size-32 bold">
  39. {{item.end_city}}
  40. </view>
  41. <view class="size-28 mt-10">
  42. {{item.end_name}}(下车)
  43. </view>
  44. </view>
  45. </view>
  46. <view class="size-28 blue mt-20">
  47. 时间:{{item.start_time.split(' ')[0]}}({{item.week}}) {{item.start_time.split(' ')[1]}}
  48. </view>
  49. </view>
  50. <view class="" v-if="item.status != -1&&item.more_seats*1>0">
  51. <u-button type="primary" @click="cancel(item.id)">取消行程</u-button>
  52. </view>
  53. </view>
  54. <u-loadmore v-show="list.length>9" :status="status" icon-type="flower" bg-color="transperant" margin-top="30"
  55. margin-bottom="30" />
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. list:[],
  63. page:1,
  64. status: 'loadmore',
  65. };
  66. },
  67. onLoad() {
  68. this.init()
  69. },
  70. onPullDownRefresh() {
  71. this.page = 1
  72. this.list = []
  73. this.init()
  74. },
  75. onReachBottom() {
  76. //避免多次触发
  77. if (this.status == 'loading' || this.status == 'nomore') {
  78. return;
  79. }
  80. this.status = "loading";
  81. this.init()
  82. },
  83. methods: {
  84. init(){
  85. this.$http('/addons/ddrive/sforder/release_order',{
  86. page: this.page
  87. }).then(data=>{
  88. console.log(data);
  89. if (data.length < 10) {
  90. this.status = "nomore"
  91. } else {
  92. this.page = this.page + 1
  93. this.status = "loadmore"
  94. }
  95. this.list = this.list.concat(data)
  96. uni.stopPullDownRefresh();
  97. })
  98. },
  99. cancel(id){
  100. this.$http('/addons/ddrive/sforder/cancel',{
  101. order_id: id,
  102. cancel_type: ''
  103. },"POST").then(data=>{
  104. console.log(data);
  105. uni.showToast({
  106. title:'取消成功'
  107. })
  108. this.page = 1
  109. this.list = []
  110. this.init()
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. /deep/.u-btn--primary{
  118. border-radius: 0;
  119. }
  120. /deep/.u-primary-hover {
  121. background-color: $blue !important;
  122. }
  123. /deep/.u-size-default {
  124. width: 100% !important;
  125. height: 88rpx !important;
  126. font-weight: 700 !important;
  127. }
  128. .item {
  129. box-shadow: 0px 0px 13px 0px rgba(18, 0, 98, 0.2);
  130. }
  131. </style>