Commit 1e28171d by 张立顺

fix bug

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