venueDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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="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. checkBox(item){
  184. item.checked=!item.checked
  185. this.changeCardClick(item)
  186. },
  187. changeCard(item){
  188. item.checked=!item.checked
  189. },
  190. // 选择会员卡
  191. changeCardClick(cardItem) {
  192. console.log(cardItem.checked)
  193. const cardItemIndex = this.checkedCardList.findIndex( item => item.id === cardItem.id )
  194. if(cardItemIndex === -1) {
  195. this.checkedCardList.push(cardItem)
  196. } else {
  197. this.checkedCardList.splice(cardItemIndex,1)
  198. }
  199. },
  200. // 跳转班级详情
  201. goToClassDetail(item) {
  202. uni.navigateTo({
  203. url: '/pagesMember/classDetail?id=' + item.id
  204. });
  205. },
  206. // 弹出
  207. cardHandle(item, type) {
  208. this.classId = item.id
  209. if (type == 1) {
  210. this.subscribeShow = true
  211. } else {
  212. this.enlistShow = true
  213. }
  214. },
  215. // 学员报名
  216. enlistStudent(item) {
  217. NET.request(API.enlistStudent, {
  218. classId: this.classId,
  219. studentId: item.studentId,
  220. }, 'POST').then(res => {
  221. this.enlistShow = false
  222. this.$refs.uTips.show({
  223. title: res.message,
  224. type: 'success',
  225. })
  226. }).catch(error => {
  227. this.$refs.uTips.show({
  228. title: error.message,
  229. type: 'warning',
  230. })
  231. })
  232. },
  233. // 学员预约
  234. subscribeStudent(item) {
  235. NET.request(API.subscribeStudent, {
  236. classId: this.classId,
  237. studentId: item.studentId,
  238. }, 'POST').then(res => {
  239. this.subscribeShow = false
  240. this.$refs.uTips.show({
  241. title: res.message,
  242. type: 'success',
  243. })
  244. }).catch(error => {
  245. this.$refs.uTips.show({
  246. title: error.message,
  247. type: 'warning',
  248. })
  249. })
  250. },
  251. // 跳转开通支付
  252. handlePayClick() {
  253. if(this.checkedCardList.length===0){
  254. return false
  255. }
  256. // uni.navigateTo({
  257. // url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
  258. // });
  259. uni.navigateTo({
  260. url: '/pagesMain/openMember?cardinfo=' + encodeURIComponent(JSON.stringify(this.checkedCardList))
  261. })
  262. },
  263. // 跳转新增学员表单
  264. goToSubscribelForm() {
  265. uni.navigateTo({
  266. url: '/pagesMember/subscribelForm'
  267. });
  268. },
  269. },
  270. }
  271. </script>
  272. <style lang="scss" scoped>
  273. @import "@/static/css/themes.scss";
  274. .content {
  275. width: 100%;
  276. float: left;
  277. .title-box {
  278. width: 100vw;
  279. padding: 10px 15px 5px 15px;
  280. float: left;
  281. box-sizing: border-box;
  282. }
  283. .venue-text {
  284. width: 100vw;
  285. padding: 5px 15px 15px 15px;
  286. float: left;
  287. box-sizing: border-box;
  288. color: #999999;
  289. font-size: 10px;
  290. line-height: 16px;
  291. }
  292. .section-title {
  293. width: 100%;
  294. height: 28px;
  295. display: flex;
  296. align-items: center;
  297. margin-top: 20px;
  298. padding: 0 15px;
  299. u-section {
  300. margin-left: 10px;
  301. flex: 1;
  302. }
  303. }
  304. .menber-box {
  305. width: 100vw;
  306. float: left;
  307. padding: 10px 15px;
  308. .menber-col {
  309. width: 100%;
  310. padding: 15px 20px;
  311. margin-bottom: 10px;
  312. display: inline-block;
  313. background-color: #FFFFFF;
  314. border-radius: 15px;
  315. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  316. position: relative;
  317. overflow: hidden;
  318. .menber-label {
  319. width: 100%;
  320. margin-bottom: 5px;
  321. float: left;
  322. font-size: 14px;
  323. font-weight: bold;
  324. // line-height: 20px;
  325. }
  326. .menber-num {
  327. width: 100%;
  328. float: left;
  329. font-size: 26px;
  330. line-height: 28px;
  331. color: $mainColor;
  332. }
  333. .menber-icon {
  334. font-size: 100px;
  335. color: $mainColor;
  336. position: absolute;
  337. right: -5px;
  338. bottom: -15px;
  339. opacity: 0.5;
  340. }
  341. }
  342. }
  343. .class-box {
  344. width: 100vw;
  345. padding: 5px;
  346. float: left;
  347. box-sizing: border-box;
  348. .class-card {
  349. /deep/.u-border:after {
  350. border-radius: 20px !important;
  351. border-color: #999999;
  352. }
  353. .class-content {
  354. width: 100%;
  355. padding: 2px 15px;
  356. float: left;
  357. position: relative;
  358. }
  359. .class-name {
  360. height: 20px;
  361. font-weight: bold;
  362. font-size: 14px;
  363. line-height: 20px;
  364. }
  365. .class-info {
  366. .class-info-row {
  367. color: #999999;
  368. line-height: 18px;
  369. }
  370. }
  371. }
  372. }
  373. .student-box {
  374. max-height: 200px;
  375. padding: 0 15px;
  376. margin: 25px 0 0 0;
  377. box-sizing: border-box;
  378. overflow: auto;
  379. /deep/.u-card__head {
  380. padding-bottom: 0px !important;
  381. }
  382. }
  383. }
  384. </style>