monthly.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. .catch(err => {
  87. this.$refs.uToast.show({
  88. title: '操作失败',
  89. type: 'error',
  90. });
  91. })
  92. },
  93. // 取消订单
  94. cancelMonth(monthId) {
  95. this.id = monthId;
  96. this.cancelShow = true;
  97. },
  98. // 确认取消订单
  99. confirm() {
  100. this.$u.api.cancelMonth({
  101. monthId: this.id,
  102. })
  103. .then(res => {
  104. if (res.code === 200) {
  105. this.$refs.uToast.show({
  106. title: res.msg,
  107. type: 'success',
  108. });
  109. this.queryList(this.pageNo, this.pageSize)
  110. } else {
  111. this.$refs.uToast.show({
  112. title: res.msg,
  113. type: 'error',
  114. });
  115. }
  116. }).catch(err => {
  117. this.$refs.uToast.show({
  118. title: '操作失败',
  119. type: 'error',
  120. });
  121. })
  122. },
  123. /**
  124. * 去续费
  125. * */
  126. goRenewal(item) {
  127. this.$u.route({
  128. url: 'pages/handleMonthly/handleMonthly',
  129. params: {
  130. roadNo: item.roadNo,
  131. vehicleNo: item.vehicleNo
  132. }
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. @import './monthly.scss';
  140. </style>