Commit 2ecfd683 authored by Facius's avatar Facius

feat: 前台-订单列表-页面

parent 246bdd71
This diff is collapsed.
......@@ -21,7 +21,7 @@
<text class="search-btn-text">搜订单</text>
</view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<view class="u-tabs-box">
<u-tabs
height="66"
activeColor="#2272FF"
......@@ -29,8 +29,8 @@
inactive-color="#999"
bar-height="4"
bar-width="44"
:offset="[0, 0]"
:list="list"
:offset="offset[curNow]"
:list="list[curNow]"
count="total"
:current="current"
@change="change"
......@@ -68,7 +68,7 @@
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell
:orderData="item"
:type="orderType"
:type="cellType"
:location="dataValue"
@click="handleClick"
@action="handleClickCellButton"
......@@ -106,26 +106,46 @@ export default {
pageSize: 1000, // 因为需要排序,所以暂时去掉分页
orderList: [],
list: [
{
name: '待预约',
total: 0,
},
{
name: '待签到',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '审核中',
total: 0,
},
{
name: '异常单',
total: 0,
},
[
{
name: '待预约',
total: 0,
},
{
name: '待签到',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '审核中',
total: 0,
},
{
name: '异常单',
total: 0,
},
{
name: '已完工',
total: 0,
},
],
[
{
name: '待联系',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '异常单',
total: 0,
},
],
],
current: 0,
loadStatus: 'loading',
......@@ -141,38 +161,54 @@ export default {
},
computed: {
subList() {
return ['待处理', '已完工']
return ['全部订单', '今日订单']
},
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() {
return this.indexStatus[this.currentIndex]
return this.indexStatus[this.curNow][this.current]
},
currentIndex() {
return this.curNow == 0 ? this.current : 5
cellType() {
return this.orderType == 'waitLianxi' ? '' : this.orderType
},
offset() {
return [
[0, 0],
[0, 44],
]
},
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
},
types() {
return {
waitAppointment: 0, // 待预约、
waitCheckIn: 1, // 待签到、
waitFinish: 2, // 待完工、
audit: 3, // 审核中、
exception: 4, // 异常单、
finish: 5, //已完工
}
return [
{
waitAppointment: 0, // 待预约、
waitCheckIn: 1, // 待签到、
waitFinish: 2, // 待完工、
audit: 3, // 审核中、
exception: 4, // 异常单、
finish: 5, //已完工
},
{
waitLianxi: 0, // 待联系、
waitFinish: 1, // 待完工、
exception: 2, // 异常单、
},
]
},
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() {
return {
0: 'waitAppointment',
1: 'waitCheckIn',
2: 'waitFinish',
3: 'audit',
4: 'exception',
5: 'finish',
}
return [
[
'waitAppointment',
'waitCheckIn',
'waitFinish',
'audit',
'exception',
'finish',
],
['waitLianxi', 'waitFinish', 'exception'],
]
},
countKeys() {
return [
......@@ -181,15 +217,16 @@ export default {
'toFinishCount',
'reviewingCount',
'exceptionCount',
'todayDlxCount',
'todayDwgCount',
'todayYcdCount',
]
},
noMore() {
return this.orderList.length == 0 && this.loaded
},
noOrderCustomStyle() {
return this.curNow == 0
? 'margin-top: 100rpx;background-color: #F4F5F7'
: 'margin-top: 200rpx;background-color: #F4F5F7'
return 'margin-top: 100rpx;background-color: #F4F5F7'
},
},
onLoad(e) {
......@@ -217,10 +254,10 @@ export default {
reachBottom(e) {
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList(this.currentIndex)
this.getOrderList()
},
// 页面数据
getOrderList(index) {
getOrderList() {
// 状态处理
this.pageNumber += 1
if (this.pageNumber == 1) {
......@@ -230,7 +267,7 @@ export default {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
keyword: '',
type: this.indexStatus[index],
type: this.orderType,
}
var self = this
self.$u.api.listOrder(param).then((res) => {
......@@ -242,10 +279,14 @@ export default {
}
if (res.data.list) {
self.orderList.push(...res.data.list)
if (self.list[self.types[res.data.type]]) {
self.list[self.types[res.data.type]].total = res.data.total
if (
self.list[this.curNow][self.types[this.curNow][res.data.type]]
) {
self.list[this.curNow][
self.types[this.curNow][res.data.type]
].total = res.data.total
}
self.orderList.sort((x, y) => {
return x.currentOverTime <= y.currentOverTime ? 1 : -1
})
......@@ -271,19 +312,26 @@ export default {
// 获取订单数量
getOrderCount() {
var self = this
self.$u.api.listOrderCount().then((res) => {
this.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
if (res.data) {
// 修改各个tab数量
var j = 0
var i = 0
var count = 0
for (var item of self.list) {
item.total = res.data[self.countKeys[i]]
count += item.total
i++
for (var items of this.list) {
for (var item of items) {
console.log(this.curNow, i, this.countKeys[i])
item.total = res.data[this.countKeys[i]] || 0
if (j == 0) {
// 待处理数量加起来
count += item.total
console.log('count', item)
}
i++
}
j++
}
// 修改tab总数
if (count > 0) {
uni.setTabBarBadge({
......@@ -302,9 +350,9 @@ export default {
})
},
handleClickCellButton(item, type) {
if (type == 'exception') {
this.$u.api.workerDealWithError(item.orderId).then(() => {})
}
if (type == 'exception') {
this.$u.api.workerDealWithError(item.orderId).then(() => {})
}
// 去完工
uni.navigateTo({
url:
......@@ -362,7 +410,7 @@ export default {
reloadOrderList() {
this.pageNumber = 0
this.loadStatus = 'loading'
this.getOrderList(this.currentIndex)
this.getOrderList()
},
scroll(e) {
this.old.scrollTop = e.detail.scrollTop
......@@ -381,7 +429,12 @@ export default {
.u-tabs-box {
margin-bottom: 30rpx;
}
// .u-tabs-box {
// margin-bottom: 20rpx !important;
// }
// /deep/ .u-tab-bar {
// bottom: 10rpx !important;
// }
.tab-view {
height: 100%;
overflow: auto;
......@@ -403,7 +456,7 @@ export default {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-bottom: 20rpx;
padding-bottom: 18rpx;
.search-sub {
height: 72rpx;
......
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