Commit 488c1baf authored by 刘用法's avatar 刘用法

工单列表

parent 9ebfd832
...@@ -58,14 +58,14 @@ const install = (Vue, vm) => { ...@@ -58,14 +58,14 @@ const install = (Vue, vm) => {
return config; return config;
} }
function getCode(res){ function getCode(res){
const result = res.data || res // const result = res.data || res
let code // let code
if(result.hasOwnProperty('statusCode')){ // if(result.hasOwnProperty('statusCode')){
code = res.statusCode // code = res.statusCode
}else if(result.hasOwnProperty('code')){ // }else if(result.hasOwnProperty('code')){
code = result.code // code = result.code
} // }
return code return res.statusCode || res.code || res.data.statusCode || res.data.code
} }
function getMsg(res){ function getMsg(res){
res = res.data || res res = res.data || res
......
...@@ -163,6 +163,8 @@ ...@@ -163,6 +163,8 @@
}; };
await app.getBaseInfo(self, callBack); await app.getBaseInfo(self, callBack);
this.orderList = []
this.messageList = []
// 加载消息列表 // 加载消息列表
self.loadMessageList(); self.loadMessageList();
self.loadOrderList(); self.loadOrderList();
...@@ -184,7 +186,6 @@ ...@@ -184,7 +186,6 @@
}, },
loadOrderList() { loadOrderList() {
console.log('-----------准备加载推荐列表-----------') console.log('-----------准备加载推荐列表-----------')
return
let self = this; let self = this;
// 加载订单列表 // 加载订单列表
self.search.token = self.vuex_token; self.search.token = self.vuex_token;
...@@ -192,7 +193,7 @@ ...@@ -192,7 +193,7 @@
uni.stopPullDownRefresh() // 结束下拉刷新 uni.stopPullDownRefresh() // 结束下拉刷新
if (res.code == 200) { if (res.code == 200) {
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
self.orderList.push().apply(res.data); self.orderList.push(...res.data);
} }
} else { } else {
console.log(res.message, "初始化订单列表异常"); console.log(res.message, "初始化订单列表异常");
......
...@@ -13,24 +13,23 @@ ...@@ -13,24 +13,23 @@
</view> </view>
</view> </view>
<view class="u-tabs-box" v-show="curNow == 0"> <view class="u-tabs-box" v-show="curNow == 0">
<u-tabs-swiper activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44" <u-tabs activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44"
:offset="[-1,10]" ref="tabs" :list="list" count="total" :current="current" @change="change" :offset="[-1,10]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" swiperWidth="750"></u-tabs-swiper> :is-scroll="false"></u-tabs>
</view> </view>
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" <!-- <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"> -->
@animationfinish="animationfinish"> <!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> -->
<swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring> <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring>
<view class="page-box"> <view class="page-box">
<view v-for="(item, index) in res" :key="item.orderId"> <view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :orderType="orderType" :location="dataValue" <OrderCell :orderData="item" :orderType="orderType" :location="dataValue"
@click="handleClick(item)" @action="handleAction(item)"> </OrderCell> @click="handleClick(item)" @action="handleAction(item)"> </OrderCell>
</view> </view>
<u-loadmore :status="loadStatus[ind]" bgColor="#F4F5F7"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</view> </view>
</scroll-view> </scroll-view>
</swiper-item> <!-- </swiper-item>
</swiper> </swiper> -->
<!-- </view> --> <!-- </view> -->
</TabBarPage> </TabBarPage>
...@@ -48,8 +47,6 @@ ...@@ -48,8 +47,6 @@
return { return {
showSview: true, showSview: true,
curNow: 0, curNow: 0,
timestamp: 1000,
triggered: false,
pageNumber: 0, pageNumber: 0,
pageSize: 10, pageSize: 10,
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish //waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
...@@ -61,8 +58,7 @@ ...@@ -61,8 +58,7 @@
4: 'exception', 4: 'exception',
5: 'finish' 5: 'finish'
}, },
orderList: [[],[],[],[],[],[]], orderList: [],
dataList: [],
list: [{ list: [{
name: '待预约', name: '待预约',
total: 0, total: 0,
...@@ -85,12 +81,8 @@ ...@@ -85,12 +81,8 @@
} }
], ],
current: 0, current: 0,
swiperCurrent: 0, loadStatus: 'loading',
tabsHeight: 0,
dx: 0,
loadStatus: ['loading','loading','loading','loading','loading','loading'],
dataValue: [], dataValue: [],
total: 0
}; };
}, },
onLoad() { onLoad() {
...@@ -107,22 +99,23 @@ ...@@ -107,22 +99,23 @@
return this.currentIndex + 1 return this.currentIndex + 1
}, },
currentIndex() { currentIndex() {
return this.curNow == 0 ? this.swiperCurrent : 5 return this.curNow == 0 ? this.current : 5
} }
}, },
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index; this.curNow = index;
this.pageNumber = 0 this.pageNumber = 0
if (index === 1) { this.orderList = []
this.showSview = false this.loadStatus = 'loading'
// 加载已完工的数据 this.getOrderList(index === 0 ? 0 : 5)
this.getOrderList(5) },
} else { // tab栏切换
this.showSview = true change(index) {
// 加载已完工的数据 this.current = index;
this.getOrderList(0) this.orderList = []
} this.loadStatus = 'loading'
this.getOrderList(index);
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
...@@ -145,10 +138,8 @@ ...@@ -145,10 +138,8 @@
}, },
reachBottom(e) { reachBottom(e) {
console.log(e) if (this.loadStatus != 'loadmore') return
console.log(this.loadStatus[this.currentIndex]) this.loadStatus == 'loading'
if (this.loadStatus[this.currentIndex] != 'loadmore') return
this.loadStatus[this.currentIndex] == 'loading'
this.getOrderList(this.currentIndex) this.getOrderList(this.currentIndex)
}, },
// 页面数据 // 页面数据
...@@ -196,11 +187,11 @@ ...@@ -196,11 +187,11 @@
...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list] ...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list]
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/ /*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
// 后台需要返回order_type,防止数据返回延迟期间点击了其他的tab // 后台需要返回orderType,防止数据返回延迟期间点击了其他的tab
if (res.data) { if (res.data) {
self.orderList[res.data.orderType].push(...res.data.list) self.orderList.push(...res.data.list)
self.list[res.data.orderType].total = res.data.total self.list[res.data.orderType].total = res.data.total
self.loadStatus[res.data.orderType] = res.data.total > self.orderList[res.data.orderType].length ? 'loadmore' : 'nomore' self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, "获取订单数量失败!");
...@@ -235,27 +226,6 @@ ...@@ -235,27 +226,6 @@
} }
}); });
}, },
// tab栏切换
change(index) {
this.swiperCurrent = index;
this.getOrderList(index);
},
transition({
detail: {
dx
}
}) {
this.$refs.tabs.setDx(dx);
},
animationfinish({
detail: {
current
}
}) {
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
viewOderItem(orderId) { // 跳转工单详情页面 viewOderItem(orderId) { // 跳转工单详情页面
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + orderId url: 'pages/order/detail?id=' + orderId
......
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