Commit a6d8bb47 authored by Facius's avatar Facius

improve: 订单页面切换时显示优化

parent 16c5f708
...@@ -22,22 +22,26 @@ ...@@ -22,22 +22,26 @@
</view> </view>
</view> </view>
<view class="u-tabs-box"> <view class="u-tabs-box">
<u-tabs <!-- 写两个是避免切换subsection时候,current不是0的时候底部蓝条有初始动画 -->
height="66" <view v-for="index of [0, 1]" :key="index">
activeColor="#2272FF" <u-tabs
bg-color="none" v-show="curNow == index"
inactive-color="#999" height="66"
bar-height="4" activeColor="#2272FF"
bar-width="44" bg-color="none"
:offset="offset[curNow]" inactive-color="#999"
:list="list[curNow]" bar-height="4"
count="total" bar-width="44"
:current="current" :offset="offset[index]"
@change="change" :list="list[index]"
:is-scroll="false" count="total"
font-size="28" :current="current[index]"
bold @change="change"
></u-tabs> :is-scroll="false"
font-size="28"
bold
></u-tabs>
</view>
</view> </view>
<view class="tab-view"> <view class="tab-view">
...@@ -62,7 +66,10 @@ ...@@ -62,7 +66,10 @@
:customStyle="noOrderCustomStyle" :customStyle="noOrderCustomStyle"
/> />
<template v-else> <template v-else>
<view v-for="item in orderList" :key="item.orderId"> <view
v-for="item in orderList[curNow][current[curNow]]"
:key="item.orderId"
>
<OrderCell <OrderCell
:orderData="item" :orderData="item"
:type="cellType" :type="cellType"
...@@ -104,7 +111,10 @@ export default { ...@@ -104,7 +111,10 @@ export default {
curNow: 0, curNow: 0,
pageNumber: 0, pageNumber: 0,
pageSize: 1000, // 因为需要排序,所以暂时去掉分页 pageSize: 1000, // 因为需要排序,所以暂时去掉分页
orderList: [], orderList: [
[[], [], [], [], [], []],
[[], [], []],
],
list: [ list: [
[ [
{ {
...@@ -147,7 +157,7 @@ export default { ...@@ -147,7 +157,7 @@ export default {
}, },
], ],
], ],
current: 0, current: { 0: 0, 1: 0 },
loadStatus: 'loading', loadStatus: 'loading',
dataValue: [], dataValue: [],
loaded: false, loaded: false,
...@@ -157,7 +167,6 @@ export default { ...@@ -157,7 +167,6 @@ export default {
old: { old: {
scrollTop: 0, scrollTop: 0,
}, },
cellType: 'waitAppointment',
} }
}, },
computed: { computed: {
...@@ -166,7 +175,7 @@ export default { ...@@ -166,7 +175,7 @@ export default {
}, },
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工' // 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() { orderType() {
return this.indexStatus[this.curNow][this.current] return this.indexStatus[this.curNow][this.current[this.curNow]]
}, },
offset() { offset() {
return [ return [
...@@ -221,7 +230,13 @@ export default { ...@@ -221,7 +230,13 @@ export default {
] ]
}, },
noMore() { noMore() {
return this.orderList.length == 0 && this.loaded return (
this.orderList[this.curNow][this.current[this.curNow]].length == 0 &&
this.loaded
)
},
cellType() {
return this.orderType == 'waitLianxi' ? '' : this.orderType
}, },
noOrderCustomStyle() { noOrderCustomStyle() {
return 'margin-top: 100rpx;background-color: #F4F5F7' return 'margin-top: 100rpx;background-color: #F4F5F7'
...@@ -231,7 +246,7 @@ export default { ...@@ -231,7 +246,7 @@ export default {
getApp().trackPage('订单首页') getApp().trackPage('订单首页')
this._freshing = false this._freshing = false
if (e && e.type) { if (e && e.type) {
this.current = e.type this.current[this.curNow] = this.indexStatus[this.curNow].indexOf(e.type)
} }
}, },
onShow() { onShow() {
...@@ -244,7 +259,7 @@ export default { ...@@ -244,7 +259,7 @@ export default {
}, },
// tab栏切换 // tab栏切换
change(index) { change(index) {
this.current = index this.current[this.curNow] = index
// this.orderList = [] // this.orderList = []
this.reloadOrderList() this.reloadOrderList()
}, },
...@@ -273,11 +288,12 @@ export default { ...@@ -273,11 +288,12 @@ export default {
if (res.data.type != self.orderType) return if (res.data.type != self.orderType) return
if (self.pageNumber == 1) { if (self.pageNumber == 1) {
self.orderList = [] self.orderList[this.curNow][this.current[this.curNow]] = []
} }
this.cellType = this.orderType == 'waitLianxi' ? '' : this.orderType
if (res.data.list) { if (res.data.list) {
self.orderList.push(...res.data.list) self.orderList[this.curNow][this.current[this.curNow]].push(
...res.data.list
)
if ( if (
self.list[this.curNow][self.types[this.curNow][res.data.type]] self.list[this.curNow][self.types[this.curNow][res.data.type]]
) { ) {
...@@ -286,12 +302,15 @@ export default { ...@@ -286,12 +302,15 @@ export default {
].total = res.data.total ].total = res.data.total
} }
self.orderList.sort((x, y) => { self.orderList[this.curNow][this.current[this.curNow]].sort(
return x.currentOverTime <= y.currentOverTime ? 1 : -1 (x, y) => {
}) return x.currentOverTime <= y.currentOverTime ? 1 : -1
}
)
self.loadStatus = self.loadStatus =
res.data.total > self.orderList.length && res.data.total >
self.orderList[this.curNow][this.current[this.curNow]].length &&
res.data.list.length == self.pageSize res.data.list.length == self.pageSize
? 'loadmore' ? 'loadmore'
: 'nomore' : 'nomore'
......
...@@ -63,7 +63,9 @@ ...@@ -63,7 +63,9 @@
:prop="item.fieldsName" :prop="item.fieldsName"
:border-bottom="false" :border-bottom="false"
v-show=" v-show="
((item.fieldsName != 'actualPaid' && item.fieldsName != 'eSerialNum') || show200) && ((item.fieldsName != 'actualPaid' &&
item.fieldsName != 'eSerialNum') ||
show200) &&
((readOnly && ((readOnly &&
!$u.test.isEmpty(form[item.fieldsName])) || !$u.test.isEmpty(form[item.fieldsName])) ||
!readOnly) !readOnly)
...@@ -865,7 +867,7 @@ export default { ...@@ -865,7 +867,7 @@ export default {
const save = await this.nextStepSaveData() const save = await this.nextStepSaveData()
if (save) { if (save) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/order?type=0', url: '/pages/index/order?type=waitAppointment',
}) })
} }
}, },
...@@ -1001,7 +1003,7 @@ export default { ...@@ -1001,7 +1003,7 @@ export default {
type: 'success', type: 'success',
callback: () => { callback: () => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/order?type=3', url: '/pages/index/order?type=audit',
}) })
}, },
}) })
...@@ -1022,7 +1024,7 @@ export default { ...@@ -1022,7 +1024,7 @@ export default {
type: 'success', type: 'success',
callback: () => { callback: () => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/order?type=3', url: '/pages/index/order?type=audit',
}) })
}, },
}) })
...@@ -1090,10 +1092,14 @@ export default { ...@@ -1090,10 +1092,14 @@ export default {
if (innerItem.fieldsName === 'paymentMethodsType') { if (innerItem.fieldsName === 'paymentMethodsType') {
// 选不需要收款的时候,收款金额修改为非必选 // 选不需要收款的时候,收款金额修改为非必选
const actualPaid = groupItem.items.find((v) => v.fieldsName === 'actualPaid') const actualPaid = groupItem.items.find(
(v) => v.fieldsName === 'actualPaid'
)
actualPaid.required = data.value != '03' actualPaid.required = data.value != '03'
const eSerialNum = groupItem.items.find((v) => v.fieldsName === 'eSerialNum') const eSerialNum = groupItem.items.find(
(v) => v.fieldsName === 'eSerialNum'
)
eSerialNum.required = data.value != '03' eSerialNum.required = data.value != '03'
} }
......
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