0407
This commit is contained in:
parent
494a3bcc83
commit
02dde0928f
@ -122,6 +122,8 @@ export default {
|
|||||||
opTenantId: null,
|
opTenantId: null,
|
||||||
opCourseType: null,
|
opCourseType: null,
|
||||||
examId:null,
|
examId:null,
|
||||||
|
batchId:null,
|
||||||
|
batchItemId: null,
|
||||||
process: {
|
process: {
|
||||||
id:null,
|
id:null,
|
||||||
userName: null,
|
userName: null,
|
||||||
@ -154,8 +156,13 @@ export default {
|
|||||||
this.process.courseId = options.courseId
|
this.process.courseId = options.courseId
|
||||||
this.process.batchId = options.batchId
|
this.process.batchId = options.batchId
|
||||||
this.examId = options.id
|
this.examId = options.id
|
||||||
|
this.batchId = options.batchId
|
||||||
|
this.batchItemId = options.id
|
||||||
|
this.process.id = options.id
|
||||||
this.process.coachId = options.coachId
|
this.process.coachId = options.coachId
|
||||||
|
this.process.userId = this.userInfo.id
|
||||||
console.log('options',options)
|
console.log('options',options)
|
||||||
|
console.log('batchItemId',this.batchItemId)
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
displayFileList() {
|
displayFileList() {
|
||||||
@ -321,8 +328,12 @@ export default {
|
|||||||
console.log('courseCompleteStatusList', this.courseCompleteStatusList)
|
console.log('courseCompleteStatusList', this.courseCompleteStatusList)
|
||||||
const subject2 = this.courseCompleteStatusList.find(item => item.subject === 2)
|
const subject2 = this.courseCompleteStatusList.find(item => item.subject === 2)
|
||||||
const subject3 = this.courseCompleteStatusList.find(item => item.subject === 3)
|
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 = [['科目一', '科目四']]
|
this.subjectColumns = [['科目一', '科目四']]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,9 +362,6 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
console.log('courseCompleteStatusList', this.courseCompleteStatusList.length)
|
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(',') || '';
|
this.process.images = this.fileList?.map(item => item.url).join(',') || '';
|
||||||
console.log('process', this.process)
|
console.log('process', this.process)
|
||||||
|
|
||||||
@ -383,11 +391,21 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveDataTwo(){
|
saveDataTwo(){
|
||||||
|
/* 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.userId = this.userInfo.id
|
||||||
this.process.tenantId = this.opTenantId
|
this.process.tenantId = this.opTenantId
|
||||||
this.process.fraction = this.process.examScore
|
this.process.fraction = this.process.examScore
|
||||||
this.process.ifPass = this.process.examStatus
|
this.process.ifPass = this.process.examStatus
|
||||||
this.process.id = this.examId
|
|
||||||
this.process.images = this.fileList?.map(item => item.url).join(',') || '';
|
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) {
|
if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
|
||||||
uni.showToast({ title: '信息填写不完整', icon: 'none' });
|
uni.showToast({ title: '信息填写不完整', icon: 'none' });
|
||||||
@ -396,6 +414,7 @@ export default {
|
|||||||
request({
|
request({
|
||||||
url: '/app-api/examBatch/update',
|
url: '/app-api/examBatch/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
// data: postData,
|
||||||
data: this.process,
|
data: this.process,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if(res.code === 0){
|
if(res.code === 0){
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
class="scroll-view"
|
class="scroll-view"
|
||||||
scroll-y
|
scroll-y
|
||||||
:style="{ height: scrollHeight + 'px' }"
|
:style="{ height: scrollHeight + 'px' }"
|
||||||
|
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
class="box_5 flex-col" v-for="(item, index) in examList"
|
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="block_3 flex-row justify-between">
|
||||||
<view class="text-group_1 flex-col 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>
|
<text class="text_3">{{ item.courseName }}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -46,7 +48,7 @@
|
|||||||
<text class="text_7">{{ item.courseType }}</text>
|
<text class="text_7">{{ item.courseType }}</text>
|
||||||
</view>
|
</view>
|
||||||
</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_8">考试地址:</text>
|
||||||
<text class="text_9">{{ item.addr }}</text>
|
<text class="text_9">{{ item.addr }}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -95,11 +97,20 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="block_8 flex-col">
|
<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>
|
<text class="text_19">笔试成绩录入</text>
|
||||||
|
<u-picker
|
||||||
|
:show="pickerShow"
|
||||||
|
:columns="[pickerColumns]"
|
||||||
|
keyName="label"
|
||||||
|
@confirm="onPickerConfirm"
|
||||||
|
@cancel="pickerShow = false"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getLocalUserInfo } from '../../utils/auth';
|
import { getLocalUserInfo } from '../../utils/auth';
|
||||||
@ -137,12 +148,18 @@ export default {
|
|||||||
examList: {},
|
examList: {},
|
||||||
examTwoList: {},
|
examTwoList: {},
|
||||||
scrollHeight: 0,
|
scrollHeight: 0,
|
||||||
constants: {}
|
constants: {},
|
||||||
|
courseList: [],
|
||||||
|
pickerShow: false,
|
||||||
|
pickerColumns: [],
|
||||||
|
curNow: 0,
|
||||||
|
isTriggered: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
this.userInfo = getLocalUserInfo()
|
this.userInfo = getLocalUserInfo()
|
||||||
this.getExamList()
|
this.getExamList()
|
||||||
|
this.getCourseList()
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
// 动态计算滚动区域高度
|
// 动态计算滚动区域高度
|
||||||
@ -155,9 +172,98 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在科目1或科目4的数据
|
||||||
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -173,6 +279,7 @@ export default {
|
|||||||
this.getExamTwoList()
|
this.getExamTwoList()
|
||||||
console.log('examList', this.examList)
|
console.log('examList', this.examList)
|
||||||
console.log('res',res)
|
console.log('res',res)
|
||||||
|
this.isTriggered = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getExamTwoList(){
|
getExamTwoList(){
|
||||||
@ -188,6 +295,15 @@ export default {
|
|||||||
console.log('resTwo',res)
|
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) {
|
getStatusText(status) {
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
0: '未通过',
|
0: '未通过',
|
||||||
@ -226,12 +342,6 @@ export default {
|
|||||||
// 计算滚动区域高度
|
// 计算滚动区域高度
|
||||||
this.scrollHeight = screenHeight - topHeight;
|
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) {
|
getButtonInfo(item) {
|
||||||
console.log('item', item)
|
console.log('item', item)
|
||||||
@ -267,7 +377,7 @@ export default {
|
|||||||
// 跳转到成绩录入页面
|
// 跳转到成绩录入页面
|
||||||
goScoreInput(item) {
|
goScoreInput(item) {
|
||||||
uni.navigateTo({
|
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}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 跳转到开始评价页面
|
// 跳转到开始评价页面
|
||||||
|
@ -199,6 +199,9 @@ import { getLocalUserInfo } from '../../utils/auth'
|
|||||||
userId: null,
|
userId: null,
|
||||||
tenantId: null,
|
tenantId: null,
|
||||||
userinfo: [],
|
userinfo: [],
|
||||||
|
payPrice: null,
|
||||||
|
payStatus: null,
|
||||||
|
loading: false,
|
||||||
columns: [
|
columns: [
|
||||||
[{
|
[{
|
||||||
label: '全款',
|
label: '全款',
|
||||||
@ -268,7 +271,6 @@ import { getLocalUserInfo } from '../../utils/auth'
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateDisplayPrice() {
|
updateDisplayPrice() {
|
||||||
|
|
||||||
this.currentPrice = this.selectedPayType === 1
|
this.currentPrice = this.selectedPayType === 1
|
||||||
? this.rightInfoList.reserveMoney
|
? this.rightInfoList.reserveMoney
|
||||||
: this.rightInfoList.price;
|
: this.rightInfoList.price;
|
||||||
@ -354,94 +356,71 @@ 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() {
|
// 报名按钮主逻辑
|
||||||
// 登录校验
|
async applicationClick() {
|
||||||
|
if (this.loading) return;
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 基础校验
|
||||||
if (!this.checkLogin()) {
|
if (!this.checkLogin()) {
|
||||||
uni.navigateTo({ url: '/pages/login/login' });
|
uni.navigateTo({ url: '/pages/login/login' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 校验身份证照片
|
if (!await this.validateForm()) return;
|
||||||
/*if(this.sfzimg === null ){
|
|
||||||
uni.showToast({
|
|
||||||
title: '请上传身份证照片',
|
|
||||||
icon: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// 判断如果为空
|
// 2. 处理已有订单
|
||||||
if (this.phone === null || this.name === null) {
|
if (this.orderId) {
|
||||||
uni.showToast({
|
const status = await this.getPayStatus(this.orderId);
|
||||||
title: '请输入完整信息',
|
if (status === '2') {
|
||||||
icon: 'error',
|
this.signContract();
|
||||||
duration: 2000
|
return;
|
||||||
})
|
} else if (status === '0') {
|
||||||
return
|
const result = await this.processExistingOrder();
|
||||||
|
if (result === 'cancelled') return;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断手机号是否满足
|
// 3. 创建新订单
|
||||||
let isPhone = this.isValidPhoneNumber(this.phone)
|
await this.createNewOrder();
|
||||||
if (isPhone === false) {
|
} catch (error) {
|
||||||
uni.showToast({
|
console.error("报名出错:", error);
|
||||||
title: '输入的手机号不规范',
|
if (!error.message.includes('cancel')) {
|
||||||
icon: 'error',
|
uni.showToast({ title: error.message || '操作失败', icon: 'none' });
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
// 判断身份证是否满足
|
this.loading = false;
|
||||||
let isIdentity = this.isValidIDNumber(this.identity)
|
|
||||||
if (isIdentity === false) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '输入的身份证不规范',
|
|
||||||
icon: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.startPay === 1) {
|
|
||||||
// 微信支付
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// 线下支付
|
|
||||||
this.xxiaPayClick(this.name, this.phone, this.identity, this.startPay, this.courseId, this.jxId)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 微信支付(新订单)
|
||||||
async wxPayClick(name, phone, identity, courseId, payType, reserveMoney, restMoney) {
|
async wxPayClick(name, phone, identity, courseId, payType, reserveMoney, restMoney) {
|
||||||
console.log("微信支付", )
|
const res = await request({
|
||||||
console.log("reserveMoney123",reserveMoney)
|
|
||||||
const that = this; // 保存this引用
|
|
||||||
let res = await request({
|
|
||||||
url: '/small/jxInfo/onLinePay',
|
url: '/small/jxInfo/onLinePay',
|
||||||
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
userName: name,
|
userName: name,
|
||||||
userPhone: phone,
|
userPhone: phone,
|
||||||
@ -457,119 +436,58 @@ import { getLocalUserInfo } from '../../utils/auth'
|
|||||||
reserveMoney: reserveMoney,
|
reserveMoney: reserveMoney,
|
||||||
payType: payType,
|
payType: payType,
|
||||||
restMoney: restMoney,
|
restMoney: restMoney,
|
||||||
},
|
}
|
||||||
method: 'post',
|
});
|
||||||
})
|
|
||||||
|
|
||||||
this.orderId = res.orderId
|
this.orderId = res.orderId;
|
||||||
this.orderNo = res.orderNo
|
this.orderNo = res.orderNo;
|
||||||
console.log("收到为单位1 =====>", this.orderId)
|
|
||||||
console.log("收到为单位2 =====>", this.orderNo)
|
|
||||||
console.log("收到为单位3 =====>", res)
|
|
||||||
|
|
||||||
let item = await request({
|
const prepayRes = await request({
|
||||||
url: '/small/jxInfo/prepayment?type=jsapi' + '&orderNo=' + this.orderNo + '&orderId=' + this.orderId + "&payType=" + payType,
|
url: `/small/jxInfo/prepayment?type=jsapi&orderNo=${this.orderNo}&orderId=${this.orderId}&payType=${payType}`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
});
|
||||||
|
|
||||||
console.log("获取到的数据为 =========>", item)
|
const result = await this.handleWxPayment(prepayRes);
|
||||||
|
if (result === 'success') {
|
||||||
|
await Promise.all([
|
||||||
wx.requestPayment({
|
this.updateOrderStatus(this.orderId, '2'),
|
||||||
timeStamp: item.timeStamp, // 时间戳,从1970年1月1日00:00:00至今的秒数,即当前的时间
|
this.insertSchoolStudent()
|
||||||
nonceStr: item.nonceStr, // 随机字符串,长度为32个字符以下。
|
]);
|
||||||
package: item.package, // 统一下单接口返回的 prepay_id 参数值,格式如“prepay_id=*”
|
this.signContract();
|
||||||
signType: item.signType, // 签名算法类型,默认为 MD5,支持RSA等其他加密算法
|
|
||||||
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'
|
return result;
|
||||||
},
|
},
|
||||||
fail: function(res) {
|
|
||||||
console.log('执行失败1', res);
|
|
||||||
that.cancelpay()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
uni.showToast({
|
// 线下支付
|
||||||
title: '成功提示',
|
async xxiaPayClick() {
|
||||||
icon: 'success',
|
const res = await request({
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async xxiaPayClick(name, phone, identity, startPay, courseId) {
|
|
||||||
|
|
||||||
let res = await request({
|
|
||||||
url: '/small/jxInfo/offLinePay',
|
url: '/small/jxInfo/offLinePay',
|
||||||
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
userName: name,
|
userName: this.name,
|
||||||
userPhone: phone,
|
userPhone: this.phone,
|
||||||
userSex: this.sex,
|
userSex: this.sex,
|
||||||
tenantId: this.tenantId,
|
tenantId: this.tenantId,
|
||||||
userNo: this.identity,
|
userNo: this.identity,
|
||||||
courseId: courseId,
|
courseId: this.courseId,
|
||||||
coachUserName: this.jlName,
|
coachUserName: this.jlName,
|
||||||
coachUserId: this.jlId,
|
coachUserId: this.jlId,
|
||||||
courseType: this.rightInfoList.type,
|
courseType: this.rightInfoList.type,
|
||||||
courseName: this.rightInfoList.name,
|
courseName: this.rightInfoList.name,
|
||||||
reserveMoney: this.rightInfoList.price,
|
reserveMoney: this.rightInfoList.price,
|
||||||
payType: '2',
|
payType: '2',
|
||||||
|
|
||||||
userId: this.userId,
|
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()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if (res.code === 0) {
|
||||||
|
const contractData = { /* ...合同数据... */ };
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData))
|
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() {
|
async getRightInfoList() {
|
||||||
let res = await request({
|
let res = await request({
|
||||||
url: '/app-api/dl-drive-school-course-small/get?id=' + this.courseId,
|
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;
|
this.currentPrice = this.rightInfoList.price;
|
||||||
console.log("111222333", this.rightInfoList)
|
console.log("111222333", this.rightInfoList)
|
||||||
},
|
},
|
||||||
async xxgetRightInfoList() {
|
|
||||||
let res = await request({
|
// 处理已存在的订单
|
||||||
url: '/drivingSchool/system/driveSchoolCourse/list?id=' + this.courseId + '&payType=' +
|
async processExistingOrder() {
|
||||||
this.id,
|
uni.showLoading({ title: '准备支付...', mask: true });
|
||||||
method: 'get',
|
|
||||||
})
|
try {
|
||||||
this.rightInfoList = res.data.records[0],
|
if (this.startPay === 1) {
|
||||||
console.log("报名班类型", this.rightInfoList)
|
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) {
|
deletePic(event) {
|
||||||
this[`fileList${event.name}`].splice(event.index, 1)
|
this[`fileList${event.name}`].splice(event.index, 1)
|
||||||
@ -659,17 +644,17 @@ import { getLocalUserInfo } from '../../utils/auth'
|
|||||||
console.log('654',res);
|
console.log('654',res);
|
||||||
that.popupShow = false
|
that.popupShow = false
|
||||||
},
|
},
|
||||||
updateOrderStatus(orderId,paymentStatus){
|
|
||||||
console.log('orderId',orderId)
|
// 更新订单状态
|
||||||
console.log('paymentStatus',paymentStatus)
|
async updateOrderStatus(orderId, status) {
|
||||||
request({
|
await request({
|
||||||
url: '/app-api/small/drive/school-course-order/update',
|
url: '/app-api/small/drive/school-course-order/update',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: {
|
data: {
|
||||||
id: orderId,
|
id: orderId,
|
||||||
paymentStatus: paymentStatus
|
paymentStatus: status
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
insertSchoolStudent(){
|
insertSchoolStudent(){
|
||||||
@ -713,7 +698,32 @@ import { getLocalUserInfo } from '../../utils/auth'
|
|||||||
|
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
// return now;
|
// 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;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<view class="btn-view">
|
<view class="btn-view">
|
||||||
|
|
||||||
<view class="clear" @click="clear()">取消</view>
|
<view class="clear" @click="clear()">取消</view>
|
||||||
|
<view class="reset" @click="reset()">重置</view>
|
||||||
<view class="save" @click="save()">签署</view>
|
<view class="save" @click="save()">签署</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -147,6 +148,21 @@
|
|||||||
}
|
}
|
||||||
}, this)
|
}, 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) {
|
emit(tempFilePath) {
|
||||||
this.$emit('change', tempFilePath)
|
this.$emit('change', tempFilePath)
|
||||||
},
|
},
|
||||||
@ -186,7 +202,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.save,
|
.save,
|
||||||
.clear {
|
.clear,
|
||||||
|
.reset {
|
||||||
height: 70rpx;
|
height: 70rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -210,6 +227,11 @@
|
|||||||
|
|
||||||
.clear {}
|
.clear {}
|
||||||
|
|
||||||
|
.reset {
|
||||||
|
background: #FF9900;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.sign-area {
|
.sign-area {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40%;
|
top: 40%;
|
||||||
@ -218,4 +240,5 @@
|
|||||||
font-size: 130rpx;
|
font-size: 130rpx;
|
||||||
transform: rotate(-20deg);
|
transform: rotate(-20deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user