Commit 397aed3f authored by Damon's avatar Damon

feat: 【ID1001296】前台-异常单去处理时只展示驳回的那几项

parent 3842edcf
...@@ -246,10 +246,10 @@ ...@@ -246,10 +246,10 @@
+ "&orderServiceType=" + item.orderServiceType + "&orderServiceType=" + item.orderServiceType
+ "&inGuaranteePeriod=" + item.inGuaranteePeriod + "&inGuaranteePeriod=" + item.inGuaranteePeriod
+ "&partnerCompanyId=" + item.partnerCompanyId + "&partnerCompanyId=" + item.partnerCompanyId
+ "&auditResultsId=" + (item.auditResults?Object.keys(item.auditResults)[Object.keys(item.auditResults).length - 1]:'')
+ "&maintainStep=" + item.maintainStep + "&maintainStep=" + item.maintainStep
+ '&orderStatus=' + item.orderStatus + '&orderStatus=' + item.orderStatus
+ '&brandId=' + item.lianbaoBrandId + '&brandId=' + item.lianbaoBrandId
+ '&auditResults=' + (item.auditResults ? Object.keys(item.auditResults).join() : '')
}) })
}, },
handleClick(item, type, showCountTime) { // type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动 handleClick(item, type, showCountTime) { // type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
......
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
shape="circle" shape="circle"
:hover-class="submitStatus ? '' : 'none'" :hover-class="submitStatus ? '' : 'none'"
> >
{{ tabIndex === list.length - 1 ? "提交" : "下一步" }} {{ tabIndex === list.length - 1 ? '提交' : '下一步' }}
</u-button> </u-button>
</view> </view>
</view> </view>
...@@ -286,53 +286,53 @@ ...@@ -286,53 +286,53 @@
</view> </view>
</template> </template>
<script> <script>
import XhInput from "@/components/createCom/XhInput.vue"; import XhInput from '@/components/createCom/XhInput.vue'
import XhMultiInput from "@/components/createCom/XhMultiInput.vue"; import XhMultiInput from '@/components/createCom/XhMultiInput.vue'
import XhRadio from "@/components/createCom/XhRadio.vue"; import XhRadio from '@/components/createCom/XhRadio.vue'
import XhCheckbox from "@/components/createCom/XhCheckbox.vue"; import XhCheckbox from '@/components/createCom/XhCheckbox.vue'
import XhSelect from "@/components/createCom/XhSelect.vue"; import XhSelect from '@/components/createCom/XhSelect.vue'
import XhSpecifications from "@/components/createCom/XhSpecifications.vue"; import XhSpecifications from '@/components/createCom/XhSpecifications.vue'
import XhFiles from "@/components/createCom/XhFiles.vue"; import XhFiles from '@/components/createCom/XhFiles.vue'
import XhLocation from "@/components/createCom/XhLocation.vue"; import XhLocation from '@/components/createCom/XhLocation.vue'
import XhScan from "@/components/createCom/XhScan.vue"; import XhScan from '@/components/createCom/XhScan.vue'
import XhTime from "@/components/createCom/XhTime.vue"; import XhTime from '@/components/createCom/XhTime.vue'
import XhServiceMeasure from "@/components/createCom/XhServiceMeasure.vue"; import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue'
import XhServiceMore from "../../components/createCom/XhServiceMore"; import XhServiceMore from '../../components/createCom/XhServiceMore'
import XhLabel from "../../components/createCom/XhLabel"; import XhLabel from '../../components/createCom/XhLabel'
import XhParts from "@/components/createCom/XhParts"; import XhParts from '@/components/createCom/XhParts'
import takePhoto from "@/components/take/index.vue"; import takePhoto from '@/components/take/index.vue'
import baseFile from "@/components/upload/index"; import baseFile from '@/components/upload/index'
import Detail from "@/components/order/detail.vue"; import Detail from '@/components/order/detail.vue'
import returnPartsVue from "../parts/returnParts.vue"; import returnPartsVue from '../parts/returnParts.vue'
// 表单类型map // 表单类型map
const formType = new Map([ const formType = new Map([
["text", ["input", "textarea"]], ['text', ['input', 'textarea']],
["password", ["password", "input"]], ['password', ['password', 'input']],
["textarea", ["input", "digit"]], ['textarea', ['input', 'digit']],
["number", ["input", "digit"]], ['number', ['input', 'digit']],
["decimal", ["input", "digit"]], ['decimal', ['input', 'digit']],
["double", ["input", "digit"]], ['double', ['input', 'digit']],
["integer", ["input", "digit"]], ['integer', ['input', 'digit']],
["string", ["input", "text"]], ['string', ['input', 'text']],
["jscode", ["input", "text"]], ['jscode', ['input', 'text']],
["multiinput", ["multiinput", "text"]], ['multiinput', ['multiinput', 'text']],
["select", ["select", "text"]], ['select', ['select', 'text']],
["specifications", ["select-new-page", "text"]], ['specifications', ['select-new-page', 'text']],
["radio", ["radio", "text"]], ['radio', ['radio', 'text']],
["checkbox", ["checkbox", "text"]], ['checkbox', ['checkbox', 'text']],
["file", ["file", "text"]], ['file', ['file', 'text']],
["photos", ["file", "text"]], ['photos', ['file', 'text']],
["location", ["location", "text"]], ['location', ['location', 'text']],
["scan", ["scan", "text"]], ['scan', ['scan', 'text']],
["machine_code", ["scan", "text"]], ['machine_code', ['scan', 'text']],
["service_measures", ["servicemeasure", "text"]], ['service_measures', ['servicemeasure', 'text']],
["time", ["time", "text"]], ['time', ['time', 'text']],
["date", ["time", "text"]], ['date', ['time', 'text']],
["form", ["form", "text"]], ['form', ['form', 'text']],
["label", ["label", "text"]], ['label', ['label', 'text']],
["parts", ["parts", "text"]], ['parts', ['parts', 'text']],
]); ])
/** /**
* modal 弹窗校验 * modal 弹窗校验
...@@ -345,80 +345,80 @@ const formType = new Map([ ...@@ -345,80 +345,80 @@ const formType = new Map([
const actions = (name, pass, type, submit) => { const actions = (name, pass, type, submit) => {
const handerProgrom = { const handerProgrom = {
perfect: { perfect: {
confirmText: "去完善", confirmText: '去完善',
action: "handerProgrom", action: 'handerProgrom',
}, },
appointment: { appointment: {
confirmText: "好的,再次预约", confirmText: '好的,再次预约',
action: "appointment", action: 'appointment',
}, },
next: { next: {
confirmText: "下一步", confirmText: '下一步',
action: "nextAction", action: 'nextAction',
}, },
noPerfectSubmit: { noPerfectSubmit: {
confirmText: "去完善", confirmText: '去完善',
action: "handerProgrom", action: 'handerProgrom',
cancelText: "部分提交", cancelText: '部分提交',
cancelAction: "appointment", cancelAction: 'appointment',
}, },
submit: { submit: {
confirmText: "提交", confirmText: '提交',
action: "orderFinish", action: 'orderFinish',
}, },
confirm: { confirm: {
confirmText: "确定", confirmText: '确定',
action: "nextAction", action: 'nextAction',
cancelText: "取消", cancelText: '取消',
cancelAction: "closeCheckResult", cancelAction: 'closeCheckResult',
}, },
}; }
if (name === "partnerInspectItem") { if (name === 'partnerInspectItem') {
// 勘察 // 勘察
if (!pass) return handerProgrom.perfect; if (!pass) return handerProgrom.perfect
return type return type
? type === "01" ? type === '01'
? handerProgrom.next ? handerProgrom.next
: handerProgrom.appointment : handerProgrom.appointment
: handerProgrom.perfect; : handerProgrom.perfect
} else if (name === "partnerInstallItem") { } else if (name === 'partnerInstallItem') {
// 安装 // 安装
let hander = ""; let hander = ''
switch (type) { switch (type) {
case "01": // 安装完成 case '01': // 安装完成
hander = !pass ? handerProgrom.perfect : handerProgrom.next; hander = !pass ? handerProgrom.perfect : handerProgrom.next
break; break
case "02": // 二次安装 case '02': // 二次安装
hander = !pass hander = !pass
? handerProgrom.noPerfectSubmit ? handerProgrom.noPerfectSubmit
: handerProgrom.appointment; : handerProgrom.appointment
break; break
case "03": //不安装 case '03': //不安装
hander = handerProgrom.confirm; hander = handerProgrom.confirm
break; break
default: default:
hander = handerProgrom.perfect; hander = handerProgrom.perfect
break; break
} }
return hander; return hander
} else { } else {
// 基础信息 // 基础信息
if (!pass) return handerProgrom.perfect; if (!pass) return handerProgrom.perfect
return submit ? handerProgrom.submit : handerProgrom.next; return submit ? handerProgrom.submit : handerProgrom.next
} }
}; }
export default { export default {
data() { data() {
return { return {
hiddenTitle: ["location", "form", "label", "parts"], hiddenTitle: ['location', 'form', 'label', 'parts'],
orderId: 0, orderId: 0,
categoryId: 0, categoryId: 0,
brandId: 0, brandId: 0,
orderServiceType: "", orderServiceType: '',
inGuaranteePeriod: "", inGuaranteePeriod: '',
partnerCompanyId: "", partnerCompanyId: '',
auditResultsId: "", auditResults: [],
list: [], list: [],
tabIndex: 0, tabIndex: 0,
scrollTop: 0, //tab标题的滚动条位置 scrollTop: 0, //tab标题的滚动条位置
...@@ -426,8 +426,8 @@ export default { ...@@ -426,8 +426,8 @@ export default {
current: 0, // 预设当前项的值 current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度 menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度 menuItemHeight: 0, // 左边菜单item的高度
itemId: "", // 栏目右边scroll-view用于滚动的id itemId: '', // 栏目右边scroll-view用于滚动的id
oldItemId: "", oldItemId: '',
menuItemPos: [], menuItemPos: [],
arr: [], arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度 scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
...@@ -439,10 +439,10 @@ export default { ...@@ -439,10 +439,10 @@ export default {
completeCheck: { completeCheck: {
status: false, status: false,
resulut: [], resulut: [],
confirmText: "去完善", confirmText: '去完善',
cancelText: "", cancelText: '',
action: "", action: '',
cancelAction: "", cancelAction: '',
}, },
waitHandlerPanelIndex: 0, waitHandlerPanelIndex: 0,
waitHandlerGroupIndex: 0, waitHandlerGroupIndex: 0,
...@@ -451,20 +451,20 @@ export default { ...@@ -451,20 +451,20 @@ export default {
// 上传组件相关 // 上传组件相关
carmeraList: [ carmeraList: [
{ {
text: "相册", text: '相册',
}, },
{ {
text: "拍照", text: '拍照',
}, },
], ],
maskShow: false, maskShow: false,
takeStatus: false, takeStatus: false,
currentItemDate: {}, currentItemDate: {},
photoItem: {}, photoItem: {},
maintainStep: "partnerInspectItem", maintainStep: 'partnerInspectItem',
orderStatus: "", orderStatus: '',
// showTab: true, // showTab: true,
}; }
}, },
components: { components: {
XhInput, XhInput,
...@@ -482,32 +482,32 @@ export default { ...@@ -482,32 +482,32 @@ export default {
XhLabel, XhLabel,
XhParts, XhParts,
Detail, Detail,
"take-photo": takePhoto, 'take-photo': takePhoto,
}, },
mixins: [baseFile], mixins: [baseFile],
created() { created() {
// console.log(allComponents,'allComponents') // console.log(allComponents,'allComponents')
}, },
onLoad(option) { onLoad(option) {
getApp().trackPage("订单完工信息页"); getApp().trackPage('订单完工信息页')
if (option) { if (option) {
this.maintainStep = option.maintainStep; this.maintainStep = option.maintainStep
this.orderId = option.orderId; this.orderId = option.orderId
this.categoryId = option.categoryId; this.categoryId = option.categoryId
this.brandId = option.brandId; this.brandId = option.brandId
this.orderServiceType = decodeURIComponent(option.orderServiceType); this.orderServiceType = decodeURIComponent(option.orderServiceType)
this.inGuaranteePeriod = option.inGuaranteePeriod; this.inGuaranteePeriod = option.inGuaranteePeriod
this.partnerCompanyId = option.partnerCompanyId; this.partnerCompanyId = option.partnerCompanyId
this.auditResultsId = option.auditResultsId; this.orderStatus = option.orderStatus
this.orderStatus = option.orderStatus; this.auditResults = option?.auditResults ? option?.auditResults.split(',') : []
// this.showTab =item.partnerCompanyName == '挚达充电桩' // this.showTab =item.partnerCompanyName == '挚达充电桩'
} else { } else {
this.orderId = 11880091; this.orderId = 11880091
this.categoryId = 1100000214; this.categoryId = 1100000214
this.orderServiceType = "安装"; this.orderServiceType = '安装'
this.inGuaranteePeriod = "Y"; this.inGuaranteePeriod = 'Y'
} }
this.getCompleteData(); this.getCompleteData()
}, },
updated() { updated() {
//console.log(this.form.name, 'form.name') //console.log(this.form.name, 'form.name')
...@@ -517,152 +517,189 @@ export default { ...@@ -517,152 +517,189 @@ export default {
// 没有数据的时候tab要有占位数据,不然有页面有晃动 // 没有数据的时候tab要有占位数据,不然有页面有晃动
return this.list.length > 0 return this.list.length > 0
? this.list[this.tabIndex].items ? this.list[this.tabIndex].items
: [{ name: "" }]; : [{ name: '' }]
}, },
mixingImage() { mixingImage() {
return process.uniEnv.qn_base_url + "mixing.png"; return process.uniEnv.qn_base_url + 'mixing.png'
}, },
uploadImage() { uploadImage() {
return process.uniEnv.qn_base_url + "upload-file.png"; return process.uniEnv.qn_base_url + 'upload-file.png'
}, },
buttonStyle() { buttonStyle() {
return { return {
color: "#FFFFFF", color: '#FFFFFF',
"background-color": "#2272FF;", 'background-color': '#2272FF;',
width: "300rpx", width: '300rpx',
height: "104rpx", height: '104rpx',
"font-size": "32rpx", 'font-size': '32rpx',
"font-weight": "bold", 'font-weight': 'bold',
"margin-left": "50rpx", 'margin-left': '50rpx',
}; }
}, },
customStyle() { customStyle() {
return { return {
"background-color": "#D1D4D4", 'background-color': '#D1D4D4',
width: "300rpx", width: '300rpx',
height: "104rpx", height: '104rpx',
"background-color": "transparent", 'background-color': 'transparent',
border: "1px solid #2272FF", border: '1px solid #2272FF',
color: "#2272FF", color: '#2272FF',
"font-weight": "bold", 'font-weight': 'bold',
"font-size": "32rpx", 'font-size': '32rpx',
}; }
}, },
show200() { show200() {
return ( return (
this.form.paymentMethodsType && this.form.paymentMethodsType != "03" this.form.paymentMethodsType && this.form.paymentMethodsType != '03'
); )
}, },
}, },
methods: { methods: {
getCompleteData() { getCompleteData() {
//获取工单配置的完工项目 //获取工单配置的完工项目
uni.showLoading({ uni.showLoading({
title: "加载中", title: '加载中',
}); })
if (this.orderId) { if (this.orderId) {
this.$u.api.getCompleteConfigAndData(this.orderId).then((res) => { this.$u.api.getCompleteConfigAndData(this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.initData(res); this.initData(res)
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message || res.data, title: res.message || res.data,
type: "error", type: 'error',
}); })
} }
}); })
} }
}, },
initData(res) { initData(res) {
this.form = res.data.value || {}; this.form = res.data.value || {}
this.initFormData(); this.initFormData()
const list = res.data.config.sort((a, b) => a.order - b.order); const list = res.data.config.sort((a, b) => a.order - b.order)
list.forEach((item, index) => { list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName) this.tabIndex = index; if (this.maintainStep === item.panelFieldsName) this.tabIndex = index
item.items.forEach((v) => { item.items.forEach((v) => {
v.items.forEach((d) => { v.items.forEach((d) => {
const type = d.fieldsType.toLocaleLowerCase(); const type = d.fieldsType.toLocaleLowerCase()
const formMap = formType.get(type) || formType.get("text"); const formMap = formType.get(type) || formType.get('text')
d.formType = formMap[0]; d.formType = formMap[0]
d.inputType = formMap[1]; d.inputType = formMap[1]
if (d.fieldsName === "actualPaid" && res.data.value) { if (d.fieldsName === 'actualPaid' && res.data.value) {
d.required = res.data.value["paymentMethodsType"] d.required = res.data.value['paymentMethodsType']
? res.data.value["paymentMethodsType"] != "03" ? res.data.value['paymentMethodsType'] != '03'
: false; : false
} }
if (d.fieldsName === "pipe" || d.fieldsName === "pipeUseLength") { if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') {
// 申请费用计算 // 申请费用计算
this.calcMoney(); this.calcMoney()
} }
if (d.fieldsName === "materialList") { if (d.fieldsName === 'materialList') {
d.subtitle = "(必填项)"; d.subtitle = '(必填项)'
} }
if (d.fieldsName === "craftList") { if (d.fieldsName === 'craftList') {
d.subtitle = "(若有增项,则为必填项)"; d.subtitle = '(若有增项,则为必填项)'
} }
}); })
}); })
}); })
this.list = list;
// this.showTab = this.list.length > 1 // this.showTab = this.list.length > 1
// 异常单处理 // 异常单处理
if (this.auditResultsId) this.checkCompleteError(); if (this.auditResults.length > 0) {
uni.hideLoading(); this.checkCompleteError(list)
} else {
this.list = list
}
uni.hideLoading()
}, },
initFormData() { initFormData() {
this.loadOrderDetail(); this.loadOrderDetail()
}, },
loadOrderDetail() { loadOrderDetail() {
if (!this.$u.test.isEmpty(this.form) && this.form.hasOwnProperty("installComfirmTime") if (
&& this.$u.test.isEmpty(this.form.installComfirmTime)) { !this.$u.test.isEmpty(this.form) &&
this.form.hasOwnProperty('installComfirmTime') &&
this.$u.test.isEmpty(this.form.installComfirmTime)
) {
this.$u.api.orderDetail(null, this.orderId).then((res) => { this.$u.api.orderDetail(null, this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (!this.$u.test.isEmpty(res.data.checkInDateTime)) { if (!this.$u.test.isEmpty(res.data.checkInDateTime)) {
this.$set( this.$set(
this.form, this.form,
"installComfirmTime", 'installComfirmTime',
this.moment(res.data.checkInDateTime).format("YYYY-MM-DD") this.moment(res.data.checkInDateTime).format('YYYY-MM-DD')
); )
} }
} }
}); })
} }
}, },
checkCompleteError() { checkCompleteError(list) {
// 异常单定位错误项 // 异常单定位错误项
let self = this; let errArr = []
self.list.forEach((panel, panelIndex) => { list.forEach((panel, panelIndex) => {
panel.items.forEach((group, groupIndex) => { panel.items.forEach((group, groupIndex) => {
group.items.forEach((ele, eleIndex) => { group.items.forEach((ele, eleIndex) => {
if (ele.fieldsName === self.auditResultsId) { if (this.auditResults.includes(ele.fieldsName)) {
self.waitHandlerPanelIndex = panelIndex; const errGroup = {
self.waitHandlerGroupIndex = groupIndex; componentType: group.componentType,
self.waitHandlerEleIndex = eleIndex; name: group.name,
self.oldItemId = `item${ele.fieldsId}`; items: ele,
}
errArr.push(errGroup)
} }
}); })
}); })
}); })
this.locationCompleteItem(
self.waitHandlerPanelIndex, const result = errArr.reduce((groups, item) => {
self.waitHandlerGroupIndex, let groupFound = groups.find((arrItem) => item.name === arrItem.name)
self.waitHandlerEleIndex if (groupFound) {
); groupFound.componentType = item.componentType
if (groupFound.items.indexOf(item.items) == -1) {
//去重
groupFound.items.push(item.items)
}
} else {
//不要直接在原来的对象修改,新建对象
let newGroup = {
name: item.name,
componentType: item.componentType,
items: [item.items],
}
groups.push(newGroup)
}
return groups
}, [])
let index = list.length++
list[index] = {
order: index + 1,
panelFieldsName: "error",
panelName: "异常处理",
items: result
}
this.list = list
this.tabIndex = index
}, },
handleSaveData() { handleSaveData() {
let param = {}; let param = {}
const name = this.list[this.tabIndex].panelFieldsName; const name = this.list[this.tabIndex].panelFieldsName
this.list.forEach((panel) => { this.list.forEach((panel) => {
param[panel.panelFieldsName] = []; param[panel.panelFieldsName] = []
panel.items.forEach((group) => { panel.items.forEach((group) => {
group.items.forEach((ele) => { group.items.forEach((ele) => {
if(name === "partnerInspectItem") { if (name === 'partnerInspectItem') {
if(!this.form?.installationMethodType) { if (!this.form?.installationMethodType) {
this.$set(this.form, "installationMethodType", this.form.installType); this.$set(
this.form,
'installationMethodType',
this.form.installType
)
} }
} }
if (this.form[ele.fieldsName]) { if (this.form[ele.fieldsName]) {
...@@ -671,96 +708,95 @@ export default { ...@@ -671,96 +708,95 @@ export default {
fieldsType: ele.fieldsType, fieldsType: ele.fieldsType,
fieldsValue: this.form[ele.fieldsName], fieldsValue: this.form[ele.fieldsName],
required: ele.required, required: ele.required,
}); })
} }
}); })
}); })
}); })
return param; return param
}, },
saveComplete() { saveComplete() {
// 保存完工信息 // 保存完工信息
// this.submitParts() // 不调这个接口;没完工不能调提交配件 // this.submitParts() // 不调这个接口;没完工不能调提交配件
const param = this.handleSaveData(); const param = this.handleSaveData()
this.$u.api.saveCompleteData(param, this.orderId).then((res) => { this.$u.api.saveCompleteData(param, this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "保存成功", title: '保存成功',
type: "success", type: 'success',
}); })
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message || res.data, title: res.message || res.data,
type: "error", type: 'error',
}); })
} }
}); })
}, },
checkCompleteItem() { checkCompleteItem() {
let checkResult = []; let checkResult = []
let pass = true; let pass = true
let first = true; let first = true
const lists = this.tabList; const lists = this.tabList
lists.forEach((group, groupIndex) => { lists.forEach((group, groupIndex) => {
const checkRequired = group.items.some((v) => v.required); const checkRequired = group.items.some((v) => v.required)
if (checkRequired) { if (checkRequired) {
let panelResult = { let panelResult = {
label: group.name, label: group.name,
submitted: 0, submitted: 0,
required: 0, required: 0,
pass: true, pass: true,
}; }
group.items.forEach((ele, eleIndex) => { group.items.forEach((ele, eleIndex) => {
if (ele.required) { if (ele.required) {
panelResult.required++; panelResult.required++
let value = this.form[ele.fieldsName]; let value = this.form[ele.fieldsName]
if (value && !Array.isArray(value)) { if (value && !Array.isArray(value)) {
panelResult.submitted++; panelResult.submitted++
} else if (value && Array.isArray(value) && value.length > 0) { } else if (value && Array.isArray(value) && value.length > 0) {
if (ele.fieldsName === "materialList") { if (ele.fieldsName === 'materialList') {
let hasMate = false; let hasMate = false
let mateRow = value.find((mate) => { let mateRow = value.find((mate) => {
if (mate.hasOwnProperty("useLength")) { if (mate.hasOwnProperty('useLength')) {
hasMate = true; hasMate = true
return !this.$u.test.isEmpty(mate.useLength); return !this.$u.test.isEmpty(mate.useLength)
} }
}); })
if (!hasMate || !this.$u.test.isEmpty(mateRow)) { if (!hasMate || !this.$u.test.isEmpty(mateRow)) {
panelResult.submitted++; panelResult.submitted++
} }
panelResult.submitted++; panelResult.submitted++
} else { } else {
panelResult.submitted++; panelResult.submitted++
} }
} else if (first) { } else if (first) {
// 记录第一个 为空 并且需要必填的项 用于定位 // 记录第一个 为空 并且需要必填的项 用于定位
first = false; first = false
this.waitHandlerPanelIndex = this.tabIndex; this.waitHandlerPanelIndex = this.tabIndex
this.waitHandlerGroupIndex = groupIndex; this.waitHandlerGroupIndex = groupIndex
this.waitHandlerEleIndex = eleIndex; this.waitHandlerEleIndex = eleIndex
this.oldItemId = `item${ele.fieldsId}`; this.oldItemId = `item${ele.fieldsId}`
} }
} }
}); })
panelResult.pass = panelResult.required <= panelResult.submitted; panelResult.pass = panelResult.required <= panelResult.submitted
pass = pass && panelResult.pass; pass = pass && panelResult.pass
checkResult.push(panelResult); checkResult.push(panelResult)
} }
}); })
console.log(checkResult); this.completeCheck.result = checkResult
this.completeCheck.result = checkResult; return pass
return pass;
}, },
// 检查结果窗口取消回调 // 检查结果窗口取消回调
closeCheckResult() { closeCheckResult() {
this.completeCheck.status = false; this.completeCheck.status = false
this[this.completeCheck.cancelAction](); this[this.completeCheck.cancelAction]()
}, },
// 检查结果窗口 确认回调 // 检查结果窗口 确认回调
confirm() { confirm() {
this.completeCheck.status = false; this.completeCheck.status = false
this[this.completeCheck.action](); this[this.completeCheck.action]()
}, },
// 去完善 // 去完善
handerProgrom() { handerProgrom() {
...@@ -768,50 +804,50 @@ export default { ...@@ -768,50 +804,50 @@ export default {
this.waitHandlerPanelIndex, this.waitHandlerPanelIndex,
this.waitHandlerGroupIndex, this.waitHandlerGroupIndex,
this.waitHandlerEleIndex this.waitHandlerEleIndex
); )
}, },
// 去预约 // 去预约
async appointment() { async appointment() {
const save = await this.nextStepSaveData(); const save = await this.nextStepSaveData()
if (save) { if (save) {
uni.reLaunch({ uni.reLaunch({
url: "/pages/index/order?type=0", url: '/pages/index/order?type=0',
}); })
} }
}, },
// 下一步动作 // 下一步动作
async nextAction() { async nextAction() {
const save = await this.nextStepSaveData(); const save = await this.nextStepSaveData()
if (this.tabIndex < this.list.length - 1 && save) { if (this.tabIndex < this.list.length - 1 && save) {
this.tabIndex++; this.tabIndex++
this.arr = []; this.arr = []
this.scrollRightTop = 0; this.scrollRightTop = 0
this.current = 0; this.current = 0
//this.itemId = '' //this.itemId = ''
//const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId //const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId
//this.oldItemId = `item${itemId}` //this.oldItemId = `item${itemId}`
this.$nextTick(async () => { this.$nextTick(async () => {
await this.swichMenu(0); await this.swichMenu(0)
}); })
} }
}, },
// 下一步弹窗处理 // 下一步弹窗处理
nextStep() { nextStep() {
this.pass = this.checkCompleteItem(); this.pass = this.checkCompleteItem()
const name = this.list[this.tabIndex].panelFieldsName; const name = this.list[this.tabIndex].panelFieldsName
const type = const type =
name === "partnerInspectItem" name === 'partnerInspectItem'
? this.form.inspectConclusionType ? this.form.inspectConclusionType
: this.form.constructionConclusionType; : this.form.constructionConclusionType
const submit = this.tabIndex === this.list.length - 1; const submit = this.tabIndex === this.list.length - 1
const result = actions(name, this.pass, type, submit); const result = actions(name, this.pass, type, submit)
this.completeCheck.status = true; this.completeCheck.status = true
this.completeCheck.confirmText = result.confirmText; this.completeCheck.confirmText = result.confirmText
this.completeCheck.action = result.action; this.completeCheck.action = result.action
this.completeCheck.cancelText = result.cancelText || ""; this.completeCheck.cancelText = result.cancelText || ''
this.completeCheck.cancelAction = result.cancelAction || ""; this.completeCheck.cancelAction = result.cancelAction || ''
}, },
// 下一步数据保存 // 下一步数据保存
nextStepSaveData() { nextStepSaveData() {
...@@ -819,274 +855,274 @@ export default { ...@@ -819,274 +855,274 @@ export default {
maintainFields: this.handleSaveData(), maintainFields: this.handleSaveData(),
currentStep: this.list[this.tabIndex].panelFieldsName, currentStep: this.list[this.tabIndex].panelFieldsName,
nextStep: this.list[this.tabIndex + 1].panelFieldsName, nextStep: this.list[this.tabIndex + 1].panelFieldsName,
}; }
uni.showLoading({ uni.showLoading({
title: "加载中", title: '加载中',
}); })
return this.$u.api.completeNextStep(params, this.orderId).then((res) => { return this.$u.api.completeNextStep(params, this.orderId).then((res) => {
uni.hideLoading(); uni.hideLoading()
if (res.code == 200) { if (res.code == 200) {
return Promise.resolve(true); return Promise.resolve(true)
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message || res.data, title: res.message || res.data,
type: "error", type: 'error',
}); })
return Promise.resolve(false); return Promise.resolve(false)
} }
}); })
}, },
locationCompleteItem(panelIndex, groupIndex, eleIndex) { locationCompleteItem(panelIndex, groupIndex, eleIndex) {
// 页面定位到某一项 // 页面定位到某一项
this.tabIndex = panelIndex; this.tabIndex = panelIndex
this.current = groupIndex; this.current = groupIndex
this.itemId = ""; this.itemId = ''
this.$nextTick(function () { this.$nextTick(function() {
if (this.oldItemId) this.itemId = this.oldItemId; if (this.oldItemId) this.itemId = this.oldItemId
}); })
}, },
// 提交配件信息 // 提交配件信息
submitParts() { submitParts() {
if (this.form.orderSpareParts) { if (this.form.orderSpareParts) {
const orderSpareParts = JSON.parse(this.form.orderSpareParts); const orderSpareParts = JSON.parse(this.form.orderSpareParts)
const lists = orderSpareParts.filter((v) => v.quantity > 0); const lists = orderSpareParts.filter((v) => v.quantity > 0)
const params = { const params = {
workOrderId: this.orderId, workOrderId: this.orderId,
applyType: "10", applyType: '10',
parts: lists ? JSON.stringify(lists) : "", parts: lists ? JSON.stringify(lists) : '',
}; }
this.$u.api.createParts(params).then((res) => { this.$u.api.createParts(params).then((res) => {
if (res.code !== 200) { if (res.code !== 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: "error", type: 'error',
}); })
} }
}); })
} }
}, },
// 提交订单 // 提交订单
orderFinish() { orderFinish() {
const param = this.handleSaveData(); const param = this.handleSaveData()
// 完工事件埋点 // 完工事件埋点
getApp().track("order_finish", { getApp().track('order_finish', {
id: this.vuex_user.id, id: this.vuex_user.id,
mobile: this.vuex_user.mobile, mobile: this.vuex_user.mobile,
orderId: Number(this.orderId), orderId: Number(this.orderId),
}); })
this.$u.api.saveCompleteData(param, this.orderId).then((res) => { this.$u.api.saveCompleteData(param, this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
//完工项信息保存成功再次完工工单 //完工项信息保存成功再次完工工单
if (this.inGuaranteePeriod === "Y") { if (this.inGuaranteePeriod === 'Y') {
this.$u.api.inOrderFinish(this.orderId).then((res) => { this.$u.api.inOrderFinish(this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.submitParts(); this.submitParts()
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "提交成功", title: '提交成功',
type: "success", type: 'success',
callback: () => { callback: () => {
uni.reLaunch({ uni.reLaunch({
url: "/pages/index/order?type=3", url: '/pages/index/order?type=3',
}); })
}, },
}); })
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: "error", type: 'error',
}); })
} }
}); })
} else { } else {
this.$u.api this.$u.api
.outOrderFinish({ customerPayType: "CASH" }, this.orderId) .outOrderFinish({ customerPayType: 'CASH' }, this.orderId)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "提交成功", title: '提交成功',
type: "success", type: 'success',
callback: () => { callback: () => {
uni.reLaunch({ uni.reLaunch({
url: "/pages/index/order?type=3", url: '/pages/index/order?type=3',
}); })
}, },
}); })
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: "error", type: 'error',
}); })
} }
}); })
} }
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: "error", type: 'error',
}); })
} }
}); })
}, },
calMaterialCraftListAmount(arr) { calMaterialCraftListAmount(arr) {
let amount = 0; let amount = 0
if (arr) { if (arr) {
arr.forEach((item) => { arr.forEach((item) => {
let useLength = let useLength =
(item.hasOwnProperty("useLength") && Number(item.useLength)) || 0; (item.hasOwnProperty('useLength') && Number(item.useLength)) || 0
let freeLength = let freeLength =
(item.hasOwnProperty("freeLength") && Number(item.freeLength)) || 0; (item.hasOwnProperty('freeLength') && Number(item.freeLength)) || 0
let unitAmt = let unitAmt =
(item.hasOwnProperty("unitAmt") && Number(item.unitAmt)) || 0; (item.hasOwnProperty('unitAmt') && Number(item.unitAmt)) || 0
amount += Math.max(useLength - freeLength, 0) * unitAmt; amount += Math.max(useLength - freeLength, 0) * unitAmt
if (item.hasOwnProperty("extraAmt") && Number(item.extraAmt)) { if (item.hasOwnProperty('extraAmt') && Number(item.extraAmt)) {
amount += Number(item.extraAmt); amount += Number(item.extraAmt)
} }
}); })
} }
return amount; return amount
}, },
setData(data) { setData(data) {
// 通过页面设置数据 // 通过页面设置数据
Object.keys(data).forEach((key) => { Object.keys(data).forEach((key) => {
this.$set(this.form, key, data[key]); this.$set(this.form, key, data[key])
}); })
// 更新预计超出金额 // 更新预计超出金额
let amount = 0; let amount = 0
amount += this.calMaterialCraftListAmount(this.form.materialList); amount += this.calMaterialCraftListAmount(this.form.materialList)
amount += this.calMaterialCraftListAmount(this.form.craftList); amount += this.calMaterialCraftListAmount(this.form.craftList)
this.$set(this.form, "overAmount", amount || 0); this.$set(this.form, 'overAmount', amount || 0)
}, },
// 字段的值更新 // 字段的值更新
fieldValueChange(data) { fieldValueChange(data) {
const groupItem = this.list[this.tabIndex].items[data.groupIndex]; const groupItem = this.list[this.tabIndex].items[data.groupIndex]
let innerItem; let innerItem
if (groupItem.items) { if (groupItem.items) {
innerItem = groupItem.items[data.itemIndex]; innerItem = groupItem.items[data.itemIndex]
} }
if (innerItem.fieldsType === "multiInput") { if (innerItem.fieldsType === 'multiInput') {
// 多个输入框的值触发 // 多个输入框的值触发
let key = Object.keys(data.value)[0]; let key = Object.keys(data.value)[0]
this.form[key] = data.value[key]; this.form[key] = data.value[key]
} else { } else {
this.$set(this.form, innerItem.fieldsName, data.value); this.$set(this.form, innerItem.fieldsName, data.value)
} }
if (innerItem.fieldsName === "paymentMethodsType") { if (innerItem.fieldsName === 'paymentMethodsType') {
// 选不需要收款的时候,收款金额修改为非必选 // 选不需要收款的时候,收款金额修改为非必选
const row = groupItem.items.find((v) => v.fieldsName === "actualPaid"); const row = groupItem.items.find((v) => v.fieldsName === 'actualPaid')
row.required = data.value != "03"; row.required = data.value != '03'
} }
if ( if (
innerItem.fieldsName === "pipe" || innerItem.fieldsName === 'pipe' ||
innerItem.fieldsName === "pipeUseLength" innerItem.fieldsName === 'pipeUseLength'
) { ) {
// 申请费用计算 // 申请费用计算
this.calcMoney(); this.calcMoney()
} }
}, },
// 申请费用计算 // 申请费用计算
calcMoney() { calcMoney() {
const price = parseInt(this.form.pipe) || 0; const price = parseInt(this.form.pipe) || 0
const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0; const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0
if (price && pipeUseLength) { if (price && pipeUseLength) {
const money = (price * pipeUseLength).toFixed(2); const money = (price * pipeUseLength).toFixed(2)
this.$set(this.form, "pipeAmount", money); this.$set(this.form, 'pipeAmount', money)
} else { } else {
this.$set(this.form, "pipeAmount", 0); this.$set(this.form, 'pipeAmount', 0)
} }
}, },
// ------------------------- 以下方法为上传组件相关 ------------------------- // ------------------------- 以下方法为上传组件相关 -------------------------
// 弹出上传选项 // 弹出上传选项
selectUpload(item, groupIndex, itemIndex) { selectUpload(item, groupIndex, itemIndex) {
const imgList = const imgList = this.$refs[`fileChild${groupIndex}${itemIndex}`][0]
this.$refs[`fileChild${groupIndex}${itemIndex}`][0].imgList; .imgList
if (imgList.length === 10) { if (imgList.length === 10) {
return this.$refs.uToast.show({ return this.$refs.uToast.show({
title: "图片已超出最大数量", title: '图片已超出最大数量',
type: "error", type: 'error',
}); })
} }
this.photoItem = { this.photoItem = {
...JSON.parse(item), ...JSON.parse(item),
groupIndex, groupIndex,
itemIndex, itemIndex,
}; }
// 弹窗展示 // 弹窗展示
this.maskShow = true; this.maskShow = true
}, },
// 区分上传动作 // 区分上传动作
uploadSelect(index) { uploadSelect(index) {
if (index === 0) { if (index === 0) {
this.uploadFile("photo"); this.uploadFile('photo')
} else { } else {
this.uploadFile(); this.uploadFile()
} }
}, },
// 拍照回调 // 拍照回调
async closeTake(val) { async closeTake(val) {
if (val && val.length > 0) { if (val && val.length > 0) {
const files = val.map((v) => v.path); const files = val.map((v) => v.path)
const value = await this.saveToTask(files); const value = await this.saveToTask(files)
this.$refs[ this.$refs[
`fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}` `fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}`
][0].setTmpValue(value); ][0].setTmpValue(value)
} }
this.takeStatus = false; this.takeStatus = false
}, },
// 上传图片 // 上传图片
async uploadFile(type) { async uploadFile(type) {
const self = this; const self = this
if (type && type === "photo") { if (type && type === 'photo') {
// 直接打开相册 // 直接打开相册
let options = { let options = {
sourceType: ["album"], //['album', 'camera'] sourceType: ['album'], //['album', 'camera']
count: 3, count: 3,
sizeType: ["compressed"], sizeType: ['compressed'],
}; }
const value = await this.chooseImg(options); const value = await this.chooseImg(options)
self.$refs[ self.$refs[
`fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}` `fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}`
][0].setTmpValue(value); ][0].setTmpValue(value)
return; return
} }
// 使用拍照工具拍摄 // 使用拍照工具拍摄
this.photograph(); this.photograph()
this.getWatermark(); this.getWatermark()
}, },
// 获取拍照规范 // 获取拍照规范
photograph() { photograph() {
let self = this; let self = this
let param = { let param = {
partnerCompanyId: this.partnerCompanyId || "", partnerCompanyId: this.partnerCompanyId || '',
categoryId: this.categoryId, categoryId: this.categoryId,
brandId: this.brandId || "", brandId: this.brandId || '',
fieldName: this.photoItem.fieldsName, fieldName: this.photoItem.fieldsName,
}; }
this.$u.api.orderStandardItem(param).then((res) => { this.$u.api.orderStandardItem(param).then((res) => {
if (res.code == 200 && res.data.length > 0) { if (res.code == 200 && res.data.length > 0) {
self.currentItemDate = res.data[0]; self.currentItemDate = res.data[0]
} else { } else {
console.log("获取完工项的拍照标准异常", res.data.message); console.log('获取完工项的拍照标准异常', res.data.message)
} }
self.takeStatus = true; self.takeStatus = true
}); })
}, },
// 获取水印 // 获取水印
getWatermark() { getWatermark() {
if (getApp().globalData.photo.waterSetting) { if (getApp().globalData.photo.waterSetting) {
return; return
} }
var data = { partnerCompanyId: this.partnerCompanyId || "" }; var data = { partnerCompanyId: this.partnerCompanyId || '' }
this.$u.api.getWatermark(data).then((res) => { this.$u.api.getWatermark(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data; getApp().globalData.photo.waterSetting = res.data
} else { } else {
console.log("获取水印备注异常", res.data.message); console.log('获取水印备注异常', res.data.message)
} }
}); })
}, },
// ------------------------- 以上方法为上传组件相关 ------------------------- // ------------------------- 以上方法为上传组件相关 -------------------------
...@@ -1094,77 +1130,77 @@ export default { ...@@ -1094,77 +1130,77 @@ export default {
// 点击左边的栏目切换 // 点击左边的栏目切换
async swichMenu(index) { async swichMenu(index) {
if (this.arr.length == 0) { if (this.arr.length == 0) {
await this.getMenuItemTop(); await this.getMenuItemTop()
} }
// if (index == this.current) return; // if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop; this.scrollRightTop = this.oldScrollTop
this.$nextTick(function () { this.$nextTick(function() {
setTimeout(() => { setTimeout(() => {
// 没有指定滚动到某一小项,就滚动到大的项 // 没有指定滚动到某一小项,就滚动到大的项
this.scrollRightTop = this.arr[index]; this.scrollRightTop = this.arr[index]
this.current = index; this.current = index
}, 100); }, 100)
}); })
}, },
// 获取右边菜单每个item到顶部的距离 // 获取右边菜单每个item到顶部的距离
getMenuItemTop() { getMenuItemTop() {
new Promise((resolve) => { new Promise((resolve) => {
let selectorQuery = uni.createSelectorQuery(); let selectorQuery = uni.createSelectorQuery()
selectorQuery selectorQuery
.selectAll(".class-item") .selectAll('.class-item')
.boundingClientRect((rects) => { .boundingClientRect((rects) => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行 // 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) { if (!rects.length) {
setTimeout(() => { setTimeout(() => {
this.getMenuItemTop(); this.getMenuItemTop()
}, 10); }, 10)
return; return
} }
rects.forEach((rect) => { rects.forEach((rect) => {
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况) // 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
this.arr.push(rect.top - rects[0].top); this.arr.push(rect.top - rects[0].top)
resolve(); resolve()
}); })
}) })
.exec(); .exec()
}); })
}, },
// 右边菜单滚动 // 右边菜单滚动
async rightScroll(e) { async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop; this.oldScrollTop = e.detail.scrollTop
if (this.arr.length == 0) { if (this.arr.length == 0) {
await this.getMenuItemTop(); await this.getMenuItemTop()
} }
if (this.timer) return; if (this.timer) return
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
// 节流 // 节流
this.timer = null; this.timer = null
// scrollHeight为右边菜单垂直中点位置 // scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop; let scrollHeight = e.detail.scrollTop
for (let i = 0; i < this.arr.length; i++) { for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i]; let height1 = this.arr[i]
let height2 = this.arr[i + 1]; let height2 = this.arr[i + 1]
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 // 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) { if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) {
this.current = i; this.current = i
return; return
} }
} }
}, 10); }, 10)
}, },
handleTouchstart() { handleTouchstart() {
// 防止输入光标滚动出现错乱 // 防止输入光标滚动出现错乱
uni.hideKeyboard(); uni.hideKeyboard()
}, },
// 返回上一页更新订单状态 // 返回上一页更新订单状态
backGo() { backGo() {
const pages = getCurrentPages(); const pages = getCurrentPages()
const beforePage = pages[pages.length - 2]; const beforePage = pages[pages.length - 2]
if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail(); if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail()
uni.navigateBack(); uni.navigateBack()
}, },
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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