113 lines
3.4 KiB
Vue
113 lines
3.4 KiB
Vue
<template>
|
|
<view v-if="isRecord" class="wrapper">
|
|
<view class="bg" @click="onTap">
|
|
<view class="edit" @click.stop>
|
|
<view class="title">手动记录</view>
|
|
<view class="editem" @click="hideKeyboard">
|
|
<view class="left">日期</view>
|
|
<view class="right">
|
|
<picker mode="date" :value="regTime" :end="endDate" @change="bindDateChange">
|
|
<view class="text">{{regTime?regTime:"请选择"}}</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<view class="editem">
|
|
<view class="left">体重</view>
|
|
<view class="right">
|
|
<input v-model="weight" type="digit" placeholder="请输入" />kg
|
|
</view>
|
|
</view>
|
|
<view class="btn close" @click="onTap()">取消</view>
|
|
<view class="btn" @click="handleTarget">确定</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
data() {
|
|
return {
|
|
regTime: "",
|
|
weight: "",
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState(["user", "isRecord"]),
|
|
endDate() {
|
|
return this.$tools.getDate("start")
|
|
},
|
|
startDate() {
|
|
return this.$tools.GetDateStr(-90);
|
|
},
|
|
},
|
|
methods: {
|
|
// 手动记录
|
|
handleTarget() {
|
|
let that = this
|
|
if (!that.regTime) {
|
|
that.$tools.msg("请选择测量日期")
|
|
return
|
|
}
|
|
if (!that.weight) {
|
|
that.$tools.msg("请输入测量体重")
|
|
return
|
|
}
|
|
that.$model.getinsertmeasure({
|
|
familyid: that.user.familyid,
|
|
time: that.regTime,
|
|
weight: that.weight,
|
|
}).then(res => {
|
|
if (res.code != 0) return
|
|
that.$tools.msg(res.message)
|
|
that.$store.commit("changeRecord", false);
|
|
that.$store.dispatch("getResult", {
|
|
birthday: that.user.birthday,
|
|
familyid: that.user.familyid,
|
|
height: that.user.height,
|
|
sex: that.user.sex,
|
|
})
|
|
that.$store.dispatch("getUserInfo", {
|
|
familyid: that.user.familyid,
|
|
})
|
|
that.$emit("getList", this.startDate, this.endDate)
|
|
that.regTime = ""
|
|
that.weight = ""
|
|
})
|
|
},
|
|
//
|
|
bindDateChange(e) {
|
|
this.regTime = e.target.value
|
|
},
|
|
onTap() {
|
|
this.regTime = ""
|
|
this.weight = ""
|
|
this.$store.commit("changeRecord", false);
|
|
},
|
|
hideKeyboard() {
|
|
uni.hideKeyboard()
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.btn {
|
|
width: 40%;
|
|
float: right;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.edit {
|
|
top: 20%
|
|
}
|
|
|
|
.close {
|
|
background: #dfdfdf !important;
|
|
float: left;
|
|
}
|
|
</style>
|