日照项目的居民端小程序
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.

157 lines
3.6 KiB

// subpages/points/pages/demand/finish.js
// @ts-nocheck
import { wxRequestPost } from "@utils/promise-wx-api"
import {
nextTick,
} from "@utils/tools"
Page({
/**
*
*/
data: {
info: {},
serviceStartTime: '',
serviceEndTime: ''
},
/**
* --
*/
onLoad: async function (options) {
await this.getInfo(options)
},
/**
* --
*/
onReady: function () {
},
/**
* --
*/
onShow: function () {
},
async getInfo(op) {
const params = {
demandRecId: op.id
}
// let url = 'heart/residemand/detail-hall'
// if (op.source == 'my') url = 'heart/residemand/my-detail'
let {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost('heart/residemand/detail-hall', params, { isMock: false });
console.log('getInfo', data)
if (msg == 'success' && code == 0) {
this.setData({
info: data
})
}
},
async 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
}
let {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost('heart/residemand/finish', params, { isMock: false });
console.log('handleSubmit', data)
await nextTick(1000)
wx.hideLoading()
if (msg == 'success' && code == 0) {
await wx.showToast({
title: '提交成功',
icon: 'none',
duration: 1500
})
await nextTick(1000)
wx.navigateBack({
delta: 1
})
}
},
handleTimeChange(e: any) {
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: any) {
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
})
},
/**
* --
*/
onHide: function () {
},
/**
* --
*/
onUnload: function () {
},
/**
* --
*/
onPullDownRefresh: function () {
},
/**
*
*/
onReachBottom: function () {
},
/**
*
*/
onShareAppMessage: function () {
}
})