Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
5a48eaa552
  1. 7
      src/js/api.js
  2. 22
      src/pages/course/experience/experience.vue
  3. 9
      src/pages/course/list/list.vue
  4. 97
      src/pages/course/roll_call/roll_call.vue
  5. 2
      src/pages/index/index.vue
  6. 23
      src/pages/site/confirm/confirm.vue
  7. 14
      src/pages/site/manage/manage.vue
  8. BIN
      src/static/images/arrow_c33.png
  9. 7
      src/store/index.js
  10. 6
      src/store/mutations.js

7
src/js/api.js

@ -19,6 +19,12 @@ export const API = {
addShiftWorkRecord: `${ORIGIN}/stadium/coach/addShiftWorkRecord`, // 小程序-教练换班-申请换班 addShiftWorkRecord: `${ORIGIN}/stadium/coach/addShiftWorkRecord`, // 小程序-教练换班-申请换班
getShiftWorkList: `${ORIGIN}/stadium/coach/getShiftWorkList`, // 小程序-教练换班记录 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'] = { API['course'] = {
@ -35,6 +41,7 @@ API['course'] = {
homeworkRecordInfo: `${ORIGIN}/stadium/coach/homework/recordInfo`, // 小程序-作业完成详情 homeworkRecordInfo: `${ORIGIN}/stadium/coach/homework/recordInfo`, // 小程序-作业完成详情
homeworkAdd: `${ORIGIN}/stadium/coach/homework/add`, // 小程序-布置作业 homeworkAdd: `${ORIGIN}/stadium/coach/homework/add`, // 小程序-布置作业
checkOrder: `${ORIGIN}/stadium/coach/checkOrder`, // 小程序-点名
// 体验课 // 体验课
getOfferPriceList: `${ORIGIN}/stadium/coach/getOfferPriceList`, // 小程序-体验课预约列表 getOfferPriceList: `${ORIGIN}/stadium/coach/getOfferPriceList`, // 小程序-体验课预约列表

22
src/pages/course/experience/experience.vue

@ -21,7 +21,7 @@
e.order_pay_status == 1 ? '已支付': '' e.order_pay_status == 1 ? '已支付': ''
}} }}
</view> </view>
<view :class="['h-icon', !e._selectedStatus?'border':'']" v-else>
<view :class="['h-icon', !e._selectedStatus?'border':'']" v-else-if="curTabInfo.status == 0">
<image v-if="e._selectedStatus" mode="aspectFit" src="/static/images/selected_c97.png"></image> <image v-if="e._selectedStatus" mode="aspectFit" src="/static/images/selected_c97.png"></image>
</view> </view>
</view> </view>
@ -62,10 +62,10 @@
</view> </view>
<view class="e-fixed-bar" v-if="curTabInfo.status == 0"> <view class="e-fixed-bar" v-if="curTabInfo.status == 0">
<view class="fb-select"> <view class="fb-select">
<view :class="[isAllSelected?'':'border']">
<view :class="[isAllSelected?'':'border']" @click="selectAll">
<image v-if="isAllSelected" mode="aspectFit" src="/static/images/selected_c97.png"></image> <image v-if="isAllSelected" mode="aspectFit" src="/static/images/selected_c97.png"></image>
</view> </view>
<text>全选</text>
<text @click="selectAll">全选</text>
</view> </view>
<view class="fb-btn" hover-class="hover-active">召开体验课</view> <view class="fb-btn" hover-class="hover-active">召开体验课</view>
</view> </view>
@ -83,6 +83,11 @@ const tabArr = [
id: 1 id: 1
}, },
{ {
name: '已召开',
status: 2,
id: 3
},
{
name: '已报价', name: '已报价',
status: 1, status: 1,
id: 2 id: 2
@ -110,6 +115,17 @@ export default {
this.curTabInfo = tabArr[0]; this.curTabInfo = tabArr[0];
}, },
methods: { methods: {
//
selectAll(){
let { exList, isAllSelected } = this;
if(exList.length<=0)return;
this.exList = exList.map(e=>{
return {
...e,
_selectedStatus: !isAllSelected
};
})
},
toDetail(e){ toDetail(e){
let _query = { let _query = {
price: e.price || 0, price: e.price || 0,

9
src/pages/course/list/list.vue

@ -22,7 +22,7 @@
<view hover-class="hover-active" @click="orderCourseBtn(e)">预约上课</view> <view hover-class="hover-active" @click="orderCourseBtn(e)">预约上课</view>
<view hover-class="hover-active" @click="toClass(e)">班级</view> <view hover-class="hover-active" @click="toClass(e)">班级</view>
</block> </block>
<view hover-class="hover-active" v-if="getCourseType(e.kind) === 1">详情</view>
<view hover-class="hover-active" v-if="getCourseType(e.kind) === 1" @click="toStudentList(e)">详情</view>
</view> </view>
</view> </view>
<view class="cl-ex-item" v-if="curTabIdx == 1"> <view class="cl-ex-item" v-if="curTabIdx == 1">
@ -173,6 +173,13 @@ export default {
} }
util.routeTo(`/pages/course/class_list/class_list?query=${util.jsonStr(_query)}`, 'nT'); 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){ orderCourseBtn: util.debounce(function(e){
this.orderInfo = { // this.orderInfo = { //
classInfo: { classInfo: {

97
src/pages/course/roll_call/roll_call.vue

@ -4,33 +4,38 @@
<view class="top-bar"><text>{{optionsQuery.course_name || '-'}}</text></view> <view class="top-bar"><text>{{optionsQuery.course_name || '-'}}</text></view>
</picker> </picker>
<view class="rc-time"> <view class="rc-time">
<view>课程时间: 2020/12/19 13:00~14:15</view>
<view>5/2</view>
<view>课程时间: {{ pageInfo.course_duration.date || '-' }} {{ pageInfo.course_duration.start_duration || '-' }}~{{ pageInfo.course_duration.end_duration || '-' }}</view>
<view>{{pageInfo.has_call_name_num || 0}}/{{pageInfo.not_call_name_num || 0}}</view>
</view> </view>
<view class="rc-list"> <view class="rc-list">
<view class="rl-item" v-for="(e, i) in studentList" :key="i">
<view class="ri-selected">
<image mode="aspectFit" src="/static/images/selected_c97.png"></image>
<view class="rl-item" v-for="(e, i) in studentList" :key="i" @click="itemSelect(i)">
<view :class="['ri-selected',!e._selectStatus?'border':'']">
<image v-if="e._selectStatus" mode="aspectFit" src="/static/images/selected_c97.png"></image>
</view> </view>
<image class="ri-avatar" mode="aspectFit" :src="e.user_info.avatar_url"></image> <image class="ri-avatar" mode="aspectFit" :src="e.user_info.avatar_url"></image>
<view class="ri-content"> <view class="ri-content">
<view class="rc-info"> <view class="rc-info">
<view class="ri-name"> <view class="ri-name">
<view>{{e.name || '-'}}</view>
<image mode="aspectFit" :src="`/src/static/images/sex_${e.gender-1}.png`"></image>
<view>{{e.course_order.name || '-'}}</view>
<image mode="aspectFit" :src="`/src/static/images/sex_${e.course_order.gender-1}.png`"></image>
</view> </view>
<view class="ri-phone">
<view>{{e.mobile || '-'}}</view>
<view class="ri-phone" @click.stop="phoneCall(e.course_order.mobile)">
<view>{{e.course_order.mobile || '-'}}</view>
<image mode="aspectFit" src="/static/images/phone_c33.png"></image> <image mode="aspectFit" src="/static/images/phone_c33.png"></image>
</view> </view>
</view> </view>
<view class="rc-tip"> <view class="rc-tip">
<view>剩余次数: {{e.number || 0}}</view>
<view>未点名</view>
<view>剩余次数: {{e.course_order.number || 0}}</view>
<view :class="[e.attendance_record.id !==0 ? 'green' : '']">
{{
e.attendance_record.id === 0? '未点名': '已点名'
}}
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="fixed-bot-btn"><view hover-class="hover-active" @click="rollCallBtn">快速点名</view></view>
</view> </view>
</template> </template>
@ -43,8 +48,18 @@ export default {
return { return {
optionsQuery: {}, optionsQuery: {},
studentList: [], 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){ onLoad(options){
console.warn(util.jsonPar(options.query)); console.warn(util.jsonPar(options.query));
let _query = util.jsonPar(options.query) || {}; let _query = util.jsonPar(options.query) || {};
@ -55,12 +70,58 @@ export default {
}) })
}, },
methods: { 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({ getUserList({
course_id, course_id,
class_id, class_id,
page= 1, page= 1,
page_size= 15, page_size= 15,
}){ }){
util.showLoad();
servers.get({ servers.get({
url: API.course.getCourseStudentList, url: API.course.getCourseStudentList,
data: { data: {
@ -72,9 +133,14 @@ export default {
failMsg: '加载失败!' failMsg: '加载失败!'
}) })
.then(res=>{ .then(res=>{
util.hideLoad();
let _list = res.list || []; let _list = res.list || [];
let { list, ..._pageInfo } = res;
console.warn(_pageInfo, '_pageInfo');
this.pageInfo = _pageInfo;
if(page == 1)return this.studentList = _list; if(page == 1)return this.studentList = _list;
if(_list.length <=0)return util.showNone('没有更多!'); if(_list.length <=0)return util.showNone('没有更多!');
this.page = page;
this.studentList = [...this.studentList, ..._list]; this.studentList = [...this.studentList, ..._list];
}) })
@ -122,10 +188,14 @@ export default {
margin-right: 26upx; margin-right: 26upx;
width: 40upx; width: 40upx;
height: 40upx; height: 40upx;
border-radius: 50%;
>image{ >image{
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
&.border{
box-shadow: inset 0 0 0 2upx #9a9a9d;
}
} }
.ri-avatar{ .ri-avatar{
flex-shrink: 0; flex-shrink: 0;
@ -182,7 +252,10 @@ export default {
flex-shrink: 0; flex-shrink: 0;
font-weight: 500; font-weight: 500;
font-size: 28upx; font-size: 28upx;
color: $themeColor;
color: #9A9A9D;
&.green{
color: $themeColor;
}
} }
} }
} }

2
src/pages/index/index.vue

@ -66,7 +66,7 @@
{ {
id: '4', id: '4',
name: '场地管理', name: '场地管理',
path: '/pages/time/select/select',
path: '/pages/site/manage/manage',
}, },
{ {
id: '5', id: '5',

23
src/pages/site/confirm/confirm.vue

@ -58,15 +58,15 @@ export default {
return { return {
ocPrice: '', ocPrice: '',
ocReaon: '', ocReaon: '',
occupyInfo: {
storeInfo: {},
typeInfo:{},
dateInfo:{}
}
// occupyInfo: {
// storeInfo: {},
// typeInfo:{},
// dateInfo:{}
// }
} }
}, },
computed: { computed: {
// ...mapState([ 'occupyInfo' ]),
...mapState([ 'occupyInfo' ]),
}, },
onLoad(){ onLoad(){
console.log(this.occupyInfo) console.log(this.occupyInfo)
@ -78,12 +78,13 @@ export default {
console.log(ocPrice, ocReaon); console.log(ocPrice, ocReaon);
servers.post({ servers.post({
url: API.venue.venueTakeUp,
url: API.takeUpVenue,
data: { data: {
reason: ocReaon, reason: ocReaon,
amount: +ocPrice, amount: +ocPrice,
group: storeInfo.id, group: storeInfo.id,
date: dateInfo.dateStr, date: dateInfo.dateStr,
type: 'normal',
items: venueList.map(el=>{ items: venueList.map(el=>{
return { return {
venue_id: el.parentObj.id, venue_id: el.parentObj.id,
@ -101,10 +102,10 @@ export default {
util.showNone(res.data.message || '操作成功!'); util.showNone(res.data.message || '操作成功!');
setTimeout(_=>{ setTimeout(_=>{
util.routeTo(); util.routeTo();
util.previousPageFunction({ //
fnName: 'refreshList',
query: null
})
// util.previousPageFunction({ //
// fnName: 'refreshList',
// query: null
// })
}, 1200) }, 1200)
}else{ }else{
util.showNone(res.data.message || '操作失败!'); util.showNone(res.data.message || '操作失败!');

14
src/pages/site/manage/manage.vue

@ -4,14 +4,14 @@
<picker mode="selector" :range="storeList" range-key="name" @change="storePickerChange"> <picker mode="selector" :range="storeList" range-key="name" @change="storePickerChange">
<view class="sh-address"> <view class="sh-address">
<text>{{curStoreInfo.name || '-'}}</text> <text>{{curStoreInfo.name || '-'}}</text>
<image mode="aspectFit" src="/static/images/icon/arrow_c33.png"></image>
<image mode="aspectFit" src="/static/images/arrow_c33.png"></image>
</view> </view>
</picker> </picker>
<view class="sh-type"> <view class="sh-type">
<picker mode="selector" :range="typeList" range-key="name" @change="typePckerChange"> <picker mode="selector" :range="typeList" range-key="name" @change="typePckerChange">
<view class="st-type"> <view class="st-type">
<text>{{curTypeInfo.name || '-'}}</text> <text>{{curTypeInfo.name || '-'}}</text>
<image mode="aspectFit" src="/static/images/icon/arrow_c33.png"></image>
<image mode="aspectFit" src="/static/images/arrow_c33.png"></image>
</view> </view>
</picker> </picker>
<view class="st-tip">{{curTypeInfo.rule_text || '-'}}</view> <view class="st-tip">{{curTypeInfo.rule_text || '-'}}</view>
@ -19,7 +19,7 @@
<picker mode="date" @change="timeSlotChange"> <picker mode="date" @change="timeSlotChange">
<view class="sh-time" v-if="dateList.length>1"> <view class="sh-time" v-if="dateList.length>1">
<text>{{dateList[0].ZhDateStr || '-'}} {{dateList[dateList.length-1].ZhDateStr || '-'}}</text> <text>{{dateList[0].ZhDateStr || '-'}} {{dateList[dateList.length-1].ZhDateStr || '-'}}</text>
<image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image>
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image>
</view> </view>
</picker> </picker>
</view> </view>
@ -129,7 +129,7 @@ export default {
try { try {
util.showLoad(); util.showLoad();
let _storeInfo = await this.getStoreList(); let _storeInfo = await this.getStoreList();
let _storeList = _storeInfo.list || [];
let _storeList = _storeInfo.stadium_data || [];
if(!_storeList.length)return util.showNone('没有店铺信息!'); if(!_storeList.length)return util.showNone('没有店铺信息!');
this.storeList = _storeList ; this.storeList = _storeList ;
let _curStore = _storeList[0] || {}; let _curStore = _storeList[0] || {};
@ -309,7 +309,7 @@ export default {
// //
getVenueList({type_key,stadium_id,date}){ getVenueList({type_key,stadium_id,date}){
return servers.get({ return servers.get({
url: API.venue.venueList,
url: API.venueList,
data: {stadium_id,type_key,date}, data: {stadium_id,type_key,date},
failMsg: '加载分类失败!' failMsg: '加载分类失败!'
}) })
@ -317,7 +317,7 @@ export default {
// //
getClassify({stadium_id}){ getClassify({stadium_id}){
return servers.get({ return servers.get({
url: API.venue.venueTypes,
url: API.venueTypes,
data: {stadium_id}, data: {stadium_id},
failMsg: '加载分类失败!' failMsg: '加载分类失败!'
}) })
@ -325,7 +325,7 @@ export default {
// //
getStoreList(){ getStoreList(){
return servers.get({ return servers.get({
url: API.stadiumList,
url: API.getHomeData,
data: {}, data: {},
failMsg: '加载店铺失败!' failMsg: '加载店铺失败!'
}) })

BIN
src/static/images/arrow_c33.png

After

Width: 24  |  Height: 24  |  Size: 308 B

7
src/store/index.js

@ -12,6 +12,13 @@ export default new Vuex.Store({
state: { state: {
// 当前小程序店铺信息 // 当前小程序店铺信息
storeInfo: {}, storeInfo: {},
// 场地占用提交页面信息
occupyInfo: {
storeInfo: {}, // 店铺信息
dateInfo: {}, // 时间信息
typeInfo: {}, // 球场类型
venueList: [], // 选择场地列表
}
}, },
mutations, mutations,
actions, actions,

6
src/store/mutations.js

@ -8,7 +8,7 @@ export default {
}, },
// // 场地占用信息 // // 场地占用信息
// setOccupyInfo(state, _occupyInfo){
// state.occupyInfo = _occupyInfo;
// }
setOccupyInfo(state, _occupyInfo){
state.occupyInfo = _occupyInfo;
}
} }
Loading…
Cancel
Save