venueDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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" @click.stop="checkBox(item)" :style="{background:item.checked?'#ffd5c7':'#fff'}">
  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.stop="changeCard(item)">选择</u-checkbox> -->
  21. <view class="menber-icon iconfont iconzu4931"></view>
  22. </view>
  23. <view >
  24. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...handleCustomStyle,'width': '91%','height': '84rpx','font-size': '13px','background':checkedCardList.length===0?'#ccc':'#ff6e3e'}" 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="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  55. :hair-line="false" plain @click.stop="cardHandle(item)">体验</u-button>
  56. <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="cardHandle(item, 2)">报名</u-button> -->
  57. </view>
  58. </u-card>
  59. </view>
  60. <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
  61. <scroll-view scroll-y class="student-box">
  62. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  63. margin="10px" borderRadius="20" v-for="(item, index) in studentList1" :key="index" @click="enlistStudent(item)">
  64. <view class="student-card" slot="body">
  65. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  66. </view>
  67. </u-card>
  68. </scroll-view>
  69. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  70. @click="goToSubscribelForm()">新增学员</u-button>
  71. </u-popup>
  72. <!-- 体验 -->
  73. <u-popup v-model="appointShow" mode="center" border-radius="30" width="600rpx">
  74. <view class="common-title">预约体验</view>
  75. <view class="menber-box">
  76. <u-form :model="form" ref="uForm" :rules="formRules">
  77. <u-form-item label="学生" prop="studentName" required><u-input v-model="form.studentName" type="select" placeholder="请选择学生" @click="subscribeShow = true" /></u-form-item>
  78. <u-form-item label="时间" prop="appointmentDate" required><u-input v-model="form.appointmentDate" type="select" placeholder="请选择时间" @click="timeShow = true" /></u-form-item>
  79. </u-form>
  80. </view>
  81. <view class="button-box">
  82. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleSubmitClick">确定</u-button>
  83. </view>
  84. </u-popup>
  85. <!-- 学生 -->
  86. <u-popup v-model="subscribeShow" mode="bottom" border-radius="30" z-index="11111">
  87. <scroll-view scroll-y class="student-box">
  88. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  89. margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="handleChooseStudentClick(item)">
  90. <view class="student-card" slot="body">
  91. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  92. </view>
  93. </u-card>
  94. </scroll-view>
  95. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  96. @click="goToSubscribelForm">新增学员</u-button>
  97. </u-popup>
  98. <!-- 时间 -->
  99. <u-picker v-model="timeShow" mode="time" @confirm="handleChooseTimeClick"></u-picker>
  100. <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
  101. </view>
  102. </template>
  103. <script>
  104. import {
  105. mapGetters
  106. } from 'vuex'
  107. const NET = require('@/utils/request')
  108. const API = require('@/config/api')
  109. export default {
  110. computed: {
  111. ...mapGetters([
  112. 'mainColor',
  113. 'customStyle',
  114. 'handleCustomStyle',
  115. 'handleDefaultCustomStyle',
  116. ])
  117. },
  118. data() {
  119. return {
  120. venueId: '',
  121. venueInfo: {
  122. url: '',
  123. name: '',
  124. address: '',
  125. desc: '',
  126. classListResList: [],
  127. },
  128. formRules: {
  129. studentName: [
  130. {
  131. required: true,
  132. message: '请选择学生',
  133. trigger: ['change']
  134. }
  135. ],
  136. appointmentDate: [
  137. {
  138. required: true,
  139. message: '请选择时间',
  140. trigger: ['change']
  141. }
  142. ]
  143. },
  144. form: {
  145. studentId: 0,
  146. studentName: '',
  147. appointmentDate: ''
  148. },
  149. appointShow: false,
  150. menberList: [],
  151. checkedCardList: [],
  152. classId: '',
  153. cardStyle: {
  154. fontWeight: 'bold'
  155. },
  156. enlistShow: false,
  157. studentList1: [],
  158. subscribeShow: false,
  159. studentList2: [],
  160. timeShow: false
  161. }
  162. },
  163. onLoad(options) {
  164. this.venueId = options.id
  165. this.initialize()
  166. },
  167. onShow() {
  168. NET.request(API.getEnlistAbleStudent, {}, 'POST').then(res => {
  169. this.studentList1 = res.data.row
  170. }).catch(error => {
  171. this.$refs.uTips.show({
  172. title: error.message,
  173. type: 'warning',
  174. })
  175. })
  176. NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
  177. this.studentList2 = res.data.row
  178. }).catch(error => {
  179. this.$refs.uTips.show({
  180. title: error.message,
  181. type: 'warning',
  182. })
  183. })
  184. },
  185. onReady() {
  186. this.$refs.uForm.setRules(this.formRules);
  187. },
  188. onPullDownRefresh() {
  189. this.initialize()
  190. setTimeout(() => {
  191. uni.stopPullDownRefresh();
  192. }, 500)
  193. },
  194. methods: {
  195. // 获取初始化数据
  196. initialize() {
  197. NET.request(API.getVenueDetail, {
  198. id: this.venueId
  199. }, 'POST').then(res => {
  200. this.venueInfo = res.data
  201. }).catch(error => {
  202. this.$refs.uTips.show({
  203. title: error.message,
  204. type: 'warning',
  205. })
  206. })
  207. // 会员卡
  208. NET.request(API.getMemberCardList, {venueId:this.venueId}, 'POST').then(res => {
  209. this.menberList = res.data.map(item => {
  210. return {
  211. id: item.id,
  212. type: item.type,
  213. typeValue: item.typeValue,
  214. sellingPrice: item.sellingPrice,
  215. startDate: item.startDate,
  216. endDate: item.endDate,
  217. checked: false
  218. }
  219. })
  220. }).catch(error => {
  221. this.$refs.uTips.show({
  222. title: error.message,
  223. type: 'warning',
  224. })
  225. })
  226. },
  227. checkBox(item){
  228. item.checked=!item.checked
  229. this.changeCardClick(item)
  230. },
  231. changeCard(item){
  232. item.checked=!item.checked
  233. },
  234. // 选择会员卡
  235. changeCardClick(cardItem) {
  236. console.log(cardItem.checked)
  237. const cardItemIndex = this.checkedCardList.findIndex( item => item.id === cardItem.id )
  238. if(cardItemIndex === -1) {
  239. this.checkedCardList.push(cardItem)
  240. } else {
  241. this.checkedCardList.splice(cardItemIndex,1)
  242. }
  243. },
  244. // 跳转班级详情
  245. goToClassDetail(item) {
  246. uni.navigateTo({
  247. url: '/pagesMember/classDetail?id=' + item.id
  248. });
  249. },
  250. // 弹出
  251. cardHandle(item, type) {
  252. this.appointShow = true
  253. this.classId = item.id
  254. },
  255. // 选择预约时间
  256. handleChooseTimeClick(args) {
  257. this.form.appointmentDate = args.year + '-' + args.month + '-' + args.day
  258. this.timeShow = false
  259. },
  260. // 学员预约
  261. handleChooseStudentClick(item) {
  262. this.form.studentId = item.studentId
  263. this.form.studentName = item.studentName
  264. this.subscribeShow = false
  265. },
  266. // 确定
  267. handleSubmitClick() {
  268. this.$refs.uForm.validate(valid => {
  269. if (valid) {
  270. NET.request(API.appointment, {
  271. venueId: this.venueId,
  272. classId: this.classId,
  273. studentId: this.form.studentId,
  274. appointmentDate: this.form.appointmentDate
  275. }, 'POST').then(res => {
  276. this.$refs.uTips.show({
  277. title: res.message,
  278. type: 'success',
  279. })
  280. this.appointShow = false
  281. }).catch(error => {
  282. this.$refs.uTips.show({
  283. title: error.message,
  284. type: 'warning',
  285. })
  286. this.appointShow = false
  287. })
  288. }
  289. });
  290. },
  291. // 跳转开通支付
  292. handlePayClick() {
  293. if(this.checkedCardList.length===0){
  294. return false
  295. }
  296. // uni.navigateTo({
  297. // url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
  298. // });
  299. uni.navigateTo({
  300. url: '/pagesMain/openMember?cardinfo=' + encodeURIComponent(JSON.stringify(this.checkedCardList))
  301. })
  302. },
  303. // 跳转新增学员表单
  304. goToSubscribelForm() {
  305. uni.navigateTo({
  306. url: '/pagesMember/subscribelForm'
  307. });
  308. },
  309. // 学员报名
  310. enlistStudent(item) {
  311. NET.request(API.enlistStudent, {
  312. classId: this.classId,
  313. studentId: item.studentId,
  314. }, 'POST').then(res => {
  315. this.enlistShow = false
  316. this.$refs.uTips.show({
  317. title: res.message,
  318. type: 'success',
  319. })
  320. }).catch(error => {
  321. this.$refs.uTips.show({
  322. title: error.message,
  323. type: 'warning',
  324. })
  325. })
  326. },
  327. },
  328. }
  329. </script>
  330. <style lang="scss" scoped>
  331. @import "@/static/css/themes.scss";
  332. .content {
  333. width: 100%;
  334. float: left;
  335. .title-box {
  336. width: 100vw;
  337. padding: 10px 15px 5px 15px;
  338. float: left;
  339. box-sizing: border-box;
  340. }
  341. .venue-text {
  342. width: 100vw;
  343. padding: 5px 15px 15px 15px;
  344. float: left;
  345. box-sizing: border-box;
  346. color: #999999;
  347. font-size: 10px;
  348. line-height: 16px;
  349. }
  350. .section-title {
  351. width: 100%;
  352. height: 28px;
  353. display: flex;
  354. align-items: center;
  355. margin-top: 20px;
  356. padding: 0 15px;
  357. u-section {
  358. margin-left: 10px;
  359. flex: 1;
  360. }
  361. }
  362. .menber-box {
  363. width: 100vw;
  364. float: left;
  365. padding: 10px 15px;
  366. .menber-col {
  367. width: 100%;
  368. padding: 15px 20px;
  369. margin-bottom: 10px;
  370. display: inline-block;
  371. background-color: #FFFFFF;
  372. border-radius: 15px;
  373. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  374. position: relative;
  375. overflow: hidden;
  376. .menber-label {
  377. width: 100%;
  378. margin-bottom: 5px;
  379. float: left;
  380. font-size: 14px;
  381. font-weight: bold;
  382. // line-height: 20px;
  383. }
  384. .menber-num {
  385. width: 100%;
  386. float: left;
  387. font-size: 26px;
  388. line-height: 28px;
  389. color: $mainColor;
  390. }
  391. .menber-icon {
  392. font-size: 100px;
  393. color: $mainColor;
  394. position: absolute;
  395. right: -5px;
  396. bottom: -15px;
  397. opacity: 0.5;
  398. }
  399. }
  400. }
  401. .class-box {
  402. width: 100vw;
  403. padding: 5px;
  404. float: left;
  405. box-sizing: border-box;
  406. .class-card {
  407. /deep/.u-border:after {
  408. border-radius: 20px !important;
  409. border-color: #999999;
  410. }
  411. .class-content {
  412. width: 100%;
  413. padding: 2px 15px;
  414. float: left;
  415. position: relative;
  416. }
  417. .class-name {
  418. height: 20px;
  419. font-weight: bold;
  420. font-size: 14px;
  421. line-height: 20px;
  422. }
  423. .class-info {
  424. .class-info-row {
  425. color: #999999;
  426. line-height: 18px;
  427. }
  428. }
  429. }
  430. }
  431. .student-box {
  432. max-height: 200px;
  433. padding: 0 15px;
  434. margin: 25px 0 0 0;
  435. box-sizing: border-box;
  436. overflow: auto;
  437. /deep/.u-card__head {
  438. padding-bottom: 0px !important;
  439. }
  440. }
  441. }
  442. .menber-box {
  443. width: 100%;
  444. // float: left;
  445. padding: 10px 15px;
  446. margin-bottom: 10px;
  447. .menber-col {
  448. width: 100%;
  449. padding: 15px;
  450. margin-bottom: 10px;
  451. display: inline-block;
  452. background-color: #FFFFFF;
  453. border-radius: 15px;
  454. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  455. position: relative;
  456. overflow: hidden;
  457. box-sizing: border-box;
  458. .menber-label {
  459. width: 100%;
  460. margin-bottom: 5px;
  461. float: left;
  462. font-size: 14px;
  463. // line-height: 20px;
  464. }
  465. .menber-num {
  466. width: 100%;
  467. float: left;
  468. font-size: 26px;
  469. line-height: 28px;
  470. color: $mainColor;
  471. }
  472. .menber-icon {
  473. font-size: 100px;
  474. color: $mainColor;
  475. position: absolute;
  476. right: -5px;
  477. bottom: -30px;
  478. opacity: 0.5;
  479. }
  480. }
  481. }
  482. .common-title {
  483. width:100%;
  484. text-align: center;
  485. font-size: 20px;
  486. margin: 10px 0;
  487. }
  488. .fix-add-icon {
  489. position: fixed;
  490. bottom: 15px;
  491. right: 15px;
  492. }
  493. .button-box {
  494. // width: 100%;
  495. padding: 10px 15px;
  496. box-sizing: border-box;
  497. }
  498. </style>