Commit 97a3f481 authored by Facius's avatar Facius

订单列表页ui

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