timeSelect.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="timeSelectBox" >
  3. <uni-popup ref="popup" type="bottom">
  4. <view class="timeBOx">
  5. <view class="time-select-popup">
  6. <view class="time-select-popup-header clearfix">
  7. <view class="h4">查看预约时间</view>
  8. <span class="cancle-text color-lightgray" @click="close()">取消</span>
  9. </view>
  10. <view class="time-select-popup-body">
  11. <view class="time-select-popup-body-left">
  12. <view class="time-select-popup-body-left-item" v-for="(timeItem,index) in timeList" :class="{'selected':selectedDate===timeItem.date}" @click="selectTimeList(timeItem)">{{timeItem.date.substring(5)}}</view>
  13. </view>
  14. <view class="time-select-popup-body-time">
  15. <view class="time-select-popup-body-time-list">
  16. <view v-for="(item) in timeItemList" :key="item.time"
  17. class="time-select-popup-body-time-ltem"
  18. @click="selectTime(`${selectedDate} ${item.time}`,item.type)">
  19. <view class="time-select-popup-body-time-ltem-body"
  20. :class="{'not':item.type!==1,'select':selectedTime===`${selectedDate} ${item.time}`}">
  21. <view class="time1">{{item.time}}</view>
  22. <view class="time2">{{item.type===1?'可预约':item.type===2?'已约满':'已过期'}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view style="height: 120rpx;"></view>
  27. </view>
  28. </view>
  29. <view class="time-select-popup-body-button fenxiang newcsbtn" style="width: 100%" @click="handleSelect">完成</view>
  30. </view>
  31. </view>
  32. </uni-popup>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. props:['timedata'],
  38. data() {
  39. return {
  40. show: false,
  41. loading: false,
  42. timeList: [],
  43. timeItemList: [],
  44. selectedTime: '',
  45. selectedDate: ''
  46. }
  47. },
  48. onLoad(opt) {
  49. },
  50. onShow() {
  51. },
  52. methods: {
  53. handleSelect(){
  54. this.$emit('changeTime', this.selectedTime);
  55. this.$refs.popup.close();
  56. },
  57. close(){
  58. this.$refs.popup.close();
  59. this.selectedTime=''
  60. },
  61. open(){
  62. // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
  63. this.$refs.popup.open('bottom');
  64. this.getOrderTimes()
  65. },
  66. selectTimeList (time) {
  67. console.log(time)
  68. this.timeItemList = time.timeList || []
  69. this.selectedDate = time.date
  70. },
  71. selectTime (time, type) {
  72. if (type !== 1) {
  73. return
  74. }
  75. this.selectedTime = time
  76. },
  77. getOrderTimes(){
  78. uni.showLoading({
  79. title: '加载中'
  80. });
  81. var yyshopInfo = uni.getStorageSync("yyshopInfo");
  82. this.$http('opendetail/getOrderTimes', {
  83. shopId:yyshopInfo.id,
  84. }, 'GET').then(res => {
  85. uni.hideLoading();
  86. this.timeList = res.data || []
  87. if (!this.timeList[0]) return
  88. this.timeItemList = this.timeList[0].timeList || []
  89. this.selectedDate = this.timeList[0].date || ''
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped lang="less">
  96. .timeSelectBox{
  97. }
  98. .timeBOx{
  99. width: 750rpx;
  100. height: 55vh;
  101. position: fixed;
  102. bottom: 0;
  103. left: 0;
  104. }
  105. .time-select-popup .time-select-popup-body .time-select-popup-body-time .time-select-popup-body-time-list .time-select-popup-body-time-ltem .time-select-popup-body-time-ltem-body.select{
  106. color: #FF7D30;
  107. }
  108. .time-select-popup-header {
  109. position: relative;
  110. border-bottom: 1px solid #EEEEEE;
  111. padding-top: 10rpx;
  112. height: 90rpx;
  113. line-height: 90rpx;
  114. border-radius: 24rpx 24rpx 0px 0px;
  115. overflow: hidden;
  116. background: #fff;
  117. .h4 {
  118. font-size: 32rpx;
  119. color: #333333;
  120. font-weight: 500;
  121. padding-left: 24rpx;
  122. }
  123. .cancle-text {
  124. position: absolute;
  125. right: 5%;
  126. line-height: 90rpx;
  127. font-size: 28rpx;
  128. color: #999999;
  129. top: 0;
  130. }
  131. }
  132. .time-select-popup-body{
  133. display: flex;
  134. background: #fff;
  135. }
  136. .time-select-popup-body-left-item{
  137. width: 172rpx;
  138. height: 94rpx;
  139. display: block;
  140. font-size:26rpx;
  141. font-family:PingFangSC-Regular,PingFang SC;
  142. font-weight:400;
  143. color:rgba(102,102,102,1);
  144. padding-left: 25rpx;
  145. line-height:94rpx;
  146. background:rgba(250,250,250,1);
  147. border-bottom:1px solid rgba(238,238,238,1);
  148. position: relative;
  149. &.selected{
  150. font-size:26rpx;
  151. font-family:PingFangSC-Medium,PingFang SC;
  152. font-weight:500;
  153. color:rgba(51,51,51,1);
  154. background:rgba(255,255,255,1);
  155. &:before{
  156. display: block;
  157. content: '';
  158. width: 6rpx;
  159. height: 30rpx;
  160. background:rgba(63,144,247,1);
  161. position: absolute;
  162. left: 0;
  163. top: 32rpx;
  164. }
  165. }
  166. }
  167. .time-select-popup-body-time {
  168. width: 578rpx;
  169. .time-select-popup-body-time-list {
  170. display: flex;
  171. align-content: flex-start;
  172. flex-wrap: wrap;
  173. align-items:baseline;
  174. background-color: rgb(255, 255, 255);
  175. height:calc(50vh - 120rpx);
  176. overflow-y: auto;
  177. .time-select-popup-body-time-ltem{
  178. width: 33.3% ;
  179. padding: 20rpx;
  180. box-sizing: border-box;
  181. text-align: center;
  182. .time-select-popup-body-time-ltem-body{
  183. padding-top: 12px;
  184. color: rgb(153, 153, 153);
  185. border-radius: 10rpx;
  186. height: 80rpx;
  187. border: 2rpx solid #DDDDDD;
  188. }
  189. .time-select-popup-body-time-ltem-body.not{
  190. background-color: #F7F7F7;
  191. height: 80rpx;
  192. border: 2rpx solid #DDDDDD;
  193. cursor: no-drop;
  194. }
  195. .time-select-popup-body-time-ltem-body.select{
  196. background-color: rgb(255, 255, 255);
  197. height: 80rpx;
  198. border: 1px solid #FF0000;
  199. color:#FF0000 !important;
  200. position: relative;
  201. &:before{
  202. position: absolute;
  203. content: '';
  204. display: block;
  205. background: url("http://dmsphoto.66km.com.cn/thFiles/5F4D0178-AB5D-491F-906C-414AFDC84FF1.png") 100% 0 no-repeat;
  206. background-size: contain;
  207. top: -2rpx;
  208. right: -2rpx;
  209. height: 50rpx;
  210. width: 50rpx;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .time1{
  217. font-size: 24rpx;
  218. }
  219. .time2{
  220. font-size: 24rpx;
  221. }
  222. .timeSelect--select .time1{
  223. color: #FF0000;
  224. }
  225. .timeSelect--select .time2{
  226. color: #FF0000;
  227. }
  228. .time-select-popup-body-button{
  229. position: fixed;
  230. bottom: 0;
  231. left: 0;
  232. width: 750rpx;
  233. color: #ffffff;
  234. height: 100rpx;
  235. line-height: 100rpx;
  236. background: #FF0000;
  237. font-size: 32rpx;
  238. text-align: center;
  239. }
  240. </style>