This commit is contained in:
Lx 2025-04-07 16:41:23 +08:00
parent 494a3bcc83
commit 02dde0928f
4 changed files with 422 additions and 260 deletions

View File

@ -122,6 +122,8 @@ export default {
opTenantId: null,
opCourseType: null,
examId:null,
batchId:null,
batchItemId: null,
process: {
id:null,
userName: null,
@ -154,8 +156,13 @@ export default {
this.process.courseId = options.courseId
this.process.batchId = options.batchId
this.examId = options.id
this.batchId = options.batchId
this.batchItemId = options.id
this.process.id = options.id
this.process.coachId = options.coachId
this.process.userId = this.userInfo.id
console.log('options',options)
console.log('batchItemId',this.batchItemId)
},
computed: {
displayFileList() {
@ -321,8 +328,12 @@ export default {
console.log('courseCompleteStatusList', this.courseCompleteStatusList)
const subject2 = this.courseCompleteStatusList.find(item => item.subject === 2)
const subject3 = this.courseCompleteStatusList.find(item => item.subject === 3)
console.log('subject2', subject2)
console.log('subject3', subject3)
console.log(subject2?.status === '2' && subject3?.status === '2')
if (subject2?.status === 2 && subject3?.status === 2) {
if (subject2?.status === '2' && subject3?.status === '2') {
console.log(subject2?.status === 2 && subject3?.status === 2)
this.subjectColumns = [['科目一', '科目四']]
}
}
@ -351,9 +362,6 @@ export default {
}
console.log('courseCompleteStatusList', this.courseCompleteStatusList.length)
this.process.userId = this.userInfo.id
this.process.tenantId = this.orderList.tenantId
this.process.images = this.fileList?.map(item => item.url).join(',') || '';
console.log('process', this.process)
@ -383,11 +391,21 @@ export default {
})
},
saveDataTwo(){
this.process.userId = this.userInfo.id
/* const postData = {
...this.process, // process
tenantId: this.opTenantId,
fraction: this.process.examScore,
ifPass: this.process.examStatus,
id: this.batchItemId,
remark: this.process.remark
images: this.fileList?.map(item => item.url).join(',') || '',
} */
// console.log('', postData)
this.process.userId = this.userInfo.id
this.process.tenantId = this.opTenantId
this.process.fraction = this.process.examScore
this.process.ifPass = this.process.examStatus
this.process.id = this.examId
this.process.images = this.fileList?.map(item => item.url).join(',') || '';
if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
uni.showToast({ title: '信息填写不完整', icon: 'none' });
@ -396,7 +414,8 @@ export default {
request({
url: '/app-api/examBatch/update',
method: 'PUT',
data: this.process,
// data: postData,
data: this.process,
}).then(res => {
if(res.code === 0){
uni.showToast({

View File

@ -20,6 +20,7 @@
class="scroll-view"
scroll-y
:style="{ height: scrollHeight + 'px' }"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"
>
<view
class="box_5 flex-col" v-for="(item, index) in examList"
@ -28,7 +29,8 @@
<view class="block_3 flex-row justify-between">
<view class="text-group_1 flex-col justify-between">
<text class="text_2">{{ formatDate(item.examTime) }}</text>
<text class="text_2" v-if="item.subject == 1 || item.subject == 4">{{ formatDate(item.examTime) }}</text>
<text class="text_2" v-else>{{ formatDate(item.startTime) }}</text>
<text class="text_3">{{ item.courseName }}</text>
</view>
@ -46,7 +48,7 @@
<text class="text_7">{{ item.courseType }}</text>
</view>
</view>
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.suject == 3">
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.subject == 3">
<text class="text_8">考试地址</text>
<text class="text_9">{{ item.addr }}</text>
</view>
@ -95,11 +97,20 @@
</view>
</view>
<view class="block_8 flex-col">
<view class="text-wrapper_8 flex-col" @click="goScorerecord()">
<view class="text-wrapper_8 flex-col" @click="onEnterScoreClick()">
<text class="text_19">笔试成绩录入</text>
<u-picker
:show="pickerShow"
:columns="[pickerColumns]"
keyName="label"
@confirm="onPickerConfirm"
@cancel="pickerShow = false"
/>
</view>
</view>
</view>
</template>
<script>
import { getLocalUserInfo } from '../../utils/auth';
@ -137,12 +148,18 @@ export default {
examList: {},
examTwoList: {},
scrollHeight: 0,
constants: {}
constants: {},
courseList: [],
pickerShow: false,
pickerColumns: [],
curNow: 0,
isTriggered: false,
};
},
onLoad(){
this.userInfo = getLocalUserInfo()
this.getExamList()
this.getCourseList()
},
onReady() {
//
@ -155,12 +172,101 @@ export default {
});
},
goScorerecord(){
uni.navigateTo({
url: '/newPages/examinationAdd/index'
});
/**
* 下拉刷新数据
*/
onRefresherrefresh() {
this.isTriggered = true
this.pageNo = 1
this.total = 0
this.examList = []
this.getExamList()
},
onEnterScoreClick() {
if (this.courseList.length > 0) {
this.pickerColumns = this.courseList.map(item => ({
label: item.courseName,
value: item.courseId
}));
this.pickerShow = true;
} else if (this.courseList.length === 1) {
this.goToScoreEntry(this.courseList[0]);
} else {
this.$u.toast("暂无课程信息");
}
},
onPickerConfirm(e) {
const selectedCourseId = e.value[0];
const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value);
console.log('courseList', this.courseList);
console.log('selectedCourseId', selectedCourseId);
console.log('selectedCourse', selectedCourse);
if (selectedCourse) {
this.getProcess(selectedCourse.courseId).then(processData => {
if (!processData || processData.length === 0) {
uni.showToast({
title: '请联系驾校负责人',
icon: 'none'
});
return;
}
// 14
const hasSubject1Or4 = processData.some(item =>
item.subject === 1 || item.subject === 4
);
if (hasSubject1Or4) {
this.goToScoreEntry(selectedCourse);
} else {
uni.showToast({
title: '未找到考试信息',
icon: 'none'
});
}
});
}
this.pickerShow = false;
},
goToScoreEntry(course) {
this.$u.route({
url: '/newPages/examinationAdd/index',
params: {
courseId: course.value,
courseType: course.courseType,
userId: course.userId,
tenantId: course.tenantId,
}
});
},
getProcess(courseId) {
return new Promise((resolve, reject) => {
request({
url: '/app-api/process/getAllByUserIdAndCourseId',
method: 'GET',
params: {
userId: this.userInfo.id,
courseId: courseId,
}
}).then(res => {
console.log('res123', res);
this.processList = res.data;
resolve(res.data);
}).catch(err => {
console.error('查询失败:', err);
reject(err);
});
});
},
getExamList(){
request({
url: '/app-api/process/getExamListByUserId',
@ -173,6 +279,7 @@ export default {
this.getExamTwoList()
console.log('examList', this.examList)
console.log('res',res)
this.isTriggered = false
})
},
getExamTwoList(){
@ -188,6 +295,15 @@ export default {
console.log('resTwo',res)
})
},
getCourseList(){
request({
url:'/app-api/small/drive/school-course-order/getCourseByLoginUser',
method: 'GET'
}).then(res => {
this.courseList = res.data
console.log('res111',res)
})
},
getStatusText(status) {
const statusMap = {
0: '未通过',
@ -226,12 +342,6 @@ export default {
//
this.scrollHeight = screenHeight - topHeight;
},
/* getButtonText(item) {
if (item.ifPass && !item.ifEvaluate) return '开始评价'
if (item.fraction == null && !item.ifPass) return '成绩录入'
if (item.ifEvaluate) return '查看评价'
return ''
} */
getButtonInfo(item) {
console.log('item', item)
@ -267,7 +377,7 @@ export default {
//
goScoreInput(item) {
uni.navigateTo({
url: `/newPages/examinationAdd/index?id=${item.id}&batchId=${item.batchId}&tenantId=${item.tenantId}&courseType=${item.courseType}&subject=${item.subject}&courseId=${item.courseId}&coachId=${item.coachId}`
url: `/newPages/examinationAdd/index?id=${item.batchItemId}&batchId=${item.batchId}&batchId=${item.batchId}&tenantId=${item.tenantId}&courseType=${item.courseType}&subject=${item.subject}&courseId=${item.courseId}&coachId=${item.coachId}`
});
},
//

View File

@ -199,6 +199,9 @@ import { getLocalUserInfo } from '../../utils/auth'
userId: null,
tenantId: null,
userinfo: [],
payPrice: null,
payStatus: null,
loading: false,
columns: [
[{
label: '全款',
@ -268,7 +271,6 @@ import { getLocalUserInfo } from '../../utils/auth'
methods: {
updateDisplayPrice() {
this.currentPrice = this.selectedPayType === 1
? this.rightInfoList.reserveMoney
: this.rightInfoList.price;
@ -354,222 +356,138 @@ import { getLocalUserInfo } from '../../utils/auth'
}
},
//
async validateForm() {
if (!this.sfzimg) {
uni.showToast({ title: '请上传身份证照片', icon: 'error' });
return false;
}
if (!this.phone || !this.name || !this.identity) {
uni.showToast({ title: '请输入完整信息', icon: 'error' });
return false;
}
if (!this.isValidPhoneNumber(this.phone)) {
uni.showToast({ title: '手机号不规范', icon: 'error' });
return false;
}
if (!this.isValidIDNumber(this.identity)) {
uni.showToast({ title: '身份证不规范', icon: 'error' });
return false;
}
return true;
},
applicationClick() {
//
if (!this.checkLogin()) {
uni.navigateTo({ url: '/pages/login/login' });
return;
}
//
/*if(this.sfzimg === null ){
uni.showToast({
title: '请上传身份证照片',
icon: 'error',
duration: 2000
})
return
}*/
//
async applicationClick() {
if (this.loading) return;
this.loading = true;
//
if (this.phone === null || this.name === null) {
uni.showToast({
title: '请输入完整信息',
icon: 'error',
duration: 2000
})
return
}
try {
// 1.
if (!this.checkLogin()) {
uni.navigateTo({ url: '/pages/login/login' });
return;
}
if (!await this.validateForm()) return;
//
let isPhone = this.isValidPhoneNumber(this.phone)
if (isPhone === false) {
uni.showToast({
title: '输入的手机号不规范',
icon: 'error',
duration: 2000
})
return
}
// 2.
if (this.orderId) {
const status = await this.getPayStatus(this.orderId);
if (status === '2') {
this.signContract();
return;
} else if (status === '0') {
const result = await this.processExistingOrder();
if (result === 'cancelled') return;
return;
}
}
//
let isIdentity = this.isValidIDNumber(this.identity)
if (isIdentity === false) {
uni.showToast({
title: '输入的身份证不规范',
icon: 'error',
duration: 2000
})
return
}
// 3.
await this.createNewOrder();
} catch (error) {
console.error("报名出错:", error);
if (!error.message.includes('cancel')) {
uni.showToast({ title: error.message || '操作失败', icon: 'none' });
}
} finally {
this.loading = false;
}
},
if (this.startPay === 1) {
//
//
async wxPayClick(name, phone, identity, courseId, payType, reserveMoney, restMoney) {
const res = await request({
url: '/small/jxInfo/onLinePay',
method: 'post',
data: {
userName: name,
userPhone: phone,
userSex: this.sex,
tenantId: this.tenantId,
userNo: identity,
courseId: courseId,
coachUserName: this.jlName,
coachUserId: this.jlId,
courseType: this.rightInfoList.type,
courseName: this.rightInfoList.name,
userId: this.userId,
reserveMoney: reserveMoney,
payType: payType,
restMoney: restMoney,
}
});
if(this.selectedPayType === 1){
//
let payType = 1
let reserveMoney = this.rightInfoList.reserveMoney
/* let restMoney = new Decimal(this.rightInfoList.price)
.minus(new Decimal(this.rightInfoList.reserveMoney))*/
let restMoney = this.rightInfoList.price - this.rightInfoList.reserveMoney
console.log("定金")
console.log("reserveMoney", reserveMoney)
console.log("restMoney", restMoney)
this.wxPayClick(this.name, this.phone, this.identity, this.courseId, payType, reserveMoney, restMoney)
}else if (this.selectedPayType === 2) {
//
let payType = 2
let reserveMoney = this.rightInfoList.price
let restMoney = 0
console.log('全款')
console.log("reserveMoney", reserveMoney)
console.log("restMoney", restMoney)
this.wxPayClick(this.name, this.phone, this.identity, this.courseId, payType, reserveMoney, restMoney)
}
this.orderId = res.orderId;
this.orderNo = res.orderNo;
} else {
// 线
this.xxiaPayClick(this.name, this.phone, this.identity, this.startPay, this.courseId, this.jxId)
}
const prepayRes = await request({
url: `/small/jxInfo/prepayment?type=jsapi&orderNo=${this.orderNo}&orderId=${this.orderId}&payType=${payType}`,
method: 'get'
});
const result = await this.handleWxPayment(prepayRes);
if (result === 'success') {
await Promise.all([
this.updateOrderStatus(this.orderId, '2'),
this.insertSchoolStudent()
]);
this.signContract();
}
return result;
},
},
async wxPayClick(name, phone, identity, courseId, payType, reserveMoney, restMoney) {
console.log("微信支付", )
console.log("reserveMoney123",reserveMoney)
const that = this; // this
let res = await request({
url: '/small/jxInfo/onLinePay',
data: {
userName: name,
userPhone: phone,
userSex: this.sex,
tenantId: this.tenantId,
userNo: identity,
courseId: courseId,
coachUserName: this.jlName,
coachUserId: this.jlId,
courseType: this.rightInfoList.type,
courseName: this.rightInfoList.name,
userId: this.userId,
reserveMoney: reserveMoney,
payType: payType,
restMoney: restMoney,
},
method: 'post',
})
// 线
async xxiaPayClick() {
const res = await request({
url: '/small/jxInfo/offLinePay',
method: 'post',
data: {
userName: this.name,
userPhone: this.phone,
userSex: this.sex,
tenantId: this.tenantId,
userNo: this.identity,
courseId: this.courseId,
coachUserName: this.jlName,
coachUserId: this.jlId,
courseType: this.rightInfoList.type,
courseName: this.rightInfoList.name,
reserveMoney: this.rightInfoList.price,
payType: '2',
userId: this.userId,
}
});
this.orderId = res.orderId
this.orderNo = res.orderNo
console.log("收到为单位1 =====>", this.orderId)
console.log("收到为单位2 =====>", this.orderNo)
console.log("收到为单位3 =====>", res)
if (res.code === 0) {
const contractData = { /* ...合同数据... */ };
uni.navigateTo({
url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData))
});
}
},
let item = await request({
url: '/small/jxInfo/prepayment?type=jsapi' + '&orderNo=' + this.orderNo + '&orderId=' + this.orderId + "&payType=" + payType,
method: 'get'
})
console.log("获取到的数据为 =========>", item)
wx.requestPayment({
timeStamp: item.timeStamp, // 19701100:00:00
nonceStr: item.nonceStr, // 32
package: item.package, // prepay_id prepay_id=*
signType: item.signType, // MD5RSA
paySign: item.paySign, //
success: function(res) {
console.log('微信支付成功返回信息', res);
if (res.errMsg = 'requestPayment:ok') {
uni.showToast({
title: '支付成功'
})
that.updateOrderStatus(that.orderId,'2')
that.insertSchoolStudent()
const contractData = {
adress: that.Address,
name: that.name,
tenantId: that.tenantId,
type: that.rightInfoList.type,
money: reserveMoney,
indent: that.identity,
phone: that.phone,
time: that.getCurrentDateTime()
};
uni.navigateTo({
url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData))
})
/*uni.navigateTo({
url: '/pages/index/contract?Address=' +
this.Address + '&name=' + this.name
})*/
}
// res.errMsg = 'requestPayment:ok'
},
fail: function(res) {
console.log('执行失败1', res);
that.cancelpay()
}
})
uni.showToast({
title: '成功提示',
icon: 'success',
duration: 2000
})
},
async xxiaPayClick(name, phone, identity, startPay, courseId) {
let res = await request({
url: '/small/jxInfo/offLinePay',
data: {
userName: name,
userPhone: phone,
userSex: this.sex,
tenantId: this.tenantId,
userNo: this.identity,
courseId: courseId,
coachUserName: this.jlName,
coachUserId: this.jlId,
courseType: this.rightInfoList.type,
courseName: this.rightInfoList.name,
reserveMoney: this.rightInfoList.price,
payType: '2',
userId: this.userId,
},
method: 'post',
})
if (res.code == 0) {
console.log('OK')
// this.updateOrderStatus('20b1fd5446aef14c7023da05332e4e43','2')
const contractData = {
adress: this.Address,
name: this.name,
tenantId: this.tenantId,
type: this.rightInfoList.type,
money: this.rightInfoList.price,
indent: this.identity,
phone: this.phone,
time: this.getCurrentDateTime()
};
uni.navigateTo({
url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData))
})
/*uni.navigateTo({
url: '/pages/index/contract?Address=' +
this.Address + '&name=' + this.name + '&tenantId=' + this.tenantId
})*/
}
},
async getRightInfoList() {
let res = await request({
url: '/app-api/dl-drive-school-course-small/get?id=' + this.courseId,
@ -579,15 +497,82 @@ import { getLocalUserInfo } from '../../utils/auth'
this.currentPrice = this.rightInfoList.price;
console.log("111222333", this.rightInfoList)
},
async xxgetRightInfoList() {
let res = await request({
url: '/drivingSchool/system/driveSchoolCourse/list?id=' + this.courseId + '&payType=' +
this.id,
method: 'get',
})
this.rightInfoList = res.data.records[0],
console.log("报名班类型", this.rightInfoList)
},
//
async processExistingOrder() {
uni.showLoading({ title: '准备支付...', mask: true });
try {
if (this.startPay === 1) {
const payType = this.selectedPayType;
const res = await request({
url: `/small/jxInfo/prepayment?type=jsapi&orderNo=${this.orderNo}&orderId=${this.orderId}&payType=${payType}`,
method: 'get'
});
const result = await this.handleWxPayment(res);
if (result === 'success') {
await Promise.all([
this.updateOrderStatus(this.orderId, '2'),
this.insertSchoolStudent()
]);
this.signContract();
}
return result;
} else {
this.xxiaPayClick();
return 'success';
}
} finally {
uni.hideLoading();
}
},
//
handleWxPayment(paymentParams) {
return new Promise((resolve) => {
wx.requestPayment({
...paymentParams,
success: (res) => {
resolve(res.errMsg === 'requestPayment:ok' ? 'success' : 'fail');
},
fail: (err) => {
resolve(err.errMsg === 'requestPayment:fail cancel' ? 'cancelled' : 'fail');
}
});
});
},
//
async createNewOrder() {
uni.showLoading({ title: '创建订单中...', mask: true });
try {
if (this.startPay === 1) {
const payType = this.selectedPayType;
const reserveMoney = payType === 1
? this.rightInfoList.reserveMoney
: this.rightInfoList.price;
await this.wxPayClick(
this.name,
this.phone,
this.identity,
this.courseId,
payType,
reserveMoney,
payType === 1 ? this.rightInfoList.price - reserveMoney : 0
);
} else {
this.xxiaPayClick();
}
} finally {
uni.hideLoading();
}
},
//
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
@ -659,18 +644,18 @@ import { getLocalUserInfo } from '../../utils/auth'
console.log('654',res);
that.popupShow = false
},
updateOrderStatus(orderId,paymentStatus){
console.log('orderId',orderId)
console.log('paymentStatus',paymentStatus)
request({
url: '/app-api/small/drive/school-course-order/update',
method: 'put',
data: {
id: orderId,
paymentStatus: paymentStatus
}
})
},
//
async updateOrderStatus(orderId, status) {
await request({
url: '/app-api/small/drive/school-course-order/update',
method: 'put',
data: {
id: orderId,
paymentStatus: status
}
});
},
insertSchoolStudent(){
request({
@ -713,7 +698,32 @@ import { getLocalUserInfo } from '../../utils/auth'
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
// return now;
}
},
signContract(){
const contractData = {
adress: this.Address,
name: this.name,
tenantId: this.tenantId,
type: this.rightInfoList.type,
money: this.payPrice,
indent: this.identity,
phone: this.phone,
time: this.getCurrentDateTime()
};
uni.navigateTo({
url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData))
})
},
//
async getPayStatus(orderId) {
const res = await request({
url: '/app-api/small/drive/school-course-order/get?id=' + orderId,
method: 'GET'
});
this.payStatus = res.data.paymentStatus;
return res.data.paymentStatus;
},
}
}

View File

@ -8,6 +8,7 @@
<view class="btn-view">
<view class="clear" @click="clear()">取消</view>
<view class="reset" @click="reset()">重置</view>
<view class="save" @click="save()">签署</view>
</view>
</view>
@ -147,6 +148,21 @@
}
}, this)
},
reset() {
let that = this
uni.getSystemInfo({
success: function(res) {
ctx.clearRect(0, 0, res.windowWidth, res.windowHeight)
ctx.draw(true)
// #ifdef MP-WEIXIN
that.setCanvasBg()
// #endif
that.setPaintStyle()
},
})
tempPoint = []
// emit
},
emit(tempFilePath) {
this.$emit('change', tempFilePath)
},
@ -186,7 +202,8 @@
}
.save,
.clear {
.clear,
.reset {
height: 70rpx;
width: 200rpx;
text-align: center;
@ -210,6 +227,11 @@
.clear {}
.reset {
background: #FF9900;
color: white;
}
.sign-area {
position: absolute;
top: 40%;
@ -218,4 +240,5 @@
font-size: 130rpx;
transform: rotate(-20deg);
}
</style>