Commit fc74282d authored by 郭晓清's avatar 郭晓清

工单列表+详情(接单)

parent eb807255
......@@ -7,9 +7,9 @@ let orderApiFun = function(vm){
let listOrderCount = async (params = {}) => await vm.$u.get('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/queryOrdersCount/V2', params);
/**
* 工单列表接口
* 工单列表接口 http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/revision/{token}/list
*/
let listOrder = async (params = {}) => await vm.$u.get('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/revision/list', params);
let listOrder = async (params = {}) => await vm.$u.get('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/revision/'+ vm.vuex_token+'/list', params);
/**
* 获取师傅的预约日历
......@@ -26,7 +26,26 @@ let orderApiFun = function(vm){
/**
* 师傅签到接口
*/
let maintainWorkerCheckin = async (params = {}) => await vm.$u.post('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/{orderId}/maintainWorkerCheckin', params,{'content-type': 'application/x-www-form-urlencoded'});
let maintainWorkerCheckin = async (params = {},orderId) => await vm.$u.post('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/'+orderId+'/maintainWorkerCheckin', params,{'content-type': 'application/x-www-form-urlencoded'});
/**
* 订单详情查询
*/
let orderDetail = async (params = {}) => await vm.$u.get('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/revision/'+ vm.vuex_token+'/'+params.orderId, params);
/**
* 查询工单操作记录列表接口
*/
let listOrderRecord = async (params = {}) => await vm.$u.get('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/record/'+ vm.vuex_token+'/listOrderRecord/'+params.orderId, params);
/**
* 接单
*/
let orderAccept= async (params = {},orderId) => await vm.$u.get('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/'+orderId+'/accept', params);
/**
* 抢单
*/
let orderGan = async (params = {},orderId) => await vm.$u.post('http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/revision/applets/'+ vm.vuex_token+'/order/acceptAppletsOrder', params,{'content-type': 'application/x-www-form-urlencoded'});
const orderApi = {
......@@ -35,7 +54,11 @@ let orderApiFun = function(vm){
listOrder,
workerCalendar,
workerAppointment,
maintainWorkerCheckin
maintainWorkerCheckin,
orderDetail,
listOrderRecord,
orderAccept,
orderGan
}
return orderApi
}
......
......@@ -12,7 +12,7 @@
<view class="tag">{{ order.orderServiceType }}</view>
<text class="title">{{ order.categoryName }}</text>
</view>
<view class="right">分配单</view>
<view class="right">{{ order.orderBusinessTypeText }}</view>
</view>
<view class="order-cell">
<text>工单编号:</text>
......@@ -62,24 +62,36 @@
<view class="top-item">
<text class="title">履约记录</text>
</view>
<view class="order-cell between-cell">
<text>接单时间:2021.04.21 16:40:35</text>
<view class="order" v-for="(record,index) in orderRecords" :key="record.operationContent">
<view class="order-cell between-cell">
<text>{{record.operationType}}</text>
<text>{{$u.timeFormat(record.operationDatetime, 'yyyy-mm-dd hh:MM:ss')}} </text>
<text style="color: red;">{{record.overTime?'':'超时 '}}{{record.exception?'':' 异常'}}</text>
</view>
</view>
</view>
<view class="card appoint-item">
<view class="card appoint-item" v-show="showTimeSelect">
<appoint-time @dateChange="dateChange" @timeChange="timeChange" @weekChange="weekChange"></appoint-time>
</view>
</view>
<view class="toolbar">
<!-- view用于占位 -->
<!-- 背景,内容,请求接口 根据状态不同改变 {{operationDoing[order.orderStatus].background}} -->
<!-- 过程反馈 -->
<view class="left">
<view v-show="allowFeedback" @click="clickFeedback" class="button"></view>
<view v-show="allowFeedback" @click="clickFeedback" class="button">
<text style="font-size: small;">过程反馈</text>
</view>
</view>
<!--接单,抢单,已被抢, 预约 ,签到 ,去完工 :class="appoint-btn" v-show="buttonShow(btn)"-->
<view class="center">
<view v-if="centerButton=='appoint'" @click="clickCenterButton" class="button" :class="centerButtonClass">
<view>
<u-toast ref="uToast" />
</view>
<view v-if="showCenterBtn" @click="handleBtn" class="button" :class="centerButtonClass">
{{ centerButtonText }}
</view>
</view>
<!-- 异常预约 ,现场拍照 这里是调用拍照的两个组件-->
<view class="right">
<view v-show="allowFeedback" @click="clickFeedback" class="button"></view>
</view>
......@@ -89,8 +101,11 @@
<script>
import appointTime from '@/components/appoint/appoint-time.vue'
import {
getQueryString
} from '@/common/util.js'
export default {
components:{
components: {
appointTime
},
data() {
......@@ -106,20 +121,30 @@
orderId: null,
order: {},
allowRejection: false, // 允许拒单
allowFeedback: true, // 允许过程反馈
allowFeedback: false, // 允许过程反馈
needPhotograph: true, // 需要现场拍摄
centerButton: 'appoint', // 是否显示按钮
centerButtonText: '预约',
};
centerButton: '', // 是否显示按钮
centerButtonText: '',
orderRecords: [],
method: null,
allowFeedbackStatus: [30, 31], // 过程反馈状态列表
showCenterBtn: false,
showTimeSelect: false,
submitType: ""
}
},
onLoad(e) {
if(e && e.id) {
this.orderId = e.id
onLoad(option) {
// 生命周期函数--监听页面加载
console.log("option", option)
if (option && option.id) {
this.orderId = option.id
} else {
// 异常处理
}
this.loadOrderDetail()
this.loadOrderRecord()
},
created(option) {},
computed: {
phoneIcon() {
return process.uniEnv.qn_base_url + 'icon/dianhua-1@2x.png'
......@@ -130,144 +155,257 @@
centerButtonClass() {
let btnClass = "appoint-btn"
return btnClass
},
}
},
methods: {
loadOrderDetail() {
loadOrderDetail() { // 获取工单详情
let self = this
let timestamp = new Date().getTime();
let order = {
brandName: '沃尔沃',
categoryId: 1,
categoryName: '充电桩',
contactAddress: '湾街道荔枝花园D座125号',
contactAddressLatitud: '116.3896',
contactAddressLongitud: '39.91917',
contactCity: 4403,
contactCityText: '深圳市',
contactCommunity: 440306,
contactCommunityText: '宝安区',
contactId: 1,
contactName: '郭小清',
contactPhone: '13631612077',
contactProvince: 44,
contactProvinceText: '广东省',
contactStreet: 44030601,
contactStreetText: '新安街道',
lianbaoBrandId: 1,
orderBusinessType: 'R',
orderId: 1,
orderNumber: 'OR2021041809827',
orderProductCount: 1,
orderServiceType: '安装',
orderStatus: '30',
serviceContent: '沃尔沃全球标充电桩(国标32A,4G联网)',
orderBusinessTypeText: '订单池',
auditResults: [],
currentWillOverTime: timestamp,
currentOverTime: timestamp,
appointmentDatetime: timestamp,
auditDatetime: timestamp,
}
self.order = order
var data = {
'orderId': self.orderId
};
self.$u.api.orderDetail(data).then((res) => {
if (res.code == 200) {
console.log("===", res.data.list[0])
self.order = res.data.list[0]
this.getCurrentBtn()
// self.order.operationType = "accept"
// }else{
// self.order.operationType = "appointment"
// }
// self.method =self.operationDoing[self.order.operationType].action;
// // 根据工单的状态确定是否需要过程反馈
// self.allowFeedback = self.allowFeedbackStatus.indexOf(self.order.orderStatus)>0
} else {
console.log(res.message, "获取订单详情失败!");
}
});
},
/**
* 拒单
*/
rejectOrder() {
loadOrderRecord() {
let self = this
var param = {
'orderId': self.orderId
};
self.$u.api.listOrderRecord(param).then((res) => {
if (res.code == 200) {
console.log("===========", res.data)
self.orderRecords = res.data
} else {
console.log(res.message, "获取订单详情失败!");
}
})
},
rejectOrder() { // 拒单
console.log("点击拒单")
},
/**
* 点击下一周
* @param {Object} data
*/
weekChange(data){
console.log(data,'week-data')
weekChange(data) {
console.log(data, 'week-data')
},
/**
* 点击日期选择
* @param {Object} data
*/
dateChange(data){
console.log(data,'week-data')
dateChange(data) {
console.log(data, 'week-data')
},
/**
* 时间段选择变化
* @param {Object} data
*/
timeChange(data){
console.log(data,'week-data')
timeChange(data) {
console.log(data, 'week-data')
},
clickCenterButton() {
getCurrentBtn() {
// 根据工单状态确定按钮的显示
var orderStatus = this.order.orderStatus
// 业务类型 指派单/订单池
var orderBusinessType = this.order.orderBusinessTypeText
if (orderStatus < 31 && orderBusinessType === '指派单') {
// 接单
this.showCenterBtn = true
this.centerButtonText = "接单"
// 已派单的时显示拒单按钮
this.allowRejection = true
} else if (orderStatus < 31 && orderBusinessType === '订单池') {
// 抢单
this.centerButton = "appoint1"
this.centerButtonText = "抢单"
this.showCenterBtn = true
} else if (orderStatus === 31 && !this.order.appointmentDatetime) {
// 预约
this.centerButton = "appoint2"
this.centerButtonText = "预约"
this.allowFeedback = true
this.showCenterBtn = true
this.showTimeSelect = true
this.submitType = "workerAppointment"
} else if (orderStatus === 31 && this.order.appointmentDatetime) {
// 签到
this.centerButton = "appoint3"
this.centerButtonText = "签到"
this.allowFeedback = true
this.showCenterBtn = true
this.submitType = "maintainWorkerCheckin"
} else if (orderStatus > 31 && orderStatus < 80) {
// 完工
this.centerButton = "appoint4"
this.centerButtonText = "去完工"
this.allowFeedback = true
this.showCenterBtn = true
} else {}
},
handleBtn() {
const data = {}
// 不同请求类型传递不同数据
if (this.submitType === 'maintainWorkerCheckin') {
data.remark = "123"
data.revert = true
}
this.$u.api[this.submitType](data, 123).then(res => {
if (res.data.code === 200) {
this.$refs.uToast.show({
title: this.centerButtonText + '操作成功',
type: 'success',
url: 'pages/order/feedback',
params: {
id: 1,
menu: 3
}
})
} else {
this.$refs.uToast.show({
title: res.data.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'error'
})
}
})
}
}
}
};
</script>
<style lang="scss">
.order-wrap {
width: 750rpx;
height: 100vh;
overflow: auto;
background-color: #F4F5F7;
background-image: linear-gradient(to top, #F4F5F7 , #2272FF);
background-size: 750rpx 600rpx;
background-repeat: no-repeat;
.header {
padding: 12rpx 30rpx 40rpx 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.title {
font-size: 40rpx;
font-weight: bold;
color: #FFFFFF;
}
.button {
text-align: center;
width: 106rpx;
height: 52rpx;
background: #FFFFFF;
border-radius: 40rpx;
font-size: 24rpx;
font-weight: 400;
color: #2272FF;
line-height: 52rpx;
}
}
.content{
height: 2000rpx;
.card {
background-color: #FFFFFF;
margin: 0 30rpx 20rpx 30rpx;
padding: 30rpx 30rpx 0 30rpx;
border-radius: 6px;
.order-wrap {
width: 750rpx;
height: 100vh;
overflow: auto;
background-color: #F4F5F7;
background-image: linear-gradient(to top, #F4F5F7, #2272FF);
background-size: 750rpx 600rpx;
background-repeat: no-repeat;
.header {
padding: 12rpx 30rpx 40rpx 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.title {
font-size: 40rpx;
font-weight: bold;
color: #FFFFFF;
}
.button {
text-align: center;
width: 106rpx;
height: 52rpx;
background: #FFFFFF;
border-radius: 40rpx;
font-size: 24rpx;
font-weight: 400;
color: #2272FF;
line-height: 52rpx;
}
}
.base-item {
padding-bottom: 36rpx;
.top-item {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
.left {
.content {
height: 2000rpx;
.card {
background-color: #FFFFFF;
margin: 0 30rpx 20rpx 30rpx;
padding: 30rpx 30rpx 0 30rpx;
border-radius: 6px;
}
.base-item {
padding-bottom: 36rpx;
.top-item {
display: flex;
align-items: center;
.tag {
justify-content: space-between;
margin-bottom: 20rpx;
.left {
display: flex;
align-items: center;
.tag {
text-align: center;
width: 84rpx;
height: 40rpx;
background-image: linear-gradient(270deg, #47ABFF 0%, #2272FF 100%);
border-radius: 8rpx;
font-size: 22rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 40rpx;
}
.title {
margin-left: 30rpx;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
line-height: 36rpx;
}
}
.right {
text-align: center;
width: 84rpx;
width: 100rpx;
height: 40rpx;
background-image: linear-gradient(270deg, #47ABFF 0%, #2272FF 100%);
border-radius: 8rpx;
background: #F4F5F7;
border-radius: 22rpx;
font-size: 22rpx;
font-weight: 500;
color: #FFFFFF;
font-weight: 400;
color: #333333;
line-height: 40rpx;
}
}
.address-cell {
height: 24rpx;
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 24rpx;
.left {
.address-txt {
margin-left: 8rpx;
}
}
}
}
.order-item {
padding-bottom: 34rpx;
.top-item {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
.title {
margin-left: 30rpx;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
......@@ -275,134 +413,108 @@
line-height: 36rpx;
}
}
.right {
text-align: center;
width: 100rpx;
height: 40rpx;
background: #F4F5F7;
border-radius: 22rpx;
font-size: 22rpx;
.address-cell {
height: 24rpx;
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
}
}
.address-cell {
height: 24rpx;
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 24rpx;
.left {
.address-txt {
margin-left: 8rpx;
line-height: 24rpx;
.left {
.address-txt {
margin-left: 8rpx;
}
}
}
}
}
.order-item {
padding-bottom: 34rpx;
.top-item {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
.title {
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
line-height: 36rpx;
}
}
.address-cell {
height: 24rpx;
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 24rpx;
.left {
.address-txt {
margin-left: 8rpx;
}
}
.record-item {}
.appoint-item {
padding: 0;
}
}
.record-item {
}
.appoint-item {
padding: 0;
}
}
.toolbar {
margin-bottom: 104rpx;
display: flex;
justify-content: center;
align-items: center;
.left {
width: 100rpx;
height: 100rpx;
.button {
.toolbar {
margin-bottom: 104rpx;
display: flex;
justify-content: center;
align-items: center;
.left {
width: 100rpx;
height: 100rpx;
background: #929CB8;
border-radius: 100rpx;
.button {
width: 100rpx;
height: 100rpx;
background: #929CB8;
border-radius: 100rpx;
}
}
}
.center {
width: 140rpx;
height: 140rpx;
margin-left: 74rpx;
margin-right: 74rpx;
.button {
.center {
width: 140rpx;
height: 140rpx;
border-radius: 100rpx;
display: flex;
justify-content: center;
align-items: center;
color: #FFFFFF;
font-size: 32rpx;
font-weight: bold;
}
.appoint-btn {
background: #2272FF;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
.sign-timeout-btn {
background: #FA5A49;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
.appoint-btn {
background: #2272FF;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
margin-left: 74rpx;
margin-right: 74rpx;
.button {
width: 140rpx;
height: 140rpx;
border-radius: 100rpx;
display: flex;
justify-content: center;
align-items: center;
color: #FFFFFF;
font-size: 32rpx;
font-weight: bold;
}
.appoint-btn {
background: #2272FF;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
.sign-timeout-btn {
background: #FA5A49;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
.appoint-btn {
background: #2272FF;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
}
}
.right {
width: 100rpx;
height: 100rpx;
.button {
.right {
width: 100rpx;
height: 100rpx;
background: #12CF84;
border-radius: 100rpx;
.button {
width: 100rpx;
height: 100rpx;
background: #12CF84;
border-radius: 100rpx;
}
}
}
}
}
// 页面公用css
.order-cell {
height: 48rpx;
font-size: 26rpx;
font-weight: 400;
color: #333333;
line-height: 48rpx;
margin-bottom: 30rpx;
}
.between-cell {
display: flex;
justify-content: space-between;
align-items: center;
}
// 页面公用css
.order-cell {
height: 48rpx;
font-size: 26rpx;
font-weight: 400;
color: #333333;
line-height: 48rpx;
margin-bottom: 30rpx;
}
.between-cell {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
......@@ -67,7 +67,7 @@
<u-count-down :timestamp="timestampDiff(res.currentOverTime)" font-size="44" color="#FF930D" :ref="'uCountDown' + index" @change="timeChange(res.currentOverTime,index)" >
</u-count-down>
</view>
<view class="right-btn" @click="viewOderItem">
<view class="right-btn" @click="viewOderItem(index)">
<text>去预约</text>
</view>
</view>
......@@ -111,7 +111,7 @@
<u-count-down :timestamp="timestampDiff(res.currentOverTime)" font-size="44" color="#FF930D" :ref="'uCountDown' + index" @change="timeChange(res.currentOverTime,index)" >
</u-count-down>
</view>
<view class="right-btn">
<view class="right-btn" @click="viewOderItem(index)">
<text>去签到</text>
</view>
</view>
......@@ -121,7 +121,7 @@
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" v-if="orderList.length<2">
<scroll-view scroll-y style="height: 100%;width: 100%;" v-if="orderList.length === 0">
<view class="page-box">
<view>
<view class="centre">
......@@ -168,7 +168,7 @@
<u-count-down :timestamp="timestampDiff(res.currentOverTime)" font-size="44" color="#FF930D" :ref="'uCountDown' + index" @change="timeChange(res.currentOverTime,index)" >
</u-count-down>
</view>
<view class="right-btn" @click="viewOderItem">
<view class="right-btn" @click="viewOderItem(index)">
<text>去完工</text>
</view>
</view>
......@@ -211,7 +211,7 @@
<u-count-down :timestamp="timestampDiff(res.currentOverTime)" font-size="44" color="#FF930D" :ref="'uCountDown' + index" @change="timeChange(res.currentOverTime,index)" >
</u-count-down>
</view>
<view class="right-btn" @click="viewOderItem">
<view class="right-btn" @click="viewOderItem(index)">
<text>审核中</text>
</view>
</view>
......@@ -254,7 +254,7 @@
<u-count-down :timestamp="timestampDiff(res.currentOverTime)" font-size="44" color="#FF930D" :ref="'uCountDown' + index" @change="timeChange(res.currentOverTime,index)" >
</u-count-down>
</view>
<view class="right-btn" @click="viewOderItem">
<view class="right-btn" @click="viewOderItem(index)">
<text>去处理</text>
</view>
</view>
......@@ -288,7 +288,7 @@
<view >
<u-icon name="map" size="32"></u-icon>
<text style="margin-left: 8rpx;">{{res.contactAddress }}</text>
<text style="margin-left: 200rpx; font-size:large;" @click="viewOderItem" > > </text>
<text style="margin-left: 200rpx; font-size:large;" @click="viewOderItem(index)" > > </text>
</view>
</view>
</view>
......@@ -546,27 +546,19 @@ export default {
console.log("getOrderList",res.data)
if (res.data) {
self.orderList = res.data.list;
//测试使用
self.orderList.forEach((item,index)=>{
if(index === 1){
item.currentOverTime -= 10
}
})
// //测试使用
// self.orderList.forEach((item,index)=>{
// if(index === 1){
// item.currentOverTime -= 10
// }
// })
self.total =res.data.total;
}
} else {
console.log(res.message, "获取订单数量失败!");
}
});
// for (let i = 0; i < indexStatus.size; i++) {
// let index = this.$u.random(0, this.dataList.length - 1);
// let data = JSON.parse(JSON.stringify(this.dataList[index]));
// data.id = this.$u.guid();
// this.orderList[idx].push(data);
// }
// this.loadStatus.splice(this.current, 1, 'loadmore');
},
// 获取订单数量
getOrderCount() {
......@@ -612,7 +604,6 @@ export default {
},
// tab栏切换
change(index) {
console.log("============",index)
this.swiperCurrent = index;
this.getOrderList(index);
},
......@@ -623,11 +614,11 @@ export default {
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},viewOderItem() { // 跳转工单详情页面
let that = this;
let params ='' //`id=${e.id}&courseId=${e.courseId}&status=${e.status}`
},viewOderItem(index) { // 跳转工单详情页面
let order = this.orderList[index]
console.log("order",order)
uni.navigateTo({
url: `/pages/order/orderItem?${params}`
url: 'pages/order/detail?id='+order.orderId
})
}
}
......
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