Commit 2ecfd683 authored by Facius's avatar Facius

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

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