monthly.vue 3.9 KB

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