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.
103 lines
2.6 KiB
103 lines
2.6 KiB
import { getDemandDetail, getMyDemandDetail, demandFinish } from '../../utils/demand'
|
|
Page({
|
|
data: {
|
|
info: {},
|
|
serviceStartTime: '',
|
|
serviceEndTime: ''
|
|
},
|
|
|
|
onLoad: function (options) {
|
|
this.getInfo(options)
|
|
},
|
|
getDemandDetail (params) {
|
|
getDemandDetail(params).then(res => {
|
|
if (res.msg == 'success' && res.code == 0) {
|
|
this.setData({
|
|
info: res.data
|
|
})
|
|
}
|
|
})
|
|
},
|
|
getMyDemandDetail (params) {
|
|
getMyDemandDetail(params).then(res => {
|
|
if (res.msg == 'success' && res.code == 0) {
|
|
this.setData({
|
|
info: res.data
|
|
})
|
|
}
|
|
})
|
|
},
|
|
getInfo(op) {
|
|
const params = {
|
|
demandRecId: op.id
|
|
}
|
|
if (op.source == 'my') {
|
|
this.getMyDemandDetail(params)
|
|
} else {
|
|
this.getDemandDetail(params)
|
|
}
|
|
},
|
|
handleSubmit() {
|
|
const { serviceStartTime, serviceEndTime, info } = this.data
|
|
if (!serviceStartTime) {
|
|
wx.showToast({
|
|
title: '服务开始时间不能为空',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if (!serviceEndTime) {
|
|
wx.showToast({
|
|
title: '服务结束时间不能为空',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
wx.showLoading({
|
|
title: '提交中...'
|
|
})
|
|
const params = {
|
|
demandRecId: info.demandRecId,
|
|
serviceId: info.serviceId,
|
|
serviceStartTime,
|
|
serviceEndTime
|
|
}
|
|
demandFinish(params).then(res => {
|
|
wx.hideLoading()
|
|
if (res.msg == 'success' && res.code == 0) {
|
|
wx.showToast({
|
|
title: '提交成功',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
setTimeout(() => {
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
}, 1500)
|
|
}
|
|
}).catch(err => {
|
|
|
|
})
|
|
},
|
|
handleTimeChange(e) {
|
|
let { serviceStartTime } = this.data
|
|
const { dateTimeArray, dateTime } = e.detail
|
|
serviceStartTime = `${dateTimeArray[0][dateTime[0]]}-${dateTimeArray[1][dateTime[1]]}-${dateTimeArray[2][dateTime[2]]} ${dateTimeArray[3][dateTime[3]]}:${dateTimeArray[4][dateTime[4]]}:${dateTimeArray[5][dateTime[5]]}`
|
|
console.log('change', e.detail)
|
|
this.setData({
|
|
serviceStartTime
|
|
})
|
|
},
|
|
handleTimeEChange(e) {
|
|
let { serviceEndTime } = this.data
|
|
const { dateTimeArray, dateTime } = e.detail
|
|
serviceEndTime = `${dateTimeArray[0][dateTime[0]]}-${dateTimeArray[1][dateTime[1]]}-${dateTimeArray[2][dateTime[2]]} ${dateTimeArray[3][dateTime[3]]}:${dateTimeArray[4][dateTime[4]]}:${dateTimeArray[5][dateTime[5]]}`
|
|
console.log('change', e.detail)
|
|
this.setData({
|
|
serviceEndTime
|
|
})
|
|
},
|
|
})
|