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.

388 lines
8.3 KiB

8 months ago
8 months ago
  1. <template>
  2. <view class="collect">
  3. <mNavbar title="我的收藏" :leftClick="leftClick"></mNavbar>
  4. <view v-if="collectList.length > 0" class="collect-list">
  5. <view @click="gototechnicianDetail(item.technician)" v-for="item in collectList" :key="item.id" class="collect-item">
  6. <view class="collect-main">
  7. <view class="technician-head b-relative">
  8. <view class="img-box">
  9. <image :src="item.technician.image" mode="aspectFill" class="bg"></image>
  10. <image v-if="item.technician.icon" :src="item.technician.icon" mode="aspectFit" class="hot">
  11. </image>
  12. <view v-if="item.technician.bookable == 'Y'" class="available-for-service">
  13. <image src="@/static/address/lightning-icon.png" mode="aspectFit"></image>
  14. <text class="desc">可服务</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="detail-info">
  19. <view class="technician-base-info">
  20. <view class="name-and-level">
  21. <view class="technician-name">{{ item.technician.title }}</view>
  22. <van-icon name="star" color="#E8615E" size="25rpx" />
  23. <text class="score">{{ item.technician.level }}</text>
  24. </view>
  25. <view @click.stop="calcelCollect(item.technician.id)" class="alert-collect">
  26. <image src="@/static/collect/alert-collect-icon.png"></image>
  27. <text class="alert-add-collect">取消收藏</text>
  28. </view>
  29. </view>
  30. <view class="appointed-time">
  31. <view class="capsule">
  32. <view class="earliest-reducible">最早可约</view>
  33. <view class="today">今天{{ item.technician.useTime}}</view>
  34. </view>
  35. </view>
  36. <view class="technician-desc">
  37. {{ item.technician.notes }}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="public-praise">
  42. <view class="server-num">已服务{{ item.technician.isFw }}+</view>
  43. <view class="evaluate-collect-subscribe">
  44. <view class="evaluate-collect">
  45. <image src="@/static/collect/review-icon.png" mode="aspectFit"></image>
  46. <view class="evaluate-num">{{item.technician.pinNum}}评价</view>
  47. <image src="@/static/collect/alert-collect-icon.png" mode="aspectFit"></image>
  48. <view class="collect-num">{{ item.technician.collectNum }}收藏</view>
  49. </view>
  50. <view @click="gototechnicianDetail(item.technician)" class="subscribe"
  51. :class="{ notAvailable : item.technician.bookable != 'Y' }">立即预约</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <van-empty v-else image="/static/empty/collect.png" image-size="400rpx" description="暂无收藏技师"/>
  57. </view>
  58. </template>
  59. <script>
  60. import mNavbar from '../../components/base/m-navbar.vue'
  61. import {
  62. showConfirmDialog
  63. } from 'vant';
  64. export default {
  65. components: {
  66. mNavbar
  67. },
  68. data() {
  69. return {
  70. queryParams: {
  71. pageNo: 1,
  72. pageSize: 10
  73. },
  74. collectList: [],
  75. }
  76. },
  77. onShow() {
  78. this.getList()
  79. },
  80. methods: {
  81. //list列表滑动到底部自动新增数据列表
  82. onLoad() {
  83. this.queryParams.pageSize += 10
  84. this.getAddressList()
  85. },
  86. //返回个人中心
  87. leftClick() {
  88. uni.switchTab({
  89. url: '/pages/index/center'
  90. })
  91. },
  92. //获取收藏列表
  93. getList() {
  94. this.$api('getCollectList', this.queryParams, res => {
  95. if (res.code == 200) {
  96. this.collectList = res.result.records
  97. }
  98. })
  99. },
  100. //跳转技师详情
  101. gototechnicianDetail(technician) {
  102. uni.navigateTo({
  103. url: '/pages/technician/technicianDetail?id=' + technician.id
  104. })
  105. },
  106. //取消收藏
  107. calcelCollect(tenId) {
  108. showConfirmDialog({
  109. title: '删除收藏',
  110. message: '确认取消此收藏?取消后数据不可恢复',
  111. }).then(() => {
  112. this.$api('calcelCollect', {
  113. tenId
  114. }, res => {
  115. if (res.code == 200) {
  116. uni.showToast({
  117. title: '取消成功',
  118. icon: 'none'
  119. })
  120. this.getList()
  121. }
  122. })
  123. }).catch(() => {});
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .collect {
  130. width: 750rpx;
  131. margin: 0 auto;
  132. background: #F5F5F5;
  133. min-height: 100vh;
  134. box-sizing: border-box;
  135. .collect-list {
  136. padding: 20rpx;
  137. .collect-item {
  138. background: white;
  139. border-radius: 20rpx;
  140. padding: 20rpx;
  141. margin-bottom: 20rpx;
  142. .collect-main {
  143. display: flex;
  144. .technician-head {
  145. width: 150rpx;
  146. height: 150rpx;
  147. border-radius: 10rpx;
  148. border: 1px solid #5EBAA2;
  149. .img-box {
  150. .bg {
  151. width: 150rpx;
  152. height: 150rpx;
  153. border-radius: 10rpx;
  154. overflow: hidden;
  155. &::v-deep div {
  156. background-position: center top !important;
  157. background-size: 100% !important;
  158. }
  159. image {
  160. width: 100%;
  161. }
  162. }
  163. .hot {
  164. position: absolute;
  165. left: -28rpx;
  166. top: -34rpx;
  167. width: 80rpx;
  168. height: 80rpx;
  169. }
  170. .available-for-service {
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. position: absolute;
  175. left: 50%;
  176. bottom: -13rpx;
  177. width: 70%;
  178. height: 40rpx;
  179. background: #60C285;
  180. border-radius: 10rpx;
  181. color: white;
  182. transform: translate(-50%);
  183. .desc {
  184. font-size: 18rpx;
  185. }
  186. image {
  187. width: 23rpx;
  188. height: 23rpx;
  189. vertical-align: middle;
  190. }
  191. }
  192. }
  193. }
  194. .detail-info {
  195. display: flex;
  196. flex-direction: column;
  197. justify-content: space-between;
  198. width: calc(100% - 150rpx);
  199. padding-left: 15rpx;
  200. .technician-base-info {
  201. display: flex;
  202. justify-content: space-between;
  203. height: 45rpx;
  204. .name-and-level {
  205. display: flex;
  206. align-items: center;
  207. .technician-name {
  208. color: #333;
  209. font-size: 28rpx;
  210. font-weight: 500;
  211. margin-right: 10rpx;
  212. }
  213. .score {
  214. color: #E8615E;
  215. margin-left: 5rpx;
  216. font-size: 20rpx;
  217. }
  218. }
  219. .alert-collect {
  220. display: flex;
  221. align-items: center;
  222. color: #6E6E6E;
  223. font-size: 20rpx;
  224. .alert-add-collect {
  225. margin-left: 5rpx;
  226. color: #FC9A37;
  227. }
  228. }
  229. text {
  230. display: block;
  231. }
  232. }
  233. .appointed-time {
  234. width: 48%;
  235. background: #E7FDF7;
  236. height: 40rpx;
  237. border-radius: 22.5rpx;
  238. font-size: 20rpx;
  239. color: #5DB9A3;
  240. .capsule {
  241. display: flex;
  242. height: 100%;
  243. align-items: center;
  244. .earliest-reducible {
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. width: 50%;
  249. height: 100%;
  250. color: white;
  251. border-radius: 20rpx;
  252. background: #52CFB0;
  253. }
  254. .today {
  255. width: 50%;
  256. text-align: center;
  257. }
  258. }
  259. }
  260. .technician-desc {
  261. color: #666666;
  262. overflow: hidden;
  263. min-height: 2em;
  264. font-size: 22rpx;
  265. display: -webkit-box;
  266. -webkit-box-orient: vertical;
  267. -webkit-line-clamp: 2;
  268. text-overflow: ellipsis;
  269. }
  270. image {
  271. width: 25rpx;
  272. height: 25rpx;
  273. }
  274. }
  275. }
  276. .public-praise {
  277. display: flex;
  278. align-items: center;
  279. margin-top: 20rpx;
  280. font-size: 26rpx;
  281. .server-num {
  282. width: 170rpx;
  283. font-size: 22rpx;
  284. color: #666666;
  285. white-space: nowrap;
  286. overflow: hidden;
  287. text-overflow: ellipsis;
  288. }
  289. .evaluate-collect-subscribe {
  290. width: calc(100% - 170rpx);
  291. display: flex;
  292. justify-content: space-between;
  293. padding-left: 15rpx;
  294. .evaluate-collect {
  295. display: flex;
  296. align-items: center;
  297. .evaluate-num {
  298. color: #B6B6B6;
  299. margin-right: 20rpx;
  300. }
  301. .collect-num {
  302. color: #B6B6B6;
  303. }
  304. image {
  305. margin-right: 5rpx;
  306. }
  307. }
  308. .subscribe {
  309. display: flex;
  310. align-items: center;
  311. justify-content: center;
  312. height: 60rpx;
  313. width: 180rpx;
  314. border-radius: 40rpx;
  315. color: white;
  316. background: linear-gradient(170deg, #53CEAC, #5AC796);
  317. }
  318. .notAvailable {
  319. background: #ccc;
  320. }
  321. }
  322. image {
  323. width: 25rpx;
  324. height: 25rpx;
  325. }
  326. }
  327. }
  328. }
  329. }
  330. </style>