Browse Source

add 教练选择&最小值限制

master
刘嘉炜 4 years ago
parent
commit
ad2e7f9c9f
  1. 1
      src/pages/course/experience/experience.vue
  2. 65
      src/pages/course/offer/offer.vue

1
src/pages/course/experience/experience.vue

@ -151,6 +151,7 @@ export default {
id: e.id,
course_name: e.course.name,
course_id: e.course.id,
course_kind: e.course.kind,
user_name: e.name,
user_id: e.user_id,
offerInfo: {

65
src/pages/course/offer/offer.vue

@ -9,9 +9,21 @@
<view class="l-tit">上课用户: </view>
<view class="l-txt">{{optionsQuery.user_name || '-'}}</view>
</view>
<view class="s-line" v-if="offerInfo.course.kind == '私教课'">
<view class="l-tit">负责教练: </view>
<picker mode="selector" :range="offerInfo.course.coaches" range-key="name" @change="coachChange">
<view class="l-frame">
<input disabled :value="coachInfo.name" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
</view>
<view class="s-line">
<view class="l-tit">课程次数: </view>
<view class="l-frame"><input :disabled="optionsQuery.offerInfo.price_option == 2" type="number" v-model="courseNumber" /></view>
<view class="l-frame"><input @change="classTimeChange" :disabled="optionsQuery.offerInfo.price_option == 2" type="number" v-model="courseNumber" /></view>
</view>
<view class="s-line">
<view class="l-tit">课程报价: </view>
@ -50,26 +62,57 @@ export default {
coursePrice: 1,
optionsQuery: {},
isShowConfirmModal: false,
offerInfo: {},
coachInfo: null,
}
},
onLoad(options){
let _query = util.jsonPar(options.query);
this.optionsQuery = _query;
if(_query.offerInfo&&_query.offerInfo.price_option == 2){
this.courseNumber = _query.offerInfo.number;
this.coursePrice = _query.offerInfo.price;
}
console.warn(_query)
this.getOfferInfo(_query.id);
this.courseNumber = _query.offerInfo.number;
this.coursePrice = _query.offerInfo.price;
},
methods: {
classTimeChange(e){
let { optionsQuery } = this;
if(e.detail.value < optionsQuery.offerInfo.number){
this.courseNumber = optionsQuery.offerInfo.number;
return util.showNone(`最小值为${optionsQuery.offerInfo.number}`);
}
console.warn(e);
},
coachChange(e){
let _coachList = [...this.offerInfo.course.coaches];
this.coachInfo = _coachList[e.detail.value];
console.warn(this.coachInfo)
console.warn(e);
},
getOfferInfo(id){
util.showLoad();
servers.get({
url: API.course.getOfferPriceInfo,
data: {id},
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
this.offerInfo = res;
console.warn(res)
})
},
submitBtn: util.debounce(function(){
let { optionsQuery, courseNumber, coursePrice } = this;
let { optionsQuery, courseNumber, coursePrice, coachInfo } = this;
console.warn(optionsQuery, courseNumber, coursePrice);
servers.post({
url: API.course.offerExpBookingPrice,
data: {
id: optionsQuery.id,
price: coursePrice,
number: courseNumber
number: courseNumber,
coach_id: coachInfo&&coachInfo.id || ''
},
isDefaultGet: false
})
@ -98,7 +141,6 @@ export default {
.o-section{
padding: 34upx 24upx;
.s-line{
@include centerFlex(flex-start);
.l-tit{
flex-shrink: 0;
@ -126,12 +168,19 @@ export default {
border: 2upx solid #D8D8D8;
border-radius: 10upx;
background-color: #f7f7f7;
@include centerFlex(space-between);
>input{
flex-grow: 1;
height: 100%;
font-size: 28upx;
color: #333;
}
>image{
margin-left: 10upx;
flex-shrink: 0;
width: 28upx;
height: 28upx;
}
}
}
}

Loading…
Cancel
Save