chooseServiceTime.vue 4.8 KB

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