timeSelect.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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{
  143. height: calc(50vh - 120rpx);
  144. overflow-y: auto;
  145. width: 200rpx;
  146. }
  147. .time-select-popup-body-left-item{
  148. width: 168rpx;
  149. height: 94rpx;
  150. display: block;
  151. font-size:26rpx;
  152. font-family:PingFangSC-Regular,PingFang SC;
  153. font-weight:400;
  154. color:rgba(102,102,102,1);
  155. padding-left: 25rpx;
  156. line-height:94rpx;
  157. background:rgba(250,250,250,1);
  158. border-bottom:1px solid rgba(238,238,238,1);
  159. position: relative;
  160. &.selected{
  161. font-size:26rpx;
  162. font-family:PingFangSC-Medium,PingFang SC;
  163. font-weight:500;
  164. color:rgba(51,51,51,1);
  165. background:rgba(255,255,255,1);
  166. &:before{
  167. /* display: block;
  168. content: '';
  169. width: 6rpx;
  170. height: 30rpx;
  171. background:#D53533;
  172. position: absolute;
  173. left: 0;
  174. top: 32rpx; */
  175. }
  176. }
  177. }
  178. .time-select-popup-body-time {
  179. width: 578rpx;
  180. .time-select-popup-body-time-list {
  181. display: flex;
  182. align-content: flex-start;
  183. flex-wrap: wrap;
  184. align-items:baseline;
  185. background-color: rgb(255, 255, 255);
  186. height:calc(50vh - 120rpx);
  187. overflow-y: auto;
  188. .time-select-popup-body-time-ltem{
  189. width: 33.3% ;
  190. padding: 20rpx;
  191. box-sizing: border-box;
  192. text-align: center;
  193. .time-select-popup-body-time-ltem-body{
  194. padding-top: 12px;
  195. color: rgb(153, 153, 153);
  196. border-radius: 10rpx;
  197. height: 80rpx;
  198. border: 2rpx solid #DDDDDD;
  199. }
  200. .time-select-popup-body-time-ltem-body.not{
  201. background-color: #F7F7F7;
  202. height: 80rpx;
  203. border: 2rpx solid #DDDDDD;
  204. cursor: no-drop;
  205. }
  206. .time-select-popup-body-time-ltem-body.select{
  207. background-color: rgb(255, 255, 255);
  208. height: 80rpx;
  209. border: 1px solid #FF0000;
  210. color:#D53533 !important;
  211. position: relative;
  212. &:before{
  213. position: absolute;
  214. content: '';
  215. display: block;
  216. background: url("http://dmsphoto.66km.com.cn/thFiles/5F4D0178-AB5D-491F-906C-414AFDC84FF1.png") 100% 0 no-repeat;
  217. background-size: contain;
  218. top: -2rpx;
  219. right: -2rpx;
  220. height: 50rpx;
  221. width: 50rpx;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. .time1{
  228. font-size: 24rpx;
  229. }
  230. .time2{
  231. font-size: 24rpx;
  232. }
  233. .timeSelect--select .time1{
  234. color: #FF0000;
  235. }
  236. .timeSelect--select .time2{
  237. color: #FF0000;
  238. }
  239. .time-select-popup-body-button{
  240. position: fixed;
  241. bottom: 0;
  242. left: 0;
  243. width: 750rpx;
  244. color: #ffffff;
  245. height: 100rpx;
  246. line-height: 100rpx;
  247. background: #D53533;
  248. font-size: 32rpx;
  249. text-align: center;
  250. }
  251. </style>