venueDetail.vue 7.7 KB

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