138 lines
3.1 KiB
Vue
138 lines
3.1 KiB
Vue
<template>
|
|
<view class="wrapper" v-if="isRecord">
|
|
<view class="bg" @click="onTap">
|
|
<view class="edit" @click.stop>
|
|
<view class="title">手动记录</view>
|
|
<view class="editem">
|
|
<view class="left">日期</view>
|
|
<view class="right">
|
|
<picker mode="date" :end="endDate" @change="changeLog" :fields="fields">
|
|
<view class="uni-input">{{regTime?regTime:'请选择'}}</view>
|
|
<icon class="iconfont icon-arrow-down-bold"></icon>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<!-- 身体 -->
|
|
<view>
|
|
<view class="editem" v-if="userInfo&&userInfo.height">
|
|
<view class="name">身高</view>
|
|
<view class="right">
|
|
<input type="digit" v-model="height" placeholder="请输入身高" />cm
|
|
</view>
|
|
</view>
|
|
<view class="editem" v-if="userInfo&&userInfo.weight">
|
|
<view class="name">体重</view>
|
|
<view class="right">
|
|
<input type="digit" v-model="weight" placeholder="请输入体重">kg
|
|
</view>
|
|
</view>
|
|
<view class="editem" v-if="userInfo.stage=='婴儿'">
|
|
<view class="left">头围</view>
|
|
<view class="right">
|
|
<input v-model="head" type="digit" placeholder="请输入" />cm
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="btn close" @click="onTap()">取消</view>
|
|
<view class="btn" @click="handleinsertmeasure()">确定</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
props: {
|
|
rtype: null,
|
|
},
|
|
data() {
|
|
return {
|
|
regTime: '',
|
|
weight: "",
|
|
height: '',
|
|
fields: "",
|
|
head: ""
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState(["user", "isRecord"]),
|
|
userInfo() {
|
|
return this.user
|
|
},
|
|
endDate() {
|
|
return this.$tools.getDate("start")
|
|
},
|
|
},
|
|
mounted() {
|
|
let that = this
|
|
// #ifdef APP-PLUS
|
|
that.fields = "time"
|
|
// #endif
|
|
// #ifndef APP-PLUS
|
|
that.fields = "day"
|
|
// #endif
|
|
},
|
|
methods: {
|
|
// 身体
|
|
handleinsertmeasure() {
|
|
let that = this
|
|
if (!that.regTime) {
|
|
that.$tools.msg("请选择测量日期")
|
|
return
|
|
}
|
|
if (!that.height) {
|
|
that.$tools.msg("请输入测量身高")
|
|
return
|
|
}
|
|
if (!that.weight) {
|
|
that.$tools.msg("请输入测量体重")
|
|
return
|
|
}
|
|
that.$model.getinsertmeasure({
|
|
aud_id: that.user.aud_id,
|
|
time: that.regTime,
|
|
weight: that.weight,
|
|
height: that.height,
|
|
head_data: that.head ? that.head : 0
|
|
}).then(res => {
|
|
if (res.code != 0) return
|
|
that.$tools.msg(res.msg)
|
|
that.$store.dispatch("getResult", {
|
|
aud_id: that.user.aud_id
|
|
})
|
|
that.$store.dispatch("getUserInfo", {
|
|
aud_id: that.user.aud_id
|
|
})
|
|
that.onTap()
|
|
})
|
|
},
|
|
changeLog(e) {
|
|
this.regTime = e.detail.value
|
|
},
|
|
onTap() {
|
|
let that = this
|
|
that.weight = ""
|
|
that.height = ""
|
|
that.regTime = ""
|
|
that.$store.commit("changeRecord", false);
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.btn {
|
|
width: 40%;
|
|
float: right;
|
|
margin-top: 15px;
|
|
background: $maincolor !important;
|
|
}
|
|
|
|
.close {
|
|
background: #dfdfdf !important;
|
|
float: left;
|
|
}
|
|
</style> |