venueDetail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view class="content">
  3. <u-image :src="venueInfo.url" mode="aspectFill" height="45vw" border-radius="10px" width="calc(100vw - 30px)" style="margin: 10px 15px;float: left;"></u-image>
  4. <u-section :title="venueInfo.name" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  5. <view class="venue-text">
  6. <u-icon name="map" style="font-size: 14px;margin-right: 2px;"></u-icon>
  7. {{venueInfo.address}}
  8. </view>
  9. <u-section title="场馆简介" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  10. <view class="venue-text">{{venueInfo.desc}}</view>
  11. <u-section title="班级信息" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  12. <view class="class-box">
  13. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0" margin="10px" v-for="(item, index) in venueInfo.classListResList"
  14. :key="index" class="class-card" @click="goToClassDetail(item)">
  15. <view class="class-content" slot="head" style="padding-top: 10px;">
  16. <text class="class-name">{{item.name}}</text>
  17. </view>
  18. <view class="class-content" slot="body" style="padding-bottom: 10px;">
  19. <view class="class-info">
  20. <view class="class-info-row">
  21. <u-icon name="clock"></u-icon>
  22. {{item.classStartDate}}&nbsp;&nbsp;{{item.classStartHours}}&nbsp;&nbsp;{{item.residue}}课时
  23. </view>
  24. <view class="class-info-row">
  25. <u-icon name="map"></u-icon>
  26. {{item.address}}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="class-content" slot="foot" style="padding-bottom: 10px;text-align: right;">
  31. <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  32. :hair-line="false" plain @click.stop="cardHandle(item, 1)">体验</u-button>
  33. <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="cardHandle(item, 2)">报名</u-button>
  34. </view>
  35. </u-card>
  36. </view>
  37. <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
  38. <scroll-view scroll-y class="student-box">
  39. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  40. margin="10px" borderRadius="20" v-for="(item, index) in studentList1" :key="index" @click="enlistStudent(item)">
  41. <view class="student-card" slot="body">
  42. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  43. </view>
  44. </u-card>
  45. </scroll-view>
  46. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px'}" @click="goToSubscribelForm()">新增学员</u-button>
  47. </u-popup>
  48. <u-popup v-model="subscribeShow" mode="bottom" border-radius="30">
  49. <scroll-view scroll-y class="student-box">
  50. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  51. margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="subscribeStudent(item)">
  52. <view class="student-card" slot="body">
  53. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  54. </view>
  55. </u-card>
  56. </scroll-view>
  57. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px'}" @click="goToSubscribelForm()">新增学员</u-button>
  58. </u-popup>
  59. <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. mapGetters
  65. } from 'vuex'
  66. const NET = require('@/utils/request')
  67. const API = require('@/config/api')
  68. export default {
  69. computed: {
  70. ...mapGetters([
  71. 'mainColor',
  72. 'customStyle',
  73. 'handleCustomStyle',
  74. 'handleDefaultCustomStyle',
  75. ])
  76. },
  77. data() {
  78. return {
  79. venueId: '',
  80. venueInfo: {
  81. url: '',
  82. name: '',
  83. address: '',
  84. desc: '',
  85. classListResList: [],
  86. },
  87. classId: '',
  88. cardStyle: {
  89. fontWeight: 'bold'
  90. },
  91. enlistShow: false,
  92. studentList1: [],
  93. subscribeShow: false,
  94. studentList2: [],
  95. }
  96. },
  97. onLoad(options) {
  98. this.venueId = options.id
  99. this.initialize()
  100. },
  101. onShow() {
  102. NET.request(API.getEnlistAbleStudent, {}, 'POST').then(res => {
  103. this.studentList1 = res.data.row
  104. }).catch(error => {
  105. this.$refs.uTips.show({
  106. title: error.message,
  107. type: 'warning',
  108. })
  109. })
  110. NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
  111. this.studentList2 = res.data.row
  112. }).catch(error => {
  113. this.$refs.uTips.show({
  114. title: error.message,
  115. type: 'warning',
  116. })
  117. })
  118. },
  119. onPullDownRefresh() {
  120. this.initialize()
  121. setTimeout(() => {
  122. uni.stopPullDownRefresh();
  123. }, 500)
  124. },
  125. methods: {
  126. // 获取初始化数据
  127. initialize() {
  128. NET.request(API.getVenueDetail, {
  129. id: this.venueId
  130. }, 'POST').then(res => {
  131. this.venueInfo = res.data
  132. }).catch(error => {
  133. this.$refs.uTips.show({
  134. title: error.message,
  135. type: 'warning',
  136. })
  137. })
  138. },
  139. // 跳转班级详情
  140. goToClassDetail(item) {
  141. uni.navigateTo({
  142. url: '/pagesMember/classDetail?id=' + item.id
  143. });
  144. },
  145. // 弹出
  146. cardHandle(item, type) {
  147. this.classId = item.id
  148. if (type == 1) {
  149. this.subscribeShow = true
  150. } else {
  151. this.enlistShow = true
  152. }
  153. },
  154. // 学员报名
  155. enlistStudent(item) {
  156. NET.request(API.enlistStudent, {
  157. classId: this.classId,
  158. studentId: item.studentId,
  159. }, 'POST').then(res => {
  160. this.enlistShow = false
  161. this.$refs.uTips.show({
  162. title: res.message,
  163. type: 'success',
  164. })
  165. }).catch(error => {
  166. this.$refs.uTips.show({
  167. title: error.message,
  168. type: 'warning',
  169. })
  170. })
  171. },
  172. // 学员预约
  173. subscribeStudent(item) {
  174. NET.request(API.subscribeStudent, {
  175. classId: this.classId,
  176. studentId: item.studentId,
  177. }, 'POST').then(res => {
  178. this.subscribeShow = false
  179. this.$refs.uTips.show({
  180. title: res.message,
  181. type: 'success',
  182. })
  183. }).catch(error => {
  184. this.$refs.uTips.show({
  185. title: error.message,
  186. type: 'warning',
  187. })
  188. })
  189. },
  190. // 跳转新增学员表单
  191. goToSubscribelForm() {
  192. uni.navigateTo({
  193. url: '/pagesMember/subscribelForm'
  194. });
  195. },
  196. },
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. @import "@/static/css/themes.scss";
  201. .content {
  202. width: 100%;
  203. float: left;
  204. .title-box {
  205. width: 100vw;
  206. padding: 10px 15px 5px 15px;
  207. float: left;
  208. box-sizing: border-box;
  209. }
  210. .venue-text {
  211. width: 100vw;
  212. padding: 5px 15px 15px 15px;
  213. float: left;
  214. box-sizing: border-box;
  215. color: #999999;
  216. font-size: 10px;
  217. line-height: 16px;
  218. }
  219. .class-box {
  220. width: 100vw;
  221. padding: 5px;
  222. float: left;
  223. box-sizing: border-box;
  224. .class-card {
  225. /deep/.u-border:after {
  226. border-radius: 20px !important;
  227. border-color: #999999;
  228. }
  229. .class-content {
  230. width: 100%;
  231. padding: 2px 15px;
  232. float: left;
  233. position: relative;
  234. }
  235. .class-name {
  236. height: 20px;
  237. font-weight: bold;
  238. font-size: 14px;
  239. line-height: 20px;
  240. }
  241. .class-info {
  242. .class-info-row {
  243. color: #999999;
  244. line-height: 18px;
  245. }
  246. }
  247. }
  248. }
  249. .student-box {
  250. max-height: 200px;
  251. padding: 0 15px;
  252. margin: 25px 0 0 0;
  253. box-sizing: border-box;
  254. overflow: auto;
  255. /deep/.u-card__head {
  256. padding-bottom: 0px !important;
  257. }
  258. }
  259. }
  260. </style>