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.

282 lines
6.0 KiB

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