select_time.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="time_box">
  3. <view class="content">
  4. <view class="title">
  5. 选择上门时间
  6. </view>
  7. <view class="center">
  8. <view class="left">
  9. <!-- <view class="item select_day" :class="currentDay == index?'select_day':''" v-for="(item,index) in day" :key="index"
  10. @click="selectDay(item,index)"> -->
  11. <view class="item select_day">
  12. <!-- {{item.title}} -->今天
  13. </view>
  14. </view>
  15. <view class="right">
  16. <view class="item" :class="currentTime == index?'select_time':''" v-for="(item,index) in time" :key="index"
  17. @click="selectTime(item,index)">
  18. {{item.value}}
  19. </view>
  20. </view>
  21. </view>
  22. <view class="bottom">
  23. <view class="btn" v-if="selectTim" @click="selectDate">
  24. {{selectDay}} {{selectTim}}
  25. </view>
  26. <view class="btn" v-else>
  27. 选择上门时间
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. name: 'seelctName',
  36. data() {
  37. return {
  38. day: [{
  39. title: '今天',
  40. type: 0
  41. },
  42. // {
  43. // title: '明天',
  44. // type: 1
  45. // }, {
  46. // title: '后天',
  47. // type: 2
  48. // },
  49. ],
  50. time: [{
  51. value: '15:00-17:00'
  52. },
  53. {
  54. value: '15:00-17:00'
  55. },
  56. {
  57. value: '15:00-17:00'
  58. },
  59. {
  60. value: '15:00-17:00'
  61. },
  62. {
  63. value: '15:00-17:00'
  64. },
  65. {
  66. value: '15:00-17:00'
  67. }
  68. ],
  69. currentDay: null,
  70. currentTime: null,
  71. selectDay: '',
  72. selectTim: ''
  73. }
  74. },
  75. methods: {
  76. // selectDay(item, index) {
  77. // // this.currentDay = index
  78. // let today = new Date();
  79. // this.currentDay = today.toISOString().slice(0, 10);
  80. // console.log(this.currentDay)
  81. // },
  82. selectTime(item, index) {
  83. this.currentTime = index
  84. this.selectTim = item.value
  85. let today = new Date();
  86. this.selectDay = today.toISOString().slice(0, 10);
  87. },
  88. selectDate() {
  89. let date = this.selectDay + ' ' + this.selectTim
  90. this.$emit('dateSend', date);
  91. }
  92. },
  93. mounted() {
  94. }
  95. }
  96. </script>
  97. <style lang="less" scoped>
  98. .time_box {
  99. width: 100vw;
  100. height: 100vh;
  101. position: fixed;
  102. top: 0;
  103. left: 0;
  104. background: rgba(0, 0, 0, 0.4);
  105. .content {
  106. width: 100%;
  107. position: fixed;
  108. bottom: 0;
  109. left: 0;
  110. .title {
  111. width: 100%;
  112. height: 92rpx;
  113. background: #E6F8F7;
  114. border-radius: 24rpx 24rpx 0px 0px;
  115. display: flex;
  116. justify-content: center;
  117. align-items: center;
  118. font-weight: 600;
  119. }
  120. .center {
  121. height: 782rpx;
  122. display: flex;
  123. .left {
  124. width: 220rpx;
  125. height: 100%;
  126. background: #F7F7F7;
  127. .item {
  128. width: 100%;
  129. height: 76rpx;
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. font-size: 28rpx;
  134. color: #000000;
  135. }
  136. .select_day {
  137. background: #FFFFFF;
  138. }
  139. }
  140. .right {
  141. flex: 1;
  142. background: #FFFFFF;
  143. .item {
  144. width: 100%;
  145. height: 76rpx;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. font-size: 28rpx;
  150. color: #999999;
  151. }
  152. .select_time {
  153. color: #000000;
  154. }
  155. }
  156. }
  157. .bottom {
  158. height: 116rpx;
  159. background: #FFFFFF;
  160. border-top: 1px solid #EEEEEE;
  161. padding: 20rpx 40rpx;
  162. box-sizing: border-box;
  163. .btn {
  164. width: 100%;
  165. height: 76rpx;
  166. background: #00B8B0;
  167. border-radius: 106rpx;
  168. font-size: 32rpx;
  169. color: #FFFFFF;
  170. display: flex;
  171. justify-content: center;
  172. align-items: center;
  173. }
  174. }
  175. }
  176. }
  177. </style>