新版厨房秤
This commit is contained in:
parent
29816185bb
commit
31facc9457
|
|
@ -124,7 +124,7 @@
|
||||||
<view class="kcal">{{activeType.kcal}}千卡/100克</view>
|
<view class="kcal">{{activeType.kcal}}千卡/100克</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="more" @click="isBle=!isBle">
|
<view class="more" @click="handleToggleBle">
|
||||||
<image class="keybordIcon"
|
<image class="keybordIcon"
|
||||||
:src="isBle?'/static/chengIcon.png':'/static/keybordIcon.png'" mode="widthFix">
|
:src="isBle?'/static/chengIcon.png':'/static/keybordIcon.png'" mode="widthFix">
|
||||||
</image>
|
</image>
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<view class="val">
|
<view class="val">
|
||||||
<input type="digit" v-model="activeType.weight" placeholder="请输入"
|
<input type="digit" v-model="activeType.weight" placeholder="请输入"
|
||||||
@focus="activeType.weight=0" />
|
@input="replaceInput" />
|
||||||
<text class="unit">克</text>
|
<text class="unit">克</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn" @click="Next()">确认添加</view>
|
<view class="btn" @click="Next()">确认添加</view>
|
||||||
|
|
@ -160,7 +160,7 @@
|
||||||
<!-- 营养分析 -->
|
<!-- 营养分析 -->
|
||||||
<view class="foodDetail">
|
<view class="foodDetail">
|
||||||
<view class="foodContent">
|
<view class="foodContent">
|
||||||
<view class="title">热量和营养</view>
|
<!-- <view class="title">热量和营养</view>
|
||||||
<view class="progress">
|
<view class="progress">
|
||||||
<div class="chart-wrap">
|
<div class="chart-wrap">
|
||||||
<qiun-data-charts type="ring" :opts="opts" :canvas2d="true"
|
<qiun-data-charts type="ring" :opts="opts" :canvas2d="true"
|
||||||
|
|
@ -175,7 +175,7 @@
|
||||||
<view>{{item.name}}:{{item.proportion}}%</view>
|
<view>{{item.name}}:{{item.proportion}}%</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="tips">
|
<view class="tips">
|
||||||
<text>营养素</text>
|
<text>营养素</text>
|
||||||
<text>{{activeType.weight}}克含量</text>
|
<text>{{activeType.weight}}克含量</text>
|
||||||
|
|
@ -266,12 +266,6 @@
|
||||||
},
|
},
|
||||||
history_food() {
|
history_food() {
|
||||||
return this.configInfo.search_history.food
|
return this.configInfo.search_history.food
|
||||||
},
|
|
||||||
getKcal() {
|
|
||||||
if (this.activeType) {
|
|
||||||
return this.activeType.kcal
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -325,6 +319,19 @@
|
||||||
that.Next()
|
that.Next()
|
||||||
console.log("返回", that.activeType, weight, unit, kcal)
|
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) {
|
realTimeWeight(weight, unit) {
|
||||||
this.activeType = Object.assign({}, this.activeType, {
|
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() {
|
Next() {
|
||||||
let that = this
|
let that = this
|
||||||
let ite = that.activeType
|
let ite = that.activeType
|
||||||
|
if (that.activeType.weight <= 0) {
|
||||||
|
that.$tools.msg("请输入重量")
|
||||||
|
return
|
||||||
|
}
|
||||||
that.IsWeight = false
|
that.IsWeight = false
|
||||||
if (that.ActiveList.indexOf(ite) == -1) {
|
if (that.ActiveList.indexOf(ite) == -1) {
|
||||||
that.ActiveList.push(ite);
|
that.ActiveList.push(ite);
|
||||||
|
|
@ -511,9 +519,16 @@
|
||||||
food_list: that.ActiveList
|
food_list: that.ActiveList
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code != 0) return
|
if (res.code != 0) return
|
||||||
|
that.$store.dispatch("getCountFoodInfo", {
|
||||||
|
aud_id: that.user.aud_id,
|
||||||
|
time: that.$tools.getDate("start")
|
||||||
|
})
|
||||||
|
setTimeout(function() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
})
|
})
|
||||||
|
}, 500)
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//删除购物车食材
|
//删除购物车食材
|
||||||
|
|
|
||||||
|
|
@ -100,19 +100,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["menuList"]),
|
...mapState(["configInfo"]),
|
||||||
menu() {
|
menu() {
|
||||||
return this.menuList
|
return this.configInfo.cookbook_label
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad() {},
|
onLoad() {},
|
||||||
onShow() {
|
onShow() {},
|
||||||
console.log("11111111onshow")
|
|
||||||
},
|
|
||||||
onTabItemClick(itemPath) {
|
|
||||||
// 例如,你可以在这里添加一个确认对话框
|
|
||||||
console.log("itemPath", itemPath)
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
//
|
//
|
||||||
getAddFood(list) {
|
getAddFood(list) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="box" v-if="userinfo">
|
<view class="box" v-if="userinfo">
|
||||||
<view class="kcal">
|
<view class="kcal2">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view class="left ">
|
<view class="left ">
|
||||||
<view class="center">
|
<view class="center">
|
||||||
|
|
@ -387,7 +387,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.kcal {
|
.kcal2 {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
@ -525,11 +525,11 @@
|
||||||
padding-bottom: 50px;
|
padding-bottom: 50px;
|
||||||
|
|
||||||
.listbox {
|
.listbox {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 40px);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-top: 15px;
|
margin: 15px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
|
|
|
||||||
|
|
@ -542,7 +542,7 @@
|
||||||
background: #fff;
|
background: #fff;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
height: 96px;
|
height: 120px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
@ -597,7 +597,7 @@
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20rpx;
|
top: 20rpx;
|
||||||
right: 30rpx;
|
right: 20rpx;
|
||||||
background: $maincolor;
|
background: $maincolor;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-align: center;
|
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
|
|
@ -147,20 +147,13 @@ var render = function () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
: null
|
: null
|
||||||
var g11 = _vm.IsWeight
|
var l1 = _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
|
|
||||||
? _vm.__map(_vm.activeType.nutrients_list, function (item, index) {
|
? _vm.__map(_vm.activeType.nutrients_list, function (item, index) {
|
||||||
var $orig = _vm.__get_orig(item)
|
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 {
|
return {
|
||||||
$orig: $orig,
|
$orig: $orig,
|
||||||
g12: g12,
|
g11: g11,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
: null
|
: null
|
||||||
|
|
@ -190,12 +183,6 @@ var render = function () {
|
||||||
_vm.e6 = function ($event) {
|
_vm.e6 = function ($event) {
|
||||||
_vm.IsWeight = false
|
_vm.IsWeight = false
|
||||||
}
|
}
|
||||||
_vm.e7 = function ($event) {
|
|
||||||
_vm.isBle = !_vm.isBle
|
|
||||||
}
|
|
||||||
_vm.e8 = function ($event) {
|
|
||||||
_vm.activeType.weight = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_vm.$mp.data = Object.assign(
|
_vm.$mp.data = Object.assign(
|
||||||
{},
|
{},
|
||||||
|
|
@ -212,9 +199,7 @@ var render = function () {
|
||||||
g8: g8,
|
g8: g8,
|
||||||
g9: g9,
|
g9: g9,
|
||||||
l0: l0,
|
l0: l0,
|
||||||
g11: g11,
|
|
||||||
l1: l1,
|
l1: l1,
|
||||||
l2: l2,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -339,12 +324,6 @@ var _default = {
|
||||||
},
|
},
|
||||||
history_food: function history_food() {
|
history_food: function history_food() {
|
||||||
return this.configInfo.search_history.food;
|
return this.configInfo.search_history.food;
|
||||||
},
|
|
||||||
getKcal: function getKcal() {
|
|
||||||
if (this.activeType) {
|
|
||||||
return this.activeType.kcal;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -398,6 +377,19 @@ var _default = {
|
||||||
that.Next();
|
that.Next();
|
||||||
console.log("返回", that.activeType, weight, unit, kcal);
|
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) {
|
realTimeWeight: function realTimeWeight(weight, unit) {
|
||||||
this.activeType = Object.assign({}, this.activeType, {
|
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() {
|
Next: function Next() {
|
||||||
var that = this;
|
var that = this;
|
||||||
var ite = that.activeType;
|
var ite = that.activeType;
|
||||||
|
if (that.activeType.weight <= 0) {
|
||||||
|
that.$tools.msg("请输入重量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
that.IsWeight = false;
|
that.IsWeight = false;
|
||||||
if (that.ActiveList.indexOf(ite) == -1) {
|
if (that.ActiveList.indexOf(ite) == -1) {
|
||||||
that.ActiveList.push(ite);
|
that.ActiveList.push(ite);
|
||||||
|
|
@ -581,9 +574,15 @@ var _default = {
|
||||||
food_list: that.ActiveList
|
food_list: that.ActiveList
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
if (res.code != 0) return;
|
if (res.code != 0) return;
|
||||||
|
that.$store.dispatch("getCountFoodInfo", {
|
||||||
|
aud_id: that.user.aud_id,
|
||||||
|
time: that.$tools.getDate("start")
|
||||||
|
});
|
||||||
|
setTimeout(function () {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
});
|
});
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//删除购物车食材
|
//删除购物车食材
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -226,19 +226,13 @@ var _default = {
|
||||||
cookIndex: null
|
cookIndex: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["menuList"])), {}, {
|
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["configInfo"])), {}, {
|
||||||
menu: function menu() {
|
menu: function menu() {
|
||||||
return this.menuList;
|
return this.configInfo.cookbook_label;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
onLoad: function onLoad() {},
|
onLoad: function onLoad() {},
|
||||||
onShow: function onShow() {
|
onShow: function onShow() {},
|
||||||
console.log("11111111onshow");
|
|
||||||
},
|
|
||||||
onTabItemClick: function onTabItemClick(itemPath) {
|
|
||||||
// 例如,你可以在这里添加一个确认对话框
|
|
||||||
console.log("itemPath", itemPath);
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
//
|
//
|
||||||
getAddFood: function getAddFood(list) {
|
getAddFood: function getAddFood(list) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -50,7 +50,7 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
.kcal.data-v-378efeb4 {
|
.kcal2.data-v-378efeb4 {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
background: #f3fffd;
|
background: #f3fffd;
|
||||||
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||||||
}
|
}
|
||||||
.kcal .left.data-v-378efeb4 {
|
.kcal2 .left.data-v-378efeb4 {
|
||||||
width: 300rpx;
|
width: 300rpx;
|
||||||
height: 300rpx;
|
height: 300rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.kcal .left .center.data-v-378efeb4 {
|
.kcal2 .left .center.data-v-378efeb4 {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 260rpx;
|
width: 260rpx;
|
||||||
|
|
@ -85,13 +85,13 @@
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
.kcal .left .center text.data-v-378efeb4 {
|
.kcal2 .left .center text.data-v-378efeb4 {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
.kcal .right.data-v-378efeb4 {
|
.kcal2 .right.data-v-378efeb4 {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
@ -105,13 +105,13 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: #d1f2ed;
|
background: #d1f2ed;
|
||||||
}
|
}
|
||||||
.kcal .right .item.data-v-378efeb4 {
|
.kcal2 .right .item.data-v-378efeb4 {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
}
|
}
|
||||||
.kcal .right .border-bottom.data-v-378efeb4 {
|
.kcal2 .right .border-bottom.data-v-378efeb4 {
|
||||||
border-bottom: 1px solid #dfdfdf;
|
border-bottom: 1px solid #dfdfdf;
|
||||||
}
|
}
|
||||||
.tools.data-v-378efeb4 {
|
.tools.data-v-378efeb4 {
|
||||||
|
|
@ -171,11 +171,11 @@
|
||||||
padding-bottom: 50px;
|
padding-bottom: 50px;
|
||||||
}
|
}
|
||||||
.list .listbox.data-v-378efeb4 {
|
.list .listbox.data-v-378efeb4 {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 40px);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-top: 15px;
|
margin: 15px 10px;
|
||||||
}
|
}
|
||||||
.list .left.data-v-378efeb4 {
|
.list .left.data-v-378efeb4 {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@
|
||||||
background: #fff;
|
background: #fff;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
height: 96px;
|
height: 120px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
@ -269,7 +269,7 @@
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20rpx;
|
top: 20rpx;
|
||||||
right: 30rpx;
|
right: 20rpx;
|
||||||
background: #3CB383;
|
background: #3CB383;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue