chooseServiceTime.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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(item,index)">
  11. <view class="flex-col justify-center timeItem" :class="{selectBack: item.label == label}">
  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. data() {
  38. return {
  39. label:'',
  40. selectIndex:0,
  41. periodDateList: []
  42. }
  43. },
  44. methods: {
  45. submit(){
  46. this.$emit("getPeriodDate",this.periodDateList[this.selectIndex])
  47. this.closePopup()
  48. },
  49. closePopup() {
  50. this.$refs.chooseServiceTimePopup.close()
  51. },
  52. selectPeriod(e,index){
  53. this.label = e.label
  54. this.selectIndex = index
  55. },
  56. openPopup(personId, date,storeId,childService,selectChildService,label) {
  57. this.$refs.chooseServiceTimePopup.open()
  58. this.label =label
  59. this.getServiceTime(personId, date,storeId,childService,selectChildService)
  60. },
  61. //获取门店排班时段
  62. getServiceTime(personId, date,storeId,childService,selectChildService) {
  63. this.$api.getServicePersonTime({
  64. personId:personId,
  65. date: date,
  66. storeId:storeId
  67. }).then(res => {
  68. let periodTimeList = res.data.data
  69. let selectServiceObjectList = childService.filter(selectServiceObject =>
  70. (selectServiceObject.serviceUserId === personId
  71. && selectServiceObject.serviceObjectId !== childService[selectChildService].serviceObjectId)
  72. || selectServiceObject.serviceUserId === -1
  73. )
  74. selectServiceObjectList.forEach(selectServiceObject =>{
  75. periodTimeList.forEach(periodTime =>{
  76. if (selectServiceObject.serviceStartTime === periodTime.label ){
  77. periodTime.total = periodTime.total - 1
  78. }
  79. })
  80. })
  81. periodTimeList = periodTimeList.filter(periodTime=> periodTime.total>0)
  82. console.log(periodTimeList)
  83. this.periodDateList = periodTimeList
  84. // if (this.periodTimeList.length === 0) {
  85. // uni.$u.toast('暂无排班时段')
  86. // }
  87. })
  88. },
  89. }
  90. }
  91. </script>
  92. <style scoped lang="scss">
  93. .chooseServiceTimeView {
  94. width: 750rpx;
  95. height: 850rpx;
  96. background: #FFFFFF;
  97. border-radius: 24rpx 24rpx 0rpx 0rpx;
  98. }
  99. .chooseServiceTimeTitle {
  100. font-size: 32rpx;
  101. font-weight: bold;
  102. color: #333333;
  103. line-height: 44rpx;
  104. margin-left: 34rpx;
  105. padding-top: 26rpx;
  106. }
  107. .scrollY {
  108. width: 730rpx;
  109. height: 604rpx;
  110. margin-top: 8rpx;
  111. margin-left: 10rpx;
  112. }
  113. .timeItem {
  114. width: 124rpx;
  115. height: 124rpx;
  116. background: #FAFAFA;
  117. border-radius: 16rpx;
  118. margin-top: 16rpx;
  119. }
  120. .time {
  121. font-size: 24rpx;
  122. color: #333333;
  123. line-height: 40rpx;
  124. }
  125. .price {
  126. font-size: 24rpx;
  127. color: #ED569F;
  128. line-height: 40rpx;
  129. }
  130. .chooseServiceTeacherButton {
  131. width: 686rpx;
  132. height: 80rpx;
  133. margin-left: 32rpx;
  134. margin-top: 32rpx;
  135. }
  136. .chooseServiceTeacherButtonL {
  137. width: 332rpx;
  138. height: 80rpx;
  139. background: #F5F5F5;
  140. border-radius: 54rpx;
  141. text-align: center;
  142. line-height: 80rpx;
  143. font-size: 28rpx;
  144. font-weight: 400;
  145. color: #666666;
  146. }
  147. .chooseServiceTeacherButtonR {
  148. width: 332rpx;
  149. height: 80rpx;
  150. background: #FFE05C;
  151. border-radius: 54rpx;
  152. text-align: center;
  153. line-height: 80rpx;
  154. font-size: 28rpx;
  155. font-weight: 400;
  156. color: #333333;
  157. }
  158. .serobV {
  159. width: 32rpx;
  160. height: 32rpx;
  161. position: absolute;
  162. top: 0;
  163. right: 0;
  164. }
  165. .serobVicon {
  166. width: 32rpx;
  167. height: 32rpx;
  168. }
  169. .selectBack {
  170. background: rgba(255, 224, 92, 0.1);
  171. border: 4rpx solid #FFE05C;
  172. box-sizing:border-box
  173. }
  174. </style>