timeSelect.vue 6.7 KB

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