Commit 0185e547 authored by 郭晓清's avatar 郭晓清

1、工单详情,去工单交互

parent 9578e392
...@@ -67,7 +67,12 @@ let orderApiFun = function(vm){ ...@@ -67,7 +67,12 @@ let orderApiFun = function(vm){
/** /**
* 获取师傅水印 or 默认水印 * 获取师傅水印 or 默认水印
*/ */
let getWatermark= async (params = {}) => await vm.$u.get('wxh-worker-rest/rest/'+ vm.vuex_token+'/photo/watermark', params); let getWatermark= async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/'+ vm.vuex_token+'/photo/watermark', params);
/**
* 联系时间接口
*/
let contactTime = async (params = {},orderId) => await vm.$u.get('/wxh-worker-rest/rest/order/record/'+ vm.vuex_token+'/contact/'+orderId, params);
const orderApi = { const orderApi = {
listByRecommendOrder, listByRecommendOrder,
...@@ -85,7 +90,8 @@ let orderApiFun = function(vm){ ...@@ -85,7 +90,8 @@ let orderApiFun = function(vm){
traceAndAppointment, traceAndAppointment,
orderStandard, orderStandard,
saveImage, saveImage,
getWatermark getWatermark,
contactTime
} }
return orderApi return orderApi
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<text>客户信息:</text> <text>客户信息:</text>
<text>{{ order.contactName }}</text> <text>{{ order.contactName }}</text>
</view> </view>
<u-image width="60rpx" height="60rpx" :src="phoneIcon"></u-image> <u-image width="60rpx" height="60rpx" :src="phoneIcon" @click="phoneToCustomer(order.contactPhone)" ></u-image>
</view> </view>
<view class="order-cell"> <view class="order-cell">
<text>联系方式:</text> <text>联系方式:</text>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<u-icon name="map" size="28"></u-icon> <u-icon name="map" size="28"></u-icon>
<text class="address-txt">{{ order.contactAddress }}</text> <text class="address-txt">{{ order.contactAddress }}</text>
</view> </view>
<u-image width="60rpx" height="60rpx" :src="navigationIcon"></u-image> <u-image width="60rpx" height="60rpx" :src="navigationIcon" @click="openLocation"></u-image>
</view> </view>
</view> </view>
<view class="card order-item"> <view class="card order-item">
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<!-- 过程反馈 --> <!-- 过程反馈 -->
<view class="left"> <view class="left">
<view v-show="allowFeedback" @click="clickFeedback" class="button"> <view v-show="allowFeedback" @click="clickFeedback" class="button">
过程反馈 <text>过程反馈</text>
</view> </view>
</view> </view>
<!--接单,抢单,已被抢, 预约 ,签到 ,去完工 timestampDiff(order.currentOverTime)>0 --> <!--接单,抢单,已被抢, 预约 ,签到 ,去完工 timestampDiff(order.currentOverTime)>0 -->
...@@ -153,7 +153,10 @@ ...@@ -153,7 +153,10 @@
btnClass:'appoint-btn', btnClass:'appoint-btn',
takeStatus:false, takeStatus:false,
errorSignIn:false, errorSignIn:false,
scenePhoto: true scenePhoto: true,
isErrorSign:false,
errorSignUrl:'',
isAllowDianhuaAndDaohang : false
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -170,10 +173,22 @@ ...@@ -170,10 +173,22 @@
}, },
computed: { computed: {
phoneIcon() { phoneIcon() {
return process.uniEnv.qn_base_url + 'icon/dianhua-1@2x.png' //self-support/icon/dianhua-0@2x.png
if(this.isAllowDianhuaAndDaohang){
return process.uniEnv.qn_base_url + 'icon/dianhua-1@2x.png'
}else{
return process.uniEnv.qn_base_url + 'icon/dianhua-0@2x.png'
}
}, },
navigationIcon() { navigationIcon() {
return process.uniEnv.qn_base_url + 'icon/daohang-1@2x.png' //self-support/icon/daohang-0@2x.png
if(this.isAllowDianhuaAndDaohang){
return process.uniEnv.qn_base_url + 'icon/daohang-1@2x.png'
}else{
return process.uniEnv.qn_base_url + 'icon/daohang-0@2x.png'
}
}, },
centerButtonClass() { centerButtonClass() {
let btnClass = "appoint-btn" let btnClass = "appoint-btn"
...@@ -181,6 +196,45 @@ ...@@ -181,6 +196,45 @@
} }
}, },
methods: { methods: {
openLocation(){
if(this.isAllowDianhuaAndDaohang){
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function (res) {
const latitude = res.latitude;
const longitude = res.longitude;
uni.openLocation({
latitude: latitude,
longitude: longitude,
success: function () {
console.log('success');
}
});
}
});
}
},
phoneToCustomer(phone){ // 联系客户
if(this.isAllowDianhuaAndDaohang){
uni.makePhoneCall({
phoneNumber: phone ,//仅为示例
complete() {
}
});
this.contactTime()
}
},
contactTime() {
let self = this
var data={}
self.$u.api.contactTime(data,this.order.orderId).then((res)=>{
if (res.code == 200) {
console.log("===", res.data)
} else {
console.log(res.message);
}
})
},
scenePhotoClick() { // 跳转拍照小程序 scenePhotoClick() { // 跳转拍照小程序
uni.navigateTo({ uni.navigateTo({
url: 'pages/photo/list?orderId='+this.order.orderId+'&brandId='+this.order.lianbaoBrandId+'&brand='+this.order.brandName url: 'pages/photo/list?orderId='+this.order.orderId+'&brandId='+this.order.lianbaoBrandId+'&brand='+this.order.brandName
...@@ -196,18 +250,13 @@ ...@@ -196,18 +250,13 @@
this.takeStatus = false this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面, // 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
if(img){ // 拍照完成 if(img){ // 拍照完成
this.$refs.uToast.show({ this.isErrorSign = true
title: '签到成功', this.errorSignUrl = img
type: 'success', this.handleBtn()
url: 'pages/order/detail',
params: {
id: 1
}
})
}else{ }else{
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '异常签到失败,请先按要求拍照', title: '异常签到失败,请先按要求拍照',
type: 'waning' type: 'warning'
}) })
} }
}, },
...@@ -222,14 +271,8 @@ ...@@ -222,14 +271,8 @@
console.log("===", res.data) console.log("===", res.data)
self.order = res.data self.order = res.data
this.getCurrentBtn() this.getCurrentBtn()
this.visibale = true if(self.order.isFirstOrder){
// 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 { } else {
console.log(res.message, "获取订单详情失败!"); console.log(res.message, "获取订单详情失败!");
} }
...@@ -238,7 +281,7 @@ ...@@ -238,7 +281,7 @@
loadOrderRecord() { loadOrderRecord() {
let self = this let self = this
var param = { var param = {
'orderId': self.orderId orderId: self.orderId
}; };
self.$u.api.listOrderRecord(param).then((res) => { self.$u.api.listOrderRecord(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
...@@ -248,9 +291,6 @@ ...@@ -248,9 +291,6 @@
} }
}) })
}, },
rejectOrder() { // 拒单
console.log("点击拒单")
},
/** /**
* 点击下一周 * 点击下一周
* @param {Object} data * @param {Object} data
...@@ -297,6 +337,7 @@ ...@@ -297,6 +337,7 @@
this.allowFeedback = true this.allowFeedback = true
this.showCenterBtn = true this.showCenterBtn = true
this.showTimeSelect = true this.showTimeSelect = true
this.isAllowDianhuaAndDaohang = true
this.submitType = "workerAppointment" this.submitType = "workerAppointment"
} else if (orderStatus === 31 && this.order.appointmentDatetime) { } else if (orderStatus === 31 && this.order.appointmentDatetime) {
// 签到 // 签到
...@@ -310,36 +351,44 @@ ...@@ -310,36 +351,44 @@
// 完工 // 完工
this.centerButton = "filish" this.centerButton = "filish"
this.centerButtonText = "去完工" this.centerButtonText = "去完工"
this.submitType = "toFilish"
this.allowFeedback = true this.allowFeedback = true
this.showCenterBtn = true this.showCenterBtn = true
this.scenePhoto = true this.scenePhoto = true
} else {} } else {}
}, },
handleBtn() { handleBtn() {
if(this.centerButton === "filish"){
this.filish()
return
}
if(!this.submitType){ if(!this.submitType){
return; return;
} }
const data = {} const data = {}
// 不同请求类型传递不同数据 // 不同请求类型传递不同数据
if (this.submitType === 'maintainWorkerCheckin') { // 签到 if(this.submitType === 'orderAccept'){ // 接单
// 检查见到距离是否符合
if(this.getDistance(this.order.contactAddressLatitud,this.order.contactAddressLongitud)>3){
this.$refs.uToast.show({
title: '签到失败,请点击异常签到处理或联系客服',
type: 'error'
})
return
}
data.remark = "123"
data.revert = true
}else if(this.submitType === 'orderAccept'){ // 接单
data.orderId = this.order.orderId data.orderId = this.order.orderId
}else if(this.submitType === 'orderGan'){ // 抢单 }else if(this.submitType === 'orderGan'){ // 抢单
data.orderId = this.order.orderId data.orderId = this.order.orderId
}else if(this.submitType === 'workerAppointment'){ // 预约
data.appointmentDatetime = ''
data.appointmentDatetimeRange = ''
if(!data.appointmentDatetime || !data.appointmentDatetimeRange ){
this.commonToast('请选择预约时间和时间段','waring')
return
}
}else if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合
if(!this.isErrorSign){
if(this.getDistance(this.order.contactAddressLatitud,this.order.contactAddressLongitud)>3){
this.commonToast('签到失败,请点击异常签到处理或联系客服','error')
return
}
}
data.exception = this.isErrorSign
data.coordinate = this.dataValue ? this.dataValue[0]+','+this.dataValue[1]:''
data.url = this.errorSignUrl?this.errorSignUrl:''
}else if(this.submitType === 'toFilish'){ // 去完工
this.filish()
return
} }
this.$u.api[this.submitType](data, this.order.orderId).then(res => { this.$u.api[this.submitType](data, this.order.orderId).then(res => {
if ((res.data.code!==undefined && res.data.code === 200) if ((res.data.code!==undefined && res.data.code === 200)
...@@ -349,8 +398,7 @@ ...@@ -349,8 +398,7 @@
type: 'success', type: 'success',
url: 'pages/order/detail', url: 'pages/order/detail',
params: { params: {
id: 1, id: this.order.orderId
menu: 2
} }
}) })
} else { } else {
...@@ -363,6 +411,14 @@ ...@@ -363,6 +411,14 @@
} }
}) })
}, },
commonToast(message,type,url,params){ // 统一得toast
this.$refs.uToast.show({
title: message,
type: type,
url: url,
params:params
})
},
isGan(){ isGan(){
this.centerButtonText = "已被抢" this.centerButtonText = "已被抢"
this.submitType = "" this.submitType = ""
...@@ -380,6 +436,11 @@ ...@@ -380,6 +436,11 @@
url: 'pages/order/complete?orderId='+this.order.orderId url: 'pages/order/complete?orderId='+this.order.orderId
}) })
}, },
rejectOrder() { // 拒单
uni.navigateTo({
url: 'pages/order/refuse?orderId='+this.order.orderId
})
},
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
*/ */
...@@ -441,13 +502,14 @@ ...@@ -441,13 +502,14 @@
this.btnClass='timeOut-btn' this.btnClass='timeOut-btn'
self.$refs['uCountDown'].seconds += 2 self.$refs['uCountDown'].seconds += 2
} }
},handleClick(){ },
handleClick(){
this.visibale = false this.visibale = false
// 去完工 // 去完工
uni.navigateTo({ uni.navigateTo({
url: 'pages/photo/list' url: 'pages/photo/list'
}) })
} }
} }
}; };
</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