venueDetail.vue 14 KB

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