From 5a48eaa552e060763352cad4205836aee7c97ec0 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Thu, 25 Feb 2021 18:10:48 +0800 Subject: [PATCH] add api --- src/js/api.js | 7 +++ src/pages/course/experience/experience.vue | 22 ++++++- src/pages/course/list/list.vue | 9 ++- src/pages/course/roll_call/roll_call.vue | 97 +++++++++++++++++++++++++---- src/pages/index/index.vue | 2 +- src/pages/site/confirm/confirm.vue | 23 +++---- src/pages/site/manage/manage.vue | 14 ++--- src/static/images/arrow_c33.png | Bin 0 -> 308 bytes src/store/index.js | 7 +++ src/store/mutations.js | 6 +- 10 files changed, 149 insertions(+), 38 deletions(-) create mode 100644 src/static/images/arrow_c33.png diff --git a/src/js/api.js b/src/js/api.js index dbe4515..b95778e 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -19,6 +19,12 @@ export const API = { addShiftWorkRecord: `${ORIGIN}/stadium/coach/addShiftWorkRecord`, // 小程序-教练换班-申请换班 getShiftWorkList: `${ORIGIN}/stadium/coach/getShiftWorkList`, // 小程序-教练换班记录 + + // 占用场地 + // stadiumList: `${ORIGIN}/stadium/list`, // 店铺列表 + venueTypes: `${ORIGIN}/stadium/venue/types`, // 场馆类型 + venueList: `${ORIGIN}/stadium/book/list`, // 场地列表 + takeUpVenue: `${ORIGIN}/stadium/coach/takeUpVenue`, // 场地列表 } API['course'] = { @@ -35,6 +41,7 @@ API['course'] = { homeworkRecordInfo: `${ORIGIN}/stadium/coach/homework/recordInfo`, // 小程序-作业完成详情 homeworkAdd: `${ORIGIN}/stadium/coach/homework/add`, // 小程序-布置作业 + checkOrder: `${ORIGIN}/stadium/coach/checkOrder`, // 小程序-点名 // 体验课 getOfferPriceList: `${ORIGIN}/stadium/coach/getOfferPriceList`, // 小程序-体验课预约列表 diff --git a/src/pages/course/experience/experience.vue b/src/pages/course/experience/experience.vue index 36d8e4b..ae6a2c8 100644 --- a/src/pages/course/experience/experience.vue +++ b/src/pages/course/experience/experience.vue @@ -21,7 +21,7 @@ e.order_pay_status == 1 ? '已支付': '' }} - + @@ -62,10 +62,10 @@ - + - 全选 + 全选 召开体验课 @@ -83,6 +83,11 @@ const tabArr = [ id: 1 }, { + name: '已召开', + status: 2, + id: 3 + }, + { name: '已报价', status: 1, id: 2 @@ -110,6 +115,17 @@ export default { this.curTabInfo = tabArr[0]; }, methods: { + // 全选 + selectAll(){ + let { exList, isAllSelected } = this; + if(exList.length<=0)return; + this.exList = exList.map(e=>{ + return { + ...e, + _selectedStatus: !isAllSelected + }; + }) + }, toDetail(e){ let _query = { price: e.price || 0, diff --git a/src/pages/course/list/list.vue b/src/pages/course/list/list.vue index 263d977..8d0cd28 100644 --- a/src/pages/course/list/list.vue +++ b/src/pages/course/list/list.vue @@ -22,7 +22,7 @@ 预约上课 班级 - 详情 + 详情 @@ -173,6 +173,13 @@ export default { } util.routeTo(`/pages/course/class_list/class_list?query=${util.jsonStr(_query)}`, 'nT'); }, + toStudentList(e){ + let _query = { + course_id: e.id, + course_name: e.name, + } + util.routeTo(`/pages/course/student_list/student_list?query=${util.jsonStr(_query)}`, 'nT'); + }, orderCourseBtn: util.debounce(function(e){ this.orderInfo = { // 预约信息 classInfo: { diff --git a/src/pages/course/roll_call/roll_call.vue b/src/pages/course/roll_call/roll_call.vue index 07d104e..4d6e73e 100644 --- a/src/pages/course/roll_call/roll_call.vue +++ b/src/pages/course/roll_call/roll_call.vue @@ -4,33 +4,38 @@ {{optionsQuery.course_name || '-'}} - 课程时间: 2020/12/19 13:00~14:15 - 5/2 + 课程时间: {{ pageInfo.course_duration.date || '-' }} {{ pageInfo.course_duration.start_duration || '-' }}~{{ pageInfo.course_duration.end_duration || '-' }} + {{pageInfo.has_call_name_num || 0}}/{{pageInfo.not_call_name_num || 0}} - - - + + + - {{e.name || '-'}} - + {{e.course_order.name || '-'}} + - - {{e.mobile || '-'}} + + {{e.course_order.mobile || '-'}} - 剩余次数: {{e.number || 0}}次 - 未点名 + 剩余次数: {{e.course_order.number || 0}}次 + + {{ + e.attendance_record.id === 0? '未点名': '已点名' + }} + + 快速点名 @@ -43,8 +48,18 @@ export default { return { optionsQuery: {}, studentList: [], + pageInfo: {}, + page: 1, } }, + onReachBottom(){ + let { optionsQuery, page } = this; + this.getUserList({ + course_id: optionsQuery.course_id, + class_id: optionsQuery.class_id, + page: ++page + }) + }, onLoad(options){ console.warn(util.jsonPar(options.query)); let _query = util.jsonPar(options.query) || {}; @@ -55,12 +70,58 @@ export default { }) }, methods: { + rollCallBtn: util.debounce(function(){ + let { studentList, pageInfo } = this; + let _order_nos = studentList.filter(e=>e._selectStatus).map(e=>e.course_order.order_no) || []; + if(_order_nos.length<=0)return; + util.showLoad(); + servers.post({ + url: API.course.checkOrder, + data: { + duration_id: pageInfo.course_duration.id, + order_nos: _order_nos + }, + isDefaultGet: false + }) + .then(res=>{ + util.hideLoad(); + if(res.data.code == 0){ + util.showNone(res.data.message || '操作成功!'); + setTimeout(_=>{ + let { optionsQuery } = this; + this.studentList = []; + this.page = 1; + this.getUserList({ + course_id: optionsQuery.course_id, + class_id: optionsQuery.class_id, + }) + }, 1200) + + }else{ + util.showNone(res.data.message || '操作失败!'); + } + }) + }, 300, 300), + phoneCall(number){ + uni.makePhoneCall({ + phoneNumber: number || '-' + }) + }, + itemSelect(idx){ + let _list = [...this.studentList]; + if(_list[idx].attendance_record.id!==0)return; + _list[idx]['_selectStatus'] = !_list[idx]['_selectStatus']; + this.studentList = _list; + + + }, getUserList({ course_id, class_id, page= 1, page_size= 15, }){ + util.showLoad(); servers.get({ url: API.course.getCourseStudentList, data: { @@ -72,9 +133,14 @@ export default { failMsg: '加载失败!' }) .then(res=>{ + util.hideLoad(); let _list = res.list || []; + let { list, ..._pageInfo } = res; + console.warn(_pageInfo, '_pageInfo'); + this.pageInfo = _pageInfo; if(page == 1)return this.studentList = _list; if(_list.length <=0)return util.showNone('没有更多!'); + this.page = page; this.studentList = [...this.studentList, ..._list]; }) @@ -122,10 +188,14 @@ export default { margin-right: 26upx; width: 40upx; height: 40upx; + border-radius: 50%; >image{ width: 100%; height: 100%; } + &.border{ + box-shadow: inset 0 0 0 2upx #9a9a9d; + } } .ri-avatar{ flex-shrink: 0; @@ -182,7 +252,10 @@ export default { flex-shrink: 0; font-weight: 500; font-size: 28upx; - color: $themeColor; + color: #9A9A9D; + &.green{ + color: $themeColor; + } } } } diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 243c04c..d77da89 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -66,7 +66,7 @@ { id: '4', name: '场地管理', - path: '/pages/time/select/select', + path: '/pages/site/manage/manage', }, { id: '5', diff --git a/src/pages/site/confirm/confirm.vue b/src/pages/site/confirm/confirm.vue index deccc8f..0e19db1 100644 --- a/src/pages/site/confirm/confirm.vue +++ b/src/pages/site/confirm/confirm.vue @@ -58,15 +58,15 @@ export default { return { ocPrice: '', ocReaon: '', - occupyInfo: { - storeInfo: {}, - typeInfo:{}, - dateInfo:{} - } + // occupyInfo: { + // storeInfo: {}, + // typeInfo:{}, + // dateInfo:{} + // } } }, computed: { - // ...mapState([ 'occupyInfo' ]), + ...mapState([ 'occupyInfo' ]), }, onLoad(){ console.log(this.occupyInfo) @@ -78,12 +78,13 @@ export default { console.log(ocPrice, ocReaon); servers.post({ - url: API.venue.venueTakeUp, + url: API.takeUpVenue, data: { reason: ocReaon, amount: +ocPrice, group: storeInfo.id, date: dateInfo.dateStr, + type: 'normal', items: venueList.map(el=>{ return { venue_id: el.parentObj.id, @@ -101,10 +102,10 @@ export default { util.showNone(res.data.message || '操作成功!'); setTimeout(_=>{ util.routeTo(); - util.previousPageFunction({ // 刷新占用列表 - fnName: 'refreshList', - query: null - }) + // util.previousPageFunction({ // 刷新占用列表 + // fnName: 'refreshList', + // query: null + // }) }, 1200) }else{ util.showNone(res.data.message || '操作失败!'); diff --git a/src/pages/site/manage/manage.vue b/src/pages/site/manage/manage.vue index c973341..834d7a3 100644 --- a/src/pages/site/manage/manage.vue +++ b/src/pages/site/manage/manage.vue @@ -4,14 +4,14 @@ {{curStoreInfo.name || '-'}} - + {{curTypeInfo.name || '-'}} - + {{curTypeInfo.rule_text || '-'}} @@ -19,7 +19,7 @@ {{dateList[0].ZhDateStr || '-'}} — {{dateList[dateList.length-1].ZhDateStr || '-'}} - + @@ -129,7 +129,7 @@ export default { try { util.showLoad(); let _storeInfo = await this.getStoreList(); - let _storeList = _storeInfo.list || []; + let _storeList = _storeInfo.stadium_data || []; if(!_storeList.length)return util.showNone('没有店铺信息!'); this.storeList = _storeList ; let _curStore = _storeList[0] || {}; @@ -309,7 +309,7 @@ export default { // 场馆列表 getVenueList({type_key,stadium_id,date}){ return servers.get({ - url: API.venue.venueList, + url: API.venueList, data: {stadium_id,type_key,date}, failMsg: '加载分类失败!' }) @@ -317,7 +317,7 @@ export default { // 球类列表 getClassify({stadium_id}){ return servers.get({ - url: API.venue.venueTypes, + url: API.venueTypes, data: {stadium_id}, failMsg: '加载分类失败!' }) @@ -325,7 +325,7 @@ export default { // 店铺列表 getStoreList(){ return servers.get({ - url: API.stadiumList, + url: API.getHomeData, data: {}, failMsg: '加载店铺失败!' }) diff --git a/src/static/images/arrow_c33.png b/src/static/images/arrow_c33.png new file mode 100644 index 0000000000000000000000000000000000000000..eba9e13b5b97336c08160588142b29fefcb71c9b GIT binary patch literal 308 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaA`33ldxB_V-BO?_R6(9)##xMZn z!kADRuE4;+04M}k02i;?mHPu|qGU;sUogW@w(V0tJaIBo=e_R#`t*vXY+11b3yTxO zCvQ2B4pda*>EaloasF(-yHK-%0LxUz#*{g~{>ztg&SaV@$54B7rQMl#UEMEz!@2V> znJI5t{ilJ)GDG6eLwUYAw}N?g$1C6Xx8J2HOtpPt@Mm#@=pg?IFJH`URITQ%InudO zWKTnR=`N{*Rm^7=rIjWyUj8@VbaIC0l*Q3vE1P#%+8=nuE-HEL&sU&37(8A5T-G@y GGywo86=|dZ literal 0 HcmV?d00001 diff --git a/src/store/index.js b/src/store/index.js index cde16fc..2164a4b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -12,6 +12,13 @@ export default new Vuex.Store({ state: { // 当前小程序店铺信息 storeInfo: {}, + // 场地占用提交页面信息 + occupyInfo: { + storeInfo: {}, // 店铺信息 + dateInfo: {}, // 时间信息 + typeInfo: {}, // 球场类型 + venueList: [], // 选择场地列表 + } }, mutations, actions, diff --git a/src/store/mutations.js b/src/store/mutations.js index 74555f3..7092717 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -8,7 +8,7 @@ export default { }, // // 场地占用信息 - // setOccupyInfo(state, _occupyInfo){ - // state.occupyInfo = _occupyInfo; - // } + setOccupyInfo(state, _occupyInfo){ + state.occupyInfo = _occupyInfo; + } } \ No newline at end of file