timeSelect.vue 6.7 KB

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