123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <view>
- <view class="swiper-wrap">
- <view class="u-tabs-box">
- <u-tabs-swiper activeColor="#008CFF" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="100%"></u-tabs-swiper>
- </view>
- <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
- <swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
- <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
- <view class="page-box">
- <view class="order" @click="goDetails(orderItem)" v-for="(orderItem, index) in orderList[index]" :key="orderItem.id">
- <view class="order-top u-flex">
- <view class="order-top-left u-flex-1">
- <view class="car">{{orderItem.vehicleNo}}</view>
- <view class="addr">{{orderItem.roadName}}</view>
- </view>
- <view
- class="order-top-right apply-refund"
- v-show="current === 3 && orderItem.allowRefund == 1 && (orderItem.refundStatus === 2 || !orderItem.refundStatus && orderItem.refundStatus !== 0)"
- @click.stop="applyRefund(orderItem)"
- >申请退款</view>
- <view
- class="order-top-right apply-refund"
- @click.stop="applyRefundDetails(orderItem)"
- v-show="current === 3 && (orderItem.refundStatus || orderItem.refundStatus == 0)">
- {{orderItem.refundStatus | verifyRefundStatus}}
- </view>
- <view
- class="order-top-right"
- v-show="!orderItem.refundStatus && orderItem.refundStatus != 0"
- :class="{'order-top-right-finished': orderItem.orderStatus == '4'}">
- {{orderItem.orderStatus | verifyStatusFilter}}
- </view>
- </view>
- <view class="order-center">
- <view class="order-center-item">订单编号:{{orderItem.orderId}}</view>
- <view class="order-center-item">入场时间:{{orderItem.inTime}}</view>
- <view class="order-center-item" v-if="orderItem.orderStatus !== 1">出场时间:{{orderItem.outTime}}</view>
- <view class="order-center-item" v-if="orderItem.orderStatus !== 1">停留时间:{{orderItem.duration}}</view>
- <view class="order-center-item">应付金额:<span class="pay-amount">{{orderItem.payAmount}}</span></view>
- </view>
- <view class="order-bottom">
- <u-cell-item title="收费标准" @click.native.stop="jumpChargeStandard(orderItem)"></u-cell-item>
- </view>
- </view>
- <u-loadmore :status="loadStatus[index]" bgColor="#F6F6FF"></u-loadmore>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
-
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- orderList: [[], [], [], []],
- list: [
- {index:0,name: '全部',orderStatu:null,pageNum:1,total:null},
- {index:1,name: '停放中',orderStatu:1,pageNum:1,total:null},
- {index:2,name: '欠费未缴',orderStatu:2,pageNum:1,total:null},
- {index:3,name: '已完成',orderStatu:4,pageNum:1,total:null}
- ],
- current: 0,
- swiperCurrent: 0,
- tabsHeight: 0,
- dx: 0,
- loadStatus: ['loadmore','loadmore','loadmore','loadmore'],
- };
- },
- onLoad() {
- // this.getOrderList(this.list[0]);
- // this.getOrderList(this.list[1]);
- // this.getOrderList(this.list[2]);
- // this.getOrderList(this.list[3]);
- },
- onShow(){
- // onShow 刷新数据
- this.list[this.current].pageNum = 1;
- this.orderList=[[], [], [], []];
- this.getOrderList(this.list[this.current]);
- },
- computed: {
- // 价格小数
- priceDecimal() {
- return val => {
- if (val !== parseInt(val)) return val.slice(-2);
- else return '00';
- };
- },
- // 价格整数
- priceInt() {
- return val => {
- if (val !== parseInt(val)) return val.split('.')[0];
- else return val;
- };
- }
- },
- methods: {
- reachBottom() {
- // console.log('this.list[this.current]',this.list[this.current]);
- if(this.orderList[this.current].length>=this.list[this.current].total){
- this.loadStatus.splice(this.list[this.current].index,1,"nomore");
- return;
- };
- this.loadStatus.splice(this.list[this.current].index,1,"loading");
- this.getOrderList(this.list[this.current]);
- },
- // 页面数据
-
- getOrderList(orderType) {
- let param = {
- pageNum:orderType.pageNum,
- orderStatus:orderType.orderStatu,
- };
- // 未出场: orderStatu = 1-停放中
- // 缴费中: orderStatu = 2-出场中 && payStatus = 2-支付中
- // 完成: orderStatu = 4-完成
- this.$u.api.getOrderList(param)
- .then(res=>{
- for(let item of res.data.rows){
- this.orderList[orderType.index].push(item);
- }
- console.log('this.list[orderType.index]',this.list[orderType.index]);
- this.list[this.current].total = res.data.total;
- this.list[orderType.index].pageNum++;
- if(this.orderList[this.current].length>=this.list[this.current].total){
- this.loadStatus.splice(this.list[orderType.index].index,1,"nomore");
- };
- console.log(JSON.parse(JSON.stringify(this.orderList[this.swiperCurrent])));
- console.log('this.list[this.current]',this.list[this.current]);
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- });
- console.log('getOrderList ',err)
- });
-
- this.loadStatus.splice(this.current,1,"loadmore")
- },
- // tab栏切换
- change(index) {
- // this.swiperCurrent = this.list[index].orderStatu;
- this.swiperCurrent = index;
- this.getOrderList(this.list[index]);
- },
- transition({ detail: { dx } }) {
- this.$refs.tabs.setDx(dx);
- },
- animationfinish({ detail: { current } }) {
- this.$refs.tabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- },
- goDetails(item){
- if (item.refundStatus === 1) { // 退款完成
- this.$u.route('pages/applyRefundDetails/applyRefundAchieveDetails', {
- orderId: item.orderId
- })
- } else {
- this.$u.route({ // 未发起退款或者未退款成功的
- url: 'pages/center/order/orderDetails/orderDetails',
- params: {
- orderId: item.id
- }
- });
- }
- },
- jumpChargeStandard(item) {
- this.$u.route({
- url: 'pages/chargeStandard/chargeStandard',
- params: {
- roadNo: item.roadNo
- }
- });
- },
- // 申请退款
- applyRefund(item) {
- this.$u.route('pages/applyRefund/applyRefund', {
- orderId: item.orderId,
- payAmount: item.payAmount
- })
- },
- // 申请退款详情
- applyRefundDetails(item) {
- this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
- orderId: item.orderId
- })
- }
- },
- filters:{
- verifyStatusFilter(value) {
- if (value === 0) {
- return '';
- } else if(value === 1){
- return '停放中';
- } else if(value === 2){
- return '欠费未缴';
- } else if(value === 4){
- return '已完成';
- } else {
- return '';
- }
- },
- verifyRefundStatus(value) {
- switch(value) {
- case 0:
- return '申请退款中';
- break;
- case 1:
- return '已通过';
- break;
- case 2:
- return '已驳回';
- break;
- case 3:
- return '退款失败';
- break;
- default:
- return null;
- break;
- }
- }
- }
- };
- </script>
- <style>
- /* #ifndef H5 */
- page {
- height: 100%;
- background-color: #F6F6FF;
- }
- /* #endif */
- </style>
- <style lang="scss" scoped>
- @import "./order.scss";
- </style>
|