From 7e1d4aeec199a696582366f3f5ef5601a1286e24 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Mon, 1 Mar 2021 18:12:34 +0800 Subject: [PATCH] add api --- src/js/api.js | 8 +- src/pages.json | 8 +- src/pages/course/experience/experience.vue | 11 ++- src/pages/course/task/task.vue | 2 +- src/pages/index/index.vue | 31 ++++--- src/pages/site/confirm/confirm.vue | 6 +- src/pages/site/manage/manage.vue | 13 ++- src/pages/store_list/store_list.vue | 8 +- src/pages/time/_config/_config.vue | 141 +++++++++++++++++++++++++++++ src/pages/time/select/select.vue | 62 +++++++++++-- src/store/index.js | 3 + 11 files changed, 260 insertions(+), 33 deletions(-) create mode 100644 src/pages/time/_config/_config.vue diff --git a/src/js/api.js b/src/js/api.js index b95778e..de7b290 100644 --- a/src/js/api.js +++ b/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'] = { diff --git a/src/pages.json b/src/pages.json index 1e273f7..56582f4 100644 --- a/src/pages.json +++ b/src/pages.json @@ -152,7 +152,13 @@ { "path": "pages/time/select/select", "style": { - "navigationBarTitleText": "确认订单" + "navigationBarTitleText": "设置时间" + } + }, + { + "path": "pages/time/_config/_config", + "style": { + "navigationBarTitleText": "设置时间" } }, { diff --git a/src/pages/course/experience/experience.vue b/src/pages/course/experience/experience.vue index ae6a2c8..3fe1d4c 100644 --- a/src/pages/course/experience/experience.vue +++ b/src/pages/course/experience/experience.vue @@ -67,7 +67,7 @@ 全选 - 召开体验课 + 召开体验课 @@ -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; diff --git a/src/pages/course/task/task.vue b/src/pages/course/task/task.vue index 2abf754..bb4736e 100644 --- a/src/pages/course/task/task.vue +++ b/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); diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1ab2d0b..0ad64c8 100644 --- a/src/pages/index/index.vue +++ b/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){ diff --git a/src/pages/site/confirm/confirm.vue b/src/pages/site/confirm/confirm.vue index 0e19db1..10a0eec 100644 --- a/src/pages/site/confirm/confirm.vue +++ b/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, diff --git a/src/pages/site/manage/manage.vue b/src/pages/site/manage/manage.vue index 834d7a3..1a01864 100644 --- a/src/pages/site/manage/manage.vue +++ b/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'); diff --git a/src/pages/store_list/store_list.vue b/src/pages/store_list/store_list.vue index 0a006a0..3dc77f5 100644 --- a/src/pages/store_list/store_list.vue +++ b/src/pages/store_list/store_list.vue @@ -1,6 +1,6 @@