123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <template>
-
- <view class="monthly">
-
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
- <view class="monthly-list">
- <view class="monthly-list-item" :index="index" v-for="(monthlyItem, index) in monthlyList" :key="index">
- <view class="monthly-list-item-top">
- <view class="mlit-left">
- <view>{{monthlyItem.vehicleNo}}</view>
- <view>{{monthlyItem.roadName}}</view>
- </view>
- <view class="mlit-right u-flex">
- <view class="mlit-right-item fee-status" v-if="monthlyItem.feeStatus === 0">未缴费</view>
- <view class="mlit-right-item fee-status" v-if="monthlyItem.feeStatus === 1">已缴费</view>
- <view class="mlit-right-item" v-if="monthlyItem.energyType === 1">汽油车</view>
- <view class="mlit-right-item" v-if="monthlyItem.energyType === 2">新能源</view>
- </view>
- </view>
- <view class="monthly-list-item-bottom" >
- <view class="mlib-item">
- <view>有效期限</view>:
- <view>{{(monthlyItem.beginTime.split('-')).join('.')}}-{{(monthlyItem.endTime.split('-')).join('.')}}</view>
- </view>
- <view class="mlib-item">
- <view>剩余天数</view>:
- <view>{{monthlyItem.surplusDays}}天</view>
- </view>
- </view>
- <view v-if="monthlyItem.feeStatus=='0'" class="button-wrap u-flex u-row-right">
- <view class="tool-btn"
- :class="{'tool-btn-cancel':monthlyItem.feeStatus=='0'}"
- v-if="monthlyItem.feeStatus=='0'"
- @click="cancelMonth(monthlyItem.monthId)">取消订单</view>
- </view>
- <view v-else-if="monthlyItem.feeStatus == 1 && monthlyItem.surplusDays > 2" class="button-wrap u-flex u-row-right">
- <view class="tool-btn">已缴费</view>
- </view>
- <view v-else-if="monthlyItem.feeStatus == 1 && monthlyItem.surplusDays < 3" class="button-wrap u-flex u-row-right">
- <view class="tool-btn" @click="goRenewal(monthlyItem)">去续费</view>
- </view>
- </view>
- </view>
- </mescroll-body>
- <u-modal v-model="canclShow" content="确认取消该订单?" @confirm="confirm" :show-cancel-button="true"></u-modal>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
- id:'',
- canclShow: false,
- monthlyList: [],
- monthList:'',
- beginTime:'',
- endTime:'',
- time:[],
- }
- },
- onShow() {
-
- if(this.mescroll){
- this.mescroll.triggerDownScroll();
- }
- },
- methods: {
- customBack(){
- this.$u.route({
- type:'switchTab',
- url: 'pages/center/index'
- });
- },
-
- downCallback(){
-
- this.mescroll.resetUpScroll();
- },
-
- upCallback(page) {
- let pageNum = page.num;
- let pageSize = page.size;
-
- this.$u.api.getMonthList({pageSize:pageSize ,pageNum: pageNum})
- .then(res=>{
- if(res.code == 200){
- console.log('res',res)
-
- let curPageData = res.data.rows;
-
- let curPageLen = curPageData.length;
-
- let totalPage = res.data.pages;
-
- let totalSize = res.data.total;
-
-
-
-
- if(page.num == 1) this.monthlyList = [];
- this.monthlyList = this.monthlyList.concat(curPageData);
-
-
-
- this.mescroll.endByPage(curPageLen, totalPage);
- setTimeout(()=>{
- this.mescroll.endSuccess(curPageLen)
- },20)
- this.monthList=[],
- res.data.rows.forEach(item => {
- const obj = {
- beginTime: item.beginTime,
- endTime: item.endTime,
- }
- this.monthList.push(obj)
-
- });
- this.time = this.monthList[0]
- let Date1 = this.time.beginTime;
- let Date2 = this.time.endTime;
-
- Date1 = new Date(Date1)
- const year = Date1.getFullYear()
- const month = Date1.getMonth()+1
- const day = Date1.getDate()
- Date2 = new Date(Date2)
- const year2 = Date2.getFullYear()
- const month2 = Date2.getMonth()+1
- const day2 = Date2.getDate()
- this.beginTime = year + '.' + month + '.' + day
- console.log(this.beginTime)
- this.endTime = year2 + '.' + month2 + '.' + day2
- }else{
- this.mescroll.endErr()
- }
- }).catch(err=>{
-
-
-
-
-
- });
-
- },
- cancelMonth(monthId){
- this.id=monthId;
- this.canclShow = true;
- console.log('monthId',monthId)
- },
- confirm(){
- this.$u.api.cancelMonth({monthId: this.id})
- .then(res=>{
- if(res.code === 200){
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- });
- this.downCallback()
- }else{
-
- }
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- });
- })
- },
-
- goRenewal(item) {
- this.$u.route({
- url: 'pages/handleMonthly/handleMonthly',
- params: {
- roadNo: item.roadNo,
- vehicleNo: item.vehicleNo
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import './monthly.scss';
- </style>
|