datepicker.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="main">
  3. <view class="leftcontainer">
  4. <scroll-view scroll-y="true" style="height: 700rpx;">
  5. <view :class="leftindex==index?'leftstyle leftstyle_active':'leftstyle'" v-for="(item,index) in date[0]" @click="selectdate(item,index)"
  6. :key="index">
  7. {{item.date}}
  8. </view>
  9. </scroll-view>
  10. </view>
  11. <view class="rightcontainer">
  12. <scroll-view scroll-y="true" style="height: 700rpx;">
  13. <u-grid :col="3">
  14. <u-grid-item v-for="(itm,idx) in rightday" @click="selectday(itm)" :key="idx">
  15. <view class="">
  16. 预约时间:
  17. </view>
  18. <view class="margin-top-sm">{{itm.start_time_period}} - {{itm.end_time_period}}</view>
  19. <view class="margin-top-sm text-blue">
  20. 可预约号源:{{itm.can_appoint_num}}
  21. </view>
  22. </u-grid-item>
  23. </u-grid>
  24. </scroll-view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. date: {
  32. type: Array,
  33. }
  34. },
  35. onShow() {
  36. console.log("hahah")
  37. },
  38. mounted() {
  39. },
  40. data() {
  41. return {
  42. leftindex: 0,
  43. rightday: [],
  44. year: ""
  45. }
  46. },
  47. methods: {
  48. selectdate(item, index) {
  49. this.leftindex = index
  50. this.year = item.date
  51. this.date[1].forEach(data => {
  52. data.forEach(itm => {
  53. if (itm.schedule_id == item.id) {
  54. this.rightday = data
  55. }
  56. })
  57. })
  58. },
  59. selectday(itm) {
  60. // console.log(itm)
  61. if (this.year != "") {
  62. itm.year = this.year
  63. }
  64. this.$emit('callbacktime', itm)
  65. }
  66. }
  67. };
  68. </script>
  69. <style scoped>
  70. .main {
  71. display: flex;
  72. /* margin-left: 15rpx;
  73. margin-right: 15rpx; */
  74. }
  75. .leftcontainer {
  76. border-right: 1rpx solid #efefef;
  77. width: 25%;
  78. }
  79. .rightcontainer {
  80. width: 75%;
  81. }
  82. .leftstyle {
  83. width: 100%;
  84. height: 80rpx;
  85. display: flex;
  86. justify-content: center;
  87. align-items: center;
  88. font-size: 30rpx;
  89. color: #0B73B9;
  90. }
  91. .leftstyle_active {
  92. color: #fff;
  93. background-color: #0B73B9;
  94. }
  95. </style>