|
|
|
|
@ -25,7 +25,9 @@
|
|
|
|
|
course_forms: [],
|
|
|
|
|
sign_id: '', // 报名的id
|
|
|
|
|
opType: 'add', // edit 修改
|
|
|
|
|
isLocked: false
|
|
|
|
|
isLocked: false,
|
|
|
|
|
change_data:[], // 记录报名表中填写的字段和 form学员信息中不同的
|
|
|
|
|
is_change:0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onReady() {
|
|
|
|
|
@ -60,7 +62,6 @@
|
|
|
|
|
this.course_forms = res.course_forms.sort((a, b) => (a.sort - b.sort))
|
|
|
|
|
}
|
|
|
|
|
this.is_fee = res.is_fee
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 修改
|
|
|
|
|
async getSignDetail(id) {
|
|
|
|
|
@ -78,7 +79,9 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async backForm(e) {
|
|
|
|
|
let _arr = []
|
|
|
|
|
let _arr = []
|
|
|
|
|
let that = this
|
|
|
|
|
let change_data_arr = []
|
|
|
|
|
e.map(item => {
|
|
|
|
|
// _arr.push({
|
|
|
|
|
// name: item.name,
|
|
|
|
|
@ -87,24 +90,69 @@
|
|
|
|
|
// })
|
|
|
|
|
item.value = item.value ? item.value : ''
|
|
|
|
|
_arr.push(item)
|
|
|
|
|
// 更新扩展字段
|
|
|
|
|
if (item.belong_user === 1 && !this.base.isNull(item.value)) {
|
|
|
|
|
this.form[item.field] = item.value
|
|
|
|
|
// 更新学员user表中的字段 学员字段有值
|
|
|
|
|
|
|
|
|
|
if (item.belong_user === 1 && !this.base.isNull(item.value)) {
|
|
|
|
|
if(this.form[item.field]!=item.value){
|
|
|
|
|
console.log('item.field',item.field)
|
|
|
|
|
change_data_arr.push({[item.field]:item.value})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// this.form[item.field] = item.value
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.apply_form = _arr
|
|
|
|
|
console.log("this.apply_form", this.apply_form, this.form)
|
|
|
|
|
this.apply_form = _arr
|
|
|
|
|
|
|
|
|
|
this.change_data = change_data_arr
|
|
|
|
|
console.log("this.apply_form", this.apply_form, this.form,this.change_data)
|
|
|
|
|
// return
|
|
|
|
|
if (this.isLocked) {
|
|
|
|
|
return
|
|
|
|
|
this.is_change = 0
|
|
|
|
|
if(this.change_data.length>0){
|
|
|
|
|
this.is_change = 1
|
|
|
|
|
if (that.isLocked) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
that.isLocked = true
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content:'您当前提交的报名信息与往期数据存在差异,是否确认继续提交报名?',
|
|
|
|
|
confirmText:'提交报名',
|
|
|
|
|
cancelText:'取消',
|
|
|
|
|
success: function(res) {
|
|
|
|
|
if(res.confirm){
|
|
|
|
|
// 比对一下提交的信息和 user表中的数据是否不一样
|
|
|
|
|
//课程报名接口增加is_change字段,是否用户数据发生变化,0否1是
|
|
|
|
|
// change_data字段,传入新修改的用户信息
|
|
|
|
|
|
|
|
|
|
// return
|
|
|
|
|
// await this.saveUser()
|
|
|
|
|
if (that.opType == 'edit') {
|
|
|
|
|
that.updateApplyCourse()
|
|
|
|
|
} else {
|
|
|
|
|
that.applyCourse()
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
that.isLocked = false
|
|
|
|
|
that.change_data = {}
|
|
|
|
|
that.is_change = 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
that.is_change = 0
|
|
|
|
|
if (that.isLocked) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
that.isLocked = true
|
|
|
|
|
// await this.saveUser()
|
|
|
|
|
|
|
|
|
|
if (that.opType == 'edit') {
|
|
|
|
|
that.updateApplyCourse()
|
|
|
|
|
} else {
|
|
|
|
|
that.applyCourse()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.isLocked = true
|
|
|
|
|
await this.saveUser()
|
|
|
|
|
if (this.opType == 'edit') {
|
|
|
|
|
await this.updateApplyCourse()
|
|
|
|
|
} else {
|
|
|
|
|
await this.applyCourse()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
async saveUser() {
|
|
|
|
|
let that = this
|
|
|
|
|
@ -121,12 +169,11 @@
|
|
|
|
|
},
|
|
|
|
|
async applyCourse() {
|
|
|
|
|
let that = this
|
|
|
|
|
// let that = this
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.$u.api.courseSign({
|
|
|
|
|
course_id: this.course_id,
|
|
|
|
|
data: this.apply_form
|
|
|
|
|
data: this.apply_form,
|
|
|
|
|
change_data:this.change_data,
|
|
|
|
|
is_change:this.is_change
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (this.is_fee) {
|
|
|
|
|
this.newsSubscription()
|
|
|
|
|
@ -150,7 +197,9 @@
|
|
|
|
|
let that = this
|
|
|
|
|
this.$u.api.courseUpdateSign({
|
|
|
|
|
id: this.sign_id,
|
|
|
|
|
data: this.apply_form
|
|
|
|
|
data: this.apply_form,
|
|
|
|
|
change_data:this.change_data,
|
|
|
|
|
is_change:this.is_change
|
|
|
|
|
}).then(res => {
|
|
|
|
|
that.base.toast("修改成功", 1500, function() {
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
|