Commit 84a539ab authored by Facius's avatar Facius

订单详情页面优化

parent 5207db1a
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
buttonStyle() { // 按钮样式 buttonStyle() { // 按钮样式
switch (this.orderType) { switch (this.orderType) {
case 0: case 0:
if (this.orderData.orderBusinessType != 'R') { if (!this.isCompetition ) {
return this.buttonStyles[0] return this.buttonStyles[0]
} else { } else {
return this.buttonStyles[1] return this.buttonStyles[1]
...@@ -130,8 +130,7 @@ ...@@ -130,8 +130,7 @@
} }
}, },
showCountTime() { // ((待预约、 待签到、 待完工) || (待接单 && 业务类型非抢单)) && 有超过时间点 showCountTime() { // ((待预约、 待签到、 待完工) || (待接单 && 业务类型非抢单)) && 有超过时间点
return ([1, 2, 3].indexOf(this.orderType) != -1 || (this.orderType == 0 && this.orderData return ([1, 2, 3].indexOf(this.orderType) != -1 || (this.orderType == 0 && !this.isCompetition)) && this.orderData.currentOverTime
.orderBusinessType != 'R')) && this.orderData.currentOverTime
}, },
showTime() { showTime() {
return [4, 5, 6].indexOf(this.orderType) != -1 return [4, 5, 6].indexOf(this.orderType) != -1
...@@ -146,9 +145,12 @@ ...@@ -146,9 +145,12 @@
}, },
typeTexts() { typeTexts() {
return [this.type0Text, '去预约', '去签到', '去完工', '审核中', '去处理', '已完工'] return [this.type0Text, '去预约', '去签到', '去完工', '审核中', '去处理', '已完工']
},
isCompetition() { // 是:订单池,抢单; 否:指派单,接单
return this.orderData.orderBusinessType == 'R'
}, },
type0Text() { type0Text() {
return this.orderData.orderBusinessType != 'R' ? '接单' : '抢单' return !this.isCompetition ? '接单' : '抢单'
}, },
buttonStyles() { buttonStyles() {
return [{ return [{
...@@ -196,17 +198,6 @@ ...@@ -196,17 +198,6 @@
showDistance() { showDistance() {
return this.orderType == 0 && this.location.length >= 2 && (this.orderData.contactAddressLatitud || this.orderData.contactAddressLongitud) return this.orderType == 0 && this.location.length >= 2 && (this.orderData.contactAddressLatitud || this.orderData.contactAddressLongitud)
}, },
titles() {
return {
'waitAccept': '待' + this.type0Text, // 待接单、
'waitAppointment': '待预约', // 待预约、
'waitCheckIn': '待签到', // 待签到、
'waitFinish': '待完工', // 待完工、
'audit': '审核中', // 审核中、
'exception': '异常单', // 异常单、
'finish': '已完工', //已完工
}
},
types() { types() {
return { return {
'waitAccept': 0, // 待接单、 'waitAccept': 0, // 待接单、
...@@ -218,9 +209,6 @@ ...@@ -218,9 +209,6 @@
'finish': 6, //已完工 'finish': 6, //已完工
} }
}, },
title() {
return this.titles[this.type]
},
orderDistance() { orderDistance() {
return this.distance(this.orderData.contactAddressLatitud,this.orderData.contactAddressLongitud, this.location[0], this.location[1]) return this.distance(this.orderData.contactAddressLatitud,this.orderData.contactAddressLongitud, this.location[0], this.location[1])
}, },
...@@ -282,10 +270,10 @@ ...@@ -282,10 +270,10 @@
// title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动 // title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
handleClick() { handleClick() {
// if (this.buttonDisabled) return // if (this.buttonDisabled) return
this.$emit('action', this.orderData, this.title, this.showCountTime ? 'show' : '') this.$emit('action', this.orderData, this.type, this.showCountTime ? 'show' : '')
}, },
handleClickCell() { handleClickCell() {
this.$emit('click', this.orderData, this.title, this.showCountTime ? 'show' : '') this.$emit('click', this.orderData, this.type, this.showCountTime ? 'show' : '')
}, },
handleChange(timestamp) { handleChange(timestamp) {
if (this.timeout) this.$refs['order-count-down'].seconds += 2 if (this.timeout) this.$refs['order-count-down'].seconds += 2
...@@ -310,10 +298,10 @@ ...@@ -310,10 +298,10 @@
/** /**
* echo distance(116.3896,39.91917,116.3940,39.91726); * echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离 * 计算两点之间直线距离
* @param float $lon1 * @param float $lon1
* @param float $lat1 * @param float $lat1
* @param float $lon2 * @param float $lon2
* @param float $lat2 * @param float $lat2
* @return float 浮点数 * @return float 浮点数
*/ */
distance(lat1, lng1, lat2, lng2) { distance(lat1, lng1, lat2, lng2) {
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
</view> </view>
<view class="right-view"> <view class="right-view">
<view class="line-view-top"> <view class="line-view-top">
<text>{{$u.timeFormat(record.operationDatetime, 'yyyy.mm.dd hh:MM:ss')}} </text> <text>{{$u.timeFormat(record.operationDatetime, 'yyyy.mm.dd &nbsp hh:MM:ss')}}</text>
<text style="color: red;">{{record.overTime?'超时':''}}{{record.exception?'异常':''}}</text> <text style="color: red;">{{record.overTime?'超时':''}}{{record.overTime && record.exception ? '/' : ''}}{{record.exception?'异常':''}}</text>
<text style="color: #2272FF;" v-show="record.isTrace">跟进</text> <text style="color: #2272FF;" v-show="record.isTrace">跟进</text>
</view> </view>
<view class="line-view-item"> <view class="line-view-item">
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
scroll-anchoring scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" scroll-anchoring scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh" refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" enable-back-to-top> @refresherrestore="onRestore" enable-back-to-top>
<!-- <TabBarPage title="扳手会"> -->
<image class="banner-image" :src="bannerImage" @click="handleClickBanner"></image> <image class="banner-image" :src="bannerImage" @click="handleClickBanner"></image>
<view class="msg-view"> <view class="msg-view">
...@@ -23,12 +22,9 @@ ...@@ -23,12 +22,9 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 订单推荐吸顶 --> <view class="sticky">
<!-- <u-sticky offset-top="0"> --> <text>订单推荐</text>
<view class="sticky"> </view>
<text>订单推荐</text>
</view>
<!-- </u-sticky> -->
<view class="order-view"> <view class="order-view">
<!-- 入驻成功之后显示推荐订单列表 --> <!-- 入驻成功之后显示推荐订单列表 -->
<view class="order-list-view" v-if="loaded"> <view class="order-list-view" v-if="loaded">
...@@ -47,28 +43,21 @@ ...@@ -47,28 +43,21 @@
<NoOrder /> <NoOrder />
</view> </view>
<view v-else class="order-item-view"> <view v-else class="order-item-view">
<!-- <scroll-view scroll-y style="margin-bottom: 20rpx;" @scrolltolower="reachBottom"
scroll-anchoring> -->
<view v-for="(item, index) in orderList" :key="index"> <view v-for="(item, index) in orderList" :key="index">
<OrderCell :orderData="item" type="waitAccept" :location="location" <OrderCell :orderData="item" type="waitAccept" :location="location"
@click="handleClick" @action="handleClick"> @click="handleClick" @action="handleClick">
</OrderCell> </OrderCell>
</view> </view>
<u-loadmore v-show="(search.pageNumber == 1 && loadedOrder) || search.pageNumber > 2" :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore> <u-loadmore v-show="(search.pageNumber == 1 && loadedOrder) || search.pageNumber > 2" :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore>
<!-- </scroll-view> -->
</view> </view>
</template> </template>
</view> </view>
</view> </view>
<!-- </view> -->
<!-- </scroll-view> -->
<view class="bottom-view" v-if="needSettled || orderList.length <= 0"> <view class="bottom-view" v-if="needSettled || orderList.length <= 0">
<view class="bottom-line-view"></view> <view class="bottom-line-view"></view>
<view class="bottom-text">我也是有底线哒</view> <view class="bottom-text">我也是有底线哒</view>
<view class="bottom-line-view"></view> <view class="bottom-line-view"></view>
</view> </view>
<!-- </TabBarPage> -->
</scroll-view> </scroll-view>
</view> </view>
</TabBarPage> </TabBarPage>
...@@ -166,9 +155,11 @@ ...@@ -166,9 +155,11 @@
this.getOrderCount() this.getOrderCount()
this.initSettleInfo(); this.initSettleInfo();
}, },
handleClick(item, title) { // 跳转工单详情页面 handleClick(item, type, showCountTime) { // 跳转工单详情页面 showCountTime:是否显示倒计时
// type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + item.orderId + '&title=' + title url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
}) })
}, },
async initSettleInfo() { async initSettleInfo() {
......
<template> <template>
<TabBarPage title="订单" :fixed="true"> <TabBarPage title="订单" :fixed="true">
<!-- <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"
...@@ -20,7 +19,6 @@ ...@@ -20,7 +19,6 @@
</view> </view>
<view class="tab-view"> <view 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 <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh" refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
...@@ -34,11 +32,8 @@ ...@@ -34,11 +32,8 @@
<u-loadmore v-show="(pageNumber == 1 && loaded) || pageNumber > 2" :status="loadStatus" bgColor="#F4F5F7"></u-loadmore> <u-loadmore v-show="(pageNumber == 1 && loaded) || pageNumber > 2" :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</template> </template>
</scroll-view> </scroll-view>
<!-- </swiper-item> -->
</view> </view>
<!-- </view> -->
<PopView title="aaaa" message="bbbb" :visible="visibale" />
</TabBarPage> </TabBarPage>
</template> </template>
...@@ -55,8 +50,6 @@ ...@@ -55,8 +50,6 @@
}, },
data() { data() {
return { return {
visibale: false,
showSview: true,
curNow: 0, curNow: 0,
pageNumber: 0, pageNumber: 0,
pageSize: 100, pageSize: 100,
...@@ -90,21 +83,6 @@ ...@@ -90,21 +83,6 @@
_freshing: false, _freshing: false,
}; };
}, },
onLoad(e) {
getApp().trackPage('订单首页')
this._freshing = false;
// this.getLocation(); // 不需要获取位置
// this.getOrderCount();
// this.getOrderList(0);
if (e && e.type) {
this.current = e.type
}
},
onShow() {
this.pageNumber = 0
this.getOrderCount()
this.getOrderList(this.currentIndex);
},
computed: { computed: {
subList() { subList() {
return ['待处理', '已完工'] return ['待处理', '已完工']
...@@ -140,6 +118,9 @@ ...@@ -140,6 +118,9 @@
5: 'finish' 5: 'finish'
} }
}, },
countKeys() {
return ['toAppointmentCount', 'toCheckinCount', 'toFinishCount', 'reviewingCount', 'exceptionCount']
},
noMore() { noMore() {
return this.orderList.length == 0 && this.loaded return this.orderList.length == 0 && this.loaded
}, },
...@@ -148,6 +129,16 @@ ...@@ -148,6 +129,16 @@
} }
}, },
onLoad(e) {
getApp().trackPage('订单首页')
this._freshing = false;
if (e && e.type) {
this.current = e.type
}
},
onShow() {
this.reloadOrderInfo()
},
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index; this.curNow = index;
...@@ -164,43 +155,6 @@ ...@@ -164,43 +155,6 @@
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderList(index); this.getOrderList(index);
}, },
/**
* 获取当前位置的经纬度
*/
getLocation() {
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
},
complete: function(res) {
if (res.errMsg.indexOf('auth') != -1) {
uni.showModal({
title: '提示',
content: '获取权限失败,请到设置页面开启权限',
confirmText: '好的',
success(res) {
if (res.confirm) {
uni.openSetting({
success(res) {
console.log(res.authSetting)
}
});
}
}
})
}
},
fail: function(err) {
}
});
},
reachBottom(e) { reachBottom(e) {
if (this.loadStatus != 'loadmore') return if (this.loadStatus != 'loadmore') return
...@@ -244,27 +198,19 @@ ...@@ -244,27 +198,19 @@
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
var self = this; // 加载订单列表 var self = this
self.$u.api.listOrderCount().then((res) => { self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
self.list.forEach(item => { // 修改各个tab数量
if (item.name === '待预约') { var i = 0
item.total = res.data.toAppointmentCount
} else if (item.name === '待签到') {
item.total = res.data.toCheckinCount
} else if (item.name === '待完工') {
item.total = res.data.toFinishCount
} else if (item.name === '审核中') {
item.total = res.data.reviewingCount
} else if (item.name === '异常单') {
item.total = res.data.exceptionCount
}
})
var count = 0 var count = 0
for (var i in res.data) { for (var item of self.list) {
count += res.data[i] item.total = res.data[self.countKeys[i]]
count += item.total
i++
} }
// 修改tab总数 // 修改tab总数
if (count > 0) { if (count > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
...@@ -282,13 +228,15 @@ ...@@ -282,13 +228,15 @@
} }
}); });
}, },
handleClick(item, title, showCountTime) { // title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动 handleClick(item, type, showCountTime) { // type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
if(item.orderStatus===86 || item.orderStatus===88){ if(item.orderStatus===86 || item.orderStatus===88){
this.filish(item) this.filish(item)
return return
} }
//type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + item.orderId + '&title=' + title + '&showCountTime=' + showCountTime url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
}) })
}, },
filish(item){ filish(item){
...@@ -303,13 +251,6 @@ ...@@ -303,13 +251,6 @@
+ "&maintainStep=" + item.maintainStep + "&maintainStep=" + item.maintainStep
}) })
}, },
// handleAction(item) {
// if(item.orderStatus===86 || item.orderStatus===88){
// this.filish(item)
// return
// }
// this.viewOderItem(item.orderId)
// },
handleClickSearch() { handleClickSearch() {
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/search' url: 'pages/order/search'
...@@ -318,15 +259,18 @@ ...@@ -318,15 +259,18 @@
onRefresh() { onRefresh() {
if (this._freshing) return; if (this._freshing) return;
this._freshing = true; this._freshing = true;
this.reloadOrderInfo()
},
onRestore() {
this.triggered = 'restore'; // 需要重置
},
reloadOrderInfo() {
this.pageNumber = 0 this.pageNumber = 0
this.orderList = [] this.orderList = []
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderCount(); this.getOrderCount();
this.getOrderList(this.currentIndex); this.getOrderList(this.currentIndex);
}, }
onRestore() {
this.triggered = 'restore'; // 需要重置
},
} }
}; };
</script> </script>
...@@ -347,13 +291,6 @@ ...@@ -347,13 +291,6 @@
} }
.order { .order {
// width: 710rpx;
// background-color: #ffffff;
// margin: 20rpx auto;
// border-radius: 20rpx;
// box-sizing: border-box;
// padding: 20rpx;
// font-size: 28rpx;
.top { .top {
display: flex; display: flex;
...@@ -519,17 +456,6 @@ ...@@ -519,17 +456,6 @@
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
// .swiper-box {
// flex: 1;
// }
// .swiper-item {
// height: 100%;
// .page-box {
// padding-bottom: 20rpx;
// }
// }
.tools-box { .tools-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
}, },
handleClickCell(orderId) { handleClickCell(orderId) {
this.$u.route({ this.$u.route({
url: 'pages/order/detail?isFromMine=1', url: 'pages/order/detail?&type=other',
params: { params: {
id: orderId id: orderId
} }
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
handleClickCell(orderId) { handleClickCell(orderId) {
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?isFromMine=1&id=' + orderId url: 'pages/order/detail?isFromMine=1&id=' + orderId + '&type=other'
}) })
}, },
async loadStatement() { async loadStatement() {
......
...@@ -112,7 +112,6 @@ ...@@ -112,7 +112,6 @@
import XhLabel from "../../components/createCom/XhLabel" import XhLabel from "../../components/createCom/XhLabel"
import takePhoto from '@/components/take/index.vue' import takePhoto from '@/components/take/index.vue'
import baseFile from '@/components/upload/index' import baseFile from '@/components/upload/index'
import Detail from "@/components/order/detail.vue"
// 表单类型map // 表单类型map
const formType = new Map([ const formType = new Map([
...@@ -274,7 +273,6 @@ ...@@ -274,7 +273,6 @@
XhServiceMeasure, XhServiceMeasure,
XhServiceMore, XhServiceMore,
XhLabel, XhLabel,
Detail,
'take-photo': takePhoto 'take-photo': takePhoto
}, },
mixins: [baseFile], mixins: [baseFile],
......
This diff is collapsed.
...@@ -368,13 +368,13 @@ export default { ...@@ -368,13 +368,13 @@ export default {
let res = await self.$u.api.traceAndAppointment(params, self.orderId); let res = await self.$u.api.traceAndAppointment(params, self.orderId);
self.submiting = false; self.submiting = false;
if(res && res.code == 200) { if(res && res.code == 200) {
self.$u.route({ var pages = getCurrentPages();
type: 'redirect', if (pages.length >= 2) {
url: 'pages/order/detail', var page = pages[pages.length - 2];
params: { page.needFresh = true
id: self.orderId }
}
}) uni.navigateBack()
} }
} }
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<view v-if="orderList && orderList.length > 0" class="order-row"> <view v-if="orderList && orderList.length > 0" class="order-row">
<view v-for="(item, index) in orderList" :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" @action="handleClick"> </OrderCell>
</view> </view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</view> </view>
...@@ -114,17 +114,29 @@ ...@@ -114,17 +114,29 @@
self.loaded = true self.loaded = true
}); });
}, },
viewOderItem(orderId) { // 跳转工单详情页面 handleClick(item, type, showCountTime) { // type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
if(item.orderStatus===86 || item.orderStatus===88){
this.filish(item)
return
}
//type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + orderId url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
}) })
}, },
handleClick(item) { filish(item){
this.viewOderItem(item.orderId) // 去完工
}, uni.navigateTo({
handleAction(item) { url: 'pages/order/complete?orderId='+item.orderId
this.viewOderItem(item.orderId) + "&categoryId=" + item.categoryId
}, + "&orderServiceType=" + item.orderServiceType
+ "&inGuaranteePeriod=" + item.inGuaranteePeriod
+ "&partnerCompanyId=" + item.partnerCompanyId
+ "&auditResultsId=" + (item.auditResults?Object.keys(item.auditResults)[Object.keys(item.auditResults).length - 1]:'')
+ "&maintainStep=" + item.maintainStep
})
}
}, },
} }
</script> </script>
......
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