menu.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="pr">
  3. <image :src="bgimg" class="bgimg"></image>
  4. <view class="cookbox">
  5. <view class="cboxs">
  6. <view class="ctopimg">
  7. <image :src="ctopimg"></image>
  8. <view class="tit">{{startDate}} - {{endDate}}</view>
  9. </view>
  10. <image :src="cbgimg" class="cbgimg"></image>
  11. <view class="cline">
  12. <image :src="cline"></image>
  13. </view>
  14. <view class="clists" v-for="(ite,idx) in list" :key="idx">
  15. <image :src="cooka" class="cookimg hea" v-if="kaType(ite.menuFoodTime,weeklist)=='1'"></image>
  16. <image :src="cookb" class="cookimg heb" v-if="kaType(ite.menuFoodTime,weeklist)=='2'"></image>
  17. <image :src="cookc" class="cookimg hec" v-if="kaType(ite.menuFoodTime,weeklist)=='3'"></image>
  18. <image :src="cookd" class="cookimg hed" v-if="kaType(ite.menuFoodTime,weeklist)=='4'"></image>
  19. <image :src="cooke" class="cookimg heb" v-if="kaType(ite.menuFoodTime,weeklist)=='5'"></image>
  20. <image :src="cookf" class="cookimg heb" v-if="kaType(ite.menuFoodTime,weeklist)=='6'"></image>
  21. <image :src="cookg" class="cookimg hed" v-if="kaType(ite.menuFoodTime,weeklist)=='7'"></image>
  22. <view class="clist">
  23. <!-- <view class="list">
  24. <view class="tit bgb">早餐</view>
  25. <view class="txt">{{ite.menuFoodDetailBk||"无"}}</view>
  26. </view> -->
  27. <view class="list">
  28. <view class="tit bga">午餐</view>
  29. <view class="txt">{{ite.menuFoodDetailLu||"无"}}</view>
  30. </view>
  31. <view class="list">
  32. <view class="tit bgb">晚餐</view>
  33. <view class="txt">{{ite.menuFoodDetailDi||"无"}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. <image :src="cfotimg" class="cfotimg"></image>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import {getMenuRecordList,getMenuList} from "@/api/mine/order.js"
  44. import {getDictionaryFn} from "@/api/mine/register.js"
  45. import { selectDictLabel } from '@/utils/common.js';
  46. export default {
  47. data(){
  48. return{
  49. bgimg:require("@/work/static/yuy/bg.png"),
  50. cbgimg:require("@/work/static/yuy/cbg.png"),
  51. ctopimg:require("@/work/static/yuy/ctop.png"),
  52. cfotimg:require("@/work/static/yuy/cfot.png"),
  53. cline:require("@/work/static/yuy/cline.png"),
  54. cooka:require("@/work/static/yuy/menua.png"),
  55. cookb:require("@/work/static/yuy/menub.png"),
  56. cookc:require("@/work/static/yuy/menuc.png"),
  57. cookd:require("@/work/static/yuy/menud.png"),
  58. cooke:require("@/work/static/yuy/menue.png"),
  59. cookf:require("@/work/static/yuy/menuf.png"),
  60. cookg:require("@/work/static/yuy/menug.png"),
  61. list:[],
  62. startDate:'',
  63. endDate:'',
  64. weeklist:'',
  65. }
  66. },
  67. onLoad: function() {
  68. this.init()
  69. this.getWeeksDay()
  70. },
  71. methods:{
  72. kaType(data, list) {
  73. return selectDictLabel(list, data);
  74. },
  75. init(){
  76. // 食谱日期
  77. getDictionaryFn('week').then(res=>{
  78. if(res.code==200){
  79. this.weeklist = res.data.map(v => {
  80. return {
  81. dictLabel: v.dictLabel,
  82. dictValue: v.dictValue,
  83. }
  84. })
  85. }
  86. })
  87. },
  88. getWeeksDay(){
  89. var date = new Date();
  90. var y = date.getFullYear();
  91. var m = date.getMonth();
  92. var d = date.getDate();
  93. var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  94. var startDate,endDate
  95. if(week==0){
  96. startDate=new Date(y,m,d-week-6)
  97. endDate=new Date(y,m,d-week)
  98. }else{
  99. startDate=new Date(y,m,d-week+1)
  100. endDate=new Date(y,m,d-week+7)
  101. }
  102. this.startDate=this.formatDate(startDate)
  103. this.endDate=this.formatDate(endDate)
  104. this.getDataFn()
  105. // console.log(this.formatDate(startDate),this.formatDate(endDate))
  106. },
  107. formatDate(date){
  108. const year = date.getFullYear();
  109. const month = ('0' + (date.getMonth() + 1)).slice(-2);
  110. const day = ('0' + date.getDate()).slice(-2);
  111. return month + '-' + day;
  112. },
  113. getDataFn() {
  114. var params = {
  115. pageSize: this.pageSize,
  116. pageNum: this.pageNum,
  117. isUse:'Y'
  118. }
  119. getMenuRecordList(params).then(res => {
  120. if (res.code == 200) {
  121. // if (res.rows.length < this.pageSize) {
  122. // this.reachflag = false
  123. // this.wtdt = '到底了~';
  124. // } else {
  125. // var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
  126. // 1)
  127. // if (num < res.total) {
  128. // this.reachflag = true
  129. // this.wtdt = '上拉加载更多'
  130. // } else {
  131. // this.reachflag = false
  132. // this.wtdt = '到底了~';
  133. // }
  134. // }
  135. if (this.pageNum == 1) {
  136. this.list = res.rows;
  137. } else {
  138. this.list = this.list.concat(res.rows)
  139. }
  140. } else {
  141. this.$toast(res.msg)
  142. }
  143. })
  144. },
  145. },
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .bgimg{width: 100%;min-height: 100vh;z-index: -2;position: absolute;left: 0;right: 0;top: 0;bottom: 0;height: auto;}
  150. .cookbox{padding: 172rpx 36rpx 54rpx 64rpx;box-sizing: border-box;
  151. .cboxs{position: relative;width: 100%;min-height: calc(100vh - 226rpx);padding: 152rpx 50rpx 154rpx 66rpx;box-sizing: border-box;
  152. .ctopimg{width: 548rpx;height: 296rpx;position: absolute;left: 50%;top: -154rpx;z-index: 1;margin-left: -274rpx;
  153. image{width: 100%;height: 100%;}
  154. .tit{font-size: 30rpx;color: #FFFFFE;text-stroke: 2rpx #291313;-webkit-text-stroke: 2rpx #291313;font-weight: bold;
  155. position: absolute;bottom: 80rpx;font-family: FZZhengHeiS-EB-GB;left: 144rpx;right: 172rpx;text-align: center;line-height: 40rpx;
  156. }
  157. }
  158. .cfotimg{width: 582rpx;height: 264rpx;position: absolute;right: -12rpx;bottom: -42rpx;}
  159. .cbgimg{width: 100%;height: 100%;position: absolute;left: 0;right: 0;top: 0;bottom: 0;z-index: -1;}
  160. .cline{width: 62rpx;height: auto;position: absolute;top: 252rpx;bottom: 270rpx;left:-24rpx;overflow: hidden;display: flex;align-items: center;
  161. //min-height: 370rpx;
  162. image{height: 1638rpx;width: 100%;}
  163. }
  164. // 主体
  165. .clists{padding-bottom: 12rpx;
  166. .cookimg{width: 532rpx;margin-bottom: 26rpx;
  167. &.hea{height: 56rpx;width: 534rpx;}
  168. &.heb{height: 60rpx;}
  169. &.hec{height: 64rpx;}
  170. &.hed{height: 66rpx;width: 534rpx;}
  171. }
  172. .list{padding-left: 6rpx;display: flex;align-items: flex-start;margin-bottom: 18rpx;
  173. .tit{font-size: 26rpx;min-width: 76rpx;padding: 0 8rpx;text-align: center;line-height: 34rpx;box-sizing: border-box;height: 34rpx;border-radius: 16rpx;flex: 0 0 auto;margin-right: 20rpx;color: #161616;
  174. &.bga{background: #FFE0AE;}
  175. &.bgb{background: #DCF1FF;}
  176. }
  177. .txt{font-size: 26rpx;font-family: FZKaTong-M19S;color: #382324;}
  178. }
  179. }
  180. }
  181. }
  182. </style>