venueDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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. <!-- 场馆简介 -->
  10. <u-section title="场馆简介" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  11. <view class="venue-text">{{venueInfo.desc}}</view>
  12. <!-- 会员开通 -->
  13. <u-section title="会员开通" font-size="32" :right="false" :show-line="false" class="title-box"></u-section>
  14. <view class="menber-box">
  15. <view class="menber-col" v-for="(item, index) in menberList" :key="index">
  16. <view class="menber-label">卡名: {{ item.typeValue }}</view>
  17. <view class="menber-label">售价: ¥ {{ item.sellingPrice }}</view>
  18. <view class="menber-label">使用时间: {{ item.startDate }}~{{ item.endDate }}</view>
  19. <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...handleCustomStyle, float: 'left', marginLeft: ''}" size="mini" @click="goToPay(item)">点击开通</u-button> -->
  20. <u-checkbox v-model="item.checked" active-color="#ff6e3e" @change="changeCardClick(item)">选择</u-checkbox>
  21. <view class="menber-icon iconfont iconzu4931"></view>
  22. </view>
  23. <view v-if="checkedCardList.length">
  24. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...handleCustomStyle, float: 'right'}" size="mini" @click="handlePayClick">去支付</u-button>
  25. </view>
  26. </view>
  27. <!-- 班级信息 -->
  28. <u-section title="班级信息" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  29. <view class="class-box">
  30. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0" margin="10px" v-for="(item, index) in venueInfo.classListResList"
  31. :key="index" class="class-card" @click="goToClassDetail(item)">
  32. <view class="class-content" slot="head" style="padding-top: 10px;">
  33. <text class="class-name">{{item.name}}</text>
  34. </view>
  35. <view class="class-content" slot="body" style="padding-bottom: 10px;">
  36. <view class="class-info">
  37. <view class="class-info-row">
  38. <u-icon name="clock"></u-icon>
  39. {{item.classStartDate}}&nbsp;~&nbsp;{{item.classEndDate}}
  40. </view>
  41. <view class="class-info-row" v-for="(site, index2) in item.classExtrasList" :key="index2">
  42. <u-icon name="calendar" style="visibility: hidden;"></u-icon>
  43. <text>{{site.week}}&nbsp;{{site.startTime}}-{{site.endTime}}</text>
  44. </view>
  45. <view class="class-info-row">
  46. <u-icon name="map"></u-icon>
  47. {{item.address}}
  48. </view>
  49. </view>
  50. </view>
  51. <view class="class-content" slot="foot" style="padding-bottom: 10px;text-align: right;">
  52. <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  53. :hair-line="false" plain @click.stop="cardHandle(item, 1)">体验</u-button>
  54. <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="cardHandle(item, 2)">报名</u-button> -->
  55. </view>
  56. </u-card>
  57. </view>
  58. <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
  59. <scroll-view scroll-y class="student-box">
  60. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  61. margin="10px" borderRadius="20" v-for="(item, index) in studentList1" :key="index" @click="enlistStudent(item)">
  62. <view class="student-card" slot="body">
  63. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  64. </view>
  65. </u-card>
  66. </scroll-view>
  67. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  68. @click="goToSubscribelForm()">新增学员</u-button>
  69. </u-popup>
  70. <u-popup v-model="subscribeShow" mode="bottom" border-radius="30">
  71. <scroll-view scroll-y class="student-box">
  72. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  73. margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="subscribeStudent(item)">
  74. <view class="student-card" slot="body">
  75. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  76. </view>
  77. </u-card>
  78. </scroll-view>
  79. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  80. @click="goToSubscribelForm()">新增学员</u-button>
  81. </u-popup>
  82. <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. mapGetters
  88. } from 'vuex'
  89. const NET = require('@/utils/request')
  90. const API = require('@/config/api')
  91. export default {
  92. computed: {
  93. ...mapGetters([
  94. 'mainColor',
  95. 'customStyle',
  96. 'handleCustomStyle',
  97. 'handleDefaultCustomStyle',
  98. ])
  99. },
  100. data() {
  101. return {
  102. venueId: '',
  103. venueInfo: {
  104. url: '',
  105. name: '',
  106. address: '',
  107. desc: '',
  108. classListResList: [],
  109. },
  110. menberList: [],
  111. checkedCardList: [],
  112. classId: '',
  113. cardStyle: {
  114. fontWeight: 'bold'
  115. },
  116. enlistShow: false,
  117. studentList1: [],
  118. subscribeShow: false,
  119. studentList2: [],
  120. }
  121. },
  122. onLoad(options) {
  123. this.venueId = options.id
  124. this.initialize()
  125. },
  126. onShow() {
  127. NET.request(API.getEnlistAbleStudent, {}, 'POST').then(res => {
  128. this.studentList1 = res.data.row
  129. }).catch(error => {
  130. this.$refs.uTips.show({
  131. title: error.message,
  132. type: 'warning',
  133. })
  134. })
  135. NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
  136. this.studentList2 = res.data.row
  137. }).catch(error => {
  138. this.$refs.uTips.show({
  139. title: error.message,
  140. type: 'warning',
  141. })
  142. })
  143. },
  144. onPullDownRefresh() {
  145. this.initialize()
  146. setTimeout(() => {
  147. uni.stopPullDownRefresh();
  148. }, 500)
  149. },
  150. methods: {
  151. // 获取初始化数据
  152. initialize() {
  153. NET.request(API.getVenueDetail, {
  154. id: this.venueId
  155. }, 'POST').then(res => {
  156. this.venueInfo = res.data
  157. }).catch(error => {
  158. this.$refs.uTips.show({
  159. title: error.message,
  160. type: 'warning',
  161. })
  162. })
  163. // 会员卡
  164. NET.request(API.getMemberCardList, {venueId:this.venueId}, 'POST').then(res => {
  165. this.menberList = res.data.map(item => {
  166. return {
  167. id: item.id,
  168. type: item.type,
  169. typeValue: item.typeValue,
  170. sellingPrice: item.sellingPrice,
  171. startDate: item.startDate,
  172. endDate: item.endDate,
  173. checked: false
  174. }
  175. })
  176. }).catch(error => {
  177. this.$refs.uTips.show({
  178. title: error.message,
  179. type: 'warning',
  180. })
  181. })
  182. },
  183. // 选择会员卡
  184. changeCardClick(cardItem) {
  185. const cardItemIndex = this.checkedCardList.findIndex( item => item.id === cardItem.id )
  186. if(cardItemIndex === -1) {
  187. this.checkedCardList.push(cardItem)
  188. } else {
  189. this.checkedCardList.splice(cardItemIndex,1)
  190. }
  191. },
  192. // 跳转班级详情
  193. goToClassDetail(item) {
  194. uni.navigateTo({
  195. url: '/pagesMember/classDetail?id=' + item.id
  196. });
  197. },
  198. // 弹出
  199. cardHandle(item, type) {
  200. this.classId = item.id
  201. if (type == 1) {
  202. this.subscribeShow = true
  203. } else {
  204. this.enlistShow = true
  205. }
  206. },
  207. // 学员报名
  208. enlistStudent(item) {
  209. NET.request(API.enlistStudent, {
  210. classId: this.classId,
  211. studentId: item.studentId,
  212. }, 'POST').then(res => {
  213. this.enlistShow = false
  214. this.$refs.uTips.show({
  215. title: res.message,
  216. type: 'success',
  217. })
  218. }).catch(error => {
  219. this.$refs.uTips.show({
  220. title: error.message,
  221. type: 'warning',
  222. })
  223. })
  224. },
  225. // 学员预约
  226. subscribeStudent(item) {
  227. NET.request(API.subscribeStudent, {
  228. classId: this.classId,
  229. studentId: item.studentId,
  230. }, 'POST').then(res => {
  231. this.subscribeShow = false
  232. this.$refs.uTips.show({
  233. title: res.message,
  234. type: 'success',
  235. })
  236. }).catch(error => {
  237. this.$refs.uTips.show({
  238. title: error.message,
  239. type: 'warning',
  240. })
  241. })
  242. },
  243. // 跳转开通支付
  244. handlePayClick() {
  245. // uni.navigateTo({
  246. // url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
  247. // });
  248. uni.navigateTo({
  249. url: '/pagesMain/openMember?cardinfo=' + encodeURIComponent(JSON.stringify(this.checkedCardList))
  250. })
  251. },
  252. // 跳转新增学员表单
  253. goToSubscribelForm() {
  254. uni.navigateTo({
  255. url: '/pagesMember/subscribelForm'
  256. });
  257. },
  258. },
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. @import "@/static/css/themes.scss";
  263. .content {
  264. width: 100%;
  265. float: left;
  266. .title-box {
  267. width: 100vw;
  268. padding: 10px 15px 5px 15px;
  269. float: left;
  270. box-sizing: border-box;
  271. }
  272. .venue-text {
  273. width: 100vw;
  274. padding: 5px 15px 15px 15px;
  275. float: left;
  276. box-sizing: border-box;
  277. color: #999999;
  278. font-size: 10px;
  279. line-height: 16px;
  280. }
  281. .section-title {
  282. width: 100%;
  283. height: 28px;
  284. display: flex;
  285. align-items: center;
  286. margin-top: 20px;
  287. padding: 0 15px;
  288. u-section {
  289. margin-left: 10px;
  290. flex: 1;
  291. }
  292. }
  293. .menber-box {
  294. width: 100vw;
  295. float: left;
  296. padding: 10px 15px;
  297. .menber-col {
  298. width: 100%;
  299. padding: 15px 20px;
  300. margin-bottom: 10px;
  301. display: inline-block;
  302. background-color: #FFFFFF;
  303. border-radius: 15px;
  304. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  305. position: relative;
  306. overflow: hidden;
  307. .menber-label {
  308. width: 100%;
  309. margin-bottom: 5px;
  310. float: left;
  311. font-size: 14px;
  312. font-weight: bold;
  313. // line-height: 20px;
  314. }
  315. .menber-num {
  316. width: 100%;
  317. float: left;
  318. font-size: 26px;
  319. line-height: 28px;
  320. color: $mainColor;
  321. }
  322. .menber-icon {
  323. font-size: 100px;
  324. color: $mainColor;
  325. position: absolute;
  326. right: -5px;
  327. bottom: -15px;
  328. opacity: 0.5;
  329. }
  330. }
  331. }
  332. .class-box {
  333. width: 100vw;
  334. padding: 5px;
  335. float: left;
  336. box-sizing: border-box;
  337. .class-card {
  338. /deep/.u-border:after {
  339. border-radius: 20px !important;
  340. border-color: #999999;
  341. }
  342. .class-content {
  343. width: 100%;
  344. padding: 2px 15px;
  345. float: left;
  346. position: relative;
  347. }
  348. .class-name {
  349. height: 20px;
  350. font-weight: bold;
  351. font-size: 14px;
  352. line-height: 20px;
  353. }
  354. .class-info {
  355. .class-info-row {
  356. color: #999999;
  357. line-height: 18px;
  358. }
  359. }
  360. }
  361. }
  362. .student-box {
  363. max-height: 200px;
  364. padding: 0 15px;
  365. margin: 25px 0 0 0;
  366. box-sizing: border-box;
  367. overflow: auto;
  368. /deep/.u-card__head {
  369. padding-bottom: 0px !important;
  370. }
  371. }
  372. }
  373. </style>