venueDetail.vue 7.4 KB

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