修复...

This commit is contained in:
2022-02-14 11:44:49 +08:00
parent b3739a9d8d
commit db94c6b962
14 changed files with 762 additions and 812 deletions

View File

@@ -8,11 +8,7 @@
<template>
<view class="add-foods">
<view class="re">
<view>低等热量</view>
<view>中等热量</view>
<view>高等热量</view>
</view>
<view class="re"> <view>低等热量</view> <view>中等热量</view> <view>高等热量</view> </view>
<!-- 搜索页面 -->
<u-search :show-action="true" actionText="搜索" :animation="true" :clearabled="true" placeholder="请输入食品名称"
@custom="searchCustom" @clear="clearSearch" v-model="name" />
@@ -59,8 +55,6 @@
//没有id的时候就是新增要处理type
this.type = this.$Route.query.type;
this.date = this.$Route.query.date;
console.log(this.date,'date.........')
// this.getFoods();
},
onLoad() {
this.getFoods();
@@ -85,9 +79,15 @@
name: this.name,
};
healthFoods(data).then((res) => {
console.log(res);
this.lists = this.lists.concat(res.data);
this.has_more = res.page.has_more;
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none",
duration: 2000,
mask: true
})
});
},
// 监听点击键盘触发返回值新增食品
@@ -100,17 +100,14 @@
food_id: this.selectGoods[0].food_id,
date: this.date,
};
console.log(data,'data...........');
this.addHealthFoods(data);
},
// 添加食物
addHealthFoods(data) {
addHealthFoods(data).then((res) => {
console.log(res);
this.addShow = false;
this.$Router.back();
}).catch(err => {
console.log(err, '添加食物error');
uni.showToast({
title: err.message,
icon: "none",
@@ -133,7 +130,6 @@
},
// 点击搜索左侧按钮
searchCustom(e) {
console.log(e);
this.name = e;
this.reset();
},