course.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="course-card">
  3. <view class="course-tips">
  4. <view class="">!</view>
  5. <view class="">全平台每种类型的运动课程只可免费试听一次</view>
  6. </view>
  7. <view class="select-btn">
  8. <view :class="sel_btn===index?'distance':'score'" v-for="(item,index) in selectList" :key="index"
  9. @click="select_btn(item,index)">{{item.name}}</view>
  10. </view>
  11. <view class="venue-card" v-for="item in listData" :key="item.id" @click="toCourseDetail(item)">
  12. <image :src="item.cover" mode=""></image>
  13. <view class="venue-info">
  14. <view class="info-title">
  15. <view class="title textHidden">{{item.name}}</view>
  16. <view class="sales">年售{{item.salesYear}}</view>
  17. </view>
  18. <view class="type">
  19. 上课地点:{{item.address}} | {{item.km||'--'}}km
  20. </view>
  21. <view class="type">
  22. {{item.count||'0'}}课时 {{item.startTime}}-{{item.endTime}}
  23. </view>
  24. <view class="price">
  25. <view class="">¥{{item.sellingPrice}}</view>
  26. <view class="">¥{{item.originalPrice}}</view>
  27. </view>
  28. <view class="price-info">
  29. <view class="sale">
  30. 已售{{item.sales}} {{item.goodRate}}%好评
  31. </view>
  32. <view class="price-btn">免费试听</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="not-data" v-if="listData.length<1">暂无数据</view>
  37. <view class="more">查看更多</view>
  38. </view>
  39. </template>
  40. <script lang="ts" setup>
  41. import { ref } from 'vue';
  42. interface Props {
  43. listData ?: any;
  44. selectList?:any;
  45. }
  46. const props = withDefaults(defineProps<Props>(), {
  47. listData: [],
  48. selectList:[],
  49. });
  50. const emit = defineEmits(['change']);
  51. const sel_btn=ref(0);
  52. const select_btn=(e,i)=>{
  53. sel_btn.value=i
  54. emit('change', e, i);
  55. }
  56. const toCourseDetail=(e)=>{
  57. uni.navigateTo({
  58. url:`/pages/index/courseDetail/index?id=${e.id}&type=1`
  59. })
  60. }
  61. </script>
  62. <style lang="less" scoped>
  63. .course-card {
  64. padding: 20rpx;
  65. background: #FFFFFF;
  66. border-radius: 32rpx;
  67. margin-top: 20rpx;
  68. .course-tips {
  69. display: flex;
  70. align-items: center;
  71. gap: 10rpx;
  72. font-size: 24rpx;
  73. color: #999999;
  74. &>view:first-child {
  75. width: 32rpx;
  76. height: 32rpx;
  77. background:#FFA347;
  78. border-radius: 50%;
  79. display: flex;
  80. justify-content: center;
  81. align-items: center;
  82. color: #FFFFFF;
  83. }
  84. }
  85. .select-btn {
  86. display: flex;
  87. align-items: center;
  88. gap: 20rpx;
  89. margin-top: 20rpx;
  90. .distance {
  91. width: 92rpx;
  92. height: 36rpx;
  93. background:#C8FF0C;
  94. border-radius: 8rpx;
  95. font-size: 24rpx;
  96. color: #222222;
  97. line-height:34rpx;
  98. text-align: center;
  99. }
  100. .score {
  101. width: 92rpx;
  102. height: 36rpx;
  103. background:#F5F5F5;
  104. border-radius: 8rpx;
  105. font-size: 24rpx;
  106. color:#AAAAAA;
  107. line-height:34rpx;
  108. text-align: center;
  109. }
  110. }
  111. .venue-card{
  112. display: flex;
  113. align-items: center;
  114. gap: 20rpx;
  115. margin-top: 20rpx;
  116. &>image{
  117. width: 200rpx;
  118. height: 200rpx;
  119. border-radius: 32rpx;
  120. }
  121. .venue-info{
  122. width: 430rpx;
  123. height: 260rpx;
  124. border-bottom: 1rpx solid #F0F0F0;
  125. .info-title{
  126. display: flex;
  127. align-items: center;
  128. justify-content: space-between;
  129. .title{
  130. width: 340rpx;
  131. font-weight: 800;
  132. font-size: 32rpx;
  133. color: #222222;
  134. }
  135. .sales{
  136. font-size: 22rpx;
  137. color: #AAAAAA;
  138. }
  139. }
  140. .type{
  141. margin-top: 16rpx;
  142. font-size: 24rpx;
  143. color: #AAAAAA;
  144. }
  145. .price{
  146. display: flex;
  147. align-items: center;
  148. gap: 20rpx;
  149. margin-top: 16rpx;
  150. &>view:nth-child(1){
  151. font-weight: bold;
  152. font-size: 28rpx;
  153. color: #FB5B5B;
  154. }
  155. &>view:nth-child(2){
  156. font-size: 22rpx;
  157. color: #AAAAAA;
  158. text-decoration: line-through;
  159. }
  160. }
  161. .price-info{
  162. display: flex;
  163. align-items: center;
  164. justify-content: space-between;
  165. .sale{
  166. font-size: 24rpx;
  167. color: #AAAAAA;
  168. }
  169. .price-btn{
  170. width: 152rpx;
  171. height: 48rpx;
  172. background: #C8FF0C;
  173. border-radius: 8rpx;
  174. font-weight: bold;
  175. font-size: 28rpx;
  176. color: #222222;
  177. text-align: center;
  178. line-height: 48rpx;
  179. }
  180. }
  181. }
  182. }
  183. .more{
  184. margin: auto;
  185. width:100rpx;
  186. margin-top: 20rpx;
  187. text-align: center;
  188. font-size: 24rpx;
  189. color: #CCCCCC;
  190. position: relative;
  191. }
  192. .more::after{
  193. position: absolute;
  194. bottom: -10rpx;
  195. left:25rpx;
  196. content: '';
  197. width: 38rpx;
  198. height: 4rpx;
  199. border-radius: 2rpx;
  200. background-color: #CCCCCC;
  201. }
  202. }
  203. </style>