kitchendDevice/pageTwo/count/KcalEdit.vue

111 lines
1.9 KiB
Vue
Raw Normal View History

2023-09-08 15:17:21 +08:00
<template>
<view class="content">
<view class="title">
自定义卡路里量
2025-03-25 10:17:30 +08:00
<text class="desc">{{suggestion_kcal_range_val}}</text>
2023-09-08 15:17:21 +08:00
</view>
<view class="input">
<input type="digit" placeholder="请输入" v-model="kcal" />
<text>千卡</text>
</view>
<view class="btn" @click="handlesub">确认修改</view>
</view>
</template>
<script>
2025-03-25 10:17:30 +08:00
import {
mapState
} from "vuex";
2023-09-08 15:17:21 +08:00
export default {
data() {
return {
2025-03-25 10:17:30 +08:00
kcal: "",
suggestion_kcal_range_val: ""
2023-09-08 15:17:21 +08:00
}
},
2025-03-25 10:17:30 +08:00
computed: {
...mapState(["user"]),
},
onLoad(options) {
this.suggestion_kcal_range_val = options.suggestion_kcal_range_val
},
2023-09-08 15:17:21 +08:00
methods: {
handlesub() {
let that = this
if (that.kcal == '' || Number(that.kcal) <= 0) {
that.$tools.msg("请输入卡路里")
return
}
2025-03-25 10:17:30 +08:00
that.$model.getCountSetUserKcal({
aud_id: that.user.aud_id,
set_kcal: that.kcal
}).then(res => {
if (res.code == 0) {
that.$tools.msg("设置成功")
setTimeout(function() {
uni.switchTab({
url: '/pages/count/count'
})
}, 1000)
}
})
2023-09-08 15:17:21 +08:00
}
}
}
</script>
<style scoped lang="scss">
.content {
2025-11-25 14:21:22 +08:00
padding: 0 30rpx;
2023-09-08 15:17:21 +08:00
flex-wrap: wrap;
background-color: #fff;
}
.title {
width: 100%;
font-size: 16px;
2025-11-25 14:21:22 +08:00
margin: 30rpx 0;
2023-09-08 15:17:21 +08:00
font-weight: bold;
text {
font-size: 14px;
color: #999;
font-weight: 500;
width: 100%;
display: inline-block;
2025-11-25 14:21:22 +08:00
margin-top: 20rpx;
2023-09-08 15:17:21 +08:00
}
}
.input {
display: flex;
2025-11-25 14:21:22 +08:00
margin: 40rpx;
2023-09-08 15:17:21 +08:00
height: 35px;
line-height: 35px;
border-bottom: 1px solid #dfdfdf;
2025-11-25 14:21:22 +08:00
width: calc(100% - 80rpx);
2023-09-08 15:17:21 +08:00
position: relative;
/deep/input {
width: 100%;
height: 35px;
font-size: 18px;
line-height: 35px;
text-align: center;
font-weight: bold;
position: absolute;
}
text {
position: absolute;
right: 0;
}
}
.btn {
2025-11-25 14:21:22 +08:00
margin-top: 80rpx;
width: calc(100% - 60rpx);
2023-09-08 15:17:21 +08:00
color: #fff;
}
2025-03-25 10:17:30 +08:00
</style>