venueDetail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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-popup>
  63. <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
  64. </view>
  65. </template>
  66. <script>
  67. import {
  68. mapGetters
  69. } from 'vuex'
  70. const NET = require('@/utils/request')
  71. const API = require('@/config/api')
  72. export default {
  73. computed: {
  74. ...mapGetters([
  75. 'mainColor',
  76. 'customStyle',
  77. 'handleCustomStyle',
  78. 'handleDefaultCustomStyle',
  79. ])
  80. },
  81. data() {
  82. return {
  83. userId:'',
  84. venueId: '',
  85. venueInfo: {
  86. url: '',
  87. name: '',
  88. address: '',
  89. desc: '',
  90. classListResList: [],
  91. },
  92. classId: '',
  93. cardStyle: {
  94. fontWeight: 'bold'
  95. },
  96. enlistShow: false,
  97. studentList1: [],
  98. subscribeShow: false,
  99. studentList2: [],
  100. }
  101. },
  102. onLoad(options) {
  103. this.userId = options.userId
  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. return
  148. // uni.navigateTo({
  149. // url: '/pagesMember/classDetail?id=' + item.id
  150. // });
  151. },
  152. // 体验
  153. cardHandle(item, type) {
  154. const classId = parseInt(item.id)
  155. const customerId = parseInt(this.$store.state.customerId)
  156. NET.request(API.customerAppointment, {
  157. classId,
  158. customerId
  159. }, 'POST').then(res => {
  160. this.$refs.uTips.show({
  161. title: res.message,
  162. type: 'success',
  163. })
  164. setTimeout(()=> {
  165. uni.navigateBack({
  166. delta: 2
  167. })
  168. }, 1000)
  169. }).catch(error => {
  170. this.$refs.uTips.show({
  171. title: error.message,
  172. type: 'warning',
  173. })
  174. })
  175. },
  176. // 学员报名
  177. enlistStudent(item) {
  178. NET.request(API.enlistStudent, {
  179. classId: this.classId,
  180. studentId: item.studentId,
  181. }, 'POST').then(res => {
  182. this.enlistShow = false
  183. this.$refs.uTips.show({
  184. title: res.message,
  185. type: 'success',
  186. })
  187. }).catch(error => {
  188. this.$refs.uTips.show({
  189. title: error.message,
  190. type: 'warning',
  191. })
  192. })
  193. },
  194. // 学员预约
  195. subscribeStudent(item) {
  196. NET.request(API.customerAppointment, {
  197. classId: this.classId,
  198. studentId: this.userId,
  199. }, 'POST').then(res => {
  200. this.$refs.uTips.show({
  201. title: res.message,
  202. type: 'success',
  203. })
  204. }).catch(error => {
  205. this.$refs.uTips.show({
  206. title: error.message,
  207. type: 'warning',
  208. })
  209. })
  210. },
  211. // 跳转新增学员表单
  212. // goToSubscribelForm() {
  213. // uni.navigateTo({
  214. // url: '/pagesMember/subscribelForm'
  215. // });
  216. // },
  217. },
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. @import "@/static/css/themes.scss";
  222. .content {
  223. width: 100%;
  224. float: left;
  225. .title-box {
  226. width: 100vw;
  227. padding: 10px 15px 5px 15px;
  228. float: left;
  229. box-sizing: border-box;
  230. }
  231. .venue-text {
  232. width: 100vw;
  233. padding: 5px 15px 15px 15px;
  234. float: left;
  235. box-sizing: border-box;
  236. color: #999999;
  237. font-size: 10px;
  238. line-height: 16px;
  239. }
  240. .class-box {
  241. width: 100vw;
  242. padding: 5px;
  243. float: left;
  244. box-sizing: border-box;
  245. .class-card {
  246. /deep/.u-border:after {
  247. border-radius: 20px !important;
  248. border-color: #999999;
  249. }
  250. .class-content {
  251. width: 100%;
  252. padding: 2px 15px;
  253. float: left;
  254. position: relative;
  255. }
  256. .class-name {
  257. height: 20px;
  258. font-weight: bold;
  259. font-size: 14px;
  260. line-height: 20px;
  261. }
  262. .class-info {
  263. .class-info-row {
  264. color: #999999;
  265. line-height: 18px;
  266. }
  267. }
  268. }
  269. }
  270. .student-box {
  271. max-height: 200px;
  272. padding: 0 15px;
  273. margin: 25px 0 0 0;
  274. box-sizing: border-box;
  275. overflow: auto;
  276. /deep/.u-card__head {
  277. padding-bottom: 0px !important;
  278. }
  279. }
  280. }
  281. </style>