Browse Source

add offer

master
刘嘉炜 4 years ago
parent
commit
3c71fe9f20
  1. 2
      src/js/api.js
  2. 21
      src/pages/course/experience/experience.vue
  3. 10
      src/pages/course/offer/offer.vue
  4. 38
      src/pages/course/offer_info/offer_info.vue

2
src/js/api.js

@ -53,6 +53,8 @@ API['course'] = {
// 体验课
getOfferPriceList: `${ORIGIN}/stadium/coach/getOfferPriceList`, // 小程序-体验课预约列表
offerExpBookingPrice: `${ORIGIN}/stadium/coach/offerExpBookingPrice`, // 体验课-报价 - 教练端
getOfferPriceInfo: `${ORIGIN}/stadium/coach/getOfferPriceInfo`, // 小程序-获取报价详情
}

21
src/pages/course/experience/experience.vue

@ -137,14 +137,14 @@ export default {
})
},
toDetail(e){
let _query = {
price: e.price || 0,
number: e.number || 0,
name: e.name,
course_name: e.course.name,
order_pay_status: e.order_pay_status
}
util.routeTo(`/pages/course/offer_info/offer_info?query=${util.jsonStr(_query)}`, 'nT');
// let _query = {
// price: e.price || 0,
// number: e.number || 0,
// name: e.name,
// course_name: e.course.name,
// order_pay_status: e.order_pay_status
// }
util.routeTo(`/pages/course/offer_info/offer_info?class_id=${e.id}`, 'nT');
},
toOffer(e){
let _query = {
@ -153,6 +153,11 @@ export default {
course_id: e.course.id,
user_name: e.name,
user_id: e.user_id,
offerInfo: {
price_option: e.course.price_option, // 1 / 2
number: e.course.number,
price: e.course.price,
}
}
util.routeTo(`/pages/course/offer/offer?query=${util.jsonStr(_query)}`, 'nT');
},

10
src/pages/course/offer/offer.vue

@ -11,11 +11,11 @@
</view>
<view class="s-line">
<view class="l-tit">课程次数: </view>
<view class="l-frame"><input type="number" v-model="courseNumber" /></view>
<view class="l-frame"><input :disabled="optionsQuery.offerInfo.price_option == 2" type="number" v-model="courseNumber" /></view>
</view>
<view class="s-line">
<view class="l-tit">课程报价: </view>
<view class="l-frame"><input type="digit" v-model="coursePrice" /></view>
<view class="l-frame"><input :disabled="optionsQuery.offerInfo.price_option == 2" type="digit" v-model="coursePrice" /></view>
<view class="l-txt"></view>
</view>
</view>
@ -55,6 +55,10 @@ export default {
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;
}
},
methods: {
submitBtn: util.debounce(function(){
@ -72,7 +76,7 @@ export default {
.then(res=>{
if(res.data.code == 0){
util.showNone(res.data.message || '操作成功!');
setTimeout(_=>util.routeTo(), 1200);
setTimeout(_=>util.routeTo(`/pages/course/offer_info/offer_info?class_id=${optionsQuery.id}`, 'rT'), 1200);
}else{
util.showNone(res.data.message || '操作失败!');
}

38
src/pages/course/offer_info/offer_info.vue

@ -1,32 +1,50 @@
<template>
<view class="offer-info">
<view :class="['i-status', optionsQuery.order_pay_status == 1?'i-active':'']">
<view :class="['i-status', offerInfo.order_pay_status == 1?'i-active':'']">
{{
optionsQuery.order_pay_status == 0? '等待客户支付':
optionsQuery.order_pay_status == 1? '客户已支付': ''
offerInfo.order_pay_status == 0? '等待客户支付':
offerInfo.order_pay_status == 1? '客户已支付': ''
}}
</view>
<view class="i-setion">
<view class="s-line"><text>课程名称</text>{{optionsQuery.course_name || '-'}}</view>
<view class="s-line"><text>上课用户</text>{{optionsQuery.name || '-'}}</view>
<view class="s-line"><text>课程次数</text>{{optionsQuery.number || '-'}}</view>
<view class="s-line"><text>课程报价</text>{{optionsQuery.price || '-'}}</view>
<view class="s-line"><text>课程名称</text>{{offerInfo.course.name || '-'}}</view>
<view class="s-line"><text>上课用户</text>{{offerInfo.name || '-'}}</view>
<view class="s-line"><text>课程次数</text>{{offerInfo.number || '0'}}</view>
<view class="s-line"><text>课程报价</text>{{offerInfo.offer_price || '0'}}</view>
</view>
</view>
</template>
<script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util'
export default {
data(){
return {
optionsQuery: {}
offerInfo: {},
}
},
onLoad(options){
let _query = util.jsonPar(options.query);
this.optionsQuery = _query;
// let _query = util.jsonPar(options.query);
// this.optionsQuery = _query;
this.getOfferInfo(options.class_id);
},
methods: {
getOfferInfo(id){
util.showLoad();
servers.get({
url: API.course.getOfferPriceInfo,
data: {id},
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
this.offerInfo = res;
console.warn('offerInfo', res);
})
}
}
}
</script>

Loading…
Cancel
Save