Commit 7a9d3862 authored by Facius's avatar Facius

feat: 前台-订单管理-列表

parent 45ff8ad0
...@@ -162,6 +162,26 @@ ...@@ -162,6 +162,26 @@
"disableScroll": true "disableScroll": true
} }
}, },
{
"path": "order/index",
"style": {
"navigationBarTitleText": "订单管理",
"enablePullDownRefresh": false,
"disableScroll": true,
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#F4F5F7"
}
},
{
"path": "order/list",
"style": {
"navigationBarTitleText": "订单管理-订单列表",
"enablePullDownRefresh": false,
"disableScroll": true,
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#F4F5F7"
}
},
{ {
"path": "wallet/index", "path": "wallet/index",
"style": { "style": {
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
:customStyle="noOrderCustomStyle" :customStyle="noOrderCustomStyle"
/> />
<template v-else> <template v-else>
<view v-for="(item, index) in orderList" :key="item.orderId"> <view v-for="item in orderList" :key="item.orderId">
<OrderCell <OrderCell
:orderData="item" :orderData="item"
:type="cellType" :type="cellType"
......
<template>
<view class="list-view">
<u-navbar
back-icon-color="#333333"
background="#FFFFFF"
:title="title"
titleColor="#333333"
:border-bottom="false"
title-bold
></u-navbar>
<scroll-view
scroll-y
style="height: 100%;width: 100%;"
@scrolltolower="reachBottom"
scroll-anchoring
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
:scroll-top="scrollTop"
refresher-background="#F4F5F7"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@scroll="scroll"
enable-back-to-top
>
<view class="loading-view" v-if="!loaded && !_freshing">
<u-loading mode="flower"></u-loading>
</view>
<NoOrder
v-else-if="noMore"
imageName="zwdd.png"
:customStyle="noOrderCustomStyle"
/>
<template v-else>
<view v-for="item in orderList" :key="item.orderId">
<OrderCell
:orderData="item"
:type="cellType"
:location="dataValue"
@click="handleClick"
@action="handleClickCellButton"
>
</OrderCell>
</view>
<view class="load-more-view">
<u-loadmore
v-show="(pageNumber == 1 && loaded) || pageNumber > 1"
:status="loadStatus"
bgColor="#F4F5F7"
></u-loadmore>
</view>
</template>
</scroll-view>
</view>
</template>
<script>
import OrderCell from '@/components/order/index.vue'
import NoOrder from '@/components/order/noOrder.vue'
export default {
components: {
OrderCell,
NoOrder,
},
data() {
return {
pageNumber: 0,
pageSize: 1000, // 因为需要排序,所以暂时去掉分页
orderList: [],
loadStatus: 'loading',
dataValue: [],
loaded: false,
triggered: true,
_freshing: false,
orderType: '',
timeType: '',
}
},
computed: {
title() {
return (
this.orderTypeTexts[this.timeType] +
'-' +
this.orderTypeTexts[this.orderType]
)
},
orderTypeTexts() {
return {
waitAppointment: '已接单',
waitCheckIn: '已接单',
waitFinish: '已前到',
finish: '已完工',
}
},
timeTypeTexts() {
return { today: '今日', yesterday: '昨日', week: '本周', month: '本月' }
},
cellType() {
return this.orderType == 'waitLianxi' ? '' : this.orderType
},
noMore() {
return this.orderList.length == 0 && this.loaded
},
noOrderCustomStyle() {
return 'margin-top: 100rpx;background-color: #F4F5F7'
},
},
onLoad(e) {
getApp().trackPage('订单首页')
this._freshing = false
if (e && e.orderType) {
this.orderType = e.orderType
}
if (e && e.timeType) {
this.timeType = e.timeType
}
},
onShow() {
this.reloadOrderInfo()
},
methods: {
reachBottom(e) {
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList()
},
// 页面数据
getOrderList() {
// 状态处理
this.pageNumber += 1
if (this.pageNumber == 1) {
this.loaded = false
}
var param = {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
keyword: '',
type: this.orderType,
}
var self = this
self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) {
if (self.pageNumber == 1) {
self.orderList = []
}
if (res.data.list) {
self.orderList.push(...res.data.list)
self.orderList.sort((x, y) => {
return x.currentOverTime <= y.currentOverTime ? 1 : -1
})
self.loadStatus =
res.data.total > self.orderList.length &&
res.data.list.length == self.pageSize
? 'loadmore'
: 'nomore'
}
} else {
console.log(res.message, '获取订单数量失败!')
}
self.$nextTick(() => {
if (self._freshing) {
self.triggered = false
self._freshing = false
}
})
this.loaded = true
})
},
handleClickCellButton(item, type) {
if (type == 'exception') {
this.$u.api.workerDealWithError(item.orderId).then(() => {})
}
// 去完工
uni.navigateTo({
url:
'pages/order/complete?orderId=' +
item.orderId +
'&categoryId=' +
item.categoryId +
'&orderServiceType=' +
item.orderServiceType +
'&inGuaranteePeriod=' +
item.inGuaranteePeriod +
'&partnerCompanyId=' +
item.partnerCompanyId +
'&maintainStep=' +
item.maintainStep +
'&orderStatus=' +
item.orderStatus +
'&brandId=' +
item.lianbaoBrandId +
'&auditResults=' +
(item.auditResults ? Object.keys(item.auditResults).join() : ''),
})
},
handleClick(item, type, showCountTime) {
// type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
//type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({
url:
'pages/order/detail?id=' +
item.orderId +
'&type=' +
type +
'&showCountTime=' +
showCountTime,
})
},
onRefresh() {
if (this._freshing) return
this._freshing = true
this.reloadOrderInfo()
},
onRestore() {
this.triggered = 'restore' // 需要重置
},
reloadOrderInfo() {
this.reloadOrderList()
this.getOrderCount()
},
reloadOrderList() {
this.pageNumber = 0
this.loadStatus = 'loading'
this.getOrderList()
},
},
}
</script>
<style lang="scss" scoped>
.list-view {
height: 100vh;
overflow: auto;
padding-bottom: 24rpx;
display: flex;
flex-direction: column;
.load-more-view {
margin-bottom: 20rpx;
}
.loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 300rpx;
position: absolute;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment