|
@@ -1,4 +1,3 @@
|
|
|
-import ColProtocol from '@/components/col-protocol'
|
|
|
import Calendar from '@/business-components/calendar'
|
|
|
import request from '@/helpers/request'
|
|
|
import { state } from '@/state'
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
import { defineComponent } from 'vue'
|
|
|
import { getWeekCh } from '@/helpers/utils'
|
|
|
import styles from './practice.module.less'
|
|
|
+import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'practice',
|
|
@@ -31,7 +31,6 @@ export default defineComponent({
|
|
|
const query = this.$route.query
|
|
|
return {
|
|
|
teacherId: query.teacherId,
|
|
|
- agreeStatus: false,
|
|
|
teacherSubjectList: [],
|
|
|
subjectStatus: false,
|
|
|
subjectInfo: {
|
|
@@ -79,6 +78,8 @@ export default defineComponent({
|
|
|
this.teacherSubjectList = result
|
|
|
|
|
|
this.getList()
|
|
|
+
|
|
|
+ this.onBuy(true)
|
|
|
} catch {}
|
|
|
},
|
|
|
computed: {
|
|
@@ -111,11 +112,6 @@ export default defineComponent({
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (!this.agreeStatus) {
|
|
|
- Toast('请先阅读并同意《酷乐秀平台服务协议》')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
if (this.selectCourseList.length < this.courseNum) {
|
|
|
this.selectStatus = true
|
|
|
return
|
|
@@ -253,7 +249,7 @@ export default defineComponent({
|
|
|
async onReset() {
|
|
|
// 是否有锁课状态 或 是锁课类型的
|
|
|
if (this.coursePlanStatus || this.selectType === 'enough') {
|
|
|
- await this._unLookCourse()
|
|
|
+ // await this._unLookCourse()
|
|
|
} else if (this.selectType === 'noEnough') {
|
|
|
this.selectStatus = false
|
|
|
}
|
|
@@ -264,19 +260,80 @@ export default defineComponent({
|
|
|
await this._lookCourse(() => {
|
|
|
if (status) {
|
|
|
this.selectStatus = false
|
|
|
+
|
|
|
+ console.log(this.selectCourseList, 'this.selectCourseList')
|
|
|
+
|
|
|
+ this.onBuy()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async onBuy(goTo?: boolean) {
|
|
|
+ try {
|
|
|
+ const res = await request.post(
|
|
|
+ '/api-student/userOrder/getPendingOrder',
|
|
|
+ {
|
|
|
+ data: {
|
|
|
+ goodType: 'PRACTICE',
|
|
|
+ bizId: this.teacherId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ console.log(res, res.data)
|
|
|
+ orderStatus.orderType = 'PRACTICE'
|
|
|
+ const subjectInfo = this.subjectInfo
|
|
|
+ const tempCourseList = [...this.selectCourseList]
|
|
|
+ tempCourseList.forEach((item: any) => {
|
|
|
+ item.classDate = dayjs(item.startTime).format('YYYY-MM-DD')
|
|
|
+ })
|
|
|
+ orderStatus.practiceInfo = {
|
|
|
+ courseGroupName: subjectInfo.subjectName + '陪练课',
|
|
|
+ courseIntroduce: subjectInfo.subjectName + '陪练课',
|
|
|
+ subjectId: subjectInfo.subjectId,
|
|
|
+ singleCourseMinutes: subjectInfo.courseMinutes,
|
|
|
+ courseNum: this.courseNum,
|
|
|
+ coursePrice: (this.courseNum * subjectInfo.subjectPrice).toFixed(2),
|
|
|
+ teacherName:
|
|
|
+ this.userInfo.username || `游客${this.userInfo.userId || ''}`,
|
|
|
+ teacherId: this.userInfo.userId,
|
|
|
+ starGrade: this.userInfo.starGrade,
|
|
|
+ avatar: this.userInfo.heardUrl,
|
|
|
+ classTime: tempCourseList
|
|
|
+ }
|
|
|
+ const result = res.data
|
|
|
+ if (result) {
|
|
|
+ Dialog.confirm({
|
|
|
+ title: '提示',
|
|
|
+ message: '您有一个未支付的订单,是否继续支付?',
|
|
|
+ confirmButtonColor: '#269a93',
|
|
|
+ cancelButtonText: '取消订单',
|
|
|
+ confirmButtonText: '继续支付'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ orderStatus.orderInfo = {
|
|
|
+ orderNo: result.orderNo,
|
|
|
+ actualPrice: result.actualPrice,
|
|
|
+ payStatus: true
|
|
|
+ }
|
|
|
+ this.routerTo()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ Dialog.close()
|
|
|
+ // 只用取消订单,不用做其它处理
|
|
|
+ this.cancelPayment(result.orderNo)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ !goTo && this.routerTo()
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
+ },
|
|
|
+ routerTo() {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/orderDetail',
|
|
|
+ query: {
|
|
|
+ orderType: 'PRACTICE'
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // routerTo() {
|
|
|
- // const live = this.live
|
|
|
- // this.$router.push({
|
|
|
- // path: '/orderDetail',
|
|
|
- // query: {
|
|
|
- // orderType: 'LIVE',
|
|
|
- // courseGroupId: live.courseGroupId
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
async cancelPayment(orderNo: string) {
|
|
|
try {
|
|
|
await request.post('/api-student/userOrder/orderCancel', {
|
|
@@ -377,14 +434,6 @@ export default defineComponent({
|
|
|
}}
|
|
|
></Cell>
|
|
|
|
|
|
- <div class={styles.protocol}>
|
|
|
- <ColProtocol
|
|
|
- v-model={this.agreeStatus}
|
|
|
- showHeader
|
|
|
- style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
<Popup show={this.selectStatus} class={styles.selectPopup}>
|
|
|
<div class={styles.selectContainer}>
|
|
|
<div class={styles.rTitle}>
|