|
|
|
|
@ -22,9 +22,10 @@
|
|
|
|
|
is_fee: 0, //需不需要缴费这个课程
|
|
|
|
|
form: {},
|
|
|
|
|
apply_form: [],
|
|
|
|
|
course_forms: [],
|
|
|
|
|
sign_id:'', // 报名的id
|
|
|
|
|
opType:'add', // edit 修改
|
|
|
|
|
course_forms: [],
|
|
|
|
|
sign_id: '', // 报名的id
|
|
|
|
|
opType: 'add', // edit 修改
|
|
|
|
|
isLocked: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onReady() {
|
|
|
|
|
@ -32,8 +33,8 @@
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.course_id = options.id
|
|
|
|
|
if (options.type === 'edit') {
|
|
|
|
|
this.opType = 'edit'
|
|
|
|
|
if (options.type === 'edit') {
|
|
|
|
|
this.opType = 'edit'
|
|
|
|
|
this.getSignDetail(options.id)
|
|
|
|
|
} else {
|
|
|
|
|
this.getCourseDetail(options.id)
|
|
|
|
|
@ -65,7 +66,7 @@
|
|
|
|
|
async getSignDetail(id) {
|
|
|
|
|
const res = await this.$u.api.courseGetSign({
|
|
|
|
|
course_id: id
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.sign_id = res.detail.id
|
|
|
|
|
if (res.detail.data && res.detail.data.length > 0) {
|
|
|
|
|
res.detail.data.map(item => {
|
|
|
|
|
@ -93,23 +94,17 @@
|
|
|
|
|
})
|
|
|
|
|
this.apply_form = _arr
|
|
|
|
|
console.log("this.apply_form", this.apply_form, this.form)
|
|
|
|
|
// return
|
|
|
|
|
this.saveUser()
|
|
|
|
|
if(this.opType == 'edit'){
|
|
|
|
|
this.updateApplyCourse()
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
this.applyCourse()
|
|
|
|
|
// return
|
|
|
|
|
if (this.isLocked) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.isLocked = true
|
|
|
|
|
this.saveUser()
|
|
|
|
|
if (this.opType == 'edit') {
|
|
|
|
|
this.updateApplyCourse()
|
|
|
|
|
} else {
|
|
|
|
|
this.applyCourse()
|
|
|
|
|
}
|
|
|
|
|
// this.$refs.uForm.validate(valid => {
|
|
|
|
|
// if (valid) {
|
|
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
// console.log('验证失败');
|
|
|
|
|
// // this.base.toast("验证失败")
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
async saveUser() {
|
|
|
|
|
let that = this
|
|
|
|
|
@ -119,11 +114,16 @@
|
|
|
|
|
// this.$u.api.user().then(res => {
|
|
|
|
|
// this.$u.vuex('vuex_user', res.user)
|
|
|
|
|
// })
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log("err", err)
|
|
|
|
|
that.isLocked = false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async applyCourse() {
|
|
|
|
|
let that = this
|
|
|
|
|
// let that = this
|
|
|
|
|
// let that = this
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.$u.api.courseSign({
|
|
|
|
|
course_id: this.course_id,
|
|
|
|
|
data: this.apply_form
|
|
|
|
|
@ -140,23 +140,29 @@
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log("err", err)
|
|
|
|
|
that.isLocked = false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 更新报名信息
|
|
|
|
|
async updateApplyCourse() {
|
|
|
|
|
let that = this
|
|
|
|
|
this.$u.api.courseUpdateSign({
|
|
|
|
|
id: this.sign_id,
|
|
|
|
|
data: this.apply_form
|
|
|
|
|
}).then(res => {
|
|
|
|
|
that.base.toast("修改成功", 1500, function() {
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '/packages/mycourse/index'
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
})
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log("err", err)
|
|
|
|
|
that.isLocked = false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 更新报名信息
|
|
|
|
|
async updateApplyCourse() {
|
|
|
|
|
let that = this
|
|
|
|
|
this.$u.api.courseUpdateSign({
|
|
|
|
|
id: this.sign_id,
|
|
|
|
|
data:this.apply_form
|
|
|
|
|
}).then(res => {
|
|
|
|
|
that.base.toast("修改成功", 1500, function() {
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '/packages/mycourse/index'
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 订阅缴费
|
|
|
|
|
|
|
|
|
|
|