Commit 97a3f481 authored by Facius's avatar Facius

订单列表页ui

parent 7a0a0df3
page { page {
background-color: #fafafa; background-color: #f4f5f7;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
......
<template> <template>
<view class="content"> <view :class="['content', {'fixed': fixed}]">
<u-navbar :is-back="false" :is-fixed="false" :background="{ background: 'transparent' }" :border-bottom="false"> <u-navbar :is-back="false" :is-fixed="false" :background="{ background: 'transparent' }" :border-bottom="false">
<text class="title-view">{{title}}</text> <text class="title-view">{{title}}</text>
</u-navbar> </u-navbar>
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
title: { title: {
type: String, type: String,
default: '充电桩自营平台' default: '充电桩自营平台'
},
fixed: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -27,11 +31,15 @@ ...@@ -27,11 +31,15 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {
height: 100vh; height: 100vh;
background-color: #f4f5f7; background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx; padding: 0rpx 30rpx 0 30rpx;
overflow-y: auto; overflow-y: auto;
&.fixed {
display: flex;
flex-direction: column;
}
.title-view { .title-view {
color: #333333; color: #333333;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"style": { "style": {
"navigationBarTitleText": "订单", "navigationBarTitleText": "订单",
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": true "disableScroll": true
} }
}, },
{ {
...@@ -251,6 +251,11 @@ ...@@ -251,6 +251,11 @@
"path": "pages/index/index", //启动页面,必选 "path": "pages/index/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
}, },
{
"name": "订单列表", //模式名称
"path": "pages/order/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},
{ {
"name": "入驻首页", "name": "入驻首页",
"path": "pages/settle/index", "path": "pages/settle/index",
......
<template> <template>
<TabBarPage title="订单"> <TabBarPage title="订单" :fixed="true">
<view class="wrap"> <!-- <view class="wrap"> -->
<view class="tools-box"> <view class="tools-box">
<view class="search-sub"> <view class="search-sub">
<u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white" <u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white"
...@@ -19,21 +19,20 @@ ...@@ -19,21 +19,20 @@
</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 orderLists" :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-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring>
refresher-enabled @refresherrefresh="refresherrefresh">
<view class="page-box"> <view class="page-box">
<view v-for="(item, index) in res" :key="item.orderId"> <view v-for="(item, index) in res" :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[0]" bgColor="#f2f2f2"></u-loadmore> <u-loadmore :status="loadStatus[ind]" bgColor="#F4F5F7"></u-loadmore>
</view> </view>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> <!-- </view> -->
</TabBarPage> </TabBarPage>
</template> </template>
...@@ -49,7 +48,10 @@ ...@@ -49,7 +48,10 @@
return { return {
showSview: true, showSview: true,
curNow: 0, curNow: 0,
timestamp: 1000, timestamp: 1000,
triggered: false,
pageNumber: 0,
pageSize: 10,
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish //waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus: { indexStatus: {
0: 'waitAccept', 0: 'waitAccept',
...@@ -59,51 +61,34 @@ ...@@ -59,51 +61,34 @@
4: 'exception', 4: 'exception',
5: 'finish' 5: 'finish'
}, },
orderLists: [ orderList: [[],[],[],[],[],[]],
[],
[],
[],
[],
[],
[]
],
dataList: [], dataList: [],
list: [{ list: [{
name: '待预约', name: '待预约',
total: 0, total: 0,
pageNumber: 0,
pageSize: 10
}, },
{ {
name: '待签到', name: '待签到',
total: 0, total: 0,
pageNumber: 0,
pageSize: 10
}, },
{ {
name: '待完工', name: '待完工',
total: 0, total: 0,
pageNumber: 0,
pageSize: 10
}, },
{ {
name: '待审核', name: '待审核',
total: 0, total: 0,
pageNumber: 0,
pageSize: 10
}, },
{ {
name: '异常单', name: '异常单',
total: 0, total: 0,
pageNumber: 0,
pageSize: 10
} }
], ],
current: 0, current: 0,
swiperCurrent: 0, swiperCurrent: 0,
tabsHeight: 0, tabsHeight: 0,
dx: 0, dx: 0,
loadStatus: ['loading', 'loading', 'loading', 'loading', 'loading', 'loading'], loadStatus: ['loading','loading','loading','loading','loading','loading'],
dataValue: [], dataValue: [],
total: 0 total: 0
}; };
...@@ -126,7 +111,9 @@ ...@@ -126,7 +111,9 @@
} }
}, },
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index;
this.pageNumber = 0
if (index === 1) { if (index === 1) {
this.showSview = false this.showSview = false
// 加载已完工的数据 // 加载已完工的数据
...@@ -136,23 +123,6 @@ ...@@ -136,23 +123,6 @@
// 加载已完工的数据 // 加载已完工的数据
this.getOrderList(0) this.getOrderList(0)
} }
this.curNow = index;
},
timeChange(currentOverTime, index) {
let self = this
var nowTime = new Date(); // 当前时间
if (nowTime.getTime() > currentOverTime * 1000) {
self.$refs['uCountDown' + index][0].seconds += 2
}
},
timestampDiff(currentOverTime) {
var nowTime = new Date(); // 当前时间
if (nowTime.getTime() > currentOverTime * 1000) {
var diff = nowTime.getTime() - (currentOverTime * 1000);
} else {
var diff = (currentOverTime * 1000) - nowTime.getTime();
}
return diff;
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
...@@ -174,34 +144,31 @@ ...@@ -174,34 +144,31 @@
}); });
}, },
reachBottom() { reachBottom(e) {
// 此tab为空数据 console.log(e)
if (this.current != 2) { console.log(this.loadStatus[this.currentIndex])
this.loadStatus.splice(this.current, 1, 'loading'); if (this.loadStatus[this.currentIndex] != 'loadmore') return
setTimeout(() => { this.loadStatus[this.currentIndex] == 'loading'
this.getOrderList(this.current); this.getOrderList(this.currentIndex)
}, 1200);
}
}, },
// 页面数据 // 页面数据
getOrderList(index) { getOrderList(index) {
// 状态处理 // 状态处理
console.log("chage:", this.indexStatus[index]) this.pageNumber += 1
this.list[index].pageNumber += 1
var param = { var param = {
pageNumber: this.list[index].pageNumber, pageNumber: this.pageNumber,
pageSize: this.list[index].pageSize, pageSize: this.pageSize,
keyword: '', keyword: '',
type: this.indexStatus[index] type: this.indexStatus[index]
} }
var self = this; var self = this;
self.$u.api.listOrder(param).then((res) => { self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log("getOrderList", res.data) console.log("getOrderList", res.data)
/*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/ /*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/
var res = { var res = {
data: { data: {
total: 100, total: 15,
orderType: this.currentIndex, orderType: this.currentIndex,
list: [{ list: [{
orderServiceType: '安装', // 服务类型:安装、维修 orderServiceType: '安装', // 服务类型:安装、维修
...@@ -224,15 +191,16 @@ ...@@ -224,15 +191,16 @@
}] }]
} }
} }
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 // 后台需要返回order_type,防止数据返回延迟期间点击了其他的tab
if (res.data) { if (res.data) {
self.orderLists[res.data.orderType].push(...res.data.list) self.orderList[res.data.orderType].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.orderLists[res.data self.loadStatus[res.data.orderType] = res.data.total > self.orderList[res.data.orderType].length ? 'loadmore' : 'nomore'
.orderType].length ? 'loading' : 'nomore'
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, "获取订单数量失败!");
...@@ -240,11 +208,6 @@ ...@@ -240,11 +208,6 @@
}); });
}, },
refresherrefresh() {
this.list[this.currentIndex].pageNumber = 0
this.orderLists[this.currentIndex] = []
this.getOrderList()
},
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
...@@ -272,22 +235,6 @@ ...@@ -272,22 +235,6 @@
} }
}); });
}, },
// 总价
totalPrice(item) {
let price = 0;
item.map(val => {
price += parseFloat(val.price);
});
return price.toFixed(2);
},
// 总件数
totalNum(item) {
let num = 0;
item.map(val => {
num += val.number;
});
return num;
},
// tab栏切换 // tab栏切换
change(index) { change(index) {
this.swiperCurrent = index; this.swiperCurrent = index;
...@@ -513,7 +460,10 @@ ...@@ -513,7 +460,10 @@
} }
.swiper-item { .swiper-item {
height: 100%; height: 100%;
.page-box {
padding-bottom: 20rpx;
}
} }
.tools-box { .tools-box {
......
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