eatlistday.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view>
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" left-icon="left" title="我的订餐记录" :background-color="backgroundColor"
  5. :border="false" statusBar='true' fixed="true" @clickLeft='getBack'>
  6. </uni-nav-bar>
  7. </view>
  8. <image :src="navbg" class="navbg"></image>
  9. <view class="zxmain" :style="'margin-top:-'+marTop+'rpx;'">
  10. <view class="ytbox">
  11. <!-- <view class="ytop flexc">
  12. <view class="tit">{{visitName.charAt(0)}}</view>
  13. <view class="cent">
  14. <view class="ctit">{{visitName}}</view>
  15. <view class="ctime">最新打卡:2024-07-18</view>
  16. </view>
  17. </view> -->
  18. <!-- 日历 -->
  19. <view class="mb24">
  20. <lunc-calendar ref="calendar" :showLunar="false" :configWeek="configWeek" :configHoliday="configHoliday" :firstDayOfWeek="firstDayOfWeek" :showMonthBg="false" :showShrink="true" :signList="signList"
  21. @dayChange="dayChange" weekType="" @monthChange="monthChange" @getIsSelDayFn="getIsSelDayFn" @shrinkClick="shrinkClick">
  22. </lunc-calendar>
  23. </view>
  24. <!-- 步骤条 -->
  25. <view class="mb16 plr18">
  26. <view class="steps">
  27. <view class="cir"></view>
  28. <view class="stepsa">
  29. <view class="steptit">中餐预订</view>
  30. <view class="steptxt">
  31. <image :src="cirimg"></image>
  32. <view>{{datainfo.am}}</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="steps">
  37. <view class="cir"></view>
  38. <view class="stepsa">
  39. <view class="steptit">晚餐预订</view>
  40. <view class="steptxt">
  41. <image :src="cirimg"></image>
  42. <view>{{datainfo.pm}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  53. import {getDictionaryFn} from "@/api/mine/register.js"
  54. import {getFoodRiLi} from "@/api/mine/work.js"
  55. import luncCalendar from "@/work/components/lunc-calendar/foodlunc-calendar.vue"
  56. export default {
  57. components: {luncCalendar},
  58. data() {
  59. return {
  60. cirimg:require("@/static/images/home/chose.png"),
  61. navbg:require("@/static/images/navbg.png"),
  62. backgroundColor: "transparent",
  63. datainfo:{},
  64. nvaHeight: 44,
  65. marTop: 0, //距离顶部的距离
  66. stubarHeight: 0, //
  67. visitName:'林涵宇',
  68. jclxlist:[],//就餐类型
  69. kaTime:'',
  70. signList: [],
  71. configWeek:[],
  72. configHoliday:'Y',
  73. firstDayOfWeek:'sunday',
  74. // dayflag:false,
  75. // month:'',
  76. // year:'',
  77. // kaTime:'',
  78. changetime:'',//改变的日期
  79. // timeday:'',//选择的日期
  80. // visitDate:'',
  81. userId:this.$store.state.user.userId,
  82. }
  83. },
  84. onPageScroll(e) {
  85. var scrollTop = Number(e.scrollTop);
  86. if (scrollTop > 0) {
  87. this.backgroundColor = '#0491FD'
  88. } else {
  89. this.backgroundColor = 'transparent'
  90. }
  91. },
  92. onLoad: function() {
  93. // this.init()
  94. this.time()
  95. this.getCalendarList()
  96. uni.getSystemInfo({
  97. success: (e) => {
  98. this.stubarHeight = Number(e.statusBarHeight);
  99. this.nvaHeight = Number(e.statusBarHeight) + 44;
  100. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  101. }
  102. })
  103. // 3c8cadac11af4f1298a2882addc8788d
  104. },
  105. onShow() {},
  106. mounted() {
  107. this.getHeightFn()
  108. },
  109. methods: {
  110. checkPermi,
  111. checkRole,
  112. getBack() {
  113. uni.navigateBack({
  114. delta: 1
  115. })
  116. },
  117. time(){
  118. var date = new Date();
  119. var y = date.getFullYear();
  120. var m = date.getMonth() + 1;
  121. var d = date.getDate();
  122. // var h = date.getHours();
  123. // var min = date.getMinutes();
  124. // var s = date.getSeconds();
  125. // var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  126. // var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  127. var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
  128. // var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
  129. // '0' + s) : s);
  130. this.year=y;
  131. this.month=m < 10 ? ('0' + m) : m;
  132. this.kaTime = yearStr
  133. },
  134. dayChange(e){
  135. if(e.daySign&&e.daySign.length){
  136. var daySign=e.daySign[0];
  137. this.datainfo=JSON.parse(JSON.stringify(daySign))
  138. }
  139. },
  140. monthChange(e){
  141. var y=e.year;
  142. var m=e.month;
  143. if(y==this.year&&m==this.month){
  144. this.getCalendarList()
  145. this.changetime='';
  146. }else{
  147. var time=y + '-' + m + '-' + '01'
  148. this.changetime=time
  149. this.getCalendarList(time)
  150. }
  151. },
  152. // 选中的日期
  153. getIsSelDayFn(e){
  154. if(e.sign&&e.sign.length){
  155. var date=e.sign[0].date;
  156. if(date==this.kaTime){
  157. var daySign=e.sign[0];
  158. this.datainfo=JSON.parse(JSON.stringify(daySign))
  159. }
  160. }
  161. },
  162. shrinkClick(e){
  163. console.log(e,3)
  164. },
  165. getHeightFn() {
  166. let query = uni.createSelectorQuery().in(this);
  167. //需要给黄色区域设置一个id标识,在这里是demo
  168. query.select('.navbox').boundingClientRect(data => {
  169. var top = data.top < 0 ? -data.top : data.top;
  170. var stubarHeight = Number(this.stubarHeight);
  171. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  172. 2 + 40 //赋值,待会要用
  173. if (top <= this.nvaHeight) {
  174. const opacity = top / 100 // 计算透明度值
  175. const color = `rgba(4, 145, 253, ${opacity})`
  176. this.backgroundColor = color // 更新盒子背景颜色
  177. } else {
  178. this.backgroundColor = '#00A9F0'
  179. }
  180. }).exec();
  181. },
  182. init() {
  183. // 就餐类型
  184. getDictionaryFn('jiucan').then(res=>{
  185. if(res.code==200){
  186. this.jclxlist = res.data.map(v => {
  187. return {
  188. label: v.dictLabel,
  189. value: v.dictValue
  190. }
  191. })
  192. }
  193. })
  194. },
  195. getCalendarList(itime) {
  196. var time=this.kaTime
  197. if(itime){
  198. time=itime
  199. }
  200. var params = {
  201. orderFoodTime: time,
  202. }
  203. params.orderFoodUserId=this.userId;
  204. getFoodRiLi(params).then(res => {
  205. if (res.code == 200) {
  206. this.signList=res.data;
  207. } else {
  208. this.$toast(res.msg)
  209. }
  210. })
  211. },
  212. },
  213. }
  214. </script>
  215. <style>
  216. /* page {
  217. background: #ffffff;
  218. } */
  219. </style>
  220. <style lang="scss" scoped>
  221. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  222. .navbg{width: 100%;height: 692rpx;}
  223. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;}
  224. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 12rpx;border-radius: 14rpx;
  225. .ytop{padding: 16rpx 0 24rpx 16rpx;
  226. .tit{width: 62rpx;height: 62rpx;background: #0391FD;border-radius: 6rpx;font-weight: 500;
  227. font-size: 34rpx;color: #FFFFFF;margin-right: 18rpx;text-align: center;line-height: 62rpx;flex: 0 0 auto;}
  228. .cent{
  229. flex: 1;
  230. .ctit{font-weight: bold;font-size: 28rpx;color: #161616;margin-bottom: 6rpx;}
  231. .ctime{font-weight: 500;font-size: 18rpx;color: #666666;}
  232. }
  233. }
  234. .tips{font-weight: 500;font-size: 26rpx;color: #888888;padding-left: 34rpx;margin-bottom: 24rpx;}
  235. // 步骤条
  236. .steps{position: relative;display: flex;padding-bottom:40rpx;
  237. &::after{
  238. content: '';position: absolute;left:6rpx;top: 34rpx;bottom: 4rpx;background-color: #DADADA;width: 2rpx;
  239. }
  240. .cir{width: 14rpx;height: 14rpx;background: #AFAFAF;border-radius: 50%;flex: 0 0 auto;margin-right: 38rpx;margin-top: 13rpx;}
  241. .stepsa{flex: 1;
  242. .steptit{font-weight: bold;font-size: 28rpx;color: #161616;margin-bottom: 20rpx;}
  243. .steptxt{display: flex;
  244. image{width: 20rpx;height: 20rpx;margin-right: 14rpx;flex: 0 0 auto;margin-top: 7rpx;}
  245. view{font-weight: bold;font-size: 26rpx;color: #888888;}
  246. }
  247. }
  248. }
  249. }
  250. </style>