Files
szjs/pages/tool/tool.js
2025-03-07 22:27:18 +08:00

177 lines
3.6 KiB
JavaScript

// pages/tool/tool.js
const app = getApp()
Page({
data: {
heightone: '',
name: '诺言',
age: '6',
height: '120',
boneAge: '6',
fatherHeight: '32',
motherHeight: '28',
igf: '334',
lh: '0.6',
thickness: '11',
result: '',
show: false,
},
inputName: function (e) {
this.setData({
name: e.detail.value
})
},
inputAge: function (e) {
this.setData({
age: e.detail.value
})
},
inputHeight: function (e) {
this.setData({
height: e.detail.value
})
},
inputBoneAge: function (e) {
this.setData({
boneAge: e.detail.value
})
},
inputFatherHeight: function (e) {
this.setData({
fatherHeight: e.detail.value
})
},
inputMotherHeight: function (e) {
this.setData({
motherHeight: e.detail.value
})
},
inputIGF: function (e) {
this.setData({
igf: e.detail.value
})
},
inputLH: function (e) {
this.setData({
lh: e.detail.value
})
},
inputThickness: function (e) {
this.setData({
thickness: e.detail.value
})
},
pintuan() {
this.setData({
show: true
});
},
tiaoguo() {
this.setData({
show: false
});
},
calculate: function () {
const data = this.data;
const result = {
};
console.log(result);
if (wx.getStorageSync('phone') == '') {
wx.setStorageSync('uidFlag', false);
console.log('请登录')
this.isdenglu()
} else {
this.setData({
show: true
});
this.payment()
}
},
//是否登录
isdenglu() {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
wx.switchTab({
url: '/pages/my/my'
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
payment() {
if (this.data.name == '') {
wx.showToast({
title: '请输入姓名',
icon: 'none'
});
return
}
var that = this;
wx.request({
url: app.globalData.url + 'app/Ruilaiwechat/calculate',
data: {
uid: wx.getStorageSync('uid'), //人员id
name: this.data.name, //姓名
age: this.data.age, //年龄
height: this.data.height, //身高
bone_age: this.data.boneAge, //骨龄
father_height: this.data.fatherHeight, //父亲身高
mother_height: this.data.motherHeight, //母亲身高
IGF: this.data.igf, //IGF-1值
LH: this.data.lh, //LH基础值
uterus_thickness: this.data.thickness, //子宫厚度
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success(res) {
if (res.data.erro == 0) {
that.setData({
result: res.data.calculate_resutlt,
})
} else {
wx.showToast({
title: res.data.msg,
icon: 'error',
duration: 2000
})
}
}
})
},
onLoad: function (options) {
},
go_history(){
wx.navigateTo({
url: '/pages/order/order',
})
},
reset() {
if (wx.getStorageSync('phone') == '') {
wx.setStorageSync('uidFlag', false);
console.log('请登录')
this.isdenglu()
} else {
this.setData({
name: '',
age: '',
height: '',
boneAge: '',
fatherHeight: '',
motherHeight: '',
igf: '',
lh: '',
thickness: '',
});
console.log('order_id==')
}
}
})