新版厨房秤

This commit is contained in:
qcl_123 2025-11-08 17:31:03 +08:00
parent 29816185bb
commit 31facc9457
14 changed files with 87 additions and 85 deletions

View File

@ -124,7 +124,7 @@
<view class="kcal">{{activeType.kcal}}千卡/100</view>
</view>
</view>
<view class="more" @click="isBle=!isBle">
<view class="more" @click="handleToggleBle">
<image class="keybordIcon"
:src="isBle?'/static/chengIcon.png':'/static/keybordIcon.png'" mode="widthFix">
</image>
@ -151,7 +151,7 @@
<view v-else>
<view class="val">
<input type="digit" v-model="activeType.weight" placeholder="请输入"
@focus="activeType.weight=0" />
@input="replaceInput" />
<text class="unit"></text>
</view>
<view class="btn" @click="Next()">确认添加</view>
@ -160,7 +160,7 @@
<!-- 营养分析 -->
<view class="foodDetail">
<view class="foodContent">
<view class="title">热量和营养</view>
<!-- <view class="title">热量和营养</view>
<view class="progress">
<div class="chart-wrap">
<qiun-data-charts type="ring" :opts="opts" :canvas2d="true"
@ -175,7 +175,7 @@
<view>{{item.name}}{{item.proportion}}%</view>
</view>
</view>
</view>
</view> -->
<view class="tips">
<text>营养素</text>
<text>{{activeType.weight}}克含量</text>
@ -266,12 +266,6 @@
},
history_food() {
return this.configInfo.search_history.food
},
getKcal() {
if (this.activeType) {
return this.activeType.kcal
}
return 0
}
},
components: {
@ -325,6 +319,19 @@
that.Next()
console.log("返回", that.activeType, weight, unit, kcal)
},
handleToggleBle() {
let that = this
that.isBle = !that.isBle
if (!that.isBle) {
that.activeType.weight = that.activeType.weight != 0 ? that.activeType.weight : ''
}
},
replaceInput(event) {
let weight = event.target.value
this.activeType = Object.assign({}, this.activeType, {
weight: weight
})
},
//
realTimeWeight(weight, unit) {
this.activeType = Object.assign({}, this.activeType, {
@ -378,13 +385,14 @@
}]
}));
},
getKcal() {
this.opts.title.name = this.activeType.nutrients_four[0].value * this.activeType.weight
},
//
Next() {
let that = this
let ite = that.activeType
if (that.activeType.weight <= 0) {
that.$tools.msg("请输入重量")
return
}
that.IsWeight = false
if (that.ActiveList.indexOf(ite) == -1) {
that.ActiveList.push(ite);
@ -511,9 +519,16 @@
food_list: that.ActiveList
}).then(res => {
if (res.code != 0) return
that.$store.dispatch("getCountFoodInfo", {
aud_id: that.user.aud_id,
time: that.$tools.getDate("start")
})
setTimeout(function() {
uni.navigateBack({
delta: 1
})
}, 500)
})
},
//

View File

@ -100,19 +100,13 @@
}
},
computed: {
...mapState(["menuList"]),
...mapState(["configInfo"]),
menu() {
return this.menuList
return this.configInfo.cookbook_label
},
},
onLoad() {},
onShow() {
console.log("11111111onshow")
},
onTabItemClick(itemPath) {
//
console.log("itemPath", itemPath)
},
onShow() {},
methods: {
//
getAddFood(list) {

View File

@ -15,7 +15,7 @@
</view>
</view>
<view class="box" v-if="userinfo">
<view class="kcal">
<view class="kcal2">
<view class="top">
<view class="left ">
<view class="center">
@ -387,7 +387,7 @@
}
}
.kcal {
.kcal2 {
width: calc(100% - 20px);
margin-bottom: 15px;
background: #fff;
@ -525,11 +525,11 @@
padding-bottom: 50px;
.listbox {
width: calc(100% - 20px);
width: calc(100% - 40px);
padding: 10px;
border-radius: 10px;
background-color: #fff;
margin-top: 15px;
margin: 15px 10px;
}
.left {

View File

@ -542,7 +542,7 @@
background: #fff;
position: relative;
padding: 20rpx;
height: 96px;
height: 120px;
overflow: hidden;
border-radius: 20rpx;
margin-bottom: 30rpx;
@ -597,7 +597,7 @@
height: 50rpx;
position: absolute;
top: 20rpx;
right: 30rpx;
right: 20rpx;
background: $maincolor;
border-radius: 50%;
text-align: center;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -147,20 +147,13 @@ var render = function () {
}
})
: null
var g11 = _vm.IsWeight
? Math.floor((_vm.activeType.kcal * _vm.activeType.weight) / 100)
: null
var l1 =
_vm.IsWeight && _vm.activeType.nutrients_four
? _vm.activeType.nutrients_four.slice(1)
: null
var l2 = _vm.IsWeight
var l1 = _vm.IsWeight
? _vm.__map(_vm.activeType.nutrients_list, function (item, index) {
var $orig = _vm.__get_orig(item)
var g12 = Number((item.value * _vm.activeType.weight) / 100).toFixed(2)
var g11 = Number((item.value * _vm.activeType.weight) / 100).toFixed(2)
return {
$orig: $orig,
g12: g12,
g11: g11,
}
})
: null
@ -190,12 +183,6 @@ var render = function () {
_vm.e6 = function ($event) {
_vm.IsWeight = false
}
_vm.e7 = function ($event) {
_vm.isBle = !_vm.isBle
}
_vm.e8 = function ($event) {
_vm.activeType.weight = 0
}
}
_vm.$mp.data = Object.assign(
{},
@ -212,9 +199,7 @@ var render = function () {
g8: g8,
g9: g9,
l0: l0,
g11: g11,
l1: l1,
l2: l2,
},
}
)
@ -339,12 +324,6 @@ var _default = {
},
history_food: function history_food() {
return this.configInfo.search_history.food;
},
getKcal: function getKcal() {
if (this.activeType) {
return this.activeType.kcal;
}
return 0;
}
}),
components: {
@ -398,6 +377,19 @@ var _default = {
that.Next();
console.log("返回", that.activeType, weight, unit, kcal);
},
handleToggleBle: function handleToggleBle() {
var that = this;
that.isBle = !that.isBle;
if (!that.isBle) {
that.activeType.weight = that.activeType.weight != 0 ? that.activeType.weight : '';
}
},
replaceInput: function replaceInput(event) {
var weight = event.target.value;
this.activeType = Object.assign({}, this.activeType, {
weight: weight
});
},
//实时重量
realTimeWeight: function realTimeWeight(weight, unit) {
this.activeType = Object.assign({}, this.activeType, {
@ -451,13 +443,14 @@ var _default = {
}]
}));
},
getKcal: function getKcal() {
this.opts.title.name = this.activeType.nutrients_four[0].value * this.activeType.weight;
},
// 保存
Next: function Next() {
var that = this;
var ite = that.activeType;
if (that.activeType.weight <= 0) {
that.$tools.msg("请输入重量");
return;
}
that.IsWeight = false;
if (that.ActiveList.indexOf(ite) == -1) {
that.ActiveList.push(ite);
@ -581,9 +574,15 @@ var _default = {
food_list: that.ActiveList
}).then(function (res) {
if (res.code != 0) return;
that.$store.dispatch("getCountFoodInfo", {
aud_id: that.user.aud_id,
time: that.$tools.getDate("start")
});
setTimeout(function () {
uni.navigateBack({
delta: 1
});
}, 500);
});
},
//删除购物车食材

File diff suppressed because one or more lines are too long

View File

@ -226,19 +226,13 @@ var _default = {
cookIndex: null
};
},
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["menuList"])), {}, {
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["configInfo"])), {}, {
menu: function menu() {
return this.menuList;
return this.configInfo.cookbook_label;
}
}),
onLoad: function onLoad() {},
onShow: function onShow() {
console.log("11111111onshow");
},
onTabItemClick: function onTabItemClick(itemPath) {
// 例如,你可以在这里添加一个确认对话框
console.log("itemPath", itemPath);
},
onShow: function onShow() {},
methods: {
//
getAddFood: function getAddFood(list) {

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,7 @@
text-align: center;
padding: 5px;
}
.kcal.data-v-378efeb4 {
.kcal2.data-v-378efeb4 {
width: calc(100% - 20px);
margin-bottom: 15px;
background: #fff;
@ -61,7 +61,7 @@
background: #f3fffd;
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
}
.kcal .left.data-v-378efeb4 {
.kcal2 .left.data-v-378efeb4 {
width: 300rpx;
height: 300rpx;
position: relative;
@ -72,7 +72,7 @@
justify-content: center;
align-items: center;
}
.kcal .left .center.data-v-378efeb4 {
.kcal2 .left .center.data-v-378efeb4 {
position: absolute;
text-align: center;
width: 260rpx;
@ -85,13 +85,13 @@
background: #fff;
border-radius: 50%;
}
.kcal .left .center text.data-v-378efeb4 {
.kcal2 .left .center text.data-v-378efeb4 {
display: inline-block;
font-size: 22px;
font-weight: bold;
margin: 10px 0;
}
.kcal .right.data-v-378efeb4 {
.kcal2 .right.data-v-378efeb4 {
position: absolute;
left: 50%;
bottom: 0;
@ -105,13 +105,13 @@
flex-direction: column;
background: #d1f2ed;
}
.kcal .right .item.data-v-378efeb4 {
.kcal2 .right .item.data-v-378efeb4 {
display: flex;
justify-content: space-between;
height: 35px;
line-height: 35px;
}
.kcal .right .border-bottom.data-v-378efeb4 {
.kcal2 .right .border-bottom.data-v-378efeb4 {
border-bottom: 1px solid #dfdfdf;
}
.tools.data-v-378efeb4 {
@ -171,11 +171,11 @@
padding-bottom: 50px;
}
.list .listbox.data-v-378efeb4 {
width: calc(100% - 20px);
width: calc(100% - 40px);
padding: 10px;
border-radius: 10px;
background-color: #fff;
margin-top: 15px;
margin: 15px 10px;
}
.list .left.data-v-378efeb4 {
width: 100%;

View File

@ -219,7 +219,7 @@
background: #fff;
position: relative;
padding: 20rpx;
height: 96px;
height: 120px;
overflow: hidden;
border-radius: 20rpx;
margin-bottom: 30rpx;
@ -269,7 +269,7 @@
height: 50rpx;
position: absolute;
top: 20rpx;
right: 30rpx;
right: 20rpx;
background: #3CB383;
border-radius: 50%;
text-align: center;