武田基因病B开发环境
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.

84 lines
1.6 KiB

const app = getApp<IAppOption>()
import { calc } from 'a-calc'
Page({
data: {
injectionDate: '',
injectionWeight: '',
injectionDrugs: '',
injectionNum: '',
},
onLoad() {
app.waitLogin().then(() => {
this.getDetail()
})
},
handleWeight(e) {
const value = e.detail.value
if (value) {
const injectionDrugs = calc(`${value} * 1.25 | =0 ~+`)
const injectionNum = calc(`${value} * 1.25 / 2 | =0 ~+`)
this.setData({
injectionDrugs,
injectionNum,
})
}
},
handleChangeDate(e) {
const value = e.detail.value
wx.ajax({
method: 'POST',
url: '?r=wtx/treatment/save-injection-date',
data: {
injectionDate: value,
},
}).then((res) => {
console.log('res: ', res)
})
},
getDetail() {
wx.ajax({
method: 'GET',
url: '?r=wtx/treatment/get-injection-info',
data: {},
}).then((res) => {
this.setData({
...res,
injectionDate: res.injectionDate || '',
})
})
},
handleBack() {
wx.navigateBack()
},
handleSubmit() {
const { injectionDate, injectionWeight } = this.data
if (!injectionDate) {
wx.showToast({
title: '请选择输注时间',
icon: 'none',
})
return
}
if (!injectionWeight) {
wx.showToast({
title: '请输入体重',
icon: 'none',
})
return
}
wx.ajax({
method: 'POST',
url: '?r=wtx/treatment/save-injection-info',
data: {
injectionWeight,
},
}).then(() => {
wx.navigateBack()
})
},
})
export {}