Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
7e1d4aeec1
  1. 8
      src/js/api.js
  2. 8
      src/pages.json
  3. 11
      src/pages/course/experience/experience.vue
  4. 2
      src/pages/course/task/task.vue
  5. 31
      src/pages/index/index.vue
  6. 6
      src/pages/site/confirm/confirm.vue
  7. 13
      src/pages/site/manage/manage.vue
  8. 8
      src/pages/store_list/store_list.vue
  9. 141
      src/pages/time/_config/_config.vue
  10. 62
      src/pages/time/select/select.vue
  11. 3
      src/store/index.js

8
src/js/api.js

@ -1,5 +1,5 @@
// export const ORIGIN = `https://test.ouxuanzhineng.cn`; // 测试
export const ORIGIN = `http://kahing.local:9090`; // 本地测试
export const ORIGIN = `https://test.ouxuanzhineng.cn`; // 测试
// export const ORIGIN = `http://kahing.local:9090`; // 本地测试
// export const ORIGIN = `https://coach.ouxuanzhineng.cn`; // 正式
export const API = {
@ -25,6 +25,10 @@ export const API = {
venueTypes: `${ORIGIN}/stadium/venue/types`, // 场馆类型
venueList: `${ORIGIN}/stadium/book/list`, // 场地列表
takeUpVenue: `${ORIGIN}/stadium/coach/takeUpVenue`, // 场地列表
// 我的时间
getCoachTimeList: `${ORIGIN}/stadium/coach/getCoachTimeList`, // 场地列表
}
API['course'] = {

8
src/pages.json

@ -152,7 +152,13 @@
{
"path": "pages/time/select/select",
"style": {
"navigationBarTitleText": "确认订单"
"navigationBarTitleText": "设置时间"
}
},
{
"path": "pages/time/_config/_config",
"style": {
"navigationBarTitleText": "设置时间"
}
},
{

11
src/pages/course/experience/experience.vue

@ -67,7 +67,7 @@
</view>
<text @click="selectAll">全选</text>
</view>
<view class="fb-btn" hover-class="hover-active">召开体验课</view>
<view class="fb-btn" hover-class="hover-active" @click="conveneBtn">召开体验课</view>
</view>
</view>
</template>
@ -115,6 +115,15 @@ export default {
this.curTabInfo = tabArr[0];
},
methods: {
conveneBtn(){
let _ids = this.exList.filter(ele=>ele._selectedStatus).map(ele=>ele.id)
console.warn(_ids)
let _query = {
occupyType: 'exp_booking',
exp_booking_ids: _ids
}
util.routeTo(`/pages/site/manage/manage?query=${util.jsonStr(_query)}`, 'nT');
},
//
selectAll(){
let { exList, isAllSelected } = this;

2
src/pages/course/task/task.vue

@ -66,7 +66,7 @@ export default {
homework_id: e.id,
...optionsQuery,
};
if(e._courseType === 1)return util.routeTo(`/pages/course/task_info/task_info?query=${util.jsonStr(_query)}`, 'nT');
// if(e._courseType === 1)return util.routeTo(`/pages/course/task_info/task_info?query=${util.jsonStr(_query)}`, 'nT');
util.routeTo(`/pages/course/task_finish/task_finish?query=${util.jsonStr(_query)}`, 'nT');
},
// (0)/(1);

31
src/pages/index/index.vue

@ -102,24 +102,24 @@
}
},
onLoad(){
this.getCoachCourseTimes();
// this.getCoachCourseTimes();
this.getHomeData();
},
methods: {
toStoreList(){
util.routeTo('/pages/store_list/store_list', 'nT');
},
getCoachCourseTimes(){
servers.get({
url: API.getCoachCourseTimes,
data: {},
failMsg: '加载失败!'
})
.then(res=>{
console.warn(res)
this.course_times = res.course_times
})
},
// getCoachCourseTimes(){
// servers.get({
// url: API.getCoachCourseTimes,
// data: {},
// failMsg: ''
// })
// .then(res=>{
// console.warn(res)
// this.course_times = res.course_times
// })
// },
getHomeData(){
util.showLoad();
servers.get({
@ -129,10 +129,13 @@
})
.then(res=>{
util.hideLoad();
this.indexData = res;
let _storeList = res.stadium_data || [];
this.indexData = res;
this.course_times = res.course_times
// return console.warn(this.$store)
if(_storeList.length)this.$store.commit('setStoreInfo', _storeList[0])
console.warn('this.storeInfo',this.storeInfo)
console.warn('JSON.stringify(this.storeInfo)',JSON.stringify(this.storeInfo))
if(_storeList.length&&JSON.stringify(this.storeInfo)=='{}')this.$store.commit('setStoreInfo', _storeList[0])
})
},
tabClick(e){

6
src/pages/site/confirm/confirm.vue

@ -73,9 +73,8 @@ export default {
},
methods: {
confirmOccupy: util.debounce(function(){
let { storeInfo, dateInfo, venueList, typeInfo } = this.occupyInfo;
let { storeInfo, dateInfo, venueList, occupyType, exp_booking_ids } = this.occupyInfo;
let { ocPrice, ocReaon } = this;
console.log(ocPrice, ocReaon);
servers.post({
url: API.takeUpVenue,
@ -84,7 +83,8 @@ export default {
amount: +ocPrice,
group: storeInfo.id,
date: dateInfo.dateStr,
type: 'normal',
type: occupyType,
exp_booking_ids: occupyType == 'normal'?[]:exp_booking_ids,
items: venueList.map(el=>{
return {
venue_id: el.parentObj.id,

13
src/pages/site/manage/manage.vue

@ -115,6 +115,10 @@ export default {
totalPrice: 0,
occupyTip: '', //
venueAreaSize: '', //
occupyTypeInfo: {
occupyType: 'normal', // normal: exp_booking
exp_booking_ids: [], // id
},
}
},
computed: {
@ -125,7 +129,11 @@ export default {
clearTimeout(tipTimer);
tipTimer = null;
},
async onLoad(){
async onLoad(options){
if(options.query){
let _optionsQuery = util.jsonPar(options.query);
if(!!_optionsQuery.occupyType)this.occupyTypeInfo = _optionsQuery;
}
try {
util.showLoad();
let _storeInfo = await this.getStoreList();
@ -294,7 +302,7 @@ export default {
this.$nextTick(_=>this.refreshVenues());
},
toOrderConfirm(){
let { curStoreInfo, curTypeInfo, curDateInfo, selectedVenueList } = this;
let { curStoreInfo, curTypeInfo, curDateInfo, selectedVenueList, occupyTypeInfo } = this;
if(!selectedVenueList.length)return;
this.$store.commit('setOccupyInfo', {
@ -302,6 +310,7 @@ export default {
dateInfo: curDateInfo,
typeInfo: curTypeInfo,
venueList: selectedVenueList,
...occupyTypeInfo,
})
util.routeTo(`/pages/site/confirm/confirm`, 'rT');

8
src/pages/store_list/store_list.vue

@ -1,6 +1,6 @@
<template>
<view class="store-list">
<view class="sl-item" v-for="(e, i) in courseList" :key="i">
<view class="sl-item" v-for="(e, i) in courseList" :key="i" @click="storeSelected(e)">
<image class="si-logo" mode="aspectFit" :src="e.logo || ''"></image>
<view class="si-content">
<view class="sc-top">
@ -34,7 +34,10 @@ export default {
this.getHomeData();
},
methods: {
storeSelected(e){
this.$store.commit('setStoreInfo', e);
util.routeTo();
},
getHomeData(){
servers.get({
url: API.getHomeData,
@ -44,7 +47,6 @@ export default {
.then(res=>{
let _list = res.stadium_data || [];
this.courseList = _list;
console.warn(res, 1231321321321321313)
})
},
}

141
src/pages/time/_config/_config.vue

@ -0,0 +1,141 @@
<template>
<view class="config-container fixed-bot-padding">
<view class="cc-tit">快速配置</view>
<view class="c-item">
<view class="i-tit">选择日期范围</view>
<view class="i-select">
<picker class="s-picker">
<view class="p-view">
<input value="2020年5月16日" />
<image></image>
</view>
</picker>
<view>-</view>
<picker class="s-picker">
<view class="p-view">
<input value="2020年5月16日" />
<image></image>
</view>
</picker>
</view>
</view>
<view class="c-item">
<view class="i-tit">选择日期范围</view>
<view class="i-select">
<picker class="s-picker">
<view class="p-view">
<input value="2020年5月16日" />
<image></image>
</view>
</picker>
<view>-</view>
<picker class="s-picker">
<view class="p-view">
<input value="2020年5月16日" />
<image></image>
</view>
</picker>
</view>
</view>
<view class="c-item">
<view class="i-tit">状态</view>
<view class="i-select">
<picker class="s-picker">
<view class="p-view">
<input value="空闲" />
<image></image>
</view>
</picker>
</view>
</view>
<view class="c-remarks">
<view class="r-tit">备注</view>
<view class="r-frame"><textarea></textarea></view>
</view>
<view class="fixed-bot-btn"><view hover-class="hover-active">保存</view></view>
</view>
</template>
<script>
export default {
}
</script>
<style lang="scss">
@import '~style/public.scss';
page{
background-color: #fff;
}
.cc-tit{
padding: 24upx 0 44upx;
text-align: center;
font-size: 36upx;
line-height: 50upx;
color: #333;
}
.c-item{
margin-bottom: 24upx;
padding: 0 24upx;
.i-tit{
margin-bottom: 16upx;
line-height: 40upx;
font-size: 28upx;
color: #333;
}
.i-select{
@include centerFlex(space-between);
.s-picker{
border: 2upx solid #d8d8d8;
border-radius: 6upx;
.p-view{
padding: 0 16upx;
width: 316upx;
height: 60upx;
@include centerFlex(space-between);
input{
text-align: center;
flex-grow: 1;
font-weight: 500;
font-size: 28upx;
color: #333;
}
image{
flex-shrink: 0;
width: 16upx;
height: 16upx;
background-color: skyblue;
}
}
}
}
}
.c-remarks{
padding: 0 24upx;
.r-tit{
margin-bottom: 24upx;
font-size: 28upx;
line-height: 40upx;
color: #333;
}
.r-frame{
padding: 16upx;
height: 242upx;
border-radius: 6upx;
border: 2upx solid #d8d8d8;
>textarea{
width: 100%;
height: 100%;
font-size: 28upx;
line-height: 32upx;
color: #333;
}
}
}
</style>

62
src/pages/time/select/select.vue

@ -1,16 +1,16 @@
<template>
<view class="time-select">
<view class="s-time-bar">
<picker>
<picker mode="date" @change="startTimeChange">
<view>
<input value="2020年5月16日" />
<input disabled v-model="timeSlot.start" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
<text></text>
<picker>
<picker mode="date" @change="endTimeChange">
<view>
<input value="2020年5月16日" />
<input disabled v-model="timeSlot.end" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
@ -56,7 +56,7 @@
<view>课程/预约</view>
</view>
</view>
<view class="tf-btn" hover-class="hover-active">快速预约时间</view>
<view class="tf-btn" hover-class="hover-active" @click="toConfig">快速预约时间</view>
</view>
<view class="s-select-fixed">
@ -65,13 +65,62 @@
</template>
<script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util';
export default {
data(){
return {
timeAreaScrollX: 0,
timeSlot: {
start: '',
end: '',
}
}
},
onLoad(){
let _startDate = util.formatDate({});
let _endDate = util.formatDate({
date: new Date().getTime()+(7*24*60*60*1000)
})
this.timeSlot.start = _startDate
this.timeSlot.end = _endDate
console.warn(_startDate, '-' ,_endDate)
this.getTimeList({
start_date: _startDate,
end_date: _endDate,
})
},
methods: {
toConfig(){
util.routeTo(`/pages/time/_config/_config`, 'nT')
},
getTimeList({
start_date,
end_date,
}){
servers.get({
url: API.getCoachTimeList,
data: {
start_date,
end_date,
},
failMsg: '加载失败!'
})
.then(res=>{
this.timeList = res.list || [];
console.warn(res)
})
},
startTimeChange(e){
this.timeSlot.start = e.detail.value;
},
endTimeChange(e){
this.timeSlot.end = e.detail.value;
},
dateScroll(e){
console.warn('dateScroll', e)
this.timeAreaScrollX = e.detail.scrollLeft;
@ -79,7 +128,8 @@ export default {
timeScroll(e){
console.warn('timeScroll', e)
this.timeAreaScrollX = e.detail.scrollLeft;
}
},
}
}
</script>

3
src/store/index.js

@ -18,6 +18,9 @@ export default new Vuex.Store({
dateInfo: {}, // 时间信息
typeInfo: {}, // 球场类型
venueList: [], // 选择场地列表
// 新增类型
occupyType: 'normal', // normal:教练占场, exp_booking: 代表体验课占场
exp_booking_ids: [], // 体验课预约id数组
}
},
mutations,

Loading…
Cancel
Save