123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <view :style="'padding-top:'+nvaHeight+'px;'">
- <view class="navbox">
- <uni-nav-bar color="#ffffff" left-icon="left" title="食谱记录" :background-color="backgroundColor"
- :border="false" statusBar='true' fixed="true" @clickLeft='getBack'>
- </uni-nav-bar>
- <view class="searchs flexc" :style="'background:'+backgroundColor">
- <image :src="licoimg" class="limg" @click='getResetFn'></image>
- <picker mode="date" class="pickbox flex1" @change="bindTimeChangea">
- <view class="search flexc">
- <image :src="serimg"></image>
- <view class="input" :class="recordTime?'':'nact'">{{recordTime||"请选择时间进行搜索"}}</view>
- <!-- <input placeholder="请选择时间进行搜索" confirm-type="search" placeholder-style="color:#B9DCF7" v-model="title" @confirm="getConfirm"/> -->
- </view>
- </picker>
- </view>
-
- </view>
- <image :src="navbg" class="navbg"></image>
- <view class="zxmain">
- <!-- 列表 -->
- <y-list type='recordlist' :datalist="list" :wtdt="wtdt" @getDelFn="getDelFn"></y-list>
- <!-- <view class="yyfbtn flexcc" v-if="checkPermi(['system:food:add'])" @click="getAddFn">添加食谱</view> -->
- </view>
- </view>
- </template>
- <script>
- import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
- import yList from "@/work/components/yuyue/list.vue"
- import {getMenuRecordList} from "@/api/mine/order.js"
- import {getDictionaryFn} from "@/api/mine/register.js"
- export default {
- components: {yList},
- data() {
- return {
- wupimg:require("@/work/static/record/wup.png"),
- serimg:require("@/work/static/record/search.png"),
- licoimg:require("@/work/static/record/lico.png"),
- navbg:require("@/static/images/navbg.png"),
- dayimg:require("@/work/static/yuy/day.png"),
- backgroundColor: "transparent",
- datainfo:{},
- nvaHeight: 44,
- marTop: 0, //距离顶部的距离
- stubarHeight: 0, //
- title:'',
- list:[],
- pageSize: 10,
- pageNum: 1,
- reachflag: false,
- wtdt:'',
- userId:this.$store.state.user.userId,
- recordTime:'',
- }
- },
- onPageScroll(e) {
- var scrollTop = Number(e.scrollTop);
- if (scrollTop > 0) {
- this.backgroundColor = '#0491FD'
- } else {
- this.backgroundColor = 'transparent'
- }
- },
- onUnload() {
- },
- onLoad: function() {
- // this.init()
- this.getDataFn()
- uni.getSystemInfo({
- success: (e) => {
- this.stubarHeight = Number(e.statusBarHeight);
- this.nvaHeight = Number(e.statusBarHeight) + 44;
- }
- })
- },
- onShow() {},
- mounted() {
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods: {
- checkPermi,
- checkRole,
- getConfirm(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getBack() {
- uni.navigateBack({
- delta: 1
- })
- },
- bindTimeChangea(e){
- var val=e.detail.value;
- this.recordTime=val;
- this.getConfirm()
- },
- getResetFn(){
- this.recordTime='';
- this.getConfirm()
- },
- init() {
- // // 就餐类型
- // getDictionaryFn('jiucan').then(res=>{
- // if(res.code==200){
- // this.jclxlist = res.data.map(v => {
- // return {
- // dictLabel: v.dictLabel,
- // dictValue: v.dictValue
- // }
- // })
- // }
- // })
- },
- getDelFn(id){
- var that=this;
- getFoodDel(id).then(res=>{
- if(res.code==200){
- this.$toast('删除成功')
- setTimeout(function(){
- that.getConfirm()
- },1200)
- }
- })
- },
- getDataFn() {
- var params = {
- pageSize: this.pageSize,
- pageNum: this.pageNum,
- }
- if(this.recordTime){
- params.recordTime=this.recordTime
- }
- getMenuRecordList(params).then(res => {
- if (res.code == 200) {
- if (res.rows.length < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- } else {
- var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
- 1)
- if (num < res.total) {
- this.reachflag = true
- this.wtdt = '上拉加载更多'
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- }
- }
- var data=JSON.parse(JSON.stringify(res.rows))
- var newArr=[];
- data.forEach(ite=>{
- var obj=JSON.parse(JSON.stringify(ite));
- var a=ite.menuFoodDetailBkPhoto?ite.menuFoodDetailBkPhoto.split(','):[];
- var b=ite.menuFoodDetailLuPhoto?ite.menuFoodDetailLuPhoto.split(','):[];
- var c=ite.menuFoodDetailDiPhoto?ite.menuFoodDetailDiPhoto.split(','):[];
- obj.imgs=a.concat(b).concat(c);
- newArr.push(obj)
- })
- if (this.pageNum == 1) {
- this.list = newArr;
- } else {
- this.list = this.list.concat(newArr)
- }
- } else {
- this.$toast(res.msg)
- }
- })
- },
- },
- }
- </script>
- <style>
- /* page {
- background: #ffffff;
- } */
- </style>
- <style lang="scss" scoped>
- .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
- .navbg{width: 100%;height: 692rpx;position: absolute;left: 0;right: 0;top: 0;z-index: -1;}
- .zxmain{position: relative;padding: 120rpx 0rpx 10rpx;box-sizing: border-box;}
- .searchs{padding: 12rpx 32rpx;
- .limg{width: 24rpx;height: 24rpx;margin-right: 16rpx;flex:0 0 auto;}
- }
- .search{padding: 0 52rpx;box-sizing: border-box;
- width: 100%;height: 76rpx;background: rgba(40, 139, 214, 0.5);border-radius: 38rpx;
- image{width: 24rpx;height: 24rpx;margin-right: 22rpx;flex: 0 0 auto;}
- .input{flex: 1;font-weight: 500;font-size: 22rpx;color: #FFFFFF;
- &.nact{color:#B9DCF7;}
- }
- }
- .daybtn{font-weight: 500;font-size: 26rpx;color: #FFFFFF;flex: 0 0 auto;
- image{width: 30rpx;height: 30rpx;margin-right: 8rpx;}
- }
- </style>
|