time.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view>
  3. <uni-popup ref="popupTime" type="bottom">
  4. <view class="pop-address box-border-box p-24">
  5. <view class="text-align-center fs-36 fw-600 box-title mb-32">
  6. 选择预计送达时间
  7. <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
  8. </view>
  9. <view class="scroll-view-css flex-justify-space">
  10. <view class="time-left">
  11. <view class="item-box" :class="type == item.type?'bgc-f':''"
  12. v-for="(item,i) in list" :key="i" @click="select(1,item)">
  13. {{item.name}}
  14. </view>
  15. </view>
  16. <view class="time-right flex-1">
  17. <view class="item-box b-b-F9F9F9" :class="time == item.name?'fc-41ABF5':''"
  18. v-for="(item,i) in timeList" :key="i" @click="select(2,item)">
  19. {{item.name}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </uni-popup>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data(){
  30. return{
  31. list:[
  32. {
  33. type:1,
  34. name:'今日',
  35. timeList:[
  36. {name:'10:30'},{name:'11:00'},{name:'11:30'},{name:'12:00'},
  37. {name:'12:30'},{name:'13:00'},{name:'13:30'},{name:'14:00'},
  38. {name:'14:30'},{name:'15:00'},{name:'15:30'},{name:'16:00'},
  39. ]
  40. },
  41. {
  42. type:2,
  43. name:'明日',
  44. timeList:[
  45. {name:'10:00'},{name:'10:30'},{name:'11:00'},{name:'11:30'},{name:'12:00'},
  46. ]
  47. }
  48. ],
  49. timeList:[],
  50. type:'',
  51. time:'',
  52. }
  53. },
  54. methods:{
  55. getList(){
  56. this.openPop();
  57. this.timeList = this.list[0].timeList;
  58. this.type = this.list[0].type;
  59. this.time = this.timeList[0].name;
  60. },
  61. openPop(){
  62. this.$refs.popupTime.open();
  63. },
  64. closeCoupon(){
  65. this.$refs.popupTime.close();
  66. },
  67. select(type,item){
  68. if(type === 1){
  69. if(this.type != item.type){
  70. this.type = item.type;
  71. this.time = '';
  72. }
  73. }else{
  74. this.time = item.name
  75. }
  76. }
  77. },
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .pop-address{
  82. width: 100%;
  83. height: 50vh;
  84. background-color: #fff;
  85. border-radius: 24rpx 24rpx 0rpx 0rpx;
  86. padding-top: 32rpx !important;
  87. display: flex;
  88. flex-direction: column;
  89. .box-title{
  90. position: relative;
  91. .box-close{
  92. position: absolute;
  93. right: 22rpx;
  94. }
  95. }
  96. .time-left{
  97. width: 240rpx;
  98. height: auto;
  99. background-color: #F7F8FA;
  100. }
  101. .time-right{
  102. overflow-y: scroll;
  103. }
  104. .item-box{
  105. width: 100%;
  106. height: 104rpx;
  107. line-height: 104rpx;
  108. font-size: 28rpx;
  109. font-weight: 400;
  110. text-align: center;
  111. }
  112. }
  113. </style>