Commit 95ff399f by zhangxw

用领评审确认内容改动

1 parent da3dbf3b
......@@ -15,5 +15,10 @@ module.exports = {
return api.post('dj.api.smartcarlife.construction.summary.status', {
...params
})
},
/**获取技师列表数据(过滤已禁用的数据) */
getTechnicianList(data) {
let params = data || {}
return api.post('dj.api.smartcarlife.roleTechnician.list.effective', {...params})
}
}
\ No newline at end of file
// pages/tabRepairOrder/components/Screening/index.js
import api from '~/api/api'
import api from '../../api'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
......@@ -89,7 +89,7 @@ Component({
})
wx.showLoading()
// 获取技师数据
api.getQYTechnicianList({
api.getTechnicianList({
yqMerchantId: wx.$util.getUserInfo()?.isSuper ? '' : wx.$util.getStorageSync('dj_boutique_user_info')?.merchantId
}).then(respone => {
wx.hideLoading()
......
......@@ -174,9 +174,9 @@ Page({
data?.list?.forEach((val, index) => {
if (val.startTime) val.startTime = new Date(val.startTime).format("yyyy-MM-dd hh:mm:ss");
if (val.successTime) val.successTime = new Date(val.successTime).format("yyyy-MM-dd hh:mm:ss");
val.statuscolor = val.constructionStatus == 1 ? '#347BFF' : val.constructionStatus == 0 ? '#FF9D0A' : ''
val.statusbackground = val.constructionStatus == 1 ? '#EAF1FF' : val.constructionStatus == 0 ? '#FFF5E6' : ''
val.statusText = val.constructionStatus == 1 ? '已施工' : val.constructionStatus == 0 ? '待施工' : ''
val.statuscolor = val.constructionStatus == 1 || val.constructionStatus == 2 ? '#347BFF' : val.constructionStatus == 0 ? '#FF9D0A' : ''
val.statusbackground = val.constructionStatus == 1 || val.constructionStatus == 2 ? '#EAF1FF' : val.constructionStatus == 0 ? '#FFF5E6' : ''
val.statusText = val.constructionStatus == 1 ? '已施工' : val.constructionStatus == 0 ? '待施工' : val.constructionStatus == 2 ? '客户返工' : ''
val.customerName = val.customer?.customerName
val.mainTechnicianName = val.mainTechnicianList?.find(v => v.technicianType == 0)?.technicianName // 主技师
const [subTechnicianName_1 = '', subTechnicianName_2 = ''] =
......
......@@ -39,5 +39,10 @@ module.exports = {
// 施工单返工
reworkAPI(data) {
return api.post('dj.api.smartcarlife.construction.rework', data)
},
/**获取技师列表数据(过滤已禁用的数据) */
getTechnicianList(data) {
let params = data || {}
return api.post('dj.api.smartcarlife.roleTechnician.list.effective', {...params})
}
}
......@@ -15,23 +15,18 @@ Component({
this.setData({
scrollTop: 0
})
let { infoData } = this.data
if (infoData) {
this.getDetailInfo(infoData)
}
let { detailInfo } = this.data
this.setData({
infoData: wx.$util.deepClone(detailInfo)
}, () => {
this.getDetailInfo(this.data.infoData)
})
}
}
},
title: String,
detailInfo: {
type: Object,
observer: function(n) {
if (n) {
this.setData({
infoData: wx.$util.deepClone(n)
})
}
}
type: Object
},
userPermissions: Array
},
......
// tabRepairOrder/components/reviewPopup/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
// 审核通过
confirm() {
this.triggerEvent('confirm')
},
// 不通过
cancel() {
this.triggerEvent('cancel')
},
// 关闭
close() {
this.triggerEvent('close')
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* tabRepairOrder/components/reviewPopup/index.wxss */
.popclass {
font-size: var(--fontSize32);
color: #292D33;
.title {
margin-top: var(--fontSize32);
text-align: center;
font-weight: 500;
}
.content {
margin: var(--fontSize32) var(--fontSize48) var(--fontSize48);
padding: 0 var(--fontSize30);
text-align: center;
font-size: var(--fontSize30);
color: #5A5E66;
}
.popup-footer {
height: var(--fontSize100);
display: flex;
align-items: center;
justify-content: center;
border-top: var(--fontSize1) solid #EBEDF0;
.btn {
flex: 1;
height: 100%;
text-align: center;
line-height: var(--fontSize100);
}
.cancel {
border-right: var(--fontSize1) solid #EBEDF0;
}
.confirm {
font-weight: 500;
color: #347BFF;
}
}
}
\ No newline at end of file
<!--tabRepairOrder/components/reviewPopup/index.wxml-->
<van-popup lock-scroll catchtouchmove="noScroll" custom-style="width:var(--fontSize622);" round z-index="999999" custom-class="popclass" closeable show="{{ show }}" bind:close="close">
<view class="title">审核施工单</view>
<view class="content">
驻店零售/区域经理可审核每笔技师施工单的施工结果
</view>
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}">
<view class="cancel btn text-center" bind:tap="cancel">不通过</view>
<view class="confirm btn text-center" bind:tap="confirm">审核通过</view>
</view>
</van-popup>
\ No newline at end of file
......@@ -74,7 +74,7 @@ Component({
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds(),
dateStr: date.format('yyyy/MM/dd')?.replace(/\//g, '-')
dateStr: date.format('yyyy-MM-dd')?.replace(/\//g, '-')
}
} catch (error) {
return this.getCurrentTimeData()
......@@ -91,7 +91,7 @@ Component({
hour: today.getHours(),
minute: today.getMinutes(),
second: today.getSeconds(),
dateStr: today.format('yyyy/MM/dd')?.replace(/\//g, '-')
dateStr: today.format('yyyy-MM-dd')?.replace(/\//g, '-')
}
},
......@@ -126,7 +126,7 @@ Component({
const hours = []
// 根据是否是当前日期决定小时范围
const isToday = defaultTime.dateStr === today.format('yyyy/MM/dd')?.replace(/\//g, '-')
const isToday = defaultTime.dateStr === today.format('yyyy-MM-dd')?.replace(/\//g, '-')
const hourLimit = isToday ? today.getHours() + 1 : 24
for (let hour = 0; hour < hourLimit; hour++) {
hours.push(hour.toString().padStart(2, '0'));
......@@ -139,9 +139,8 @@ Component({
const minutes = []
const seconds = []
const isToday = defaultTime.dateStr === today.format('yyyy/MM/dd')?.replace(/\//g, '-')
const isToday = defaultTime.dateStr === today.format('yyyy-MM-dd')?.replace(/\//g, '-')
const isCurrentHour = defaultTime.hour === today.getHours()
console.log(defaultTime.hour, today.getHours())
// 分钟范围
const minuteLimit = (isToday && isCurrentHour) ? today.getMinutes() + 1 : 60
for (let minute = 0; minute < minuteLimit; minute++) {
......@@ -200,7 +199,7 @@ Component({
const index = value[0]
this.currentDate = days[index]
const today = new Date().format('yyyy/MM/dd')?.replace(/\//g, '-')
const today = new Date().format('yyyy-MM-dd')?.replace(/\//g, '-')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTime(timeType)
},
......@@ -210,7 +209,7 @@ Component({
const { value } = e.detail
const index = value[0]
this.currentHour = hours[index]
const today = new Date().format('yyyy/MM/dd')?.replace(/\//g, '-')
const today = new Date().format('yyyy-MM-dd')?.replace(/\//g, '-')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTimeMinute(timeType)
},
......@@ -267,7 +266,7 @@ Component({
}
const str = `${this.currentDate} ${this.currentHour}:${this.currentMinute}:${this.currentSecond}`
const result = new Date(str.replace(/-/g, '/')).format('yyyy/MM/dd hh:mm:ss')?.replace(/\//g, '-')
const result = new Date(str.replace(/-/g, '/')).format('yyyy-MM-dd hh:mm:ss')?.replace(/\//g, '-')
this.triggerEvent('confirm', result)
this.setData({ errorMsg: '' })
},
......@@ -329,7 +328,7 @@ Component({
const seconds = []
let second_len = 60
const currentDateStr = today.format('yyyy/MM/dd')?.replace(/\//g, '-')
const currentDateStr = today.format('yyyy-MM-dd')?.replace(/\//g, '-')
if (this.currentDate === currentDateStr &&
this.currentHour === today.getHours().toString().padStart(2, '0') &&
this.currentMinute === today.getMinutes().toString().padStart(2, '0')) {
......
......@@ -67,21 +67,6 @@ Page({
// 获取人员权限
getStaffPermissions() {
// 假数据开始
const res = {
code: 0,
data: [{
name: '施工确认',
code: 'SHIGONGQUEREN'
}, {
name: '完成施工',
code: 'WANCHENGSHIGONG'
}]
}
this.setData({
userPermissions: res.data
})
return
let { userInfo } = this.data
commonApi.staffPermissions({phone: userInfo?.phone}).then(res => {
console.log(res)
......@@ -97,10 +82,14 @@ Page({
},
// 获取详情数据
getDetail(data) {
wx.showLoading({
title: '加载中'
})
api.getConstructionDetail({
id: data?.id,
constructionCode: data?.constructionCode
}).then(res => {
wx.hideLoading()
let { code, data, message } = res
const mainSelected = data?.mainTechnicianList?.filter(val => val.technicianType == 0)?.map(it => { return { technicianId: it.technicianId, staffName: it.technicianName, id: it.id, uuid: it.technicianUuid } })
const deputySelected = data?.mainTechnicianList?.filter(val => val.technicianType == 1)?.map(it => { return { technicianId: it.technicianId, staffName: it.technicianName, id: it.id, uuid: it.technicianUuid } })
......@@ -122,7 +111,7 @@ Page({
getTechnicianList() {
let { userInfo } = this.data
// 获取技师数据
commonApi.getQYTechnicianList({
api.getTechnicianList({
yqMerchantId: !userInfo?.isSuper ? wx.$util.getStorageSync('dj_boutique_user_info')?.merchantId : ''
}).then(respone => {
wx.hideLoading()
......
......@@ -4,16 +4,18 @@
<view class="item goods">
<view class="title">
<view class="box">商品信息</view>
<block wx:if="{{!editGoodsFlag}}">
<view class="edit-btn" bindtap="handleEditGoods">
<image src="{{IMG_URL}}repair-order/relate-goods.png" mode=""/>关联商品
</view>
</block>
<block wx:else>
<view class="edit-btn">
<view class="cancel" bindtap="handelGoodsCancel">取消</view>
<view bindtap="handelGoodsConfirm">完成</view>
</view>
<block wx:if="{{confirmInfo.reworkFlag != 1 && filter.btnPermissions(userPermissions, 'SHIGONGQUEREN')}}">
<block wx:if="{{!editGoodsFlag}}">
<view class="edit-btn" bindtap="handleEditGoods">
<image src="{{IMG_URL}}repair-order/relate-goods.png" mode=""/>关联商品
</view>
</block>
<block wx:else>
<view class="edit-btn">
<view class="cancel" bindtap="handelGoodsCancel">取消</view>
<view bindtap="handelGoodsConfirm">完成</view>
</view>
</block>
</block>
</view>
<view class="box">
......@@ -68,14 +70,16 @@
<view class="item service">
<view class="title">
<view class="box">施工单信息</view>
<block wx:if="{{!editServiceFlag}}">
<view class="edit-btn" bindtap="handleEditService">编辑</view>
</block>
<block wx:else>
<view class="edit-btn">
<view class="cancel" bindtap="handelServicesCancel">取消</view>
<view bindtap="handelServicesConfirm">完成</view>
</view>
<block wx:if="{{filter.btnPermissions(userPermissions, 'SHIGONGQUEREN')}}">
<block wx:if="{{!editServiceFlag}}">
<view class="edit-btn" bindtap="handleEditService">编辑</view>
</block>
<block wx:else>
<view class="edit-btn">
<view class="cancel" bindtap="handelServicesCancel">取消</view>
<view bindtap="handelServicesConfirm">完成</view>
</view>
</block>
</block>
</view>
<view class="service-box">
......
......@@ -5,6 +5,7 @@ import api from '../../api'
import { uploadImg, getSceneById, staffPermissions } from '~/api/api'
import { setConfigInfo } from '~/store/index'
const app = getApp()
let time = null
Page({
/**
* 页面的初始数据
......@@ -110,6 +111,10 @@ Page({
1: {
text: '已施工',
color: '#35C376'
},
2: {
text: '客户返工',
color: '#35C376'
}
},
outboundStatus: {
......@@ -168,32 +173,6 @@ Page({
onShow() {},
// 人员权限
getStaffPermissions() {
// 假数据开始
const res = {
code: 0,
data: [
{
name: '施工确认',
code: 'SHIGONGQUEREN'
},
{
name: '完成施工',
code: 'WANCHENGSHIGONG'
},
{
name: '物料出库',
code: 'WULIAOCHUKU'
},
{
name: '审核施工单',
code: 'SHENHESHIGONGDAN'
}
]
}
this.setData({
userPermissions: res.data
})
return
let { userInfo } = this.data
staffPermissions({ phone: userInfo?.phone }).then(res => {
let { code, data, message } = res
......@@ -242,18 +221,57 @@ Page({
})
},
setTime() {
let _this = this
let { queryOptions } = _this.data
time = setTimeout(() => {
api
.getConstructionDetail({
id: queryOptions?.id,
constructionCode: queryOptions?.constructionCode
})
.then(res => {
let { code, data, message } = res
let { detailInfo } = this.data
this.setTime()
if (code == 0) {
if (data.startTime) {
data.startTime = new Date(data.startTime).format('yyyy-MM-dd hh:mm:ss')
}
_this.setData({
'detailInfo.outboundStatus': data?.outboundStatus,
'detailInfo.startTime': detailInfo.startTime ? detailInfo.startTime : data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间)
})
} else {
wx.$util.showToast(message)
}
})
}, 10 * 1000)
},
// 获取施工单详情
getDetail() {
let { queryOptions } = this.data
if (!queryOptions.id || !queryOptions.constructionCode) return
wx.showLoading({
title: '加载中',
})
api
.getConstructionDetail({
id: queryOptions?.id,
constructionCode: queryOptions?.constructionCode
})
.then(res => {
wx.hideLoading()
let { code, data, message } = res
let { detailInfo } = this.data
if (code == 0) {
// 未出库 轮询查订单状态,更新出库状态
if (data.outboundStatus == 0) {
this.setTime()
} else {
time && clearTimeout(time)
}
const mainTechnicianName = data?.mainTechnicianList?.find(
val => val.technicianType == 0
)?.technicianName
......@@ -279,7 +297,8 @@ Page({
'detailInfo.subTechnicianName': subTechnicianName,
'detailInfo.pictureList': data?.pictureList?.map(val => {
return val.pictureUrl
})
}),
'detailInfo.startTime': detailInfo.startTime ? detailInfo.startTime : data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间)
},
() => {
if (data?.startTime && data?.endTime) {
......@@ -618,10 +637,19 @@ Page({
}
})
}
if (!detailInfo?.startTime || !detailInfo?.endTime)
if (!detailInfo?.startTime)
return wx.$util.showToast('请在页面中提交施工时间')
if (!detailInfo?.pictureList?.length)
return wx.$util.showToast('请在页面中提交上传施工图片')
if (!detailInfo.endTime) { // 未选择施工结束时间取当前时间
this.setData({
'detailInfo.endTime': new Date().format('yyyy-MM-dd hh:mm:ss')
}, () => {
this.calculateTimeDifference() // 自动计算施工时长
})
}
const pictureList = detailInfo?.pictureList?.map(val => {
return {
pictureUrl: val
......@@ -639,13 +667,19 @@ Page({
constructionDuration: detailInfo.constructionDuration,
pictureList: pictureList
}
wx.showLoading({
title: '加载中',
})
api
.completeConstructionOrder(params)
.then(res => {
wx.hideLoading()
let { code, message } = res
this.setData({
submitFlag: false
})
setTimeout(() => {
this.setData({
submitFlag: false
})
}, 1000)
if (code == 0) {
wx.$router.redirectTo('repairOrderDetail', {
id: detailInfo.id,
......@@ -657,56 +691,96 @@ Page({
}
})
.catch(() => {
this.setData({
submitFlag: false
})
wx.hideLoading()
setTimeout(() => {
this.setData({
submitFlag: false
})
}, 1000)
})
},
// 审核施工单
checkOrder() {
this.setData({
reviewVisible: true
})
},
reviewEvent(type) {
let { detailInfo } = this.data
wx.showModal({
title: '审核施工单',
content: '驻店零售/区域经理可审核每笔技师施工单的施工结果',
confirmColor: '#347BFF',
confirmText: '审核通过',
cancelText: '不通过',
success(res) {
api
.approvalRepairOrder({
id: detailInfo.id,
constructionCode: detailInfo.constructionCode,
approvalStatus: res.confirm ? 1 : res.cancel ? 2 : ''
})
.then(result => {
let { code, message } = result
if (code == 0) {
wx.$util.showToast('')
wx.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => {
wx.$router.back()
}, 200)
} else {
wx.$util.showToast(message)
}
})
if (this.data.reviewFlag) return
this.setData({
reviewFlag: true
})
wx.showLoading({
title: '加载中',
})
api.approvalRepairOrder({
id: detailInfo.id,
constructionCode: detailInfo.constructionCode,
approvalStatus: type
}).then(result => {
wx.hideLoading()
this.reviewClose()
let { code, message } = result
setTimeout(() => {
this.setData({
reviewFlag: false
})
}, 1000)
if (code == 0) {
wx.$util.showToast('')
wx.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => {
wx.$router.back()
}, 200)
} else {
wx.$util.showToast(message)
}
}).catch(() => {
wx.hideLoading()
setTimeout(() => {
this.setData({
reviewFlag: false
})
}, 1000)
})
},
// 审核通过
reviewConfirm() {
this.reviewEvent(1)
},
// 审核不通过
reviewCancel() {
this.reviewEvent(2)
},
// 关闭审核弹窗
reviewClose() {
this.setData({
reviewVisible: false
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
onHide() {
time && clearTimeout(time)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
onUnload() {
time && clearTimeout(time)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
......
......@@ -2,7 +2,8 @@
"usingComponents": {
"time-select": "../../components/timeSelect/index",
"outbound-popup": "../../components/outboundPopup/index",
"rework-popup": "../../components/reworkPopup/index"
"rework-popup": "../../components/reworkPopup/index",
"review-popup": "../../components/reviewPopup/index"
},
"navigationBarTitleText": "施工单详情"
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!