You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 lines
4.8 KiB

8 months ago
  1. <template>
  2. <view v-if="technicianList.length > 0" v-for="item in technicianList" :key="item.id" class="technician-item"
  3. @click="select(item)">
  4. <view class="technician-img-and-status">
  5. <view class="img-box">
  6. <image :src="item.image" mode="widthFix"></image>
  7. </view>
  8. <view v-if="item.bookable == 'Y'" class="technician-status">
  9. 可服务
  10. </view>
  11. </view>
  12. <view class="technician-server-info">
  13. <view class="technician-server-top">
  14. <view class="technician-name">
  15. <text class="name">{{ item.title }}</text>
  16. <text class="btn">更多照片</text>
  17. </view>
  18. <view class="appointed-time">
  19. <view class="capsule">
  20. <view class="earliest-reducible">最早可约</view>
  21. <view class="today">今天{{ item.useTime}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="technician-server-center">
  26. <view class="server-num">
  27. 已服务{{ item.isFw }}
  28. </view>
  29. <view class="position">
  30. <view class="position-icon">
  31. <image src="@/static/technician/position.png" mode="aspectFill"></image>
  32. </view>
  33. <view class="distance">
  34. {{ item.setKmOpen ? item.setKm : item.km || 0 }}km
  35. </view>
  36. </view>
  37. </view>
  38. <view class="technician-server-bottom">
  39. <view class="evaluate">
  40. <view class="evaluate-icon">
  41. <image src="@/static/technician/evaluate-icon.png"></image>
  42. </view>
  43. <view class="evaluate-title">
  44. 评价
  45. </view>
  46. </view>
  47. <view class="book-now" :class="{ notAvailable : item.bookable != 'Y'}">
  48. {{ item.bookable != 'Y' ? '不可预约' : '立即预约' }}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <van-empty v-else image="/static/empty/data.png" image-size="400rpx" description="此项目暂无技师服务"/>
  54. </template>
  55. <script>
  56. import Position from '@/utils/position.js'
  57. export default {
  58. name:"selectTechnicianCompoents",
  59. props : ['technicianList', "select"],
  60. data() {
  61. return {
  62. }
  63. },
  64. created(){
  65. this.calculatedDistance()
  66. },
  67. methods : {
  68. calculatedDistance(){ //计算距离
  69. Position.getLocation(result => {
  70. this.technicianList.forEach(item => {
  71. let distance = Position.calculateDistance(result.latitude,result.longitude,item.latitude,item.longitude)
  72. item.km = distance;
  73. })
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. .technician-item {
  81. display: flex;
  82. background: white;
  83. padding: 20rpx;
  84. margin-bottom: 20rpx;
  85. .technician-img-and-status {
  86. position: relative;
  87. height: 150rpx;
  88. display: flex;
  89. flex-direction: column;
  90. justify-content: space-between;
  91. .img-box {
  92. width: 150rpx;
  93. height: 150rpx;
  94. background: #ccc;
  95. border-radius: 10rpx;
  96. overflow: hidden;
  97. image{
  98. width: 150rpx;
  99. }
  100. }
  101. .technician-status {
  102. display: flex;
  103. justify-content: center;
  104. align-items: center;
  105. position: absolute;
  106. left: 10%;
  107. bottom: -15rpx;
  108. background: #55CCA7;
  109. width: 80%;
  110. color: white;
  111. font-size: 22rpx;
  112. height: 35rpx;
  113. border-radius: 5rpx;
  114. }
  115. }
  116. .technician-server-info {
  117. display: flex;
  118. width: calc(100% - 150rpx);
  119. padding: 0rpx 20rpx;
  120. flex-direction: column;
  121. justify-content: space-between;
  122. .technician-server-top {
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. font-size: 26rpx;
  127. .technician-name {
  128. .name {
  129. font-weight: 600;
  130. margin-right: 10rpx;
  131. }
  132. .btn {
  133. border: 1px solid #55CCA7;
  134. color: #55CCA7;
  135. font-size: 20rpx;
  136. padding: 5rpx;
  137. border-radius: 5rpx;
  138. }
  139. }
  140. .appointed-time {
  141. width: 40%;
  142. background: #E7FDF7;
  143. height: 40rpx;
  144. border-radius: 22.5rpx;
  145. font-size: 20rpx;
  146. color: #5DB9A3;
  147. .capsule {
  148. display: flex;
  149. height: 100%;
  150. align-items: center;
  151. .earliest-reducible {
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. width: 50%;
  156. height: 100%;
  157. color: white;
  158. border-radius: 20rpx;
  159. background: #52CFB0;
  160. }
  161. .today {
  162. width: 50%;
  163. text-align: center;
  164. }
  165. }
  166. }
  167. }
  168. .technician-server-center {
  169. display: flex;
  170. align-items: center;
  171. font-size: 26rpx;
  172. color: #888;
  173. .position {
  174. display: flex;
  175. margin-left: 10rpx;
  176. }
  177. image {
  178. width: 25rpx;
  179. height: 25rpx;
  180. }
  181. }
  182. .technician-server-bottom {
  183. display: flex;
  184. justify-content: space-between;
  185. .evaluate{
  186. display: flex;
  187. align-items: center;
  188. color: #333;
  189. font-size: 20rpx;
  190. .evaluate-icon{
  191. margin-right: 10rpx;
  192. }
  193. }
  194. .book-now{
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. height: 50rpx;
  199. width: 160rpx;
  200. border-radius: 40rpx;
  201. color: white;
  202. background: linear-gradient(170deg, #53CEAC, #5AC796);
  203. font-size: 24rpx;
  204. }
  205. .notAvailable{
  206. background: #ccc;
  207. }
  208. image{
  209. width: 25rpx;
  210. height: 25rpx;
  211. }
  212. }
  213. }
  214. }
  215. </style>