Commit 6a97f680 authored by Facius's avatar Facius

Merge branch 'dev-1.4.5' into test

parents 7a3f1140 8d17eb09
;(function() { ;(function() {
let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境 let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null let ENV_VAR = null
let VERSION_NUMBER = '1.4.0' //版本号 let VERSION_NUMBER = '1.4.1' //版本号
//小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频 //小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
if (NODE_ENV === 'dev') { if (NODE_ENV === 'dev') {
......
<!-- 预约时间 --> <!-- 预约时间 -->
<template> <template>
<view :class="{'con-box':titleShow}"> <view :class="{ 'con-box': titleShow }">
<view class="title" v-if="titleShow">{{ title }}</view> <view class="title" v-if="titleShow">{{ title }}</view>
<view class="u-m-t-40"> <view class="u-m-t-40">
<view class="appoint-box"> <view class="appoint-box">
<view class="select-date"> <view class="select-date">
<view class="u-flex u-row-between "> <view class="u-flex u-row-between ">
<view class="txt">选择日期:</view> <view class="txt">选择日期:</view>
<view class="txt active">{{appointTime | datefmt('YYYY.MM.DD')}}</view> <view class="txt active">{{
</view> appointTime | datefmt('YYYY.MM.DD')
<view class="u-m-t-30 u-flex u-row-between date-list"> }}</view>
<view v-show="hasLast" class="last" @click="lastWeek(dateList[0],dateList)"> </view>
<u-icon name="arrow-left" color="#2979ff" size="28"></u-icon> <view class="u-m-t-30 u-flex u-row-between date-list">
</view> <view
<view class="u-flex u-row-between date-box"> v-show="hasLast"
<view :class="{'date-item':true,'active':item.day===appointTime}" class="last"
@click="dateChange(item,index,dateList)" v-for="(item,index) in dateList" :key="index"> @click="lastWeek(dateList[0], dateList)"
<text class="day">{{ weekFmt(item.day)}}</text> >
<text class="day day1">{{ item.day | datefmt('DD')}}</text> <u-icon name="arrow-left" color="#2979ff" size="28"></u-icon>
</view> </view>
</view> <view class="u-flex u-row-between date-box">
<view class="next" @click="nextWeek(dateList[0],dateList)"> <view
<u-icon name="arrow-right" color="#2979ff" size="28"></u-icon> :class="{ 'date-item': true, active: item.day === appointTime }"
</view> @click="dateChange(item, index, dateList)"
</view> v-for="(item, index) in dateList"
</view> :key="index"
<!-- weekChange --> >
<view class="select-time u-m-t-50"> <text class="day">{{ weekFmt(item.day) }}</text>
<view class="u-flex u-row-between"> <text class="day day1">{{ item.day | datefmt('DD') }}</text>
<view class="txt">选择时间:</view> </view>
<view class="txt active">{{ appointRangeText }}</view> </view>
</view> <view class="next" @click="nextWeek(dateList[0], dateList)">
<view class="u-m-t-30 time-list"> <u-icon name="arrow-right" color="#2979ff" size="28"></u-icon>
<view </view>
:class="{'time-item':true,'active': item.pkey===appointRange}" v-for="(item,index) in timeList" </view>
:key="item.pkey"> </view>
<button class="time" :plain="true" <!-- weekChange -->
:disabled="item.disabled || (currentDayIndex == 0 && item.pkey.replace(/[^0-9]/ig,'') <= currentPkey && needTodyClipping)" :hair-line="false" <view class="select-time u-m-t-50">
@click="timeChange(item,index,timeList)"> <view class="u-flex u-row-between">
{{item.name}} <view class="txt">选择时间:</view>
</button> <view class="txt active">{{ appointRangeText }}</view>
</view> </view>
</view> <view class="u-m-t-30 time-list">
</view> <view
:class="{ 'time-item': true, active: item.pkey === appointRange }"
</view> v-for="(item, index) in timeList"
</view> :key="item.pkey"
</view> >
<button
class="time"
:plain="true"
:disabled="
item.disabled ||
(currentDayIndex == 0 &&
item.pkey.replace(/[^0-9]/gi, '') <= currentPkey &&
needTodyClipping)
"
:hair-line="false"
@click="timeChange(item, index, timeList)"
>
{{ item.name }}
</button>
</view>
</view>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
let now = new Date(new Date().toLocaleDateString()).getTime() let now = new Date(new Date().toLocaleDateString()).getTime()
export default { export default {
props: { props: {
titleShow: { titleShow: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
title: { title: {
type: String, type: String,
default(){ default() {
return "预约时间" return '预约时间'
} },
}, },
type: { // subscribe 预约; filing 报备 type: {
type: String, // subscribe 预约; filing 报备
default: 'subscribe' type: String,
}, default: 'subscribe',
dateList: { },
type: Array, dateList: {
default(){ type: Array,
return [ default() {
{day: now, timeRange: []}, return [
{day: now + (1*86400000), timeRange: []}, { day: now, timeRange: [] },
{day: now + (2*86400000), timeRange: []}, { day: now + 1 * 86400000, timeRange: [] },
{day: now + (3*86400000), timeRange: []}, { day: now + 2 * 86400000, timeRange: [] },
{day: now + (4*86400000), timeRange: []}, { day: now + 3 * 86400000, timeRange: [] },
{day: now + (5*86400000), timeRange: []}, { day: now + 4 * 86400000, timeRange: [] },
{day: now + (6*86400000), timeRange: []}, { day: now + 5 * 86400000, timeRange: [] },
] { day: now + 6 * 86400000, timeRange: [] },
} ]
}, },
timeList: { },
type: Array, timeList: {
default(){ type: Array,
return [ default() {
{"name":"06:00-08:00","pkey":"appointment_range_8","disabled":false}, return [
{"name":"08:00-10:00","pkey":"appointment_range_10","disabled":false}, { name: '06:00-08:00', pkey: 'appointment_range_8', disabled: false },
{"name":"10:00-12:00","pkey":"appointment_range_12","disabled":false}, {
{"name":"12:00-14:00","pkey":"appointment_range_14","disabled":false}, name: '08:00-10:00',
{"name":"14:00-16:00","pkey":"appointment_range_16","disabled":false}, pkey: 'appointment_range_10',
{"name":"16:00-18:00","pkey":"appointment_range_18","disabled":false}, disabled: false,
{"name":"18:00-20:00","pkey":"appointment_range_20","disabled":false}, },
{"name":"20:00-22:00","pkey":"appointment_range_22","disabled":false}, {
{"name":"22:00-24:00","pkey":"appointment_range_24","disabled":false} name: '10:00-12:00',
] pkey: 'appointment_range_12',
} disabled: false,
}, },
defaultAppointRangeItem: { {
type: Object, name: '12:00-14:00',
default() { pkey: 'appointment_range_14',
// return {"name":"22:00-24:00","pkey":"appointment_range_24","disabled":false} disabled: false,
return {} },
} {
} name: '14:00-16:00',
}, pkey: 'appointment_range_16',
data() { disabled: false,
return { },
appointTime: null, {
appointRange: null, name: '16:00-18:00',
appointRangeText: '', pkey: 'appointment_range_18',
num: 0, disabled: false,
hasLast: false, },
currentPkey: new Date().getHours(), {
currentDayIndex: -1, name: '18:00-20:00',
} pkey: 'appointment_range_20',
}, disabled: false,
watch: { },
title() { {
this.appointTime = null name: '20:00-22:00',
this.appointRange = null pkey: 'appointment_range_22',
this.appointRangeText = '' disabled: false,
this.currentDayIndex = -1 },
} {
}, name: '22:00-24:00',
computed: { pkey: 'appointment_range_24',
needTodyClipping() { // 报备不限制当天已经过去的时间 disabled: false,
return this.type != 'filing' },
} ]
}, },
methods: { },
getDateList() { defaultAppointRangeItem: {
// 获取日期 type: Object,
}, default() {
async dateChange(item, index, list) { // return {"name":"22:00-24:00","pkey":"appointment_range_24","disabled":false}
let data = { return {}
item, },
index, },
list, },
} data() {
this.appointTime = item.day return {
this.initAppointRange() appointTime: null,
this.currentDayIndex = index appointRange: null,
this.$emit('date-change', data) appointRangeText: '',
if (this.appointRange) { num: 0,
this.$emit('time-change', {item:{pkey:this.appointRange, name:this.appointRangeText}}) hasLast: false,
} currentPkey: new Date().getHours(),
}, currentDayIndex: -1,
timeChange(item, index, list) { }
let data = { },
item, // watch: {
index, // title() {
list, // this.appointTime = null
} // this.appointRange = null
this.appointRange = item.pkey // this.appointRangeText = ''
this.appointRangeText = item.name // this.currentDayIndex = -1
this.$emit('time-change', data) // }
}, // },
weekChange(item, index, list) { computed: {
let data = { needTodyClipping() {
item, // 报备不限制当天已经过去的时间
index, // return this.type != 'filing'
list, return false // 报备和改约都不限制了
} },
this.$emit('week-change', data) },
}, methods: {
lastWeek(item, list) { getDateList() {
if(this.num > 0) { // 获取日期
this.num -- },
let len = list.length async dateChange(item, index, list) {
if(this.num == 0) { let data = {
this.hasLast = false item,
len ++ index,
} list,
let time = item.day - len*86400000 }
let data = { this.appointTime = item.day
time: time, this.initAppointRange()
num: this.num this.currentDayIndex = index
} this.$emit('date-change', data)
if (this.appointRange) {
this.$emit('week-change', data) this.$emit('time-change', {
} item: { pkey: this.appointRange, name: this.appointRangeText },
}, })
nextWeek(item, list) { }
this.hasLast = true },
this.num ++ timeChange(item, index, list) {
let len = list.length let data = {
let time = item.day + len*86400000 item,
let data = { index,
time: time, list,
num: this.num }
} this.appointRange = item.pkey
this.$emit('week-change', data) this.appointRangeText = item.name
}, this.$emit('time-change', data)
weekFmt(day) { },
let morrow = this.moment(now).add(1, 'days') weekChange(item, index, list) {
let content let data = {
if(day == now) { item,
content = '今天' index,
} else if(day == morrow) { list,
content = '明天' }
} else { this.$emit('week-change', data)
content = this.moment(day).format('周dd') },
} lastWeek(item, list) {
return content if (this.num > 0) {
}, this.num--
initAppointRange() { let len = list.length
this.appointRange = this.defaultAppointRangeItem.pkey if (this.num == 0) {
this.appointRangeText = this.defaultAppointRangeItem.name this.hasLast = false
} len++
} }
} let time = item.day - len * 86400000
let data = {
time: time,
num: this.num,
}
this.$emit('week-change', data)
}
},
nextWeek(item, list) {
this.hasLast = true
this.num++
let len = list.length
let time = item.day + len * 86400000
let data = {
time: time,
num: this.num,
}
this.$emit('week-change', data)
},
weekFmt(day) {
let morrow = this.moment(now).add(1, 'days')
let content
if (day == now) {
content = '今天'
} else if (day == morrow) {
content = '明天'
} else {
content = this.moment(day).format('周dd')
}
return content
},
initAppointRange() {
this.appointRange = this.defaultAppointRangeItem.pkey
this.appointRangeText = this.defaultAppointRangeItem.name
},
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.con-box { .con-box {
padding: 30rpx 30rpx 10rpx 30rpx; padding: 30rpx 30rpx 10rpx 30rpx;
border-radius: 12rpx; border-radius: 12rpx;
background-color: #FFFFFF; background-color: #ffffff;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
}
.txt {
font-size: 26rpx;
line-height: 26rpx;
color: #333;
&.active {
color: #2272ff;
}
}
.title { .date-list {
font-weight: bold; background-color: #f4f5f7;
font-size: 32rpx; .last {
line-height: 32rpx; width: 60rpx;
color: #333; height: 120rpx;
} line-height: 120rpx;
} text-align: center;
border-right: 2rpx solid #fff;
}
.date-box {
padding: 20rpx 18rpx 16rpx 20rpx;
width: 568rpx;
.date-item {
// padding: 20rpx 20rpx 16rpx;
border-radius: 12rpx;
.txt { .day {
font-size: 26rpx; display: block;
line-height: 26rpx; font-size: 24rpx;
color: #333; line-height: 26rpx;
color: #999;
&.active { &.day1 {
color: #2272FF width: 48rpx;
} height: 48rpx;
} margin-top: 10rpx;
border-radius: 50%;
font-size: 28rpx;
text-align: center;
line-height: 48rpx;
}
}
.date-list { &.active {
background-color: #F4F5F7; .day {
.last{ color: #2272ff;
width: 60rpx;
height: 120rpx;
line-height: 120rpx;
text-align: center;
border-right: 2rpx solid #fff;
}
.date-box {
padding: 20rpx 18rpx 16rpx 20rpx;
width: 568rpx;
.date-item {
// padding: 20rpx 20rpx 16rpx;
border-radius: 12rpx;
.day {
display: block;
font-size: 24rpx;
line-height: 26rpx;
color: #999;
&.day1 {
width: 48rpx;
height: 48rpx;
margin-top: 10rpx;
border-radius: 50%;
font-size: 28rpx;
text-align: center;
line-height: 48rpx;
}
}
&.active {
.day {
color: #2272FF;
&.day1 {
background-color: #2272FF;
color: #fff !important;
}
}
}
}
}
.next{
width: 60rpx;
height: 120rpx;
line-height: 120rpx;
text-align: center;
border-left: 2rpx solid #fff;
}
} &.day1 {
background-color: #2272ff;
color: #fff !important;
}
}
}
}
}
.next {
width: 60rpx;
height: 120rpx;
line-height: 120rpx;
text-align: center;
border-left: 2rpx solid #fff;
}
}
.time-list { .time-list {
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
align-content: flex-start; align-content: flex-start;
.time-item { .time-item {
flex: 0 0 196rpx; flex: 0 0 196rpx;
min-width: 196rpx; min-width: 196rpx;
margin-right: auto; margin-right: auto;
margin-bottom: 20rpx; margin-bottom: 20rpx;
border-radius: 12rpx; border-radius: 12rpx;
background-color: #F4F5F7; background-color: #f4f5f7;
&:nth-child(3n) { &:nth-child(3n) {
margin-right: 0; margin-right: 0;
} }
&.active{ &.active {
background-color: #2272FF; background-color: #2272ff;
.time{ .time {
color:#fff; color: #fff;
} }
} }
.time { .time {
font-size: 26rpx; font-size: 26rpx;
line-height: 76rpx; line-height: 76rpx;
color: #999; color: #999;
} }
/deep/ button { /deep/ button {
padding: 0; padding: 0;
height: 76rpx; height: 76rpx;
}
} /deep/ button[plain] {
/deep/ button[plain] { border: none;
border: none; }
} button[disabled]:not([type]) {
button[disabled]:not([type]) { background: #ffffff;
background: #FFFFFF; color: #cccccc;
color: #CCCCCC; border: 2rpx solid #f4f5f7;
border: 2rpx solid #F4F5F7; }
} }
} }
}
</style> </style>
<!-- 改约 -->
<template>
<view class="content-view">
<view class="con-box">
<view class="title">{{ traceTitles[0] }}</view>
<view class="u-flex u-flex-wrap">
<view
v-for="(item, index) in options['owns']"
:key="index"
@click="changeOwn(index, item.name, item.types)"
:class="{ 'txt-item': true, active: curOwn == index }"
>
<text class="txt">{{ item.name }}</text>
</view>
</view>
<u-gap height="30"></u-gap>
<view class="title">{{ traceTitles[1] }}</view>
<view class="u-flex u-flex-wrap">
<view
v-for="(txt, index) in options['owns'][curOwn]['types']"
:key="index"
@click="changeType(index, txt)"
:class="{ 'txt-item': true, active: trace.reason == txt }"
style="width: 306rpx;margin-right: 18rpx"
>
<text class="txt">{{ txt }}</text>
</view>
</view>
<view class="input-view">
<u-input
v-model="trace.remark"
class="textarea"
height="156"
type="textarea"
placeholder="请补充详细说明,以便于记录您的接单信用分"
></u-input>
</view>
</view>
<view class="time-view">
<appoint-time
:dateList="dateList"
:title="appointTitle"
:timeList="timeList"
:type="type"
:defaultAppointRangeItem="defaultAppointRangeItem"
@dateChange="dateChange"
@timeChange="timeChange"
@weekChange="weekChange"
></appoint-time>
</view>
</view>
</template>
<script>
let now = new Date(new Date().toLocaleDateString()).getTime()
import appointTime from '@/components/appoint/appoint-time.vue'
export default {
components: {
appointTime,
},
props: {
// 报备(预约): 'filing', 改约: 'subscribe'
type: {
type: String,
default: 'subscribe',
},
categoryId: {
type: String,
default: null,
},
},
data() {
return {
feedback: null,
options: [
{
name: '报备',
owns: [
{
name: '客户',
types: [
'等客户报装电表',
'等客户与物业沟通',
'等客户改造电源',
'客户不确定安装时间',
'等客户通知安装时间',
'客户电话未打通',
'客户反馈暂不安装',
],
},
{ name: '个人', types: [] },
{ name: '客观', types: [] },
],
},
{
name: '改约',
owns: [
{
name: '客户',
types: ['有事耽搁', '未带齐工具', '个人改约', '其他'],
},
{ name: '个人', types: [] },
{ name: '客观', types: [] },
],
},
],
dateList: [
{ day: now, timeRange: [] },
{ day: now + 1 * 86400000, timeRange: [] },
{ day: now + 2 * 86400000, timeRange: [] },
{ day: now + 3 * 86400000, timeRange: [] },
{ day: now + 4 * 86400000, timeRange: [] },
{ day: now + 5 * 86400000, timeRange: [] },
{ day: now + 6 * 86400000, timeRange: [] },
],
timeList: [
{ name: '06:00-08:00', pkey: 'appointment_range_8', disabled: false },
{ name: '08:00-10:00', pkey: 'appointment_range_10', disabled: false },
{ name: '10:00-12:00', pkey: 'appointment_range_12', disabled: false },
{ name: '12:00-14:00', pkey: 'appointment_range_14', disabled: false },
{ name: '14:00-16:00', pkey: 'appointment_range_16', disabled: false },
{ name: '16:00-18:00', pkey: 'appointment_range_18', disabled: false },
{ name: '18:00-20:00', pkey: 'appointment_range_20', disabled: false },
{ name: '20:00-22:00', pkey: 'appointment_range_22', disabled: false },
{ name: '22:00-24:00', pkey: 'appointment_range_24', disabled: false },
],
traceTitles: ['问题归属', '问题类型'],
appointTitle: '改约时间',
appoint: ['下次联系时间', '改约时间'],
trace: {
reasonType: '报备', // 反馈类型
reasonRelegation: '客户', // 反馈归属
reason: '', // 反馈原因
remark: '', // 备注
traceDate: null, // 反馈时间
timeRange: null, // 反馈时间段
dateItem: null,
timeItem: null,
},
curOwn: 0,
num: 0,
}
},
computed: {
curTab() {
return this.isSubscribe ? 1 : 0
},
isSubscribe() {
return this.type == 'subscribe'
},
disabledSubmit() {
let self = this
if (
self.trace.reasonRelegation &&
self.trace.reason &&
self.trace.traceDate &&
self.trace.timeRange
) {
return false
}
return true
},
types() {
return { 报备: 'filing', 改约: 'subscribe' }
},
typeKeys() {
return { filing: '报备', subscribe: '改约' }
},
// timeType() {
// return this.types[this.options.name]
// },
defaultAppointRangeItem() {
return this.options.defaultAppointRangeItem
},
submitData() {
if (this.isSubscribe) {
// 改约
let params = {
reason: this.trace.reason,
reasonRelegation: this.trace.reasonRelegation,
reasonType: this.trace.reasonType,
remark: this.trace.remark,
}
params.appointmentDatetime = this.trace.traceDate
params.appointmentDatetimeRange = this.trace.timeRange
return params
} else {
// 报备(预约)
let data = {
reason: this.trace.reason,
reasonRelegation: this.trace.reasonRelegation,
reasonType: this.trace.reasonType,
remark: this.trace.remark,
}
data.appointmentDatetime = this.trace.traceDate
data.appointmentDatetimeRange = this.trace.timeRange
// 最后一个24:00点,按照23:59分处理
if (
this.trace.timeItem &&
this.trace.timeItem.pkey &&
this.trace.traceDate
) {
let traceDate = this.moment(this.trace.traceDate)
let timeArr = this.trace.timeItem.pkey.split('_')
if (this.trace.timeItem.pkey == 'appointment_range_24') {
let traceDateTime = traceDate
.clone()
.add(23, 'hours')
.add(59, 'minutes')
data.nextTraceDatetime = traceDateTime.unix() * 1000
} else {
let hours = timeArr && timeArr.length && timeArr.pop()
let traceDateTime = traceDate.clone().add(Number(hours), 'hours')
data.nextTraceDatetime = traceDateTime.unix() * 1000
}
}
return data
}
},
},
watch: {
disabledSubmit(val) {
this.$emit('change', val)
},
categoryId(val) {
if (val) {
this.initPageData()
}
},
},
created() {
if (this.categoryId) {
this.initPageData()
}
},
methods: {
/* 初始化页面数据 */
async initPageData() {
let self = this
await Promise.all([self.loadCalendar(), self.loadTimerange()])
let params = { categoryId: self.categoryId }
let res = await self.$u.api.feedbackConfig(params)
if (res && res.code == 200) {
self.feedback = res.data || {}
self.buildConfig()
}
uni.hideLoading()
},
/* 组装数据项参数 */
buildConfig() {
let self = this
if (self.feedback) {
let key = self.typeKeys[this.type]
let data = self.feedback[key]
let configs = {}
let owns = Object.keys(data)
let ownVals = Object.values(data)
var defaultAppointRangeItem =
this.isSubscribe
? {
name: '',
pkey: '',
disabled: false,
}
: {
name: '22:00-24:00',
pkey: 'appointment_range_24',
disabled: false,
}
configs = {
name: key,
owns: [],
defaultAppointRangeItem: defaultAppointRangeItem,
}
owns.forEach(function(own, key) {
configs['owns'][key] = { name: own, types: ownVals[key] }
})
// 数组改写需要刷新绑定数据
self.options = configs
this.initParams()
}
},
/* 初始化参数 */
initParams() {
let self = this
if (self.options) {
let tabList = self.options
self.trace.reasonType = tabList.name
self.trace.reasonRelegation = tabList['owns'][self.curOwn].name
self.trace.reason = tabList['owns'][self.curOwn]['types'][0]
self.appointTitle = self.appoint[self.curTab]
self.trace.remark = ''
self.trace.traceDate = null
self.trace.timeRange = null
self.trace.dateItem = null
// if (self.trace.reasonType == '改约') { // 屏蔽改约对时间段选择的限制
// if (self.dateList && self.timeList) {
// self.timeList.map((item, index) => {
// if (
// (self.trace.dateItem &&
// self.trace.dateItem.timeRange &&
// self.trace.dateItem.timeRange.indexOf(item.pkey) > -1) ||
// item.isEnd
// ) {
// item.disabled = true
// } else {
// item.disabled = false
// }
// })
// }
// } else {
self.timeList.map((item, index) => {
item.disabled = false
})
// }
}
},
/* 加载日历数据 */
async loadCalendar() {
let self = this
let res = await this.$u.api.workerCalendar({ num: this.num })
if (res && res.code == 200) {
self.dateList = res.data
}
},
/* 加载预约时间段 */
async loadTimerange() {
let self = this
let res = await this.$u.api.openTimerange()
if (res && res.code == 200) {
let list = res.data
list.map((item, index) => {
item.disabled = false
})
self.timeList = list
}
},
changeOwn(index, own, types) {
let self = this
self.curOwn = index
self.trace.reasonRelegation = own
self.trace.reason = types[0]
},
changeType(index, type) {
this.trace.reason = type
},
weekChange(data) {
// 点击下一周
console.log(data, 'week-data')
if (data && data.time) {
let num = data.num
let time = data.time
this.num = num
if (num == 0) {
this.loadCalendar()
} else {
this.loadCalendar()
}
}
},
dateChange(data) {
// 点击日期选择
let self = this
self.trace.dateItem = data.item
// if (self.trace.reasonType == '改约') { // 屏蔽改约对时间段选择的限制
// self.timeList.map((item, index) => {
// if (
// (data.item.timeRange &&
// data.item.timeRange.indexOf(item.pkey) > -1) ||
// item.isEnd
// ) {
// item.disabled = true
// } else {
// item.disabled = false
// }
// })
// } else {
self.timeList.map((item, index) => {
item.disabled = false
})
// }
self.trace.traceDate = data.item.day
self.trace.timeRange = null
},
timeChange(data) {
// 时间段选择变化
console.log(data, 'week-data')
this.trace.timeRange = data.item.pkey
this.trace.timeItem = data.item
},
},
}
</script>
<style lang="scss" scoped>
.content-view {
height: 100%;
border-radius: 12rpx;
overflow: auto;
.time-view {
border-radius: 12rpx;
background-color: #ffffff;
padding-bottom: 20rpx;
}
}
.con-box {
padding: 30rpx 30rpx 8rpx 30rpx;
border-radius: 12rpx;
background-color: #ffffff;
margin-bottom: 20rpx;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
& > .u-flex {
margin-top: 40rpx;
margin-right: -24rpx;
.txt-item {
border-radius: 12rpx;
padding: 24rpx 38rpx;
width: 196rpx;
height: 72rpx;
text-align: center;
margin-right: 22rpx;
margin-bottom: 20rpx;
background-color: #f4f5f7;
&.active {
background-color: #2272ff;
.txt {
color: #fff;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
}
}
.txt {
display: block;
font-size: 26rpx;
line-height: 26rpx;
color: #333;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.input-view {
margin-top: 24rpx;
margin-bottom: 24rpx;
border: 2rpx solid #ececec;
padding: 18rpx 30rpx;
}
}
</style>
...@@ -299,7 +299,7 @@ export default { ...@@ -299,7 +299,7 @@ export default {
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空 待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空 待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80 待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 or orderStatus == 88 工单状态 等于85 或者 等于有87 审核中 orderStatus ==85 or orderStatus == 87 or orderStatus == 88 工单状态 等于85 或者 等于87 或者 等于88
异常 orderStatus ==86 工单状态 等于86 异常 orderStatus ==86 工单状态 等于86
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110 已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/ */
......
<template> <template>
<view class="order-record-view"> <view class="order-record-view">
<view class="top-item"> <view class="top-item">
<text>履约记录</text> <text>履约记录</text>
</view> </view>
<view v-if="orderRecords.length == 0" class="no-record-view">当前暂无履约记录</view> <view v-if="orderRecords.length == 0" class="no-record-view"
<view v-else :class="['record-list-view', {'short': orderRecords.length <= showLenght}]"> >当前暂无履约记录</view
<view class="record-right-view"> >
<view class="dashed-line-view"></view> <view
<view class="order-list"> v-else
<view v-for="(record,index) in showOrderRecords" :key="record.operationContent" :class="['order-cell', {'first': index == 0}]"> :class="[
<view class="node-view"> 'record-list-view',
<view class="node-border-view"> { short: orderRecords.length <= showLenght },
<view class="node-middle-view"></view> ]"
</view> >
</view> <view class="record-right-view">
<view class="right-view"> <view class="dashed-line-view"></view>
<view class="line-view-top"> <view class="order-list">
<text>{{$u.timeFormat(record.operationDatetime, 'yyyy.mm.dd &nbsp hh:MM:ss')}}</text> <view
<text style="color: red;">{{record.overTime?'超时':''}}{{record.overTime && record.exception ? '/' : ''}}{{record.exception?'异常':''}}</text> v-for="(record, index) in showOrderRecords"
<text style="color: #2272FF;" v-show="record.isTrace">跟进</text> :key="record.operationContent"
</view> :class="['order-cell', { first: index == 0 }]"
<view class="line-view-item"> >
<view> <view class="node-view">
<text>{{record.operationTypeText}}</text> <view class="node-border-view">
</view> <view class="node-middle-view"></view>
<view class="item-operation-view" v-show="record.isTrace"> </view>
<text class="item-label" >{{record.traceLabel + ":"}}</text> </view>
<text class="item-content">{{record.traceTime}}</text> <view class="right-view">
</view> <view class="line-view-top">
<view class="item-operation-view" v-show="record.operationContent"> <text>{{
<text class="item-label">备注:</text> $u.timeFormat(
<text class="item-content">{{ record.operationContent }}</text> record.operationDatetime,
</view> 'yyyy.mm.dd &nbsp hh:MM:ss'
</view> )
</view> }}</text>
</view> <text style="color: red;"
</view> >{{ record.overTime ? '超时' : ''
</view> }}{{ record.overTime && record.exception ? '/' : ''
<view v-if="orderRecords && orderRecords.length > showLenght" @click="readMoreRecord = !readMoreRecord"> }}{{ record.exception ? '异常' : '' }}</text
<view v-if="readMoreRecord" class="read-more-toggle"> >
<u-icon name="arrow-down"></u-icon> <text style="color: #2272FF;" v-show="record.isTrace"
<text class="read-more-text">查看更多</text> >跟进</text
</view> >
<view v-else class="read-more-toggle"> </view>
<u-icon name="arrow-up"></u-icon> <view class="line-view-item">
<text class="read-more-text">点击收起</text> <view>
</view> <text>{{ record.operationTypeText }}</text>
</view> </view>
<view v-else style="height: 10rpx;"></view> <view class="item-operation-view" v-show="record.isTrace">
</view> <text class="item-label">{{ record.traceLabel + ':' }}</text>
<text class="item-content">{{ record.traceTime }}</text>
</view> </view>
<view
class="item-operation-view"
v-show="record.operationContent"
>
<text class="item-label">备注:</text>
<text class="item-content">{{
record.operationContent
}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view
v-if="orderRecords && orderRecords.length > showLenght"
@click="readMoreRecord = !readMoreRecord"
>
<view v-if="readMoreRecord" class="read-more-toggle">
<u-icon name="arrow-down"></u-icon>
<text class="read-more-text">查看更多</text>
</view>
<view v-else class="read-more-toggle">
<u-icon name="arrow-up"></u-icon>
<text class="read-more-text">点击收起</text>
</view>
</view>
<view v-else style="height: 10rpx;"></view>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
// 履约记录 // 履约记录
orderRecords: { orderRecords: {
type: Array, type: Array,
default () { default() {
return [] return []
} },
}, },
}, },
data() { data() {
return { return {
readMoreRecord: true, readMoreRecord: true,
showLenght: 5, showLenght: 5,
} }
}, },
computed: { computed: {
showOrderRecords() { showOrderRecords() {
if (this.readMoreRecord && this.orderRecords && this.orderRecords.length > 0) { if (
return this.orderRecords.slice(0, this.showLenght) this.readMoreRecord &&
} else { this.orderRecords &&
return this.orderRecords this.orderRecords.length > 0
} ) {
}, return this.orderRecords.slice(0, this.showLenght)
}, } else {
} return this.orderRecords
}
},
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.order-record-view { .order-record-view {
.top-item { .top-item {
font-size: 32rpx; font-size: 32rpx;
color: #333333; color: #333333;
font-weight: bold; font-weight: bold;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.no-record-view { .no-record-view {
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;
padding-bottom: 30rpx; padding-bottom: 30rpx;
} }
.record-list-view { .record-list-view {
position: relative; position: relative;
&.short { &.short {
padding-bottom: 30rpx; padding-bottom: 30rpx;
} }
.record-right-view { .record-right-view {
position: relative; position: relative;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.dashed-line-view { .dashed-line-view {
position: absolute; position: absolute;
width: 2rpx; width: 2rpx;
border-left: 1px dashed #2272FF; border-left: 1px dashed #2272ff;
height: 100%; height: 100%;
top: 14rpx; top: 14rpx;
left: 11rpx; left: 11rpx;
} }
.order-list { .order-list {
width: 100%; width: 100%;
.order-cell { .order-cell {
margin-top: 50rpx; margin-top: 50rpx;
display: flex; display: flex;
&.first { &.first {
margin-top: 0; margin-top: 0;
} }
.node-view { .node-view {
margin-right: 18rpx; margin-right: 18rpx;
flex-shrink: 0; flex-shrink: 0;
margin-top: 8rpx; margin-top: 8rpx;
z-index: 1; z-index: 1;
.node-border-view { .node-border-view {
border: 2rpx solid #2272FF; border: 2rpx solid #2272ff;
border-radius: 11rpx; border-radius: 50%;
width: 22rpx; width: 22rpx;
height: 22rpx; height: 22rpx;
// display: flex; display: flex;
// align-items: center; align-items: center;
// justify-content: center; justify-content: center;
padding: 5rpx; // padding: 6rpx;
background-color: #FFFFFF; background-color: #ffffff;
.node-middle-view { .node-middle-view {
width: 10rpx; width: 10rpx;
height: 10rpx; height: 10rpx;
background-color: #2272FF; background-color: #2272ff;
border-radius: 6rpx; border-radius: 50%;
} }
} }
} }
.right-view { .right-view {
width: 100%; width: 100%;
.line-view-top { .line-view-top {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
color: #333333; color: #333333;
font-weight: bold; font-weight: bold;
font-size: 28rpx; font-size: 28rpx;
} }
.line-view-item { .line-view-item {
color: #666666; color: #666666;
font-size: 26rpx; font-size: 26rpx;
margin-top: 10rpx; margin-top: 10rpx;
.item-operation-view { .item-operation-view {
margin-top: 20rpx; margin-top: 20rpx;
.item-label { .item-label {
color: #2272FF; color: #2272ff;
} }
.item-content { .item-content {
word-break: break-all; word-break: break-all;
} }
} }
} }
} }
}
} }
} }
} }
}
.read-more-toggle {
.read-more-toggle { text-align: center;
text-align: center; color: #2272ff;
color: #2272FF; font-size: 26rpx;
font-size: 26rpx; padding-top: 30rpx;
padding-top: 30rpx; padding-bottom: 30rpx;
padding-bottom: 30rpx; }
}
.read-more-text {
.read-more-text { padding-left: 8rpx;
padding-left: 8rpx; }
}
.order-item-more {
.order-item-more { font-size: 26rpx;
font-size: 26rpx; color: #333333;
color: #333333; text-align: right;
text-align: right;
.line-view {
.line-view { background-color: #f4f5f7;
background-color: #F4F5F7; height: 2rpx;
height: 2rpx; margin-bottom: 20rpx;
margin-bottom: 20rpx; }
} }
}
} </style>
}
</style>
<template> <template>
<view class="order-wrap"> <view class="order-wrap">
<u-navbar title-color="#FFFFFF" title-size="32" back-icon-color="#FFFFFF" :background="background" :border-bottom="false" title-bold></u-navbar> <u-navbar
<view class="content"> title-color="#FFFFFF"
<view class="title-view"> title-size="32"
<view class="title-text">{{title}}</view> back-icon-color="#FFFFFF"
<!-- 拒单 --> :background="background"
<view v-show="allowRejection" class="reject-button" @click="$u.throttle(rejectOrder, 500)">拒单</view> :border-bottom="false"
</view> title-bold
<!-- 订单详情 --> ></u-navbar>
<view class="card"> <view class="content">
<view class="header" v-if="showTimeView"> <view class="title-view">
<view class="header-left-view"> <view class="title-text">{{ title }}</view>
<u-icon :name="clockName" margin-left="10" custom-prefix="wxh" <!-- 拒单 -->
:color="countColor" size="40" :label="tipText" label-size="32" <view
:label-color="countColor" :custom-style="{'font-weight': 'bold'}" /> v-show="allowRejection"
</view> class="reject-button"
<!-- 倒计时 --> @click="$u.throttle(rejectOrder, 500)"
<view class="title"> >拒单</view
<u-count-down :timestamp="timestamp" font-size="28" show-days separator="zh" separator-size="32" height="40" >
color="#FFFFFF" separator-color="#666666" @change="timeOutChange" ref="order-count-down" :bg-color="countColor"></u-count-down> </view>
</view> <!-- 订单详情 -->
</view> <view class="card">
<Detail :order="order" :readMore.sync="readMore" :operate="isAllowDianhuaAndDaohang"></Detail> <view class="header" v-if="showTimeView">
</view> <view class="header-left-view">
<!-- 从我的页面进来显示结算信息 --> <u-icon
<view v-if="isOther" class="settlement-view"> :name="clockName"
<view class="settlement-title">结算信息</view> margin-left="10"
<view class="settlement-content"> custom-prefix="wxh"
<text class="content-left">工单确认时间:</text> :color="countColor"
<text>{{settlementInfo.formatTime}}</text> size="40"
</view> :label="tipText"
<view class="settlement-content" v-for="(item, index) in settlementInfo.list" :key="index"> label-size="32"
<text class="content-left">{{item.businessSettlementType + ':'}}</text> :label-color="countColor"
<text>{{(item.realSettlementAmount || item.settlementAmount) + '元'}}</text> :custom-style="{ 'font-weight': 'bold' }"
<text v-if="item.adjustmentRemark">{{'-' + item.adjustmentRemark}}</text> />
</view> </view>
<view class="settlement-content"> <!-- 倒计时 -->
<text class="content-left">最终结算金额:</text> <view class="title">
<text>{{settlementInfo.amount}}元</text> <u-count-down
</view> :timestamp="timestamp"
</view> font-size="28"
<!-- 不是从我的页面,而是其他页面进来 --> show-days
<view v-else> separator="zh"
<!-- 业务文件 --> separator-size="32"
<view class="order-file" v-if="showFile" @click="$u.throttle(handleClickFile, 500)"> height="40"
<view class="order-file-left"> color="#FFFFFF"
<image :src="wenjianImage" class="file-image"></image> separator-color="#666666"
<text>充电桩安装业务文件</text> @change="timeOutChange"
</view> ref="order-count-down"
<view class="order-file-right"> :bg-color="countColor"
<text>点击查看</text> ></u-count-down>
<u-icon name="arrow-right"></u-icon> </view>
</view> </view>
</view> <Detail
<!-- 带预约显示时间选择 --> :order="order"
<view class="card appoint-item" v-show="isWaitAppointment"> :readMore.sync="readMore"
<appoint-time :dateList="dateList" :timeList="timeList" @dateChange="dateChange" @timeChange="timeChange" @weekChange="weekChange"></appoint-time> :operate="isAllowDianhuaAndDaohang"
</view> ></Detail>
<!-- 履约记录 --> </view>
<view class="card record-item"> <!-- 从我的页面进来显示结算信息 -->
<Record :orderRecords="orderRecords"></Record> <view v-if="isOther" class="settlement-view">
</view> <view class="settlement-title">结算信息</view>
</view> <view class="settlement-content">
</view> <text class="content-left">工单确认时间:</text>
<!-- 不是从我的页面进来才显示 --> <text>{{ settlementInfo.formatTime }}</text>
<template v-if="!isOther"> </view>
<!-- 提示窗口 --> <view
<view> class="settlement-content"
<u-toast ref="uToast" /> v-for="(item, index) in settlementInfo.list"
</view> :key="index"
<BottomButtons v-if="showBottomBtn" :buttons="buttons" @submit="handleSubmit"></BottomButtons> >
<!-- 拍照 --> <text class="content-left">{{
<take-photo type="test" v-if="takeStatus" @close="closeTake" :upload="false" :num="1"></take-photo> item.businessSettlementType + ':'
<!-- 添加客服 --> }}</text>
<u-popup border-radius="12" v-model="visible" safe-area-inset-bottom mode="center" width="690rpx" <text>{{
:mask-close-able="false" close-icon-color="#FFFFFF"> (item.realSettlementAmount || item.settlementAmount) + '元'
<view class="order-pop-view"> }}</text>
<Customer type="pop" @click="handleJoin"></Customer> <text v-if="item.adjustmentRemark">{{
</view> '-' + item.adjustmentRemark
</u-popup> }}</text>
<!-- 已申请配件列表 --> </view>
<!-- <ApplyList :show.sync="showApplyList" :list="partsList" @action="handleClickCell" @operate="handleOperate" @apply="handleApply"></ApplyList> --> <view class="settlement-content">
</template> <text class="content-left">最终结算金额:</text>
</view> <text>{{ settlementInfo.amount }}元</text>
</view>
</view>
<!-- 不是从我的页面,而是其他页面进来 -->
<view v-else>
<!-- 业务文件 -->
<view
class="order-file"
v-if="showFile"
@click="$u.throttle(handleClickFile, 500)"
>
<view class="order-file-left">
<image :src="wenjianImage" class="file-image"></image>
<text>充电桩安装业务文件</text>
</view>
<view class="order-file-right">
<text>点击查看</text>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<!-- 带预约显示时间选择 -->
<FeedbackContent
ref="feed-back"
v-show="isWaitAppointment"
:categoryId="order.categoryId"
type="filing"
@change="handleChange"
class="content-view"
/>
<!-- 履约记录 -->
<view class="card record-item">
<Record :orderRecords="orderRecords"></Record>
</view>
</view>
</view>
<!-- 不是从我的页面进来才显示 -->
<template v-if="!isOther">
<!-- 提示窗口 -->
<view>
<u-toast ref="uToast" />
</view>
<BottomButtons
v-if="showBottomBtn"
:buttons="buttons"
@submit="handleSubmit"
></BottomButtons>
<!-- 拍照 -->
<take-photo
type="test"
v-if="takeStatus"
@close="closeTake"
:upload="false"
:num="1"
></take-photo>
<!-- 添加客服 -->
<u-popup
border-radius="12"
v-model="visible"
safe-area-inset-bottom
mode="center"
width="690rpx"
:mask-close-able="false"
close-icon-color="#FFFFFF"
>
<view class="order-pop-view">
<Customer type="pop" @click="handleJoin"></Customer>
</view>
</u-popup>
<!-- 已申请配件列表 -->
<!-- <ApplyList :show.sync="showApplyList" :list="partsList" @action="handleClickCell" @operate="handleOperate" @apply="handleApply"></ApplyList> -->
</template>
</view>
</template> </template>
<script> <script>
import appointTime from '@/components/appoint/appoint-time.vue' // import appointTime from '@/components/appoint/appoint-time.vue'
import takePhoto from '@/components/take/index.vue' import takePhoto from '@/components/take/index.vue'
// import PopView from "@/components/popView/index.vue" // import PopView from "@/components/popView/index.vue"
import baseFile from '@/components/upload/index' import baseFile from '@/components/upload/index'
import Customer from "@/components/mine/customer.vue" import Customer from '@/components/mine/customer.vue'
import Record from "@/components/order/performanceRecord.vue" import Record from '@/components/order/performanceRecord.vue'
import Detail from "@/components/order/detail.vue" import Detail from '@/components/order/detail.vue'
import BottomButtons from "@/components/order/bottomButtons.vue" import BottomButtons from '@/components/order/bottomButtons.vue'
// import ApplyList from "@/components/parts/applyList.vue" import FeedbackContent from '@/components/order/feedback.vue'
let now = new Date(new Date().toLocaleDateString()).getTime();
export default {
components: {
appointTime,
'take-photo': takePhoto,
// PopView,
Customer,
Record,
Detail,
BottomButtons,
// ApplyList
},
mixins: [baseFile],
data() {
return {
type: '',
readMore: true, // 是:显示的是'查看更多'按钮;否:显示的是'点击收起'按钮
dateList: [
{day: now, timeRange: []},
{day: now + (1*86400000), timeRange: []},
{day: now + (2*86400000), timeRange: []},
{day: now + (3*86400000), timeRange: []},
{day: now + (4*86400000), timeRange: []},
{day: now + (5*86400000), timeRange: []},
{day: now + (6*86400000), timeRange: []},
],
timeList: [
{"name":"06:00-08:00","pkey":"appointment_range_8"},
{"name":"08:00-10:00","pkey":"appointment_range_10"},
{"name":"10:00-12:00","pkey":"appointment_range_12"},
{"name":"12:00-14:00","pkey":"appointment_range_14"},
{"name":"14:00-16:00","pkey":"appointment_range_16"},
{"name":"16:00-18:00","pkey":"appointment_range_18"},
{"name":"18:00-20:00","pkey":"appointment_range_20"},
{"name":"20:00-22:00","pkey":"appointment_range_22"},
{"name":"22:00-24:00","pkey":"appointment_range_24"}
],
background: {
backgroundColor: 'none',
// 导航栏背景图
// background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
// 还可以设置背景图size属性
// backgroundSize: 'cover',
// 渐变色
},
visible: false,
// orderId: null,
orderId: 11880366, // 测试数据
order: {},
needPhotograph: true, // 需要现场拍摄
orderRecords: [],
method: null,
submitType: '',
nextUrl:'',
takeStatus:false,
isErrorSign:false,
errorSignUrl:'',
appointmentDatetimeRange:'',
appointmentDatetime:'',
signDistance:3000,
contactAddressLongitud:0,
contactAddressLatitud:0,
num:0,
clicking: false,
dateItem: null,
centerBtnDisabled:false,
settlementInfo: {formatTime: '-', list: [], amount: ''},
unloaded: false,
timeout: false,
timestamp: 0,
showCountTime : false, // 从上个页面传入是否显示倒计时
// showApplyList: false, // 显示已申请配件列表
partsList: [], // 已申请的配件列表
partsCount: 0
}
},
computed: {
customStyle() {
return {
'height': '48rpx',
'width': '100rpx',
'color': '#FFFFFF',
'border-color': 'transparent',
'background-color': 'transparent'
}
},
buttons() {
//id: 0 主流程; 1 过程反馈;2 异常签到; 3 现场拍照; 4 备件申请
// label: 按钮文字,
// type: 'image' 上图片下文字;'text' 纯文字,
// image: 图片名,
// show: 是否显示,
// disabled: 是 禁用;否 正常,
// id: 区分各个按钮
return [{
label: '过程反馈',
type: 'image',
image: 'guochengfankui.png',
show: this.allowFeedback,
disabled: false,
id: 1
},
{
label: '异常签到',
type: 'image',
image: 'yichangqiandao.png',
show: this.isWaitCheckIn, // 待签到显示
disabled: false,
id: 2
},
{
label: '现场拍照',
type: 'image',
image: 'xiancahngpaizhao.png',
show: this.isWaitFinish,
disabled: false,
id: 3
},
{
label: '备件申请',
type: 'image',
image: 'peijian.png',
show: this.allowFeedback,
disabled: false,
count: this.partsCount,
id: 4
},
{
label: this.bottomButtonText,
type: 'text',
image: '',
show: true,
disabled: this.centerBtnDisabled,
id: 0,
customStyle: {
'background-color': this.isCompetitionAndWaitAccept ? '#FF930D' : (this.centerBtnDisabled ? '#D1D4D4' : '#2272FF')
}
}]
},
clockName() {
return this.timeout ? 'timeout' : 'clock'
},
countColor() {
return this.timeout ? '#FA5A49' : '#2272FF'
},
wenjianImage() {
return process.uniEnv.qn_base_url + 'wenjian.png'
},
types() {
return {
'waitAccept': 0, // 待接单、待抢单
'waitAppointment': 1, // 待预约、
'waitCheckIn': 2, // 待签到、
'waitFinish': 3, // 待完工、
'audit': 4, // 审核中、
'exception': 5, // 异常单、
'finish': 6, // 已完工
'snapped': 8, // 已被抢
'other': 9, // 工单结算信息
}
},
titles() {
return ['待' + this.type0Text,'待预约','待签到','待完工','审核中','异常单','已完工','','','订单信息']
},
bottomButtonText() { // 底部主流程按钮文字
return this.buttonTexts[this.types[this.type]]
},
buttonTexts() {
return [this.type0Text,'预约','签到','去完工','','','','','已被抢','']
},
tipText() { // 时间紧迫提示文字
return this.timeout ? '订单超时' : '剩余时间'
},
title() { // 标题
return this.titles[this.types[this.type]]
},
type0Text() {
return this.isCompetition ? '抢单' : '接单'
},
isCompetition() { // 是:订单池,抢单; 否:指派单,接单
return this.order.orderBusinessType == 'R'
},
isOther() { // 工单结算信息
return this.type == 'other'
},
allowRejection() { // 允许拒单
// 待接单 && 业务类型非抢单
return this.type == 'waitAccept' && !this.isCompetition
},
isCompetitionAndWaitAccept() { // 抢单页面
// 待接单 && 业务类型抢单
return this.type == 'waitAccept' && this.isCompetition
},
showBottomBtn() { // 显示底部button
// 0 待接单、待抢单, 1 待预约, 2 待签到, 3 待完工, 8 已被抢
return [0, 1, 2, 3, 8].indexOf(this.types[this.type]) != -1
},
showFile() { // 显示查看业务文件
// 1 待预约, 2 待签到, 3 待完工, 4 审核中, 5 异常单, 6 已完工, 8 已被抢
return this.types[this.type] > 0
},
isAllowDianhuaAndDaohang() { // 可以点击电话和定位按钮
return this.type != 'waitAccept'
},
showTimeView() { // 是否显示倒计时窗口
// 上个页面传入 || 订单信息有超过时间点 && ((待预约、 待签到、 待完工) || (待接单 && 业务类型非抢单))
return this.showCountTime || this.order.currentOverTime && ([1, 2, 3].indexOf(this.types[this.type]) != -1 || (this.type == 'waitAccept' && !this.isCompetition))
},
allowFeedback() { // 允许过程反馈 // 显示配件申请按钮
// 1 待预约, 2 待签到, 3 待完工
return [1, 2, 3].indexOf(this.types[this.type]) != -1
},
isWaitCheckIn() { // 待签到
return this.type == 'waitCheckIn'
},
isWaitAppointment() { // 待预约
return this.type == 'waitAppointment'
},
isWaitFinish() {
return this.type == 'waitFinish'
}
},
onLoad(option) {
getApp().trackPage('订单详情页')
// 生命周期函数--监听页面加载
if (option && option.id) {
this.orderId = option.id
}
if (option && option.showCountTime) { // 是否显示倒计时,上个页面传入,可以快速显示避免页面跳动太大;之后还需要从后台获取信息,再根据其他条件判断一次
this.showCountTime = option.showCountTime
}
if (option && option.type) { // 类型,从上个页面传进来可以快速构建页面;之后还需要从后台获取信息,更新状态
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
this.type = option.type
}
this.loadOrderDetail()
this.getLocation()
if (this.isOther) {
// 获取结算信息
this.loadSettlement()
} else {
this.loadOrderRecord() // 履约记录
this.getSignDistance() // 定位
// this.getOrderPartsSum() // 备件单数量
}
},
onShow() {
// 从过程反馈回来,需要刷新数据
let pages = getCurrentPages()
let page = pages[pages.length - 1]
if (page.needFresh) {
page.needFresh = null
this.loadOrderDetail()
this.loadOrderRecord()
}
if (page.needRefresh) {
page.needRefresh = null
this.getApplyList()
}
},
onUnload() {
this.unloaded = true
this.closeLocationChange()
},
methods: {
updateLocation(){
let self = this
wx.startLocationUpdate({
success:function(){
self.openLocationChange()
}
})
},
_locationChangeFn(res) {
let self = this
console.log('location change', res)
const dataValue = this.dataValue || []
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
if(this.getDistance(res.latitude,res.longitude)>this.signDistance){
// 计算签到距离
this.centerBtnDisabled = true
}else{
this.centerBtnDisabled = false
}
},
openLocationChange(){
console.log("openLocationChange")
wx.onLocationChange(this._locationChangeFn);
},
closeLocationChange(){
console.log("closeLocationChange")
wx.offLocationChange(this._locationChangeFn);
},
handleClickRight(active) {
this.isWaitFinish ? this.scenePhotoClick() : this.take()
},
scenePhotoClick() { // 跳转拍照小程序
uni.navigateTo({
url: 'pages/photo/list?orderId='+this.order.orderId+'&brandId='+this.order.lianbaoBrandId+'&brand='+this.order.brandName
+'&systemId='+this.order.partnerCompanyId+'&classifyId='+this.order.categoryId
})
},
take() {
uni.hideTabBar()
this.takeStatus = true
},
async closeTake(img) {
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
if(img){ // 拍照完成
const files = img.map(v => v.path)
const value = await this.saveToTask(files)
this.isErrorSign = true
this.errorSignUrl = value[0].key
this.handleBtn()
}else{
this.$refs.uToast.show({
title: '异常签到失败,请先按要求拍照',
type: 'warning'
})
}
},
loadOrderDetail() { // 获取工单详情
let self = this
let timestamp = new Date().getTime();
var data = {
'orderId': self.orderId
};
self.$u.api.orderDetail(data, self.orderId).then((res) => {
if (res.code == 200) {
self.order = res.data
this.setOrderType()
var nowTime = new Date().getTime();
this.timeout = this.order.currentOverTime && nowTime> this.order.currentOverTime
this.timestamp = Math.round(Math.abs(this.order.currentOverTime - nowTime) / 1000)
// 格式化时间
this.settlementInfo.formatTime = this.order.settleCenterSyncDatetime ? this.$u.timeFormat(this.order.settleCenterSyncDatetime, 'yyyy.mm.dd hh:MM:ss') : '-'
} else {
console.log(res.message, "获取订单详情失败!");
}
});
},
loadSettlement() { // 获取工单详情
let self = this
var data = {
'orderId': self.orderId
};
self.$u.api.querySettleByOrder(data, self.orderId).then((res) => {
if (res.code == 200) {
var amount = 0
for (var item of res.data) {
amount += (item.realSettlementAmount || item.settlementAmount)
}
this.settlementInfo.amount = amount
this.settlementInfo.list = res.data
} else {
console.log(res.message, "获取订单详情失败!");
}
});
},
// getOrderPartsSum() { // 获取订单配件数量
// this.$u.api.getOrderPartsSum(this.orderId).then((res) => {
// if (res.code == 200) {
// if (res.data) {
// this.partsCount = res.data.totalPartCount
// }
// } else {
// console.log(res.message)
// }
// });
// },
getSignDistance(){
let self = this
var data={}
self.$u.api.getSignDistance(data).then((res) => {
if (res.code == 200) {
self.signDistance = res.data
}
});
},
loadOrderRecord() {
let self = this
var param = {
orderId: self.orderId
};
self.$u.api.listOrderRecord(param).then((res) => {
if (res.code == 200) {
res.data.forEach(item =>{
item.isTrace = false
item.traceTime = null
item.traceLabel = item.operationType
if (item.operationType === '报备' || item.operationType === '改约'){
item.isTrace = true
item.traceLabel = item.operationType === '报备' ? '下次联系时间' : '改约时间'
item.operationTypeText = item.operationType
item.traceTime = item.orderRecordRemark
let arr = item.orderRecordRemark.split(',')
if(arr && arr.length > 1) {
let remark = arr[1].substring(arr[1].indexOf(':')+1,arr[1].length)
item.traceTime = remark
item.operationTypeText = arr[0]
}
} else if(item.operationType === '预约') {
let remark = item.orderRecordRemark.substring(item.orderRecordRemark.lastIndexOf(",")+1);
item.traceTime = remark
item.operationTypeText = `上门 ${remark}`
} else {
item.operationTypeText = item.operationType
}
})
self.orderRecords = res.data
} else {
console.log(res.message, "获取订单详情失败!");
}
})
},
weekChange(data){
// 点击下一周
if (data && data.time) {
let num = data.num
let time = data.time
this.num = num
if (num == 0) {
this.loadCalendar()
} else {
this.loadCalendar()
}
}
},/* 加载日历数据 */
async loadCalendar() {
let self = this
let params = {
num: this.num
}
self.dateItem = null
let res = await this.$u.api.workerCalendar(params)
if(res && res.code == 200) {
self.dateList = res.data
}
this.loadTimerange()
},
/* 加载预约时间段 */
async loadTimerange() {
let self = this
let res = await this.$u.api.openTimerange()
if(res && res.code == 200) {
let list = res.data
list.map((item, index) => {
if(self.dateItem && self.dateItem.timeRange.indexOf(item.pkey) > -1 || item.isEnd) {
item.disabled = true
} else {
false
}
})
self.timeList = list
}
},
dateChange(data){
// 点击日期选择
let self = this
self.appointmentDatetime = data.item.day
self.dateItem = data.item
self.appointmentDatetimeRange = null
self.timeList.map((item, index) => {
if(data.item.timeRange.indexOf(item.pkey) > -1 || item.isEnd) {
item.disabled = true
} else {
item.disabled = false
}
})
},
timeChange(data){
// 时间段选择变化
this.appointmentDatetimeRange = data.item
},
addressToCoordinate(){
let self = this
self.$u.api.addressToCoordinate(self.orderId).then((res) => {
if (res.code == 200) {
self.contactAddressLongitud=res.data.lng
self.contactAddressLatitud = res.data.lat
} else {
console.log(res.message);
}
})
},
setOrderType() {
// 确定工单类型
var orderStatus = this.order.orderStatus
if (orderStatus < 31) {
// 接单
this.type = 'waitAccept'
this.submitType = this.isCompetition ? 'orderGan' : 'orderAccept'
} else if (orderStatus === 31 && !this.order.appointmentDatetime) {
// 预约
this.type = 'waitAppointment'
this.submitType = "workerAppointment"
this.loadCalendar()
} else if (orderStatus === 31 && this.order.appointmentDatetime) {
// 签到
this.type = 'waitCheckIn'
this.submitType = "maintainWorkerCheckin"
this.updateLocation()
} else if (orderStatus > 31 && orderStatus < 80) {
// 完工
this.type = 'waitFinish'
this.submitType = "toFilish"
}else if (orderStatus == 85 || orderStatus == 87 || orderStatus == 88) { // 审核中
this.type = 'audit'
} else if (orderStatus == 86) { // 异常单
this.type = 'exception'
} else if ([80, 81, 89, 110].indexOf(orderStatus) != -1) { // 已完工
this.type = 'finish'
}
this.readMore = this.type != 'waitAccept'
},
handleClickSure() {
if ((this.submitType == 'orderAccept' || this.submitType == 'orderGan') && process.uniEnv.node_env == 'prod') {
this.$u.api.checkAddCustomer().then((res) => {
if (res.code == 200) {
if(res.data === true){
this.handleBtn()
} else {
this.visible = true
}
} else {}
})
} else {
this.handleBtn()
}
},
handleSubmit(id) {
console.log(id)
// 0 主流程; 1 过程反馈;2 异常签到; 3 现场拍照
switch (id) {
case 0:
this.handleClickSure()
break
case 1:
this.clickFeedback()
break
case 2:
getApp().track("order_errorSign", {orderId: this.orderId})
this.take()
break
case 3:
getApp().track("order_scenePhotoClick", {orderId: this.orderId})
this.scenePhotoClick()
break
case 4:
this.handleApplyParts()
break
}
},
handleApplyParts() { // 点击了配件申请按钮
// if (this.buttons[3].count > 0) { // 已经有配件,弹出配件列表
// this.showApplyList = true
// this.getApplyList()
// } else { // 没有配件,跳到配件申请
this.toApplyParts()
// }
},
async getApplyList() {
let res = await this.$u.api.applyList({
'pageSize': 1000,
'pageNumber': 1,
// 'status': null, // -不传值 全部 待签收 15 待发货 10 待审核 1 已取消 -1 已驳回 -2 已签收 20
'workOrderId': this.order.orderId
})
if(res && res.code == 200) {
this.partsList = res.data || []
}
},
handleBtn() {
console.log('click button')
if(!this.submitType){
return;
}
const data = {}
// 不同请求类型传递不同数据
if(this.submitType === 'orderAccept'){ // 接单
data.orderId = this.order.orderId
}else if(this.submitType === 'orderGan'){ // 抢单
data.orderId = this.order.orderId
data.channel = 4
}else if(this.submitType === 'workerAppointment'){ // 预约
data.appointmentDatetime =this.appointmentDatetime
if(!data.appointmentDatetime ){
this.commonToast('请选择预约日期','waring')
return
}
if( !this.appointmentDatetimeRange || !this.appointmentDatetimeRange.pkey ){
this.commonToast('请选择预约时间段','waring')
return
}
data.appointmentDatetimeRange = this.appointmentDatetimeRange.pkey
}else if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合
if(!this.isErrorSign){
if(this.centerBtnDisabled){
return
}else{
this.closeLocationChange()
}
if(this.getDistance() > this.signDistance){
this.commonToast('签到失败,请点击异常签到处理或联系客服','error')
return
}
}
data.channel = 4
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'){ // 去完工
if (this.order.categoryName != '充电桩') {
uni.showModal({
title: '提示',
content: '非充电桩订单,请在扳手APP进行完工',
showCancel:false,
confirmText: '好的',
})
} else {
this.filish()
}
return
}
if (this.clicking) {
return
}
this.clicking = true
this.$u.api[this.submitType](data, this.order.orderId).then(res => {
let self = this
if (res.code === 200) {
this.trackOrder()
this.$refs.uToast.show({
title: this.bottomButtonText + '操作成功',
type: 'success',
duration: 1000,
callback : function(){
if(self.unloaded === false) { // 如果用户一秒钟之内没有后退退出该页面才跳转
self.clicking = false
uni.redirectTo({
url: 'pages/order/detail?id='+self.order.orderId
});
}
}
})
} else {
let self = this
this.$refs.uToast.show({
title: res.data.message!==undefined ? res.data.message:res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'warning',
callback: function() {
self.clicking = false
res.data.message==='抱歉,手快的师傅已经抢到此单!'?self.isGan():''
}
})
}
})
},
// 去业务材料页面
handleClickFile() {
getApp().track("order_click_view_files", {
brandId: this.order.lianbaoBrandId,
partnerCompanyId: this.order.partnerCompanyId
})
this.$u.route({url: 'pages/order/document' + '?partnerCompanyId=' + this.order.partnerCompanyId + '&brandId=' + this.order.lianbaoBrandId})
},
trackOrder() {
// 接单成功事件,签到成功事件
if(this.submitType == 'orderAccept'
|| this.submitType == 'maintainWorkerCheckin') {
getApp().track(this.submitType, {
orderId: this.order.orderId
});
}
},
commonToast(message,type,url,params){ // 统一得toast
this.$refs.uToast.show({
title: message,
type: type,
url: url,
params:params
})
},
isGan(){
this.type = 'snapped'
this.submitType = ''
this.centerBtnDisabled = true
},
clickFeedback(){
getApp().track("order_clickFeedback", {
orderId: this.order.orderId,
categoryId: this.order.categoryId
})
// 过程反馈
uni.navigateTo({
url: 'pages/order/feedback?orderId='+this.order.orderId+'&categoryId='+this.order.categoryId+'&showGY=' + (this.bottomButtonText != '预约' ? '1' : '0')
})
},
filish(){
// 去完工
uni.navigateTo({ // import ApplyList from "@/components/parts/applyList.vue"
url: 'pages/order/complete?orderId='+this.order.orderId let now = new Date(new Date().toLocaleDateString()).getTime()
+ "&categoryId=" + this.order.categoryId export default {
+ "&orderServiceType=" + this.order.orderServiceType components: {
+ "&inGuaranteePeriod=" + this.order.inGuaranteePeriod // appointTime,
+ "&partnerCompanyId=" + this.order.partnerCompanyId 'take-photo': takePhoto,
+ '&partnerCompanyName=' + this.order.partnerCompanyName // PopView,
+ '&maintainStep=' + this.order.maintainStep Customer,
+ '&orderStatus=' + this.order.orderStatus Record,
+ '&brandId=' + this.order.lianbaoBrandId Detail,
}) BottomButtons,
}, FeedbackContent,
rejectOrder() { // 拒单 // ApplyList
// 检查是否可以拒单 },
var data={} mixins: [baseFile],
this.$u.api.checkRejectable(data).then(res => { data() {
if (res.code === 200 ) { return {
if( res.data && res.data.rejectable){ type: '',
this.$u.route({ readMore: true, // 是:显示的是'查看更多'按钮;否:显示的是'点击收起'按钮
type: 'redirect', background: {
url: 'pages/order/refuse', backgroundColor: 'none',
params: { // 导航栏背景图
orderId: this.order.orderId, // background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
count: res.data.remainderTimes // 还可以设置背景图size属性
} // backgroundSize: 'cover',
}) // 渐变色
}else{ },
this.commonToast("本月无拒单机会,请联系客服","warning") visible: false,
} // orderId: null,
} orderId: 11880366, // 测试数据
}) order: {},
}, needPhotograph: true, // 需要现场拍摄
/** orderRecords: [],
* 获取当前位置的经纬度 method: null,
*/ submitType: '',
getLocation() { nextUrl: '',
let self = this takeStatus: false,
const dataValue = this.dataValue || [] isErrorSign: false,
uni.getLocation({ errorSignUrl: '',
type: 'gcj02', signDistance: 3000,
success: function(res) { contactAddressLongitud: 0,
dataValue.push(res.longitude) contactAddressLatitud: 0,
dataValue.push(res.latitude) num: 0,
self.dataValue = dataValue clicking: false,
}, dateItem: null,
complete: function(res) { centerBtnDisabled: false,
if (res.errMsg.indexOf('auth') != -1) { settlementInfo: { formatTime: '-', list: [], amount: '' },
uni.showModal({ unloaded: false,
title: '提示', timeout: false,
content: '获取权限失败,请到设置页面开启权限', timestamp: 0,
confirmText: '好的', showCountTime: false, // 从上个页面传入是否显示倒计时
success(res) { // showApplyList: false, // 显示已申请配件列表
if (res.confirm) { partsList: [], // 已申请的配件列表
uni.openSetting({ partsCount: 0,
success(res) { }
console.log(res.authSetting) },
} computed: {
}); customStyle() {
} return {
height: '48rpx',
} width: '100rpx',
}) color: '#FFFFFF',
} 'border-color': 'transparent',
}, 'background-color': 'transparent',
}); }
}, },
getDistance(Latitud, Longitud){ buttons() {
return this.distance(this.order.contactAddressLatitud,this.order.contactAddressLongitud,this.dataValue[1],this.dataValue[0]) //id: 0 主流程; 1 过程反馈;2 异常签到; 3 现场拍照; 4 备件申请
}, // label: 按钮文字,
/** // type: 'image' 上图片下文字;'text' 纯文字,
* echo distance(116.3896,39.91917,116.3940,39.91726); // image: 图片名,
* 计算两点之间直线距离 // show: 是否显示,
* @param float $lon1 纬度 // disabled: 是 禁用;否 正常,
* @param float $lat1 经度 // id: 区分各个按钮
* @param float $lon2 纬度 return [
* @param float $lat2 经度 {
* @return float 浮点数 label: '异常签到',
*/ type: 'image',
distance(lat1, lng1, lat2, lng2) { image: 'yichangqiandao.png',
var radLat1 = this.Rad(lat1); show: this.isWaitCheckIn, // 待签到显示
var radLat2 = this.Rad(lat2); disabled: false,
var a = radLat1 - radLat2; id: 2,
var b = this.Rad(lng1) - this.Rad(lng2); },
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + {
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2))); label: '现场拍照',
s = s *6378.137 ;// EARTH_RADIUS; type: 'image',
s = Math.round(s * 10000)/10 ; //输出为米 image: 'xiancahngpaizhao.png',
console.log("计算结果",s,'M'); show: this.isWaitFinish,
return Number(s?s.toFixed(2):0); disabled: false,
}, id: 3,
Rad(d){ },
return d * Math.PI / 180.0;//经纬度转换成三角函数中度分表形式。 {
}, label: '备件申请',
timeOutChange(timestamp){ type: 'image',
if (this.timeout) this.$refs['order-count-down'].seconds += 2 image: 'peijian.png',
if (timestamp == 0 && !this.timeout) { // 超时之后倒计时变为正计时 show: this.showPartsButton,
setTimeout(()=> { disabled: false,
this.timestamp = 1 count: this.partsCount,
this.timeout = true id: 4,
}, 1000) },
} {
}, label: '改约',
// handleClick(){ type: 'image',
// this.visible = false image: 'guochengfankui.png',
// // 交互规范 show: this.allowFeedback,
// uni.switchTab({ disabled: false,
// url: 'pages/index/learn' id: 1,
// }) },
// }, {
handleJoin() { label: this.bottomButtonText,
this.visible = false type: 'text',
// 添加客服 image: '',
}, show: true,
handleOperate() { // 点了弹窗里的配件操作 disabled: this.centerBtnDisabled,
this.$u.api[operateType](partsId).then(res => { id: 0,
var type = 'error' customStyle: {
var message = res.message 'background-color': this.isCompetitionAndWaitAccept
if (res.code === 200) { ? '#FF930D'
type = 'success' : this.centerBtnDisabled
for (var item of this.partsList) { ? '#D1D4D4'
if (item.id == partsId) { : '#2272FF',
item.status = willStatus },
break },
} ]
} },
} else { clockName() {
console.log(res.message) return this.timeout ? 'timeout' : 'clock'
} },
this.$refs.uToast.show({ countColor() {
title: message, return this.timeout ? '#FA5A49' : '#2272FF'
type: type, },
duration: 1500, wenjianImage() {
callback: function() {} return process.uniEnv.qn_base_url + 'wenjian.png'
}) },
}) types() {
}, return {
handleClickCell(info) { waitAccept: 0, // 待接单、待抢单
this.setPageInfo(info) waitAppointment: 1, // 待预约、
uni.navigateTo({ waitCheckIn: 2, // 待签到、
url: 'pages/mine/warehouse/partsDetail' waitFinish: 3, // 待完工、
}) audit: 4, // 审核中、
}, exception: 5, // 异常单、
handleClickExpress(info) { finish: 6, // 已完工
this.setPageInfo(info) snapped: 8, // 已被抢
uni.navigateTo({ other: 9, // 工单结算信息
url: 'pages/mine/warehouse/express' }
}) },
}, titles() {
setPageInfo(info) { return [
var pages = getCurrentPages(); '待' + this.type0Text,
if (pages.length >= 1) { '待预约',
var page = pages[pages.length - 1]; '待签到',
page.info = info '待完工',
} '审核中',
}, '异常单',
handleApply() { // 点了弹窗的申请配件 '已完工',
this.toApplyParts() '',
}, '',
toApplyParts() { '订单信息',
uni.navigateTo({ ]
url: 'pages/parts/application?orderId='+this.order.orderId },
}) bottomButtonText() {
} // 底部主流程按钮文字
} return this.buttonTexts[this.types[this.type]]
}; },
buttonTexts() {
return [
this.type0Text,
'预约',
'签到',
'去完工',
'',
'',
'',
'',
'已被抢',
'',
]
},
tipText() {
// 时间紧迫提示文字
return this.timeout ? '订单超时' : '剩余时间'
},
title() {
// 标题
return this.titles[this.types[this.type]]
},
type0Text() {
return this.isCompetition ? '抢单' : '接单'
},
isCompetition() {
// 是:订单池,抢单; 否:指派单,接单
return this.order.orderBusinessType == 'R'
},
isOther() {
// 工单结算信息
return this.type == 'other'
},
allowRejection() {
// 允许拒单
// 待接单 && 业务类型非抢单
return this.type == 'waitAccept' && !this.isCompetition
},
isCompetitionAndWaitAccept() {
// 抢单页面
// 待接单 && 业务类型抢单
return this.type == 'waitAccept' && this.isCompetition
},
showBottomBtn() {
// 显示底部button
// 0 待接单、待抢单, 1 待预约, 2 待签到, 3 待完工, 8 已被抢
return [0, 1, 2, 3, 8].indexOf(this.types[this.type]) != -1
},
showFile() {
// 显示查看业务文件
// 1 待预约, 2 待签到, 3 待完工, 4 审核中, 5 异常单, 6 已完工, 8 已被抢
return this.types[this.type] > 0
},
isAllowDianhuaAndDaohang() {
// 可以点击电话和定位按钮
return this.type != 'waitAccept'
},
showTimeView() {
// 是否显示倒计时窗口
// 上个页面传入 || 订单信息有超过时间点 && ((待预约、 待签到、 待完工) || (待接单 && 业务类型非抢单))
return (
this.showCountTime ||
(this.order.currentOverTime &&
([1, 2, 3].indexOf(this.types[this.type]) != -1 ||
(this.type == 'waitAccept' && !this.isCompetition)))
)
},
showPartsButton() {
// 显示配件申请按钮
// 1 待预约, 2 待签到, 3 待完工
return [1, 2, 3].indexOf(this.types[this.type]) != -1
},
allowFeedback() {
// 允许改约
// 2 待签到, 3 待完工
return [2, 3].indexOf(this.types[this.type]) != -1
// return [1, 2, 3].indexOf(this.types[this.type]) != -1
},
isWaitCheckIn() {
// 待签到
return this.type == 'waitCheckIn'
},
isWaitAppointment() {
// 待预约
return this.type == 'waitAppointment'
},
isWaitFinish() {
return this.type == 'waitFinish'
},
},
onLoad(option) {
getApp().trackPage('订单详情页')
// 生命周期函数--监听页面加载
if (option && option.id) {
this.orderId = option.id
}
if (option && option.showCountTime) {
// 是否显示倒计时,上个页面传入,可以快速显示避免页面跳动太大;之后还需要从后台获取信息,再根据其他条件判断一次
this.showCountTime = option.showCountTime
}
if (option && option.type) {
// 类型,从上个页面传进来可以快速构建页面;之后还需要从后台获取信息,更新状态
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
this.type = option.type
}
this.loadOrderDetail()
this.getLocation()
if (this.isOther) {
// 获取结算信息
this.loadSettlement()
} else {
this.loadOrderRecord() // 履约记录
this.getSignDistance() // 定位
// this.getOrderPartsSum() // 备件单数量
}
},
onShow() {
// 从过程反馈回来,需要刷新数据
let pages = getCurrentPages()
let page = pages[pages.length - 1]
if (page.needFresh) {
page.needFresh = null
this.loadOrderDetail()
this.loadOrderRecord()
}
if (page.needRefresh) {
page.needRefresh = null
this.getApplyList()
}
},
onUnload() {
this.unloaded = true
this.closeLocationChange()
},
methods: {
updateLocation() {
let self = this
wx.startLocationUpdate({
success: function() {
self.openLocationChange()
},
})
},
_locationChangeFn(res) {
let self = this
console.log('location change', res)
const dataValue = this.dataValue || []
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
if (this.getDistance(res.latitude, res.longitude) > this.signDistance) {
// 计算签到距离
this.centerBtnDisabled = true
} else {
this.centerBtnDisabled = false
}
},
openLocationChange() {
console.log('openLocationChange')
wx.onLocationChange(this._locationChangeFn)
},
closeLocationChange() {
console.log('closeLocationChange')
wx.offLocationChange(this._locationChangeFn)
},
handleClickRight(active) {
this.isWaitFinish ? this.scenePhotoClick() : this.take()
},
scenePhotoClick() {
// 跳转拍照小程序
uni.navigateTo({
url:
'pages/photo/list?orderId=' +
this.order.orderId +
'&brandId=' +
this.order.lianbaoBrandId +
'&brand=' +
this.order.brandName +
'&systemId=' +
this.order.partnerCompanyId +
'&classifyId=' +
this.order.categoryId,
})
},
take() {
uni.hideTabBar()
this.takeStatus = true
},
async closeTake(img) {
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
if (img) {
// 拍照完成
const files = img.map((v) => v.path)
const value = await this.saveToTask(files)
this.isErrorSign = true
this.errorSignUrl = value[0].key
this.handleBtn()
} else {
this.$refs.uToast.show({
title: '异常签到失败,请先按要求拍照',
type: 'warning',
})
}
},
loadOrderDetail() {
// 获取工单详情
let self = this
let timestamp = new Date().getTime()
var data = {
orderId: self.orderId,
}
self.$u.api.orderDetail(data, self.orderId).then((res) => {
if (res.code == 200) {
self.order = res.data
this.setOrderType()
var nowTime = new Date().getTime()
this.timeout =
this.order.currentOverTime && nowTime > this.order.currentOverTime
this.timestamp = Math.round(
Math.abs(this.order.currentOverTime - nowTime) / 1000
)
// 格式化时间
this.settlementInfo.formatTime = this.order.settleCenterSyncDatetime
? this.$u.timeFormat(
this.order.settleCenterSyncDatetime,
'yyyy.mm.dd hh:MM:ss'
)
: '-'
} else {
console.log(res.message, '获取订单详情失败!')
}
})
},
loadSettlement() {
// 获取工单详情
let self = this
var data = {
orderId: self.orderId,
}
self.$u.api.querySettleByOrder(data, self.orderId).then((res) => {
if (res.code == 200) {
var amount = 0
for (var item of res.data) {
amount += item.realSettlementAmount || item.settlementAmount
}
this.settlementInfo.amount = amount
this.settlementInfo.list = res.data
} else {
console.log(res.message, '获取订单详情失败!')
}
})
},
// getOrderPartsSum() { // 获取订单配件数量
// this.$u.api.getOrderPartsSum(this.orderId).then((res) => {
// if (res.code == 200) {
// if (res.data) {
// this.partsCount = res.data.totalPartCount
// }
// } else {
// console.log(res.message)
// }
// });
// },
getSignDistance() {
let self = this
var data = {}
self.$u.api.getSignDistance(data).then((res) => {
if (res.code == 200) {
self.signDistance = res.data
}
})
},
loadOrderRecord() {
let self = this
var param = {
orderId: self.orderId,
}
self.$u.api.listOrderRecord(param).then((res) => {
if (res.code == 200) {
res.data.forEach((item) => {
item.isTrace = false
item.traceTime = null
item.traceLabel = item.operationType
if (
item.operationType === '报备' ||
item.operationType === '改约'
) {
item.isTrace = true
item.traceLabel =
item.operationType === '报备' ? '下次联系时间' : '改约时间'
item.operationTypeText = item.operationType
item.traceTime = item.orderRecordRemark
let arr = item.orderRecordRemark.split(',')
if (arr && arr.length > 1) {
let remark = arr[1].substring(
arr[1].indexOf(':') + 1,
arr[1].length
)
item.traceTime = remark
item.operationTypeText = arr[0]
}
} else if (item.operationType === '预约') {
let remark = item.orderRecordRemark.substring(
item.orderRecordRemark.lastIndexOf(',') + 1
)
item.traceTime = remark
item.operationTypeText = `上门 ${remark}`
} else {
item.operationTypeText = item.operationType
}
})
self.orderRecords = res.data
} else {
console.log(res.message, '获取订单详情失败!')
}
})
},
handleChange(val) {
console.log('-----handleChange-------', val)
},
addressToCoordinate() {
let self = this
self.$u.api.addressToCoordinate(self.orderId).then((res) => {
if (res.code == 200) {
self.contactAddressLongitud = res.data.lng
self.contactAddressLatitud = res.data.lat
} else {
console.log(res.message)
}
})
},
setOrderType() {
// 确定工单类型
var orderStatus = this.order.orderStatus
if (orderStatus < 31) {
// 接单
this.type = 'waitAccept'
this.submitType = this.isCompetition ? 'orderGan' : 'orderAccept'
} else if (orderStatus === 31 && !this.order.appointmentDatetime) {
// 预约
this.type = 'waitAppointment'
this.submitType = 'workerAppointment'
// this.loadCalendar()
} else if (orderStatus === 31 && this.order.appointmentDatetime) {
// 签到
this.type = 'waitCheckIn'
this.submitType = 'maintainWorkerCheckin'
this.updateLocation()
} else if (orderStatus > 31 && orderStatus < 80) {
// 完工
this.type = 'waitFinish'
this.submitType = 'toFilish'
} else if (orderStatus == 85 || orderStatus == 87 || orderStatus == 88) {
// 审核中
this.type = 'audit'
} else if (orderStatus == 86) {
// 异常单
this.type = 'exception'
} else if ([80, 81, 89, 110].indexOf(orderStatus) != -1) {
// 已完工
this.type = 'finish'
}
this.readMore = this.type != 'waitAccept'
},
handleClickSure() {
if (
(this.submitType == 'orderAccept' || this.submitType == 'orderGan') &&
process.uniEnv.node_env == 'prod'
) {
this.$u.api.checkAddCustomer().then((res) => {
if (res.code == 200) {
if (res.data === true) {
this.handleBtn()
} else {
this.visible = true
}
} else {
}
})
} else {
this.handleBtn()
}
},
handleSubmit(id) {
// 0 主流程; 1 过程反馈;2 异常签到; 3 现场拍照
switch (id) {
case 0:
this.handleClickSure()
break
case 1:
this.clickFeedback()
break
case 2:
getApp().track('order_errorSign', { orderId: this.orderId })
this.take()
break
case 3:
getApp().track('order_scenePhotoClick', { orderId: this.orderId })
this.scenePhotoClick()
break
case 4:
this.handleApplyParts()
break
}
},
handleApplyParts() {
// 点击了配件申请按钮
// if (this.buttons[3].count > 0) { // 已经有配件,弹出配件列表
// this.showApplyList = true
// this.getApplyList()
// } else { // 没有配件,跳到配件申请
this.toApplyParts()
// }
},
async getApplyList() {
let res = await this.$u.api.applyList({
pageSize: 1000,
pageNumber: 1,
// 'status': null, // -不传值 全部 待签收 15 待发货 10 待审核 1 已取消 -1 已驳回 -2 已签收 20
workOrderId: this.order.orderId,
})
if (res && res.code == 200) {
this.partsList = res.data || []
}
},
handleBtn() {
if (!this.submitType) {
return
}
var data = {}
// 不同请求类型传递不同数据
if (this.submitType === 'orderAccept') {
// 接单
data.orderId = this.order.orderId
} else if (this.submitType === 'orderGan') {
// 抢单
data.orderId = this.order.orderId
data.channel = 4
} else if (this.submitType === 'workerAppointment') {
data = this.$refs['feed-back'].submitData
if (!data.appointmentDatetime) {
this.commonToast('请选择预约日期', 'waring')
return
}
if (!data.appointmentDatetimeRange) {
this.commonToast('请选择预约时间段', 'waring')
return
}
} else if (this.submitType === 'maintainWorkerCheckin') {
// 签到
// 检查见到距离是否符合
if (!this.isErrorSign) {
if (this.centerBtnDisabled) {
return
} else {
this.closeLocationChange()
}
if (this.getDistance() > this.signDistance) {
this.commonToast('签到失败,请点击异常签到处理或联系客服', 'error')
return
}
}
data.channel = 4
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') {
// 去完工
if (this.order.categoryName != '充电桩') {
uni.showModal({
title: '提示',
content: '非充电桩订单,请在扳手APP进行完工',
showCancel: false,
confirmText: '好的',
})
} else {
this.filish()
}
return
}
if (this.clicking) {
return
}
this.clicking = true
this.$u.api[this.submitType](data, this.order.orderId).then((res) => {
let self = this
if (res.code === 200) {
this.trackOrder()
this.$refs.uToast.show({
title: this.bottomButtonText + '操作成功',
type: 'success',
duration: 1000,
callback: function() {
if (self.unloaded === false) {
// 如果用户一秒钟之内没有后退退出该页面才跳转
self.clicking = false
uni.redirectTo({
url: 'pages/order/detail?id=' + self.order.orderId,
})
}
},
})
} else {
let self = this
this.$refs.uToast.show({
title:
res.data.message !== undefined ? res.data.message : res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'warning',
callback: function() {
self.clicking = false
res.data.message === '抱歉,手快的师傅已经抢到此单!'
? self.isGan()
: ''
},
})
}
})
},
// 去业务材料页面
handleClickFile() {
getApp().track('order_click_view_files', {
brandId: this.order.lianbaoBrandId,
partnerCompanyId: this.order.partnerCompanyId,
})
this.$u.route({
url:
'pages/order/document' +
'?partnerCompanyId=' +
this.order.partnerCompanyId +
'&brandId=' +
this.order.lianbaoBrandId,
})
},
trackOrder() {
// 接单成功事件,签到成功事件
if (
this.submitType == 'orderAccept' ||
this.submitType == 'maintainWorkerCheckin'
) {
getApp().track(this.submitType, {
orderId: this.order.orderId,
})
}
},
commonToast(message, type, url, params) {
// 统一得toast
this.$refs.uToast.show({
title: message,
type: type,
url: url,
params: params,
})
},
isGan() {
this.type = 'snapped'
this.submitType = ''
this.centerBtnDisabled = true
},
clickFeedback() {
getApp().track('order_clickFeedback', {
orderId: this.order.orderId,
categoryId: this.order.categoryId,
})
// 过程反馈
uni.navigateTo({
url:
'pages/order/feedback?orderId=' +
this.order.orderId +
'&categoryId=' +
this.order.categoryId +
'&showGY=' +
(this.bottomButtonText != '预约' ? '1' : '0'),
})
},
filish() {
// 去完工
uni.navigateTo({
url:
'pages/order/complete?orderId=' +
this.order.orderId +
'&categoryId=' +
this.order.categoryId +
'&orderServiceType=' +
this.order.orderServiceType +
'&inGuaranteePeriod=' +
this.order.inGuaranteePeriod +
'&partnerCompanyId=' +
this.order.partnerCompanyId +
'&partnerCompanyName=' +
this.order.partnerCompanyName +
'&maintainStep=' +
this.order.maintainStep +
'&orderStatus=' +
this.order.orderStatus +
'&brandId=' +
this.order.lianbaoBrandId,
})
},
rejectOrder() {
// 拒单
// 检查是否可以拒单
var data = {}
this.$u.api.checkRejectable(data).then((res) => {
if (res.code === 200) {
if (res.data && res.data.rejectable) {
this.$u.route({
type: 'redirect',
url: 'pages/order/refuse',
params: {
orderId: this.order.orderId,
count: res.data.remainderTimes,
},
})
} else {
this.commonToast('本月无拒单机会,请联系客服', 'warning')
}
}
})
},
/**
* 获取当前位置的经纬度
*/
getLocation() {
let self = this
const dataValue = this.dataValue || []
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)
},
})
}
},
})
}
},
})
},
getDistance(Latitud, Longitud) {
return this.distance(
this.order.contactAddressLatitud,
this.order.contactAddressLongitud,
this.dataValue[1],
this.dataValue[0]
)
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 纬度
* @param float $lat1 经度
* @param float $lon2 纬度
* @param float $lat2 经度
* @return float 浮点数
*/
distance(lat1, lng1, lat2, lng2) {
var radLat1 = this.Rad(lat1)
var radLat2 = this.Rad(lat2)
var a = radLat1 - radLat2
var b = this.Rad(lng1) - this.Rad(lng2)
var s =
2 *
Math.asin(
Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
Math.pow(Math.sin(b / 2), 2)
)
)
s = s * 6378.137 // EARTH_RADIUS;
s = Math.round(s * 10000) / 10 //输出为米
console.log('计算结果', s, 'M')
return Number(s ? s.toFixed(2) : 0)
},
Rad(d) {
return (d * Math.PI) / 180.0 //经纬度转换成三角函数中度分表形式。
},
timeOutChange(timestamp) {
if (this.timeout) this.$refs['order-count-down'].seconds += 2
if (timestamp == 0 && !this.timeout) {
// 超时之后倒计时变为正计时
setTimeout(() => {
this.timestamp = 1
this.timeout = true
}, 1000)
}
},
// handleClick(){
// this.visible = false
// // 交互规范
// uni.switchTab({
// url: 'pages/index/learn'
// })
// },
handleJoin() {
this.visible = false
// 添加客服
},
handleOperate() {
// 点了弹窗里的配件操作
this.$u.api[operateType](partsId).then((res) => {
var type = 'error'
var message = res.message
if (res.code === 200) {
type = 'success'
for (var item of this.partsList) {
if (item.id == partsId) {
item.status = willStatus
break
}
}
} else {
console.log(res.message)
}
this.$refs.uToast.show({
title: message,
type: type,
duration: 1500,
callback: function() {},
})
})
},
handleClickCell(info) {
this.setPageInfo(info)
uni.navigateTo({
url: 'pages/mine/warehouse/partsDetail',
})
},
handleClickExpress(info) {
this.setPageInfo(info)
uni.navigateTo({
url: 'pages/mine/warehouse/express',
})
},
setPageInfo(info) {
var pages = getCurrentPages()
if (pages.length >= 1) {
var page = pages[pages.length - 1]
page.info = info
}
},
handleApply() {
// 点了弹窗的申请配件
this.toApplyParts()
},
toApplyParts() {
uni.navigateTo({
url: 'pages/parts/application?orderId=' + this.order.orderId,
})
},
},
}
</script> </script>
<style lang="scss"> <style lang="scss">
.order-wrap { .order-wrap {
.u-countdown-colon { .u-countdown-colon {
margin-left: 6rpx; margin-left: 6rpx;
margin-right: 6rpx; margin-right: 6rpx;
} }
.u-mode-center-box { .u-mode-center-box {
background-color: transparent !important; background-color: transparent !important;
padding-top: 40rpx; padding-top: 40rpx;
} }
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.order-wrap { .order-wrap {
width: 750rpx; width: 750rpx;
height: 100vh; height: 100vh;
overflow: auto; overflow: auto;
background-color: #F4F5F7; background-color: #f4f5f7;
background-image: linear-gradient(to top, #F4F5F7 0%, #2272FF 50%); background-image: linear-gradient(to top, #f4f5f7 0%, #2272ff 50%);
background-size: 750rpx 600rpx; background-size: 750rpx 600rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.content {
height: 100%;
border-radius: 12rpx;
overflow: auto;
margin: 0rpx 30rpx 30rpx 30rpx;
.title-view {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 20rpx;
.title-text {
font-weight: bold;
font-size: 48rpx;
color: #ffffff;
}
.reject-button {
width: 106rpx;
height: 52rpx;
font-size: 26rpx;
line-height: 52rpx;
color: #dedede;
text-align: right;
margin-right: 4rpx;
}
}
.card {
background-color: #ffffff;
margin-bottom: 20rpx;
padding: 30rpx 30rpx 0 30rpx;
border-radius: 6px;
.content { .header {
height: 100%; display: flex;
border-radius: 12rpx; justify-content: space-between;
overflow: auto; align-items: center;
margin: 0rpx 30rpx 30rpx 30rpx; border-bottom: 2rpx solid #f4f5f7;
.title-view { padding-bottom: 26rpx;
display: flex; margin-bottom: 30rpx;
justify-content: space-between; .header-left-view {
align-items: flex-end; display: flex;
margin-bottom: 20rpx; align-items: center;
.title-text { }
font-weight: bold; }
font-size: 48rpx; }
color: #FFFFFF;
}
.reject-button {
width: 106rpx;
height: 52rpx;
font-size: 26rpx;
line-height: 52rpx;
color: #DEDEDE;
text-align: right;
margin-right: 4rpx;
}
}
.card {
background-color: #FFFFFF;
margin-bottom: 20rpx;
padding: 30rpx 30rpx 0 30rpx;
border-radius: 6px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 2rpx solid #F4F5F7;
padding-bottom: 26rpx;
margin-bottom: 30rpx;
.header-left-view {
display: flex;
align-items: center;
}
}
}
.record-item { .record-item {
margin-bottom: 0rpx; margin-bottom: 0rpx;
} }
.appoint-item { .appoint-item {
padding: 0; padding: 0;
} }
} }
} }
.settlement-view { .settlement-view {
padding: 30rpx; padding: 30rpx;
background-color: #FFFFFF; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
.settlement-title { .settlement-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.settlement-content { .settlement-content {
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;
margin-bottom: 20rpx; margin-bottom: 20rpx;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
.content-left { .content-left {
flex-shrink: 0; flex-shrink: 0;
} }
} }
} }
.order-file { .order-file {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin: 20rpx 0; margin: 20rpx 0;
border-radius: 12rpx; border-radius: 12rpx;
background-color: #FFFFFF; background-color: #ffffff;
padding: 24rpx 30rpx; padding: 24rpx 30rpx;
.order-file-left { .order-file-left {
color: #333333; color: #333333;
font-size: 26rpx; font-size: 26rpx;
display: flex; display: flex;
align-items: center; align-items: center;
.file-image { .file-image {
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
flex-shrink: 0; flex-shrink: 0;
margin-right: 16rpx; margin-right: 16rpx;
} }
}
} .order-file-right {
.order-file-right { color: #2272ff;
color: #2272FF; font-size: 26rpx;
font-size: 26rpx; }
} }
}
</style> </style>
<!-- 过程反馈 --> <!-- 改约 -->
<template> <template>
<view class="feedback-box bg"> <view class="feedback-box bg">
<u-navbar back-icon-color="#FFFFFF" :background="background" title="过程反馈" titleColor="#FFFFFF" :border-bottom="false" title-bold></u-navbar> <u-navbar
<view class="content u-p-l-30 u-p-r-30"> back-icon-color="#FFFFFF"
<view class="top-tab"> :background="background"
<u-tabs title="改约"
:list="options" titleColor="#FFFFFF"
:current="curTab" :border-bottom="false"
height="60" title-bold
gutter="89" ></u-navbar>
bar-height="4" <view class="content u-p-l-30 u-p-r-30">
bar-width="44" <FeedbackContent
bg-color="none" ref="feed-back"
active-color="#FFFFFF" :categoryId="categoryId"
inactive-color="#DEDEDE" @change="handleChange"
font-size="32" class="content-view"
bold />
@change="changeTab" </view>
></u-tabs> <view class="bottom-view">
</view> <button
<view class="content-view"> class="btn, bottom-btn"
<view class="con-box"> @click="$u.throttle(submitForm, 500)"
<view class="title">{{ traceTitles[0] }}</view> :loading="submiting"
<view class="u-flex u-flex-wrap"> :disabled="disabledSubmit"
<view >
v-for="(item, index) in options[curTab]['owns']" <text class="button-text">确定</text>
:key="index" </button>
@click="changeOwn(index, item.name, item.types)" </view>
:class="{ 'txt-item': true, active: curOwn == index }" </view>
>
<text class="txt">{{ item.name }}</text>
</view>
</view>
<u-gap height="30"></u-gap>
<view class="title">{{ traceTitles[1] }}</view>
<view class="u-flex u-flex-wrap">
<view
v-for="(txt, index) in options[curTab]['owns'][curOwn]['types']"
:key="index"
@click="changeType(index, txt)"
:class="{ 'txt-item': true, active: trace.reason == txt }"
style="width: 306rpx;margin-right: 18rpx"
>
<text class="txt">{{ txt }}</text>
</view>
</view>
<view class="input-view">
<u-input v-model="trace.remark" class="textarea" height="156" type="textarea" placeholder="请补充详细说明,以便于记录您的接单信用分"></u-input>
</view>
</view>
<view class="time-view">
<appoint-time
:dateList="dateList"
:title="appointTitle"
:timeList="timeList"
:type="timeType"
:defaultAppointRangeItem="defaultAppointRangeItem"
@dateChange="dateChange"
@timeChange="timeChange"
@weekChange="weekChange"
></appoint-time>
</view>
</view>
</view>
<view class="bottom-view">
<button class="btn, bottom-btn" @click="$u.throttle(submitForm, 500)" :loading="submiting" :disabled="disabledSubmit"><text class="button-text">确定</text></button>
</view>
</view>
</template> </template>
<script> <script>
let now = new Date(new Date().toLocaleDateString()).getTime(); import FeedbackContent from '@/components/order/feedback.vue'
import appointTime from '@/components/appoint/appoint-time.vue';
export default {
data() {
return {
orderId: null,
categoryId: null,
showGY: true, // 非预约进来才显示改约
background: {
backgroundColor: 'none'
},
feedback: null,
options: [
{
name: '报备',
owns: [
{
name: '客户',
types: ['等客户报装电表', '等客户与物业沟通', '等客户改造电源', '客户不确定安装时间', '等客户通知安装时间', '客户电话未打通', '客户反馈暂不安装']
},
{ name: '个人', types: [] },
{ name: '客观', types: [] }
]
},
{ name: '改约', owns: [{ name: '客户', types: ['有事耽搁', '未带齐工具', '个人改约', '其他'] }, { name: '个人', types: [] }, { name: '客观', types: [] }] }
],
dateList: [
{ day: now, timeRange: [] },
{ day: now + 1 * 86400000, timeRange: [] },
{ day: now + 2 * 86400000, timeRange: [] },
{ day: now + 3 * 86400000, timeRange: [] },
{ day: now + 4 * 86400000, timeRange: [] },
{ day: now + 5 * 86400000, timeRange: [] },
{ day: now + 6 * 86400000, timeRange: [] }
],
timeList: [
{ name: '06:00-08:00', pkey: 'appointment_range_8', disabled: false },
{ name: '08:00-10:00', pkey: 'appointment_range_10', disabled: false },
{ name: '10:00-12:00', pkey: 'appointment_range_12', disabled: false },
{ name: '12:00-14:00', pkey: 'appointment_range_14', disabled: false },
{ name: '14:00-16:00', pkey: 'appointment_range_16', disabled: false },
{ name: '16:00-18:00', pkey: 'appointment_range_18', disabled: false },
{ name: '18:00-20:00', pkey: 'appointment_range_20', disabled: false },
{ name: '20:00-22:00', pkey: 'appointment_range_22', disabled: false },
{ name: '22:00-24:00', pkey: 'appointment_range_24', disabled: false }
],
traceTitles: ['问题归属', '问题类型'],
appointTitle: '预约时间',
appoint: ['下次联系时间', '预约时间'],
trace: {
reasonType: '报备', // 反馈类型
reasonRelegation: '客户', // 反馈归属
reason: '', // 反馈原因
remark: '' // 备注
},
traceDate: null, // 反馈时间
timeRange: null, // 反馈时间段
dateItem: null,
timeItem: null,
showRemark: false,
submiting: false,
curTab: 0,
curOwn: 0,
num: 0
};
},
components: {
appointTime
},
watch: {
// vuex_token(val) {
// this.initPageData();
// }
},
computed: {
disabledSubmit() {
let self = this;
if(self.trace.reasonRelegation && self.trace.reason && self.traceDate && self.timeRange) {
return false;
}
return true;
},
types() {
return {'报备': 'filing', '改约': 'subscribe'}
},
timeType() {
return this.types[this.options[this.curTab].name]
},
defaultAppointRangeItem() {
return this.options[this.curTab].defaultAppointRangeItem
}
},
async onLoad(e) {
getApp().trackPage('订单过程反馈页')
if (e) {
this.orderId = e.orderId || null;
this.categoryId = e.categoryId || null;
this.showGY = e.showGY == '1'
}
uni.showLoading({
title: '数据加载中',
mask: true
});
await this.initPageData();
},
methods: {
/* 初始化页面数据 */
async initPageData() {
let self = this;
await Promise.all([self.loadCalendar(), self.loadTimerange()]);
let params = { categoryId: self.categoryId };
let res = await self.$u.api.feedbackConfig(params);
if (res && res.code == 200) {
self.feedback = res.data || {};
self.buildConfig();
}
uni.hideLoading();
},
/* 组装数据项参数 */
buildConfig() {
let self = this;
if (self.feedback) {
let tabs = Object.keys(self.feedback);
let tabVals = Object.values(self.feedback);
let configs = [];
tabs.forEach(function(tab, index) {
let row = tabVals[index];
let owns = Object.keys(row);
let ownVals = Object.values(row);
var defaultAppointRangeItem = tab == '报备' ? { name: '22:00-24:00', pkey: 'appointment_range_24', disabled: false } : {}
configs[index] = { name: tab, owns: [], defaultAppointRangeItem: defaultAppointRangeItem};
if(tab == '改约') {
self.appoint[index] = '预约时间'
} else {
self.appoint[index] = '下次联系时间'
}
owns.forEach(function(own, key) {
configs[index]['owns'][key] = { name: own, types: ownVals[key] };
});
});
configs.map((item, key) => {
if(item.name == '报备') {
configs.splice(key, 1);
configs.unshift(item);
// 更新时间标题
let title = self.appoint[key]
self.appoint.splice(key, 1);
self.appoint.unshift(title);
} else if (item.name == '改约' && !self.showGY) {
configs.splice(key, 1);
// 更新时间标题
self.appoint.splice(key, 1);
}
})
// 数组改写需要刷新绑定数据
self.options = configs;
this.initParams()
}
},
/* 初始化参数 */
initParams() {
let self = this;
if (self.options) {
let tabList = self.options[self.curTab]
self.trace.reasonType = tabList.name;
self.trace.reasonRelegation = tabList['owns'][self.curOwn].name;
self.trace.reason = tabList['owns'][self.curOwn]['types'][0];
self.appointTitle = self.appoint[self.curTab]
self.trace.remark = '';
self.traceDate = null;
self.timeRange = null;
self.dateItem = null
if (self.trace.reasonType == '改约') {
self.showRemark = true;
if (self.dateList && self.timeList) {
self.timeList.map((item, index) => {
if (self.dateItem && self.dateItem.timeRange
&& self.dateItem.timeRange.indexOf(item.pkey) > -1 || item.isEnd) {
item.disabled = true;
} else {
item.disabled = false;
}
});
}
} else {
self.showRemark = false;
self.timeList.map((item, index) => {
item.disabled = false;
});
}
}
},
/* 加载日历数据 */ export default {
async loadCalendar() { data() {
let self = this; return {
let res = await this.$u.api.workerCalendar({num: this.num}); orderId: null,
if (res && res.code == 200) { categoryId: null,
self.dateList = res.data; submiting: false,
} disabledSubmit: true,
}, }
},
components: {
FeedbackContent,
},
computed: {},
onLoad(e) {
getApp().trackPage('订单过程反馈页')
if (e) {
this.orderId = e.orderId || null
this.categoryId = e.categoryId || null
}
},
methods: {
handleChange(val) {
this.disabledSubmit = val
},
async submitForm() {
let submitData = this.$refs['feed-back'].submitData
let self = this
if (!self.orderId) {
uni.showToast({
icon: error,
title: '工单ID不能为空',
})
return false
}
/* 加载预约时间段 */ self.submiting = true
async loadTimerange() { getApp().track('order_feedback_submitForm', {
let self = this; reasonType: submitData.reasonType,
let res = await this.$u.api.openTimerange(); traceDate: submitData.traceDate,
if (res && res.code == 200) { })
let list = res.data;
list.map((item, index) => {
item.disabled = false;
});
self.timeList = list;
}
},
/** let res = await self.$u.api.traceAndAppointment(submitData, self.orderId)
* 切换tab项 self.submiting = false
*/ if (res && res.code == 200) {
changeTab(index) { var pages = getCurrentPages()
this.curTab = index; if (pages.length >= 2) {
this.initParams(); var page = pages[pages.length - 2]
}, page.needFresh = true
changeOwn(index, own, types) { }
let self = this;
self.curOwn = index;
self.trace.reasonRelegation = own;
self.trace.reason = types[0];
},
changeType(index, type) {
this.trace.reason = type;
},
weekChange(data) {
// 点击下一周
console.log(data, 'week-data');
if (data && data.time) {
let num = data.num;
let time = data.time;
this.num = num;
if (num == 0) {
this.loadCalendar();
} else {
this.loadCalendar();
}
}
},
dateChange(data) {
// 点击日期选择
let self = this;
self.dateItem = data.item
if (self.trace.reasonType == '改约') {
self.timeList.map((item, index) => {
if (data.item.timeRange && data.item.timeRange.indexOf(item.pkey) > -1 || item.isEnd) {
item.disabled = true;
} else {
item.disabled = false;
}
});
} else {
self.timeList.map((item, index) => {
item.disabled = false;
});
}
self.traceDate = data.item.day;
self.timeRange = null;
},
timeChange(data) {
// 时间段选择变化
console.log(data, 'week-data');
this.timeRange = data.item.pkey;
this.timeItem = data.item
},
async submitForm() {
let self = this;
if (!self.orderId) {
uni.showToast({
icon: error,
title: '工单ID不能为空'
});
return false;
}
self.submiting = true; uni.navigateBack()
getApp().track("order_feedback_submitForm", { }
reasonType: self.trace.reasonType, },
traceDate: self.traceDate },
}) }
let params = this.$u.deepClone(self.trace);
if(self.trace.reasonType != '改约') {
if(self.timeItem && self.timeItem.pkey && self.traceDate){
let traceDate = self.moment(self.traceDate);
let timeArr = self.timeItem.pkey.split("_")
if (self.timeItem.pkey == 'appointment_range_24') {
let traceDateTime = traceDate.clone().add(23, 'hours').add(59, 'minutes')
params.nextTraceDatetime = traceDateTime.unix() * 1000
} else {
let hours = timeArr && timeArr.length && timeArr.pop()
let traceDateTime = traceDate.clone().add(Number(hours), 'hours');
params.nextTraceDatetime = traceDateTime.unix() * 1000
}
}
} else {
params.appointmentDatetime = self.traceDate
params.appointmentDatetimeRange = self.timeRange
}
let res = await self.$u.api.traceAndAppointment(params, self.orderId);
self.submiting = false;
if(res && res.code == 200) {
var pages = getCurrentPages();
if (pages.length >= 2) {
var page = pages[pages.length - 2];
page.needFresh = true
}
uni.navigateBack()
}
}
}
};
</script> </script>
<style lang="scss" scoped>
<style lang="scss">
.bg { .bg {
width: 750rpx; width: 750rpx;
height: 100vh; height: 100vh;
overflow: auto; overflow: auto;
background-color: #f4f5f7; background-color: #f4f5f7;
background-image: linear-gradient(to top, #f4f5f7 0%, #2272ff 50%); background-image: linear-gradient(to top, #f4f5f7 0%, #2272ff 50%);
background-size: 750rpx 600rpx; background-size: 750rpx 600rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.feedback-box { .feedback-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.header { .header {
padding: 12rpx 30rpx 40rpx 30rpx; padding: 12rpx 30rpx 40rpx 30rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.title { .title {
font-size: 40rpx; font-size: 40rpx;
font-weight: bold; font-weight: bold;
color: #ffffff; color: #ffffff;
} }
} }
}
/deep/ .u-subsection {
padding: 4rpx !important;
} }
.top-tab {
text-align: center;
}
.content {
display: flex;
flex-direction: column;
overflow: hidden;
margin-bottom: 188rpx;
.content-view {
height: 100%;
border-radius: 12rpx;
overflow: auto;
margin-top: 30rpx;
.time-view { .content {
border-radius: 12rpx; display: flex;
background-color: #ffffff; flex-direction: column;
padding-bottom: 20rpx; overflow: hidden;
} margin-bottom: 188rpx;
} margin-top: 30rpx;
.content-view {
height: 100%;
overflow: auto;
}
} }
.bottom-view { .bottom-view {
position: fixed; position: fixed;
bottom: 44rpx; bottom: 44rpx;
width: 100%; width: 100%;
} }
.bottom-btn { .bottom-btn {
height: 104rpx; height: 104rpx;
width: 600rpx; width: 600rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.button-text { .button-text {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
}
.con-box {
padding: 30rpx 30rpx 8rpx 30rpx;
border-radius: 12rpx;
background-color: #ffffff;
margin-bottom: 20rpx;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
& > .u-flex {
margin-top: 40rpx;
margin-right: -24rpx;
.txt-item {
border-radius: 12rpx;
padding: 24rpx 38rpx;
width: 196rpx;
height: 72rpx;
text-align: center;
margin-right: 22rpx;
margin-bottom: 20rpx;
background-color: #f4f5f7;
&.active {
background-color: #2272ff;
.txt {
color: #fff;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
}
}
.txt {
display: block;
font-size: 26rpx;
line-height: 26rpx;
color: #333;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.input-view {
margin-bottom: 24rpx;
}
.textarea {
/deep/ .u-input {
textarea {
margin-top: 20rpx;
border: 2rpx solid #ececec;
padding: 18rpx 30rpx;
}
}
}
} }
.btn { .btn {
padding: 30rpx; padding: 30rpx;
border-radius: 52rpx; border-radius: 52rpx;
line-height: 44rpx; line-height: 44rpx;
font-size: 32rpx; font-size: 32rpx;
text-align: center; text-align: center;
background-color: #2272ff; background-color: #2272ff;
color: #fff; color: #fff;
&::after { &::after {
content: ''; content: '';
height: 0; height: 0;
border: none; border: none;
} }
} }
.btn { .btn {
padding: 30rpx; padding: 30rpx;
border-radius: 52rpx; border-radius: 52rpx;
line-height: 44rpx; line-height: 44rpx;
font-size: 32rpx; font-size: 32rpx;
text-align: center; text-align: center;
background-color: #2272ff; background-color: #2272ff;
color: #fff; color: #fff;
&::after { &::after {
content: ''; content: '';
height: 0; height: 0;
} }
} }
.width-320 { .width-320 {
width: 320rpx; width: 320rpx;
} }
/deep/ button[plain] { /deep/ button[plain] {
border: none; border: none;
} }
button[disabled]:not([type]) { button[disabled]:not([type]) {
background: #d1d4d4; background: #d1d4d4;
color: #ffffff; color: #ffffff;
} }
</style> </style>
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