eat.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. <uni-forms ref="form" class="ytforms" :modelValue="datainfo">
  12. <view class="ytsbox">
  13. <view class="yttit">预订信息</view>
  14. <view class="pt5">
  15. <uni-forms-item label="就餐日期" name="appointmentSite">
  16. <picker mode="date" class="pickbox" range-key='dictLabel' :value="adridx"
  17. @change="bindTimeChangea">
  18. <view class="flexc flex1">
  19. <view class="flex1 " :class="day?'co16 fw5 f14':'coa f14'">
  20. {{day||'请选择'}}</view>
  21. <image :src="hupimg" class="hupimg"></image>
  22. </view>
  23. </picker>
  24. </uni-forms-item>
  25. <uni-forms-item label="就餐类型" name="appointmentSite">
  26. <picker class="pickbox" range-key='dictLabel' :value="adridx"
  27. :range="adrlist" @change="bindTimeChangea">
  28. <view class="flexc flex1">
  29. <view class="flex1 " :class="jclx?'co16 fw5 f14':'coa f14'">
  30. {{jclx||'请选择'}}</view>
  31. <image :src="hupimg" class="hupimg"></image>
  32. </view>
  33. </picker>
  34. </uni-forms-item>
  35. <uni-forms-item label="姓名" class="disable" name="visitName">
  36. <view class="intit">刘安宁</view>
  37. <!-- <uni-easyinput :inputBorder="false" disabled v-model="datainfo.visitName" placeholder="请输入姓名">
  38. </uni-easyinput> -->
  39. </uni-forms-item>
  40. <uni-forms-item label="部 门" class="disable" name="visitPhone">
  41. <view class="intit">人力行政部</view>
  42. <!-- <uni-easyinput :inputBorder="false" disabled type="number" v-model="datainfo.visitPhone"
  43. placeholder="请输入手机号码">
  44. </uni-easyinput> -->
  45. </uni-forms-item>
  46. </view>
  47. <view class="ybtn flexcc" @click="getSubmit">确认提交</view>
  48. <view class="tips">* 为响应国家号召,请您视真实情况填写,珍惜粮食,适量定 餐,避免剩餐,减少浪费。</view>
  49. </view>
  50. </uni-forms>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  57. import {getCameraList,getCameraVideo} from "@/api/mine/order.js"
  58. import {getDictionaryFn} from "@/api/mine/register.js"
  59. export default {
  60. components: {},
  61. data() {
  62. return {
  63. hupimg:require("@/static/images/order/hup.png"),
  64. navbg:require("@/static/images/navbg.png"),
  65. backgroundColor: "transparent",
  66. datainfo:{},
  67. nvaHeight: 44,
  68. marTop: 0, //距离顶部的距离
  69. stubarHeight: 0, //
  70. day:'',
  71. jclx:'',
  72. adridx:'',
  73. adrlist:[],
  74. }
  75. },
  76. onPageScroll(e) {
  77. var scrollTop = Number(e.scrollTop);
  78. if (scrollTop > 0) {
  79. this.backgroundColor = '#0491FD'
  80. } else {
  81. this.backgroundColor = 'transparent'
  82. }
  83. },
  84. onLoad: function() {
  85. this.init()
  86. // this.getDataFn()
  87. uni.getSystemInfo({
  88. success: (e) => {
  89. this.stubarHeight = Number(e.statusBarHeight);
  90. this.nvaHeight = Number(e.statusBarHeight) + 44;
  91. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  92. }
  93. })
  94. // 3c8cadac11af4f1298a2882addc8788d
  95. },
  96. onUnload() {
  97. uni.$off('refreshdatalist')
  98. },
  99. onShow() {},
  100. mounted() {
  101. this.getHeightFn()
  102. },
  103. // 上拉触底加载更多触发事件
  104. onReachBottom() {
  105. if (this.reachflag) {
  106. this.pageNum++
  107. this.getDataFn()
  108. }
  109. },
  110. methods: {
  111. checkPermi,
  112. checkRole,
  113. getBack() {
  114. uni.navigateBack({
  115. delta: 1
  116. })
  117. },
  118. bindTimeChangea(e){
  119. var val=e.detail.value;
  120. this.day=val
  121. },
  122. getHeightFn() {
  123. let query = uni.createSelectorQuery().in(this);
  124. //需要给黄色区域设置一个id标识,在这里是demo
  125. query.select('.navbox').boundingClientRect(data => {
  126. var top = data.top < 0 ? -data.top : data.top;
  127. var stubarHeight = Number(this.stubarHeight);
  128. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  129. 2 + 40 //赋值,待会要用
  130. if (top <= this.nvaHeight) {
  131. const opacity = top / 100 // 计算透明度值
  132. const color = `rgba(4, 145, 253, ${opacity})`
  133. this.backgroundColor = color // 更新盒子背景颜色
  134. } else {
  135. this.backgroundColor = '#00A9F0'
  136. }
  137. }).exec();
  138. },
  139. init() {
  140. // 门卫
  141. // getDictionaryFn('is_read').then(res=>{
  142. // if(res.code==200){
  143. // this.ydztlist = res.data.map(v => {
  144. // return {
  145. // label: v.dictLabel,
  146. // value: v.dictValue
  147. // }
  148. // })
  149. // }
  150. // })
  151. },
  152. getDataFn() {
  153. var params = {
  154. pageSize: this.pageSize,
  155. pageNo: this.pageNum,
  156. // visitType:3
  157. }
  158. getCameraList(params).then(res => {
  159. if (res.code == 200) {
  160. if (res.rows.length < this.pageSize) {
  161. this.reachflag = false
  162. this.wtdt = '到底了~';
  163. } else {
  164. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
  165. 1)
  166. if (num < res.total) {
  167. this.reachflag = true
  168. this.wtdt = '上拉加载更多'
  169. } else {
  170. this.reachflag = false
  171. this.wtdt = '到底了~';
  172. }
  173. }
  174. if (this.pageNum == 1) {
  175. this.list = res.rows;
  176. } else {
  177. this.list = this.list.concat(res.rows)
  178. }
  179. } else {
  180. this.$toast(res.msg)
  181. }
  182. })
  183. },
  184. },
  185. }
  186. </script>
  187. <style>
  188. /* page {
  189. background: #ffffff;
  190. } */
  191. </style>
  192. <style lang="scss" scoped>
  193. .ytbox /deep/ .uni-forms .uni-forms-item{padding: 10rpx 26rpx 10rpx;border: 2rpx solid #0391FD;margin-bottom: 24rpx;border-radius: 12rpx;}
  194. .ytbox /deep/ .uni-forms-item__label{flex: 0 0 auto;width: 144rpx !important;font-size: 28rpx;font-weight: bold;position: relative;color: #161616;text-align-last: justify;}
  195. .ytbox /deep/ .uni-forms-item__label text{flex: 1;}
  196. .ytbox /deep/ .uni-forms-item__label .is-required{position: absolute;right: 0;color: #F10C31;margin-top: 16rpx;}
  197. .ytbox /deep/ uni-textarea{flex: 1;width: auto;text-align: right;}
  198. .ytbox /deep/ .uni-textarea-placeholder{font-size: 28rpx;color: #DDDDDD !important;}
  199. .ytbox /deep/ .uni-easyinput__placeholder-class{font-size: 28rpx;color: #DDDDDD;}
  200. .ytbox /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  201. .ytbox /deep/ .uni-easyinput{flex: 1;text-align: right;}
  202. .ytbox /deep/ .uni-easyinput__content-input{font-size: 28rpx;}
  203. .ytbox /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;}
  204. .disable{background: #EFF0F2;border: none !important;}
  205. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 4rpx;border-radius: 14rpx;}
  206. .ytforms{
  207. .yttit{font-size: 28rpx;font-weight: bold;margin-bottom: 56rpx;
  208. color: #161616;display: flex;align-items: center;padding: 0rpx 26rpx;box-sizing: border-box;position: relative;
  209. &::before{content: '';width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;top: 50%;transform: translateY(-50%);left: 0rpx;}
  210. }
  211. .ytsbox{background-color: #ffffff;padding: 32rpx 28rpx 0;border-radius: 14rpx;margin-bottom: 24rpx;
  212. .intit{font-weight: 500;flex: 1;font-size: 26rpx;text-align: right;color: #666666;}
  213. .pickbox{flex: 1;text-align: right;font-weight: 500;font-size: 28rpx;color: #161616;
  214. .hupimg{width: 18rpx;height: 14rpx;margin-left: 12rpx;flex: 0 0 auto;}
  215. }
  216. }
  217. }
  218. // 按钮
  219. .ybtn{width: 100%;height: 90rpx;background: $com-cd3;border-radius: 14rpx;margin: 100rpx auto 0;font-size: 28rpx;font-weight: 500;color: #FFFFFF;
  220. &.btn1{background-color: #9a9c9e;}
  221. }
  222. .tips{font-weight: bold;margin-top: 28rpx;
  223. font-size: 22rpx;line-height: 34rpx;
  224. color: #FF0000;}
  225. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  226. .navbg{width: 100%;height: 692rpx;}
  227. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;
  228. min-height: calc(100vh - 44px);
  229. }
  230. </style>