venueDetail.vue 7.3 KB

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