Commit 1e28171d by 张立顺

fix bug

1 parent 904090b3
// tabRepairOrder/components/relateGoodsPop/index.js // tabRepairOrder/components/relateGoodsPop/index.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -10,15 +9,18 @@ Component({ ...@@ -10,15 +9,18 @@ Component({
baseConfigData: Object, baseConfigData: Object,
show: { show: {
type: Boolean, type: Boolean,
observer: function(n) { observer: function (n) {
if (n) { if (n) {
let {goodsList, selected} = this.data let { goodsList, selected } = this.data
goodsList?.map(val => { goodsList?.map(val => {
val.active = false val.active = false
if (selected?.findIndex(v => v.upgradeGoodsId == val.upgradeGoodsId) > -1) val.active = true if (
selected?.findIndex(v => v.subOrderCode == val.subOrderCode) > -1
)
val.active = true
return val return val
}) })
this.setData({goodsList}) this.setData({ goodsList })
} }
} }
} }
...@@ -27,9 +29,7 @@ Component({ ...@@ -27,9 +29,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -39,7 +39,7 @@ Component({ ...@@ -39,7 +39,7 @@ Component({
let { item } = e.currentTarget.dataset let { item } = e.currentTarget.dataset
let { goodsList } = this.data let { goodsList } = this.data
goodsList?.forEach(val => { goodsList?.forEach(val => {
if (val.upgradeGoodsId == item.upgradeGoodsId) val.active = !val.active if (val.subOrderCode == item.subOrderCode) val.active = !val.active
}) })
this.setData({ this.setData({
goodsList goodsList
...@@ -55,4 +55,4 @@ Component({ ...@@ -55,4 +55,4 @@ Component({
this.triggerEvent('confirm', arr) this.triggerEvent('confirm', arr)
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -226,26 +226,30 @@ Page({ ...@@ -226,26 +226,30 @@ Page({
let { queryOptions } = _this.data let { queryOptions } = _this.data
time = setTimeout(() => { time = setTimeout(() => {
api api
.getConstructionDetail({ .getConstructionDetail({
id: queryOptions?.id, id: queryOptions?.id,
constructionCode: queryOptions?.constructionCode constructionCode: queryOptions?.constructionCode
}) })
.then(res => { .then(res => {
let { code, data, message } = res let { code, data, message } = res
let { detailInfo } = this.data let { detailInfo } = this.data
this.setTime() this.setTime()
if (code == 0) { if (code == 0) {
if (data.startTime) { if (data.startTime) {
data.startTime = new Date(data.startTime).format('yyyy-MM-dd hh:mm:ss') 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)
} }
_this.setData({ })
'detailInfo.outboundStatus': data?.outboundStatus,
'detailInfo.startTime': detailInfo.startTime ? detailInfo.startTime : data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间)
})
} else {
wx.$util.showToast(message)
}
})
}, 10 * 1000) }, 10 * 1000)
}, },
...@@ -254,7 +258,7 @@ Page({ ...@@ -254,7 +258,7 @@ Page({
let { queryOptions } = this.data let { queryOptions } = this.data
if (!queryOptions.id || !queryOptions.constructionCode) return if (!queryOptions.id || !queryOptions.constructionCode) return
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中'
}) })
api api
.getConstructionDetail({ .getConstructionDetail({
...@@ -298,7 +302,9 @@ Page({ ...@@ -298,7 +302,9 @@ Page({
'detailInfo.pictureList': data?.pictureList?.map(val => { 'detailInfo.pictureList': data?.pictureList?.map(val => {
return val.pictureUrl return val.pictureUrl
}), }),
'detailInfo.startTime': detailInfo.startTime ? detailInfo.startTime : data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间) 'detailInfo.startTime': detailInfo.startTime
? detailInfo.startTime
: data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间)
}, },
() => { () => {
if (data?.startTime && data?.endTime) { if (data?.startTime && data?.endTime) {
...@@ -400,10 +406,10 @@ Page({ ...@@ -400,10 +406,10 @@ Page({
outBoundTime: e.detail?.outBoundTime, outBoundTime: e.detail?.outBoundTime,
subOrderList: arr subOrderList: arr
} }
if (requesting) return false if (requesting) return false
this.setData({ this.setData({
requesting: true requesting: true
}) })
api.outboundAPI(params).then(res => { api.outboundAPI(params).then(res => {
let { code, message } = res let { code, message } = res
if (code == 0) { if (code == 0) {
...@@ -416,11 +422,11 @@ Page({ ...@@ -416,11 +422,11 @@ Page({
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
} }
setTimeout(() => { setTimeout(() => {
this.setData({ this.setData({
requesting: false requesting: false
}) })
}, 1000) }, 1000)
}) })
}, },
// 客户返工 // 客户返工
...@@ -453,10 +459,10 @@ Page({ ...@@ -453,10 +459,10 @@ Page({
subOrderList: arr subOrderList: arr
} }
let { orderCode, constructionCode } = this.data.detailInfo let { orderCode, constructionCode } = this.data.detailInfo
if (requesting) return false if (requesting) return false
this.setData({ this.setData({
requesting: true requesting: true
}) })
api.reworkAPI(params).then(res => { api.reworkAPI(params).then(res => {
let { code, data, message } = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
...@@ -472,11 +478,11 @@ Page({ ...@@ -472,11 +478,11 @@ Page({
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
} }
setTimeout(() => { setTimeout(() => {
this.setData({ this.setData({
requesting: false requesting: false
}) })
}, 1000) }, 1000)
}) })
}, },
...@@ -661,14 +667,18 @@ Page({ ...@@ -661,14 +667,18 @@ Page({
return wx.$util.showToast('请在页面中提交施工时间') return wx.$util.showToast('请在页面中提交施工时间')
if (!detailInfo?.pictureList?.length) if (!detailInfo?.pictureList?.length)
return wx.$util.showToast('请在页面中提交上传施工图片') return wx.$util.showToast('请在页面中提交上传施工图片')
if (!detailInfo.endTime) { // 未选择施工结束时间取当前时间 if (!detailInfo.endTime) {
// 未选择施工结束时间取当前时间
this.setData({
'detailInfo.endTime': new Date().format('yyyy-MM-dd hh:mm:ss') this.setData(
}, () => { {
this.calculateTimeDifference() // 自动计算施工时长 'detailInfo.endTime': new Date().format('yyyy-MM-dd hh:mm:ss')
}) },
() => {
this.calculateTimeDifference() // 自动计算施工时长
}
)
} }
const pictureList = detailInfo?.pictureList?.map(val => { const pictureList = detailInfo?.pictureList?.map(val => {
return { return {
...@@ -676,7 +686,7 @@ Page({ ...@@ -676,7 +686,7 @@ Page({
} }
}) })
if (this.data.submitFlag) return if (this.data.submitFlag) return
this.setData({ submitFlag: true }) this.setData({ submitFlag: true }) this.setData({ submitFlag: true })
let params = { let params = {
id: detailInfo.id, id: detailInfo.id,
constructionCode: detailInfo.constructionCode, constructionCode: detailInfo.constructionCode,
...@@ -688,7 +698,7 @@ Page({ ...@@ -688,7 +698,7 @@ Page({
pictureList: pictureList pictureList: pictureList
} }
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中'
}) })
api api
.completeConstructionOrder(params) .completeConstructionOrder(params)
...@@ -734,41 +744,44 @@ Page({ ...@@ -734,41 +744,44 @@ Page({
reviewFlag: true reviewFlag: true
}) })
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中'
}) })
api.approvalRepairOrder({ api
id: detailInfo.id, .approvalRepairOrder({
constructionCode: detailInfo.constructionCode, id: detailInfo.id,
approvalStatus: type constructionCode: detailInfo.constructionCode,
}).then(result => { approvalStatus: type
wx.hideLoading() })
this.reviewClose() .then(result => {
let { code, message } = result wx.hideLoading()
setTimeout(() => { this.reviewClose()
this.setData({ let { code, message } = result
reviewFlag: false
})
}, 1000)
if (code == 0) {
wx.$util.showToast('')
wx.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => { setTimeout(() => {
wx.$router.back() this.setData({
}, 200) reviewFlag: false
} else { })
wx.$util.showToast(message) }, 1000)
} if (code == 0) {
}).catch(() => { wx.$util.showToast('')
wx.hideLoading() wx.showToast({
setTimeout(() => { title: '操作成功',
this.setData({ icon: 'success'
reviewFlag: false })
}) setTimeout(() => {
}, 1000) wx.$router.back()
}) }, 200)
} else {
wx.$util.showToast(message)
}
})
.catch(() => {
wx.hideLoading()
setTimeout(() => {
this.setData({
reviewFlag: false
})
}, 1000)
})
}, },
// 审核通过 // 审核通过
......
// tabRepairOrder/components/relateGoodsPop/index.js // tabRepairOrder/components/relateGoodsPop/index.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -10,15 +9,18 @@ Component({ ...@@ -10,15 +9,18 @@ Component({
baseConfigData: Object, baseConfigData: Object,
show: { show: {
type: Boolean, type: Boolean,
observer: function(n) { observer: function (n) {
if (n) { if (n) {
let {goodsList, selected} = this.data let { goodsList, selected } = this.data
goodsList?.map(val => { goodsList?.map(val => {
val.active = false val.active = false
if (selected?.findIndex(v => v.upgradeGoodsId == val.upgradeGoodsId) > -1) val.active = true if (
selected?.findIndex(v => v.subOrderCode == val.subOrderCode) > -1
)
val.active = true
return val return val
}) })
this.setData({goodsList}) this.setData({ goodsList })
} }
} }
} }
...@@ -27,9 +29,7 @@ Component({ ...@@ -27,9 +29,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -39,7 +39,7 @@ Component({ ...@@ -39,7 +39,7 @@ Component({
let { item } = e.currentTarget.dataset let { item } = e.currentTarget.dataset
let { goodsList } = this.data let { goodsList } = this.data
goodsList?.forEach(val => { goodsList?.forEach(val => {
if (val.upgradeGoodsId == item.upgradeGoodsId) val.active = !val.active if (val.subOrderCode == item.subOrderCode) val.active = !val.active
}) })
this.setData({ this.setData({
goodsList goodsList
...@@ -55,4 +55,4 @@ Component({ ...@@ -55,4 +55,4 @@ Component({
this.triggerEvent('confirm', arr) this.triggerEvent('confirm', arr)
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!