Commit 3d59a3bd authored by 刘用法's avatar 刘用法

工单列表数据

parent da86b864
...@@ -76,8 +76,15 @@ ...@@ -76,8 +76,15 @@
orderBusinessType: 'R', // 业务类型 R 为抢单 orderBusinessType: 'R', // 业务类型 R 为抢单
} }
} }
}, },
orderType: Number, // 0:待接单 1:'去预约', 2:'去签到', 3:'去完工', 4:'审核中', 5:'去处理', 6'已完工' // waitAccept:待接单、
// waitAppointment:待预约、
// waitCheckIn:待签到、
// waitFinish:待完工、
// review: 审核中、
// exception:异常单、
// finish:已完工
type: String,
location: { // 当前坐标 location: { // 当前坐标
type: Array, type: Array,
default () { default () {
...@@ -207,6 +214,20 @@ ...@@ -207,6 +214,20 @@
}, },
showDistance() { showDistance() {
return this.orderType == 0 return this.orderType == 0
},
types() {
return {
'waitAccept': 0, // 待接单、
'waitAppointment': 1, // 待预约、
'waitCheckIn': 2, // 待签到、
'waitFinish': 3, // 待完工、
'review': 4, // 审核中、
'exception': 5, // 异常单、
'finish': 6, //已完工
}
},
orderType() {
return this.types[this.type]
} }
}, },
methods: { methods: {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
color: #666666; color: #666666;
font-size: 28rpx; font-size: 28rpx;
padding: 30rpx; padding: 30rpx;
background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
min-height: 460rpx; min-height: 460rpx;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
取消 取消
</u-button> </u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure"> <u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure">
确定 查看
</u-button> </u-button>
</view> </view>
</view> </view>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
</view> </view>
<view v-else-if="!needSettled && orderList.length > 0" class="order-item-view"> <view v-else-if="!needSettled && orderList.length > 0" class="order-item-view">
<view v-for="(item, index) in orderList" :key="index"> <view v-for="(item, index) in orderList" :key="index">
<OrderCell :orderData="item" :orderType="0" :location="location" @click="handleClick" <OrderCell :orderData="item" type="waitAccept" :location="location" @click="handleClick(item.orderId)"
@action="handleAction"> </OrderCell> @action="handleAction(item.orderId)"> </OrderCell>
</view> </view>
<u-loadmore :status="currentLoadStatus" bgColor="#f2f2f2"></u-loadmore> <u-loadmore :status="currentLoadStatus" bgColor="#f2f2f2"></u-loadmore>
</view> </view>
...@@ -143,12 +143,18 @@ ...@@ -143,12 +143,18 @@
}, },
methods: { methods: {
handleClick() { // 点击了cell handleClick(orderId) { // 点击了cell
console.log('点击了cell') console.log('点击了cell')
this.viewOderItem(orderId)
}, },
handleAction() { // 点击了按钮 handleAction(orderId) { // 点击了按钮
console.log('点击了按钮') console.log('点击了按钮')
this.viewOderItem(orderId)
},
viewOderItem(orderId) { // 跳转工单详情页面
uni.navigateTo({
url: 'pages/order/detail?id=' + orderId
})
}, },
async initSettleInfo() { async initSettleInfo() {
let self = this; let self = this;
......
<template> <template>
<TabBarPage title="订单" :fixed="true"> <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"
inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72" inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72"
bold> bold>
</u-subsection> </u-subsection>
</view>
<view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text>
</view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44"
:offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs>
</view> </view>
<view class="tab-view"> <view class="search-btn" @click="handleClickSearch">
<!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> --> <image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring> <text class="search-btn-text">搜订单</text>
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :orderType="orderType" :location="dataValue"
@click="handleClick(item)" @action="handleAction(item)"> </OrderCell>
</view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</scroll-view>
<!-- </swiper-item> -->
</view> </view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4"
bar-width="44" :offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs>
</view>
<NoOrder v-if="noMore" style="margin-top: 100rpx;" />
<view v-else class="tab-view">
<!-- <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 v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick(item)"
@action="handleAction(item)"> </OrderCell>
</view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</scroll-view>
<!-- </swiper-item> -->
</view>
<!-- </view> --> <!-- </view> -->
<PopView title="aaaa" message="bbbb" :visible="visibale"/> <PopView title="aaaa" message="bbbb" :visible="visibale" />
</TabBarPage> </TabBarPage>
</template> </template>
<script> <script>
import TabBarPage from "@/components/tabBarList/index.vue" import TabBarPage from "@/components/tabBarList/index.vue"
import OrderCell from "@/components/order/index.vue" import OrderCell from "@/components/order/index.vue"
import NoOrder from "@/components/order/noOrder.vue"
export default { export default {
components: { components: {
TabBarPage, TabBarPage,
OrderCell OrderCell,
NoOrder
}, },
data() { data() {
return { return {
visibale: false, visibale: false,
showSview: true, showSview: true,
curNow: 0, curNow: 0,
pageNumber: 0, pageNumber: 0,
pageSize: 10, pageSize: 10,
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus: {
0: 'waitAppointment',
1: 'waitCheckIn',
2: 'waitFinish',
3: 'exception',
5: 'finish'
},
orderList: [], orderList: [],
list: [{ list: [{
name: '待预约', name: '待预约',
...@@ -72,7 +69,7 @@ ...@@ -72,7 +69,7 @@
total: 0, total: 0,
}, },
{ {
name: '待审核', name: '审核中',
total: 0, total: 0,
}, },
{ {
...@@ -83,6 +80,7 @@ ...@@ -83,6 +80,7 @@
current: 0, current: 0,
loadStatus: 'loading', loadStatus: 'loading',
dataValue: [], dataValue: [],
loaded: false
}; };
}, },
onLoad() { onLoad() {
...@@ -94,31 +92,57 @@ ...@@ -94,31 +92,57 @@
subList() { subList() {
return ['待受理', '已完工'] return ['待受理', '已完工']
}, },
// 0:待接单 1:'去预约', 2:'去签到', 3:'去完工', 4:'审核中', 5:'去处理', 6'已完工' // 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() { orderType() {
return this.currentIndex + 1 return this.indexStatus[this.currentIndex]
}, },
currentIndex() { currentIndex() {
return this.curNow == 0 ? this.current : 5 return this.curNow == 0 ? this.current : 5
}, },
sousuoImage() { sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png' return process.uniEnv.qn_base_url + 'sousuo.png'
},
types() {
return {
'waitAppointment': 0, // 待预约、
'waitCheckIn': 1, // 待签到、
'waitFinish': 2, // 待完工、
'review': 3, // 审核中、
'exception': 4, // 异常单、
'finish': 5, //已完工
}
},
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() {
return {
0: 'waitAppointment',
1: 'waitCheckIn',
2: 'waitFinish',
3: 'review',
4: 'exception',
5: 'finish'
}
},
noMore() {
console.log('nomore:', this.orderList.length == 0 && this.pageNumber != 0)
return this.orderList.length == 0 && this.loaded
} }
}, },
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index; this.curNow = index;
this.pageNumber = 0 this.pageNumber = 0
this.orderList = [] this.orderList = []
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderList(index === 0 ? 0 : 5) this.getOrderList(index === 0 ? 0 : 5)
}, },
// tab栏切换 // tab栏切换
change(index) { change(index) {
this.current = index; this.current = index;
this.orderList = [] this.pageNumber = 0
this.loadStatus = 'loading' this.orderList = []
this.getOrderList(index); this.loadStatus = 'loading'
this.getOrderList(index);
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
...@@ -140,15 +164,16 @@ ...@@ -140,15 +164,16 @@
}); });
}, },
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(this.currentIndex)
}, },
// 页面数据 // 页面数据
getOrderList(index) { getOrderList(index) {
// 状态处理 // 状态处理
// this.pageNumber += 1 this.pageNumber += 1
this.loaded = false
var param = { var param = {
pageNumber: this.pageNumber, pageNumber: this.pageNumber,
pageSize: this.pageSize, pageSize: this.pageSize,
...@@ -156,15 +181,15 @@ ...@@ -156,15 +181,15 @@
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 = { res.data.type = self.orderType
data: { if (res.data.list) {
total: 15, res.data.total = 15
orderType: this.currentIndex, if (res.data.list.length == 0 && res.data.total > 0) {
list: [{ res.data.list = [{
orderServiceType: '安装', // 服务类型:安装、维修 orderServiceType: '安装', // 服务类型:安装、维修
categoryName: '充电桩', // 品类:充电桩 categoryName: '充电桩', // 品类:充电桩
orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池 orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
...@@ -181,26 +206,31 @@ ...@@ -181,26 +206,31 @@
auditDatetime: '2021.04.19 12:45:09', // 审核时间 auditDatetime: '2021.04.19 12:45:09', // 审核时间
submissionTime: '2021.04.19 16:24:48', // 提交时间 submissionTime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果 auditResults: {}, // 审核结果
orderBusinessType: 'R', // 业务类型 R 为抢单 orderBusinessType: 'R', // 业务类型 R 为抢单
orderId: '0', // 订单id
}] }]
} }
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, ...res.data.list, ...res.data.list, ...res
...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list] .data.list, ...res.data.list
]
}
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/ /*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
// 后台需要返回orderType,防止数据返回延迟期间点击了其他的tab // 后台需要返回type,防止数据返回延迟期间点击了其他的tab
if (res.data) { if (res.data.type != self.orderType) return
if (res.data.list) {
self.orderList.push(...res.data.list) self.orderList.push(...res.data.list)
if (self.list[res.data.orderType]) { if (self.list[self.types[res.data.type]]) {
self.list[res.data.orderType].total = res.data.total self.list[self.types[res.data.type]].total = res.data.total
} }
self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore' self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, "获取订单数量失败!");
} }
this.loaded = true
}); });
}, },
...@@ -243,11 +273,11 @@ ...@@ -243,11 +273,11 @@
handleAction(item) { handleAction(item) {
console.log('click button') console.log('click button')
this.viewOderItem(item.orderId) this.viewOderItem(item.orderId)
}, },
handleClickSearch() { handleClickSearch() {
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/search' url: 'pages/order/search'
}) })
} }
} }
}; };
...@@ -433,12 +463,12 @@ ...@@ -433,12 +463,12 @@
flex-direction: column; flex-direction: column;
height: calc(100vh - var(--window-top)); height: calc(100vh - var(--window-top));
width: 100%; width: 100%;
} }
.tab-view { .tab-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
// .swiper-box { // .swiper-box {
...@@ -446,9 +476,9 @@ ...@@ -446,9 +476,9 @@
// } // }
// .swiper-item { // .swiper-item {
// height: 100%; // height: 100%;
// .page-box { // .page-box {
// padding-bottom: 20rpx; // padding-bottom: 20rpx;
// } // }
// } // }
...@@ -472,12 +502,14 @@ ...@@ -472,12 +502,14 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.search-image {
width: 36rpx; .search-image {
height: 32rpx; width: 36rpx;
flex-shrink: 0; height: 32rpx;
margin-right: 24rpx; flex-shrink: 0;
margin-right: 24rpx;
} }
.search-btn-text { .search-btn-text {
line-height: 36rpx; line-height: 36rpx;
font-weight: 400; font-weight: 400;
......
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