城阳工作端公众号前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

401 lines
18 KiB

<template>
<div class='pages' v-if="detail">
<section>
<div class="card m-top12">
<div class="m-top5 flex flex-center font-pingfangB" v-if="this.selfObj.source === 1">
{{ this.detail.title || '--' }}<br>
</div>
<div class="m-top5 flex flex-center">
<img src="@/assets/images/icon/address.png" class="small_img m-right7">
{{ detail.serviceTargetName || '--' }} {{ detail.serviceTargetMobile }}<br>
</div>
<div class="opacity5 font-size13 m-top5" style="margin-left: 29px;" v-if="selfObj.source == 4">{{
detail.serviceTargetAddress }}
</div>
<div class="opacity5 font-size13 m-top5" style="margin-left: 29px;" v-else-if="detail.serviceTargetAddresses">{{
detail.serviceTargetAddresses.join(',') }}
</div>
<div class="opacity5 font-size13 m-top5" style="margin-left: 29px;" v-else>--
</div>
<div class="m-top5 flex flex-center" v-if="selfObj.source === 4">
<img src="@/assets/images/icon/time.png" class="small_img m-right7">
<div>
{{ detail.serviceStartTime || '--' }}
</div>
</div>
<div class="m-top5 flex flex-center" v-else>
<img src="@/assets/images/icon/time.png" class="small_img m-right7">
<div>
{{ detail.serviceTimeStart || '--' }} 至 {{ detail.serviceTimeEnd || '--' }}
</div>
</div>
<div class="m-top5 ">
<div class="flex flex-center3">
<img src="@/assets/images/icon/content.png" style="vertical-align: top;"
class="small_img m-right7">
<div class="van-multi-ellipsis--l2">{{ detail.content }}</div>
</div>
</div>
</div>
<div class="card m-top12" style="padding: 5px;">
<van-cell title="服务类型" :value="sourceName" />
<van-cell :title="source === 4 ?'需求分类':'服务类别'" :value="detail.categoryName" />
<van-cell title="上报人" :value="detail.serviceTargetName + detail.serviceTargetMobile"
v-if="selfObj.source == 4" />
<van-cell title="上报时间" :value="detail.reportTime" v-if="selfObj.source == 4" />
<van-cell title="实际服务时间" :value="`${detail.serviceStartTime} 至 ${detail.serviceEndTime}`"
v-if="selfObj.source == 4 && selfObj.processStatus === 30" />
<van-cell title="评分" v-if="selfObj.source == 4 && selfObj.processStatus === 30" >
<template #default>
<van-rate v-model="detail.score" readonly color="#ffd21e"/>
</template>
</van-cell>
<van-cell title="创建时间" :value="detail.createdTime"
v-if="selfObj.source != 4 && selfObj.processStatus === 10" />
<van-cell title="指派时间" :value="detail.assignTime"
v-if="selfObj.source != 4 && (selfObj.processStatus === 30 || selfObj.processStatus === 20)" />
<van-cell title="完成时间" :value="detail.actualCompletedTime?detail.actualCompletedTime:'--'"
v-if="selfObj.source != 4 && selfObj.processStatus === 30" />
</div>
</section>
<div class="bto_btn flex flex-center" style="justify-content: end;">
<!-- source: 0:公共服务 1:共性需求 2:政策找人 3:服务找人 4:个性需求 5:温暖找人 6:技能找人 7:岗位找人 -->
<!--processStatus: 10待接单/待指派;20待处理;30已完成 -->
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom"
v-if="selfObj.processStatus === 10 && selfObj.source !== 4" @click="handelClickReceive">接单</van-button>
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom"
v-if="selfObj.processStatus === 20 && selfObj.source !== 4 && selfObj.confirmedFlag === 1"
@click="handelClickComplete">完成服务</van-button>
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom"
v-if="selfObj.processStatus === 10 && selfObj.source === 4" @click="handelClickReceive">接单</van-button>
<a :href='`tel:${selfObj.serviceTargetMobile}`'
v-if="selfObj.processStatus === 20 && selfObj.source === 4">联系需求人</a>
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom"
v-if="selfObj.processStatus === 20 && selfObj.confirmedFlag !== 1"
@click="confirmService">确认服务</van-button>
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom"
v-if="selfObj.processStatus === 20 && selfObj.source === 4 && selfObj.confirmedFlag === 1"
@click="showComplete = true">完成服务</van-button>
</div>
<!-- 个性需求完成弹框 -->
<van-dialog v-model="showComplete" title="我已完成需求人的需求" show-cancel-button :before-close="onBeforeClose">
<p class="required">服务开始时间</p>
<span @click="showStart = true, showPopup = true" class="font-size13">{{ actualServiceStartTime || '服务开始时间'
}}</span><span class="tag-date">至</span><span @click="showEnd = true, showPopup = true"
class="font-size13">{{ actualServiceEndTime || '服务结束时间' }}</span>
<p class="required">完成情况</p>
<van-radio-group v-model="rdFinishResult">
<van-radio name="resolved">已解决</van-radio>
<van-radio name="unresolved">未解决</van-radio>
</van-radio-group>
<p>上传图片</p>
<div class="block">
<template>
<van-uploader v-model="fileList" :after-read="afterRead" :max-count="3"
:max-size="10 * 1024 * 1024" />
</template>
</div>
<p>备注</p>
<van-field v-model="rdFinishDesc" rows="2" autosize type="textarea" placeholder="请输入备注" />
</van-dialog>
<!-- 接单弹框 -->
<van-dialog v-model="showScope" title="" show-cancel-button :before-close="handelReceiveService">
<p class="required">服务时间</p>
<span @click="showStart = true, showPopup = true" class="font-size13">{{ serviceTimeStart || '开始时间'
}}</span><span class="tag-date">至</span><span @click="showEnd = true, showPopup = true"
class="font-size13">{{ serviceTimeEnd || '结束时间' }}</span>
<p class="required">服务范围</p>
<span class="font-size13" @click="showTree = true, showPopup = true">{{ serviceScopeName || '请选择范围'
}}</span>
<p class="required">接单身份</p>
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</van-dialog>
<!-- 接单弹框共性需求 -->
<van-dialog v-model="showRole" title="" show-cancel-button :before-close="handelReceiveService">
<p class="required">接单身份</p>
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</van-dialog>
<van-popup v-model="showPopup" position="bottom">
<van-datetime-picker v-if="showStart" v-model="serviceTimeStart" type="datetime" title="开始时间" @confirm="handelCLickConfirmStart" @cancel="showPopup = false,showStart=false" :min-date="minDate" />
<van-datetime-picker v-if="showEnd" v-model="serviceTimeEnd" @confirm="handelCLickConfirmEnd"
@cancel="showPopup = false,showEnd=false" type="datetime" title="结束时间" :min-date="minDate" />
<van-cascader v-if="showTree" v-model="cascaderValue" title="" :options="treeOptions" :closeable="false" @change="onChange" :field-names="{ text: 'objectName', value: 'objectId' }" >
<template #title>
<div class="flex flex-end">
<span>选择范围</span>
<span @click="showPopup=false,showTree=false">完成</span>
</div>
</template>
</van-cascader>
</van-popup>
</div>
</template>
<script>
import { receiveService, getListMyIdentities, getServiceScopeTree, serviceComplete, serviceConfirm } from '@/api/service'
import { uploadvariedfile } from '@/api/basic'
import { Dialog } from 'vant';
export default {
data() {
return {
detail: null,
typeList: ['公共服务', '共性需求', '政策找人', '服务找人', '个性需求', '温暖找人', '技能找人', '岗位找人'],
id: null,
showPopup: false,
showStart: false,
showEnd: false,
showTree: false,
showScope: false,
minDate: new Date(),
treeOptions: null,
cascaderValue: null,
serviceScopeName: null,
serviceTimeStart: null,
serviceTimeEnd: null,
roleList: [],
serviceOrgType: null,
serviceOrgId: null,
showRole: false,
actualServiceStartTime: null,//实际完成时间
actualServiceEndTime: null,//实际完成时间
showComplete: false,//完成弹框
rdFinishResult: null,//是否解决
fileList: [],//图片上传
rdFinishDesc: null,//备注
};
},
created() {
this.getServiceScopeTree()
},
mounted() {
this.detail = this.$route.params.detail;
this.selfObj = this.$route.params.selfObj;
this.source = this.selfObj.source;
this.id = this.selfObj.id;
this.sourceName = this.typeList[this.source]
},
methods: {
afterRead(file) {
file.status = 'uploading'
file.message = '上传中...'
uploadvariedfile(file.file)
.then(res => {
file.status = ''
file.message = '上传成功'
file.url = res.data.url
console.log(this.fileList)
})
.catch(() => {
file.status = 'failed'
file.message = '上传失败'
})
},
async confirmService() {
let { code} = await serviceConfirm({ id: this.id })
if (code === 0) {
this.selfObj.confirmedFlag = 1
}
},
onBeforeClose(action, done) {
if (action === "confirm") {
if (this.selfObj.source === 4) {
if (!this.actualServiceStartTime) {
this.$tips.warning('请选择服务开始时间')
return done(false)
}
if (!this.actualServiceEndTime) {
this.$tips.warning('请选择服务结束时间')
return done(false)
}
if (!this.rdFinishResult) {
this.$tips.warning('请选择完成情况')
return done(false)
}
let parm = {
source: this.selfObj.source,
id: this.selfObj.id,
actualServiceStartTime: this.actualServiceStartTime,
actualServiceEndTime: this.actualServiceEndTime,
rdFinishResult: this.rdFinishResult,
rdFinishAttachments: this.fileList.map(item => ({ originFileName: item.file.name, type: item.file.type, format: 'image', url: item.url })),
rdFinishDesc: this.rdFinishDesc,
type:'finish'
}
this.serviceComplete(parm)
done(true)
}
}
else {
done(true);
}
},
handelClickComplete() {
if (this.selfObj.source != 4) {
Dialog.confirm({
message: `确定已完成“${this.detail.title}”服务吗?`,
}).then(() => {
this.serviceComplete(this.selfObj)
}).catch(() => {
});
}
},
async serviceComplete(parm) {
let { code } = await serviceComplete(parm)
if (code === 0) {
this.$tips.success('服务完成')
this.$router.go(-1)
}
},
handelChangeRole(val) {
this.serviceOrgId = val;
},
onChange(value) {
this.serviceScopeList = value.selectedOptions.map(item => ({ objectType: item.objectType, objectId: item.objectId, objectName: item.objectName }))
this.serviceScopeName = value.selectedOptions.map(item => item.objectName).join('-')
},
//提交接单
async handelReceiveService(action, done) {
if (action === "confirm") {
let parm = {
...this.formData,
id: this.serverId,
}
if (this.showScope) {
parm.serviceScopeList = this.serviceScopeList;
parm.serviceTimeStart = this.serviceTimeStart;
parm.serviceTimeEnd = this.serviceTimeEnd;
parm.serviceOrgType = this.serviceOrgType;
parm.serviceOrgId = this.serviceOrgId;
if (!this.serviceTimeStart) {
this.$tips.warning('请选择服务开始时间')
return done(false)
}
if (!this.serviceTimeEnd) {
this.$tips.warning('请选择服务结束时间')
return done(false)
}
if (!this.serviceScopeList) {
this.$tips.warning('请选择服务范围')
return done(false)
}
if (!this.serviceOrgId) {
this.$tips.warning('请选择接单身份')
return done(false)
}
} else if (this.showRole) {
if (!this.serviceOrgId) {
this.$tips.warning('请选择接单身份')
return done(false)
}
parm.serviceOrgType = this.serviceOrgType;
parm.serviceOrgId = this.serviceOrgId;
}
console.log(parm);
let { code } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
this.showScope = false;
this.pageNo = 1;
this.requestFlag = true;
this.list = [];
this.getTableData();
}
}
else {
done(true);
}
},
handelCLickConfirmStart(val) {
if (this.selfObj.processStatus === 20) {
this.actualServiceStartTime = this.$dayjs(val).format('YYYY-MM-DD HH:mm:ss');
} else {
this.serviceTimeStart = this.$dayjs(val).format('YYYY-MM-DD HH:mm:ss');
}
this.showPopup = false;
this.showStart = false;
},
handelCLickConfirmEnd(val) {
if (this.selfObj.processStatus === 20) {
this.actualServiceEndTime = this.$dayjs(val).format('YYYY-MM-DD HH:mm:ss');
} else {
this.serviceTimeEnd = this.$dayjs(val).format('YYYY-MM-DD HH:mm:ss');
}
this.showPopup = false;
this.showEnd = false;
},
handelClickReceive(){
if(this.source === 4){
this.showRole = true;
}else{
this.showScope = true;
}
this.getListMyIdentities()
},
async getListMyIdentities() {
let { data, code, msg } = await getListMyIdentities({serviceAggreId:this.id})
if (code === 0) {
this.roleList = data;
}
},
async getServiceScopeTree() {
let { data, code, msg } = await getServiceScopeTree({ id: this.serverId })
if (code === 0) {
this.treeOptions = [data];
}
},
},
components: {},
computed: {},
watch: {},
}
</script>
<style lang='less' scoped>
.pages {
padding: 0 10px;
box-sizing: border-box;
}
:deep(.van-cell__value) {
text-align: left;
}
:deep(.van-cell__title) {
max-width: 80px;
}
:deep(.van-button--small) {
padding: 12px 30px;
}
:deep(.van-cascader__title){
width: 100%;
}
a {
border: 1px solid #ebedf0;
color: #333333;
padding: 0 10px;
border-radius: 15px;
height: 26px;
line-height: 26px;
display: inline-block;
margin-left: 10px;
font-size: 12px;
}
</style>