123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508 |
- <template>
- <view class="content">
- <u-image :src="venueInfo.url" mode="aspectFill" height="45vw" border-radius="10px" width="calc(100vw - 30px)" style="margin: 10px 15px;float: left;"></u-image>
- <u-section :title="venueInfo.name" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
- <view class="venue-text">
- <u-icon name="map" style="font-size: 14px;margin-right: 2px;"></u-icon>
- {{venueInfo.address}}
- </view>
-
- <!-- 场馆简介 -->
- <u-section title="场馆简介" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
- <view class="venue-text">{{venueInfo.desc}}</view>
-
- <!-- 会员开通 -->
- <u-section title="会员开通" font-size="32" :right="false" :show-line="false" class="title-box"></u-section>
- <view class="menber-box">
- <view class="menber-col" v-for="(item, index) in menberList" :key="index" @click.stop="checkBox(item)" :style="{background:item.checked?'#ffd5c7':'#fff'}">
- <view class="menber-label">卡名: {{ item.cardName }}</view>
- <view class="menber-label">类型: {{ item.typeValue }}</view>
- <view class="menber-label">售价: ¥ {{ item.sellingPrice }}</view>
- <view class="menber-label">使用时间: {{ item.startDate }}~{{ item.endDate }}</view>
- <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...handleCustomStyle, float: 'left', marginLeft: ''}" size="mini" @click="goToPay(item)">点击开通</u-button> -->
- <!--<u-checkbox v-model="item.checked" active-color="#ff6e3e" @change.stop="changeCard(item)">选择</u-checkbox> -->
- <view class="menber-icon iconfont iconzu4931"></view>
- </view>
- <view >
- <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>
- </view>
- </view>
-
- <!-- 班级信息 -->
- <u-section title="班级信息" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
- <view class="class-box">
- <u-card :head-border-bottom="false" :foot-border-top="false" padding="0" margin="10px" v-for="(item, index) in venueInfo.classListResList"
- :key="index" class="class-card" @click="goToClassDetail(item)">
- <view class="class-content" slot="head" style="padding-top: 10px;">
- <text class="class-name">{{item.name}}</text>
- </view>
- <view class="class-content" slot="body" style="padding-bottom: 10px;">
- <view class="class-info">
- <view class="class-info-row">
- <u-icon name="clock"></u-icon>
- {{item.classStartDate}} ~ {{item.classEndDate}}
- </view>
- <view class="class-info-row" v-for="(site, index2) in item.classExtrasList" :key="index2">
- <u-icon name="calendar" style="visibility: hidden;"></u-icon>
- <text>{{site.week}} {{site.startTime}}-{{site.endTime}}</text>
- </view>
- <view class="class-info-row">
- <u-icon name="map"></u-icon>
- {{item.address}}
- </view>
- </view>
- </view>
- <view class="class-content" slot="foot" style="padding-bottom: 10px;text-align: right;">
- <!-- <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
- :hair-line="false" plain @click.stop="cardHandle(item, 1)">体验</u-button -->
-
- <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
- :hair-line="false" plain @click.stop="cardHandle(item)">体验</u-button>
- <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="cardHandle(item, 2)">报名</u-button> -->
- </view>
- </u-card>
- </view>
- <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
- <scroll-view scroll-y class="student-box">
- <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
- margin="10px" borderRadius="20" v-for="(item, index) in studentList1" :key="index" @click="enlistStudent(item)">
- <view class="student-card" slot="body">
- <view class="class-info-text">性别:{{item.sex}} 年龄:{{item.age}}</view>
- </view>
- </u-card>
- </scroll-view>
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
- @click="goToSubscribelForm()">新增学员</u-button>
- </u-popup>
-
- <!-- 体验 -->
- <u-popup v-model="appointShow" mode="center" border-radius="30" width="600rpx">
- <view class="common-title">预约体验</view>
- <view class="menber-box">
- <u-form :model="form" ref="uForm" :rules="formRules">
- <u-form-item label="学生" prop="studentName" required><u-input v-model="form.studentName" type="select" placeholder="请选择学生" @click="subscribeShow = true" /></u-form-item>
- <u-form-item label="时间" prop="appointmentDate" required><u-input v-model="form.appointmentDate" type="select" placeholder="请选择时间" @click="timeShow = true" /></u-form-item>
- </u-form>
- </view>
- <view class="button-box">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleSubmitClick">确定</u-button>
- </view>
- </u-popup>
- <!-- 学生 -->
- <u-popup v-model="subscribeShow" mode="bottom" border-radius="30" z-index="11111">
- <scroll-view scroll-y class="student-box">
- <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
- margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="handleChooseStudentClick(item)">
- <view class="student-card" slot="body">
- <view class="class-info-text">性别:{{item.sex}} 年龄:{{item.age}}</view>
- </view>
- </u-card>
- </scroll-view>
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
- @click="goToSubscribelForm">新增学员</u-button>
- </u-popup>
- <!-- 时间 -->
- <u-picker v-model="timeShow" mode="time" @confirm="handleChooseTimeClick"></u-picker>
- <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor',
- 'customStyle',
- 'handleCustomStyle',
- 'handleDefaultCustomStyle',
- ])
- },
- data() {
- return {
- venueId: '',
- venueInfo: {
- url: '',
- name: '',
- address: '',
- desc: '',
- classListResList: [],
- },
- formRules: {
- studentName: [
- {
- required: true,
- message: '请选择学生',
- trigger: ['change']
- }
- ],
- appointmentDate: [
- {
- required: true,
- message: '请选择时间',
- trigger: ['change']
- }
- ]
- },
- form: {
- studentId: 0,
- studentName: '',
- appointmentDate: ''
- },
- appointShow: false,
- menberList: [],
- checkedCardList: [],
- classId: '',
- cardStyle: {
- fontWeight: 'bold'
- },
- enlistShow: false,
- studentList1: [],
- subscribeShow: false,
- studentList2: [],
- timeShow: false
- }
- },
- onLoad(options) {
- this.venueId = options.id
- this.initialize()
- },
- onShow() {
- NET.request(API.getEnlistAbleStudent, {}, 'POST').then(res => {
- this.studentList1 = res.data.row
- })
- NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
- this.studentList2 = res.data.row
- })
- },
- onReady() {
- this.$refs.uForm.setRules(this.formRules);
- },
- onPullDownRefresh() {
- this.initialize()
- setTimeout(() => {
- uni.stopPullDownRefresh();
- }, 500)
- },
- methods: {
- // 获取初始化数据
- initialize() {
- NET.request(API.getVenueDetail, {
- id: this.venueId
- }, 'POST').then(res => {
- this.venueInfo = res.data
- })
- // 会员卡
- NET.request(API.getMemberCardList, {venueId:this.venueId}, 'POST').then(res => {
- this.menberList = res.data.map(item => {
- return {
- id: item.id,
- type: item.type,
- cardName: item.cardName,
- typeValue: item.typeValue,
- sellingPrice: item.sellingPrice,
- startDate: item.startDate,
- endDate: item.endDate,
- checked: false
- }
- })
- })
- },
- checkBox(item){
- item.checked=!item.checked
- this.changeCardClick(item)
- },
- changeCard(item){
- item.checked=!item.checked
- },
- // 选择会员卡
- changeCardClick(cardItem) {
- console.log(cardItem.checked)
- const cardItemIndex = this.checkedCardList.findIndex( item => item.id === cardItem.id )
- if(cardItemIndex === -1) {
- this.checkedCardList.push(cardItem)
- } else {
- this.checkedCardList.splice(cardItemIndex,1)
- }
- },
- // 跳转班级详情
- goToClassDetail(item) {
- uni.navigateTo({
- url: '/pagesMember/classDetail?id=' + item.id
- });
- },
- // 弹出
- cardHandle(item, type) {
- this.appointShow = true
- this.classId = item.id
- },
- // 选择预约时间
- handleChooseTimeClick(args) {
- this.form.appointmentDate = args.year + '-' + args.month + '-' + args.day
- this.timeShow = false
- },
- // 学员预约
- handleChooseStudentClick(item) {
- this.form.studentId = item.studentId
- this.form.studentName = item.studentName
- this.subscribeShow = false
- },
- // 确定
- handleSubmitClick() {
- this.$refs.uForm.validate(valid => {
- if (valid) {
- NET.request(API.appointment, {
- venueId: this.venueId,
- classId: this.classId,
- studentId: this.form.studentId,
- appointmentDate: this.form.appointmentDate
- }, 'POST').then(res => {
- this.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- this.appointShow = false
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- this.appointShow = false
- })
- }
- });
- },
- // 跳转开通支付
- handlePayClick() {
- if(this.checkedCardList.length===0){
- return false
- }
- // uni.navigateTo({
- // url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
- // });
- uni.navigateTo({
- url: '/pagesMain/openMember?cardinfo=' + encodeURIComponent(JSON.stringify(this.checkedCardList))
- })
- },
- // 跳转新增学员表单
- goToSubscribelForm() {
- uni.navigateTo({
- url: '/pagesMember/subscribelForm'
- });
- },
- // 学员报名
- enlistStudent(item) {
- NET.request(API.enlistStudent, {
- classId: this.classId,
- studentId: item.studentId,
- }, 'POST').then(res => {
- this.enlistShow = false
- this.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- .title-box {
- width: 100vw;
- padding: 10px 15px 5px 15px;
- float: left;
- box-sizing: border-box;
- }
- .venue-text {
- width: 100vw;
- padding: 5px 15px 15px 15px;
- float: left;
- box-sizing: border-box;
- color: #999999;
- font-size: 10px;
- line-height: 16px;
- }
-
- .section-title {
- width: 100%;
- height: 28px;
- display: flex;
- align-items: center;
- margin-top: 20px;
- padding: 0 15px;
-
- u-section {
- margin-left: 10px;
- flex: 1;
- }
- }
-
- .menber-box {
- width: 100vw;
- float: left;
- padding: 10px 15px;
-
- .menber-col {
- width: 100%;
- padding: 15px 20px;
- margin-bottom: 10px;
- display: inline-block;
- background-color: #FFFFFF;
- border-radius: 15px;
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
- position: relative;
- overflow: hidden;
-
- .menber-label {
- width: 100%;
- margin-bottom: 5px;
- float: left;
- font-size: 14px;
- font-weight: bold;
- // line-height: 20px;
- }
-
- .menber-num {
- width: 100%;
- float: left;
- font-size: 26px;
- line-height: 28px;
- color: $mainColor;
- }
-
- .menber-icon {
- font-size: 100px;
- color: $mainColor;
- position: absolute;
- right: -5px;
- bottom: -15px;
- opacity: 0.5;
- }
- }
- }
-
- .class-box {
- width: 100vw;
- padding: 5px;
- float: left;
- box-sizing: border-box;
- .class-card {
- /deep/.u-border:after {
- border-radius: 20px !important;
- border-color: #999999;
- }
- .class-content {
- width: 100%;
- padding: 2px 15px;
- float: left;
- position: relative;
- }
- .class-name {
- height: 20px;
- font-weight: bold;
- font-size: 14px;
- line-height: 20px;
- }
- .class-info {
- .class-info-row {
- color: #999999;
- line-height: 18px;
- }
- }
- }
- }
- .student-box {
- max-height: 200px;
- padding: 0 15px;
- margin: 25px 0 0 0;
- box-sizing: border-box;
- overflow: auto;
- /deep/.u-card__head {
- padding-bottom: 0px !important;
- }
- }
- }
- .menber-box {
- width: 100%;
- // float: left;
- padding: 10px 15px;
- margin-bottom: 10px;
-
- .menber-col {
- width: 100%;
- padding: 15px;
- margin-bottom: 10px;
- display: inline-block;
- background-color: #FFFFFF;
- border-radius: 15px;
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
- position: relative;
- overflow: hidden;
- box-sizing: border-box;
-
- .menber-label {
- width: 100%;
- margin-bottom: 5px;
- float: left;
- font-size: 14px;
- // line-height: 20px;
- }
-
- .menber-num {
- width: 100%;
- float: left;
- font-size: 26px;
- line-height: 28px;
- color: $mainColor;
- }
-
- .menber-icon {
- font-size: 100px;
- color: $mainColor;
- position: absolute;
- right: -5px;
- bottom: -30px;
- opacity: 0.5;
- }
- }
- }
- .common-title {
- width:100%;
- text-align: center;
- font-size: 20px;
- margin: 10px 0;
- }
- .fix-add-icon {
- position: fixed;
- bottom: 15px;
- right: 15px;
- }
- .button-box {
- // width: 100%;
- padding: 10px 15px;
- box-sizing: border-box;
- }
- </style>
|