chooseServiceTime.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view>
  3. <uni-popup ref="chooseServiceTimePopup" :catchtouchmove="true" type="bottom">
  4. <view class="chooseServiceTimeView">
  5. <view class="chooseServiceTimeTitle">
  6. <text>选择服务时段</text>
  7. </view>
  8. <scroll-view class="scrollY" scroll-y>
  9. <u-grid :border="false" col="5">
  10. <u-grid-item v-for="(item,index) in periodDateList" :key="index" @click="selectPeriod(index)">
  11. <view class="flex-col justify-center timeItem" :class="{selectBack: index == selectIndex}">
  12. <view class="flex-row justify-center">
  13. <text class="time">{{item.label}}</text>
  14. </view>
  15. <view class="flex-row justify-center">
  16. <text class="price">¥{{item.price}}</text>
  17. </view>
  18. </view>
  19. </u-grid-item>
  20. </u-grid>
  21. </scroll-view>
  22. <view class="flex-row justify-between chooseServiceTeacherButton">
  23. <view class="chooseServiceTeacherButtonL" @click="closePopup">
  24. <text>取消</text>
  25. </view>
  26. <view class="chooseServiceTeacherButtonR" @click="submit">
  27. <text>确定</text>
  28. </view>
  29. </view>
  30. </view>
  31. </uni-popup>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'chooseServiceTime',
  37. props: {
  38. personId: {
  39. type: String,
  40. default () {
  41. return ''
  42. }
  43. },
  44. date: {
  45. type: String,
  46. default () {
  47. return ''
  48. }
  49. }
  50. },
  51. data() {
  52. return {
  53. selectIndex:0,
  54. periodDateList: []
  55. }
  56. },
  57. methods: {
  58. submit(){
  59. this.$emit("getPeriodDate",this.periodDateList[this.selectIndex])
  60. this.closePopup()
  61. },
  62. closePopup() {
  63. this.$refs.chooseServiceTimePopup.close()
  64. },
  65. selectPeriod(e){
  66. this.selectIndex = e
  67. },
  68. openPopup() {
  69. this.$refs.chooseServiceTimePopup.open()
  70. this.getServiceTime()
  71. },
  72. //获取门店排班时段
  73. getServiceTime(storeId, date) {
  74. this.$api.getServicePersonTime({
  75. personId: this.personId,
  76. date: this.date
  77. }).then(res => {
  78. this.periodDateList = res.data.data
  79. // if (this.periodTimeList.length === 0) {
  80. // uni.$u.toast('暂无排班时段')
  81. // }
  82. })
  83. },
  84. }
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. .chooseServiceTimeView {
  89. width: 750rpx;
  90. height: 850rpx;
  91. background: #FFFFFF;
  92. border-radius: 24rpx 24rpx 0rpx 0rpx;
  93. }
  94. .chooseServiceTimeTitle {
  95. font-size: 32rpx;
  96. font-weight: bold;
  97. color: #333333;
  98. line-height: 44rpx;
  99. margin-left: 34rpx;
  100. padding-top: 26rpx;
  101. }
  102. .scrollY {
  103. width: 730rpx;
  104. height: 604rpx;
  105. margin-top: 8rpx;
  106. margin-left: 10rpx;
  107. }
  108. .timeItem {
  109. width: 124rpx;
  110. height: 124rpx;
  111. background: #FAFAFA;
  112. border-radius: 16rpx;
  113. margin-top: 16rpx;
  114. }
  115. .time {
  116. font-size: 24rpx;
  117. color: #333333;
  118. line-height: 40rpx;
  119. }
  120. .price {
  121. font-size: 24rpx;
  122. color: #ED569F;
  123. line-height: 40rpx;
  124. }
  125. .chooseServiceTeacherButton {
  126. width: 686rpx;
  127. height: 80rpx;
  128. margin-left: 32rpx;
  129. margin-top: 32rpx;
  130. }
  131. .chooseServiceTeacherButtonL {
  132. width: 332rpx;
  133. height: 80rpx;
  134. background: #F5F5F5;
  135. border-radius: 54rpx;
  136. text-align: center;
  137. line-height: 80rpx;
  138. font-size: 28rpx;
  139. font-weight: 400;
  140. color: #666666;
  141. }
  142. .chooseServiceTeacherButtonR {
  143. width: 332rpx;
  144. height: 80rpx;
  145. background: #FFE05C;
  146. border-radius: 54rpx;
  147. text-align: center;
  148. line-height: 80rpx;
  149. font-size: 28rpx;
  150. font-weight: 400;
  151. color: #333333;
  152. }
  153. .serobV {
  154. width: 32rpx;
  155. height: 32rpx;
  156. position: absolute;
  157. top: 0;
  158. right: 0;
  159. }
  160. .serobVicon {
  161. width: 32rpx;
  162. height: 32rpx;
  163. }
  164. .selectBack {
  165. background: rgba(255, 224, 92, 0.1);
  166. border: 4rpx solid #FFE05C;
  167. }
  168. </style>