monthly.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <!-- 包月 -->
  3. <view class="monthly">
  4. <z-paging class="paging" ref="paging" v-model="dataList" @query="queryList">
  5. <view class="monthly-list">
  6. <view class="monthly-list-item" v-for="(monthlyItem, index) in dataList" :key="monthlyItem.id">
  7. <view class="monthly-list-item-top">
  8. <view class="mlit-left">
  9. <view>{{monthlyItem.vehicleNo}}</view>
  10. <view>{{monthlyItem.roadName}}</view>
  11. </view>
  12. <view class="mlit-right u-flex">
  13. <view class="mlit-right-item fee-status" v-if="monthlyItem.feeStatus === 0">未缴费</view>
  14. <view class="mlit-right-item fee-status" v-if="monthlyItem.feeStatus === 1">已缴费</view>
  15. <view class="mlit-right-item" v-if="monthlyItem.energyType === 1">汽油车</view>
  16. <view class="mlit-right-item" v-if="monthlyItem.energyType === 2">新能源</view>
  17. </view>
  18. </view>
  19. <view class="monthly-list-item-bottom">
  20. <view class="mlib-item">
  21. <view>有效期限</view>:
  22. <view>
  23. {{(monthlyItem.beginTime.split('-')).join('.')}}-{{(monthlyItem.endTime.split('-')).join('.')}}
  24. </view>
  25. </view>
  26. <view class="mlib-item">
  27. <view>剩余天数</view>:
  28. <view>{{monthlyItem.surplusDays}}天</view>
  29. </view>
  30. </view>
  31. <view v-if="monthlyItem.feeStatus=='0'" class="button-wrap u-flex u-row-right">
  32. <view class="tool-btn" :class="{'tool-btn-cancel': monthlyItem.feeStatus=='0'}"
  33. v-if="monthlyItem.feeStatus=='0'" @click="cancelMonth(monthlyItem.monthId)">取消订单</view>
  34. </view>
  35. <view v-else-if="monthlyItem.feeStatus == 1 && monthlyItem.surplusDays > 2"
  36. class="button-wrap u-flex u-row-right">
  37. <view class="tool-btn">已缴费</view>
  38. </view>
  39. <view v-else-if="monthlyItem.feeStatus == 1 && monthlyItem.surplusDays < 3"
  40. class="button-wrap u-flex u-row-right">
  41. <view class="tool-btn" @click="goRenewal(monthlyItem)">去续费</view>
  42. </view>
  43. </view>
  44. </view>
  45. </z-paging>
  46. <u-modal v-model="cancelShow" content="确认取消该订单?" @confirm="confirm" :show-cancel-button="true"></u-modal>
  47. <u-toast ref="uToast" />
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. id: '', // 当前选中的条目id
  55. cancelShow: false,
  56. dataList: [],
  57. pageSize: 10,
  58. pageNo: 1
  59. }
  60. },
  61. methods: {
  62. customBack() {
  63. this.$u.route({
  64. type: 'switchTab',
  65. url: 'pages/center/index'
  66. });
  67. },
  68. // 下拉刷新操作
  69. queryList(pageNo, pageSize) {
  70. this.$u.api.getMonthList({
  71. pageSize: pageSize,
  72. pageNum: pageNo,
  73. })
  74. .then(res => {
  75. if (res.code === 200) {
  76. this.pageNo = pageNo
  77. this.pageSize = pageSize
  78. this.$refs.paging.complete(res.data.rows);
  79. } else {
  80. this.$refs.uToast.show({
  81. title: res.msg,
  82. type: 'error',
  83. });
  84. }
  85. })
  86. },
  87. // 取消订单
  88. cancelMonth(monthId) {
  89. this.id = monthId;
  90. this.cancelShow = true;
  91. },
  92. // 确认取消订单
  93. confirm() {
  94. this.$u.api.cancelMonth({
  95. monthId: this.id,
  96. })
  97. .then(res => {
  98. if (res.code === 200) {
  99. this.$refs.uToast.show({
  100. title: res.msg,
  101. type: 'success',
  102. });
  103. this.queryList(this.pageNo, this.pageSize)
  104. } else {
  105. this.$refs.uToast.show({
  106. title: res.msg,
  107. type: 'error',
  108. });
  109. }
  110. }).catch(err => {
  111. this.$refs.uToast.show({
  112. title: '操作失败',
  113. type: 'error',
  114. });
  115. })
  116. },
  117. /**
  118. * 去续费
  119. * */
  120. goRenewal(item) {
  121. this.$u.route({
  122. url: 'pages/handleMonthly/handleMonthly',
  123. params: {
  124. roadNo: item.roadNo,
  125. vehicleNo: item.vehicleNo
  126. }
  127. })
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. @import './monthly.scss';
  134. </style>