venueDetail.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini"
  36. @click.stop="handleAppointmentClick(item.id)">体验</u-button>
  37. <!-- @click.stop="cardHandle(item, 1)">体验</u-button> -->
  38. <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="cardHandle(item, 2)">报名</u-button> -->
  39. </view>
  40. </u-card>
  41. </view>
  42. <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
  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 studentList1" :key="index" @click="enlistStudent(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',float: 'left',width: 'calc(100% - 30px)'}"
  52. @click="goToSubscribelForm()">新增学员</u-button>
  53. </u-popup>
  54. <u-popup v-model="subscribeShow" mode="bottom" border-radius="30">
  55. <scroll-view scroll-y class="student-box">
  56. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  57. margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="subscribeStudent(item)">
  58. <view class="student-card" slot="body">
  59. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  60. </view>
  61. </u-card>
  62. </scroll-view>
  63. </u-popup>
  64. <u-picker v-model="timeShow" mode="time" @confirm="handleChooseTimeClick"></u-picker>
  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. timeShow: false
  102. }
  103. },
  104. onLoad(options) {
  105. this.venueId = options.id
  106. this.initialize()
  107. },
  108. onShow() {
  109. NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
  110. this.studentList2 = res.data.row
  111. }).catch(error => {
  112. this.$refs.uTips.show({
  113. title: error.message,
  114. type: 'warning',
  115. })
  116. })
  117. },
  118. onPullDownRefresh() {
  119. this.initialize()
  120. setTimeout(() => {
  121. uni.stopPullDownRefresh();
  122. }, 500)
  123. },
  124. methods: {
  125. // 获取初始化数据
  126. initialize() {
  127. NET.request(API.getVenueDetail, {
  128. id: this.venueId
  129. }, 'POST').then(res => {
  130. this.venueInfo = res.data
  131. }).catch(error => {
  132. this.$refs.uTips.show({
  133. title: error.message,
  134. type: 'warning',
  135. })
  136. })
  137. },
  138. // 跳转班级详情
  139. goToClassDetail(item) {
  140. return
  141. // uni.navigateTo({
  142. // url: '/pagesMember/classDetail?id=' + item.id
  143. // });
  144. },
  145. // 学员报名
  146. enlistStudent(item) {
  147. NET.request(API.enlistStudent, {
  148. classId: this.classId,
  149. studentId: item.studentId,
  150. }, 'POST').then(res => {
  151. this.enlistShow = false
  152. this.$refs.uTips.show({
  153. title: res.message,
  154. type: 'success',
  155. })
  156. }).catch(error => {
  157. this.$refs.uTips.show({
  158. title: error.message,
  159. type: 'warning',
  160. })
  161. })
  162. },
  163. handleAppointmentClick(id) {
  164. this.timeShow = true
  165. this.classId = id
  166. },
  167. handleChooseTimeClick(args) {
  168. const appointmentDate = args.year + '-' + args.month + '-' + args.day
  169. console.log(appointmentDate);
  170. this.subscribeStudent(appointmentDate)
  171. },
  172. // 学员预约
  173. subscribeStudent(appointmentDate) {
  174. NET.request(API.customerAppointment, {
  175. venueId: this.venueId,
  176. classId: this.classId,
  177. customerId: this.$store.state.customerId,
  178. appointmentDate
  179. }, 'POST').then(res => {
  180. this.$refs.uTips.show({
  181. title: res.message,
  182. type: 'success',
  183. })
  184. this.timeShow = false
  185. }).catch(error => {
  186. this.$refs.uTips.show({
  187. title: error.message,
  188. type: 'warning',
  189. })
  190. })
  191. }
  192. },
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. @import "@/static/css/themes.scss";
  197. .content {
  198. width: 100%;
  199. float: left;
  200. .title-box {
  201. width: 100vw;
  202. padding: 10px 15px 5px 15px;
  203. float: left;
  204. box-sizing: border-box;
  205. }
  206. .venue-text {
  207. width: 100vw;
  208. padding: 5px 15px 15px 15px;
  209. float: left;
  210. box-sizing: border-box;
  211. color: #999999;
  212. font-size: 10px;
  213. line-height: 16px;
  214. }
  215. .class-box {
  216. width: 100vw;
  217. padding: 5px;
  218. float: left;
  219. box-sizing: border-box;
  220. .class-card {
  221. /deep/.u-border:after {
  222. border-radius: 20px !important;
  223. border-color: #999999;
  224. }
  225. .class-content {
  226. width: 100%;
  227. padding: 2px 15px;
  228. float: left;
  229. position: relative;
  230. }
  231. .class-name {
  232. height: 20px;
  233. font-weight: bold;
  234. font-size: 14px;
  235. line-height: 20px;
  236. }
  237. .class-info {
  238. .class-info-row {
  239. color: #999999;
  240. line-height: 18px;
  241. }
  242. }
  243. }
  244. }
  245. .student-box {
  246. max-height: 200px;
  247. padding: 0 15px;
  248. margin: 25px 0 0 0;
  249. box-sizing: border-box;
  250. overflow: auto;
  251. /deep/.u-card__head {
  252. padding-bottom: 0px !important;
  253. }
  254. }
  255. }
  256. </style>