index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="course_layout">
  3. <view class="course_list">
  4. <view class="course_item" v-for="(item,index) in productList" :key="index">
  5. <view class="course_title">
  6. <view class="left">
  7. <image :src="item.image"></image>
  8. </view>
  9. <view class="right">
  10. <view class="title">
  11. {{item.course_name}}
  12. <!-- 拳击课程 -->
  13. </view>
  14. <view class="skill">
  15. {{item.desc}}
  16. <!-- 拳击课程修炼 -->
  17. </view>
  18. <view class="course_option">
  19. <view class="course_num">
  20. 课程数量:{{item.course_number}}
  21. </view>
  22. <!-- <view class="course_num">
  23. 总计10课堂
  24. </view> -->
  25. <view class="remain_class">
  26. 预约人数:{{item.reservation_number}}
  27. </view>
  28. </view>
  29. <view class="course_remain">
  30. <view class="remain_class">
  31. <!-- 预约人数:{{item.reservation_number}} -->
  32. </view>
  33. <view class="price">
  34. ¥{{item.price_total}}
  35. <!-- ¥100 -->
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="btn_title">
  41. <view class="title">
  42. 上课地址:{{item.address}}
  43. </view>
  44. <view class="btn">
  45. <navigator :url="`/pagesA/course/reservation?orders_product_id=${item.orders_product_id}&course_id=${item.course_id}`">
  46. <view class="course_make_btn">
  47. 预约上课
  48. </view>
  49. </navigator>
  50. <navigator url="/pagesA/course/usercourse">
  51. <view class="user_course_btn">
  52. 我的预约
  53. </view>
  54. </navigator>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="to_bottom">---到底啦---</view>
  60. </view>
  61. </template>
  62. <script>
  63. export default {
  64. data() {
  65. return {
  66. //产品列表
  67. productList:[],
  68. // 请求参数
  69. requestParam:{
  70. name:"",
  71. page:1,
  72. },
  73. // 是否最后一页
  74. isLast:false,
  75. // 是否请求中
  76. isReqing:false,
  77. }
  78. },
  79. onShow() {
  80. // 没有数据的话,或者请求中,不允许刷新
  81. if( this.isReqing ) return ;
  82. // 请求参数
  83. this.requestParam.name = "";
  84. // 请求参数
  85. this.requestParam.page = 1;
  86. // 是否是最后一页
  87. this.isLast = false;
  88. // 设置请求中
  89. this.isReqing = true;
  90. this.$http.request('api/course/get_list',this.requestParam.page).then((re)=>{
  91. // 设置非请求中
  92. this.isReqing = false;
  93. // 成功结果
  94. if( re.code == 'success' ){
  95. if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
  96. this.productList = re.data.data;
  97. }
  98. });
  99. },
  100. methods: {
  101. }
  102. }
  103. </script>
  104. <style lang="less">
  105. .course_layout{
  106. width: 690rpx;
  107. margin: 30rpx auto;
  108. .course_list{
  109. display: block;
  110. width: 690rpx;
  111. .course_item{
  112. width:690rpx;
  113. display: block;
  114. background-color: #fafafa;
  115. padding: 1rpx 0rpx;
  116. margin: 20rpx 0rpx;
  117. .course_title{
  118. display: flex;
  119. width: 660rpx;
  120. margin: 20rpx auto;
  121. .left{
  122. width: 200rpx;
  123. // height: 200rpx;
  124. // background-color: aqua;
  125. // border: 2rpx solid;
  126. border-radius: 20rpx;
  127. image{
  128. width: 200rpx;
  129. height: 200rpx;
  130. border-radius: 20rpx;
  131. border: 2rpx solid;
  132. }
  133. }
  134. .right{
  135. font-size: 24rpx;
  136. margin-left: 20rpx;
  137. .title{
  138. font-size: 36rpx;
  139. }
  140. .skill{
  141. padding: 5rpx;
  142. margin: 10rpx 10rpx 10rpx 0rpx;
  143. color: #c9c9c9;
  144. }
  145. .course_option{
  146. display: flex;
  147. justify-content: space-between;
  148. flex-wrap: wrap;
  149. width: 420rpx;
  150. justify-content: ;
  151. .course_num{
  152. display: inline-flex;
  153. justify-content: center;
  154. width: 180rpx;
  155. border: 2rpx solid #3985ff;
  156. border-radius: 15rpx;
  157. margin: 5rpx;
  158. padding: 5rpx;
  159. color: #3985ff;
  160. }
  161. .remain_class{
  162. display: inline-flex;
  163. justify-content: center;
  164. width: 180rpx;
  165. margin: 5rpx;
  166. padding: 5rpx;
  167. background-color: #3985ff;
  168. border-radius: 15rpx;
  169. color: #ffffff;
  170. }
  171. }
  172. .course_remain{
  173. display: flex;
  174. justify-content: space-between;
  175. flex-wrap: wrap;
  176. width: 420rpx;
  177. margin-top: 30rpx;
  178. // .remain_class{
  179. // display: inline-flex;
  180. // justify-content: center;
  181. // width: 180rpx;
  182. // margin: 5rpx;
  183. // padding: 5rpx;
  184. // background-color: #3985ff;
  185. // border-radius: 15rpx;
  186. // color: #ffffff;
  187. // }
  188. .price{
  189. width: 180rpx;
  190. margin: 5rpx;
  191. padding: 5rpx;
  192. text-align: right;
  193. font-size: 30rpx;
  194. }
  195. }
  196. }
  197. }
  198. .btn_title{
  199. .title{
  200. margin-left: 20rpx;
  201. }
  202. .btn{
  203. display: flex;
  204. width: 690rpx;
  205. margin: 20rpx 0rpx;
  206. justify-content: space-between;
  207. .course_make_btn{
  208. width: 300rpx;
  209. height: 60rpx;
  210. line-height: 60rpx;
  211. text-align: center;
  212. padding: 10rpx;
  213. background-color: #1fbe7e;
  214. color: #ffffff;
  215. border-radius: 20rpx;
  216. }
  217. .user_course_btn{
  218. width: 300rpx;
  219. height: 60rpx;
  220. line-height: 60rpx;
  221. text-align: center;
  222. padding: 10rpx;
  223. background-color: #1fbe7e;
  224. color: #ffffff;
  225. border-radius: 20rpx;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. }
  232. </style>