timeSelect.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. if(this.stationID){
  88. var cs={
  89. shopId:yyshopInfo.id,
  90. stationID:this.stationID
  91. }
  92. }else{
  93. var cs={
  94. shopId:yyshopInfo.id,
  95. }
  96. }
  97. this.$http('opendetail/getOrderTimes', cs, 'GET').then(res => {
  98. uni.hideLoading();
  99. this.timeList = res.data || []
  100. if (!this.timeList[0]) return
  101. this.timeItemList = this.timeList[0].timeList || []
  102. this.selectedDate = this.timeList[0].date || ''
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="less">
  109. .timeSelectBox{
  110. }
  111. .timeBOx{
  112. width: 750rpx;
  113. height: 55vh;
  114. position: fixed;
  115. bottom: 0;
  116. left: 0;
  117. }
  118. .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{
  119. color: #FF7D30;
  120. }
  121. .time-select-popup-header {
  122. position: relative;
  123. border-bottom: 1px solid #EEEEEE;
  124. padding-top: 10rpx;
  125. height: 90rpx;
  126. line-height: 90rpx;
  127. border-radius: 24rpx 24rpx 0px 0px;
  128. overflow: hidden;
  129. background: #fff;
  130. .h4 {
  131. font-size: 32rpx;
  132. color: #333333;
  133. font-weight: 500;
  134. padding-left: 24rpx;
  135. }
  136. .cancle-text {
  137. position: absolute;
  138. right: 5%;
  139. line-height: 90rpx;
  140. font-size: 28rpx;
  141. color: #999999;
  142. top: 0;
  143. }
  144. }
  145. .time-select-popup-body{
  146. display: flex;
  147. background: #fff;
  148. }
  149. .time-select-popup-body-left{
  150. height: calc(50vh - 120rpx);
  151. overflow-y: auto;
  152. width: 200rpx;
  153. }
  154. .time-select-popup-body-left-item{
  155. width: 168rpx;
  156. height: 94rpx;
  157. display: block;
  158. font-size:26rpx;
  159. font-family:PingFangSC-Regular,PingFang SC;
  160. font-weight:400;
  161. color:rgba(102,102,102,1);
  162. padding-left: 25rpx;
  163. line-height:94rpx;
  164. background:rgba(250,250,250,1);
  165. border-bottom:1px solid rgba(238,238,238,1);
  166. position: relative;
  167. &.selected{
  168. font-size:26rpx;
  169. font-family:PingFangSC-Medium,PingFang SC;
  170. font-weight:500;
  171. color:rgba(51,51,51,1);
  172. background:rgba(255,255,255,1);
  173. &:before{
  174. /* display: block;
  175. content: '';
  176. width: 6rpx;
  177. height: 30rpx;
  178. background:#D53533;
  179. position: absolute;
  180. left: 0;
  181. top: 32rpx; */
  182. }
  183. }
  184. }
  185. .time-select-popup-body-time {
  186. width: 578rpx;
  187. .time-select-popup-body-time-list {
  188. display: flex;
  189. align-content: flex-start;
  190. flex-wrap: wrap;
  191. align-items:baseline;
  192. background-color: rgb(255, 255, 255);
  193. height:calc(50vh - 120rpx);
  194. overflow-y: auto;
  195. .time-select-popup-body-time-ltem{
  196. width: 33.3% ;
  197. padding: 20rpx;
  198. box-sizing: border-box;
  199. text-align: center;
  200. .time-select-popup-body-time-ltem-body{
  201. padding-top: 12px;
  202. color: rgb(153, 153, 153);
  203. border-radius: 10rpx;
  204. height: 80rpx;
  205. border: 2rpx solid #DDDDDD;
  206. }
  207. .time-select-popup-body-time-ltem-body.not{
  208. background-color: #F7F7F7;
  209. height: 80rpx;
  210. border: 2rpx solid #DDDDDD;
  211. cursor: no-drop;
  212. }
  213. .time-select-popup-body-time-ltem-body.select{
  214. background-color: rgb(255, 255, 255);
  215. height: 80rpx;
  216. border: 1px solid #FF0000;
  217. color:#D53533 !important;
  218. position: relative;
  219. &:before{
  220. position: absolute;
  221. content: '';
  222. display: block;
  223. background: url("http://dmsphoto.66km.com.cn/thFiles/5F4D0178-AB5D-491F-906C-414AFDC84FF1.png") 100% 0 no-repeat;
  224. background-size: contain;
  225. top: -2rpx;
  226. right: -2rpx;
  227. height: 50rpx;
  228. width: 50rpx;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. .time1{
  235. font-size: 24rpx;
  236. }
  237. .time2{
  238. font-size: 24rpx;
  239. }
  240. .timeSelect--select .time1{
  241. color: #FF0000;
  242. }
  243. .timeSelect--select .time2{
  244. color: #FF0000;
  245. }
  246. .time-select-popup-body-button{
  247. position: fixed;
  248. bottom: 0;
  249. left: 0;
  250. width: 750rpx;
  251. color: #ffffff;
  252. height: 100rpx;
  253. line-height: 100rpx;
  254. background: #D53533;
  255. font-size: 32rpx;
  256. text-align: center;
  257. }
  258. </style>