|
|
@@ -1,42 +1,42 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
- <uv-list>
|
|
|
- <uv-list-item
|
|
|
- clickable show-arrow v-for="(item,index) in state.orderList" :key="index" @click="handleClickDetail(item)">
|
|
|
- <template #default>
|
|
|
- <view class="wallet-item">
|
|
|
- <view class="wallet-item_header">
|
|
|
- <view class="flex-inline">
|
|
|
- <text class="wallet-item_header-type">洗车消费</text>
|
|
|
- <uv-text class="ml10" style="margin-left: 10px;" plain :size="12"
|
|
|
- :type="item.payStatus==0?'primary':(item.payStatus==1?'success':'error')"
|
|
|
- :text="fmtDictName('Order.pay', item.payStatus)"></uv-text>
|
|
|
-
|
|
|
-<!-- <uv-tags class="ml10" style="margin-left: 10px;" size="mini" plain
|
|
|
- :type="item.orderStatus==0?'primary':(item.orderStatus==1?'success':'error')"
|
|
|
- :text="fmtDictName('Order.status', item.orderStatus)"></uv-tags>-->
|
|
|
- </view>
|
|
|
- <text class="wallet-item_header-amt">{{ (item.amount / 100).toFixed(2) }}元</text>
|
|
|
- </view>
|
|
|
- <view class="wallet-item_body">
|
|
|
- <text class="wallet-item_body-order">{{ item.orderId }}</text>
|
|
|
- <text class="wallet-item_body-time">{{ fmtDateTime(item.startTime) }}</text>
|
|
|
+ <uv-list>
|
|
|
+ <uv-list-item
|
|
|
+ clickable show-arrow v-for="(item,index) in state.orderList" :key="index" @click="handleClickDetail(item)">
|
|
|
+ <template #default>
|
|
|
+ <view class="wallet-item">
|
|
|
+ <view class="wallet-item_header">
|
|
|
+ <view class="flex-inline">
|
|
|
+ <text class="wallet-item_header-type">洗车消费</text>
|
|
|
+ <uv-text class="ml10" style="margin-left: 10px;" plain :size="12"
|
|
|
+ :type="item.payStatus==0?'primary':(item.payStatus==1?'success':'error')"
|
|
|
+ :text="fmtDictName('Order.pay', item.payStatus)"></uv-text>
|
|
|
+
|
|
|
+ <!-- <uv-tags class="ml10" style="margin-left: 10px;" size="mini" plain
|
|
|
+ :type="item.orderStatus==0?'primary':(item.orderStatus==1?'success':'error')"
|
|
|
+ :text="fmtDictName('Order.status', item.orderStatus)"></uv-tags>-->
|
|
|
</view>
|
|
|
+ <text class="wallet-item_header-amt">{{ (item.amount / 100).toFixed(2) }}元</text>
|
|
|
</view>
|
|
|
- </template>
|
|
|
- </uv-list-item>
|
|
|
- </uv-list>
|
|
|
-
|
|
|
- <uv-load-more :status="computedLoadMoreStatus"
|
|
|
- bgColor="#fff"
|
|
|
- @loadmore="loadMore" dashed :height="30"/>
|
|
|
+ <view class="wallet-item_body">
|
|
|
+ <text class="wallet-item_body-order">{{ item.orderId }}</text>
|
|
|
+ <text class="wallet-item_body-time">{{ fmtDateTime(item.startTime) }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </uv-list-item>
|
|
|
+ </uv-list>
|
|
|
+
|
|
|
+ <uv-load-more :status="computedLoadMoreStatus"
|
|
|
+ bgColor="#fff"
|
|
|
+ @loadmore="loadMore" dashed :height="30"/>
|
|
|
<!-- <login-bar class="w100 text-center"></login-bar>-->
|
|
|
<!-- <tab-bar :index="3"/>-->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import {computed, reactive} from 'vue'
|
|
|
+import {computed, reactive, ref} from 'vue'
|
|
|
import {onHide, onShow, onPullDownRefresh, onReachBottom,} from "@dcloudio/uni-app";
|
|
|
import {get} from "@/utils/https";
|
|
|
import {fmtDictName, fmtDateTime} from "@/utils/common";
|
|
|
@@ -59,22 +59,21 @@ onShow(() => {
|
|
|
console.error(gd)
|
|
|
return;
|
|
|
}
|
|
|
- loadOrderList();
|
|
|
+ loadOrderList(true);
|
|
|
});
|
|
|
|
|
|
onHide(() => {
|
|
|
Object.assign(state, initState());
|
|
|
})
|
|
|
|
|
|
-const computedLoadMoreStatus =computed(()=>{
|
|
|
- return state.hasNext?'loadmore':'nomore'
|
|
|
+const computedLoadMoreStatus = computed(() => {
|
|
|
+ return state.hasNext ? 'loadmore' : 'nomore'
|
|
|
})
|
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
console.log("onPullDownRefresh")
|
|
|
setTimeout(function () {
|
|
|
- state.query.pageNum = 1;
|
|
|
- loadOrderList()
|
|
|
+ loadOrderList(true)
|
|
|
}, 100);
|
|
|
})
|
|
|
|
|
|
@@ -85,17 +84,26 @@ onReachBottom(() => {
|
|
|
|
|
|
const loadMore = () => {
|
|
|
if (state.hasNext) {
|
|
|
- state.query.pageNum++
|
|
|
- loadOrderList()
|
|
|
+ loadOrderList(false)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const loadOrderList = () => {
|
|
|
+const loadOrderList = (refresh: boolean) => {
|
|
|
+ if (!refresh) {
|
|
|
+ state.query.pageNum++
|
|
|
+ } else {
|
|
|
+ state.query.pageNum = 1
|
|
|
+ }
|
|
|
//load order list
|
|
|
get(`/wash-order/listMyWashOrder`, state.query).then((res: any) => {
|
|
|
- if(res.list){
|
|
|
- state.orderList = state.orderList.concat(res.list);
|
|
|
- state.hasNext = res.pages>state.query.pageNum;
|
|
|
+ if (res.list) {
|
|
|
+ if (refresh) {
|
|
|
+ state.orderList = res.list;
|
|
|
+ } else {
|
|
|
+ state.orderList = state.orderList.concat(res.list);
|
|
|
+ }
|
|
|
+
|
|
|
+ state.hasNext = res.pages > state.query.pageNum;
|
|
|
}
|
|
|
|
|
|
uni.stopPullDownRefresh();
|