Commit 84a539ab authored by Facius's avatar Facius

订单详情页面优化

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