From 4f9c0d00751275122b912eccc1bfe3da6a0ed223 Mon Sep 17 00:00:00 2001 From: Lx <935448346@qq.com> Date: Wed, 9 Apr 2025 14:36:38 +0800 Subject: [PATCH] 0409-2 --- newPages/my/index.vue | 47 ++++++++++++++++++++---------------- newPages/newIndex/index.vue | 2 +- newPages/register/index.vue | 48 +++++++++++++++++++++++++------------ 3 files changed, 60 insertions(+), 37 deletions(-) diff --git a/newPages/my/index.vue b/newPages/my/index.vue index 02610b8..1f3135d 100644 --- a/newPages/my/index.vue +++ b/newPages/my/index.vue @@ -131,7 +131,8 @@ import tabbar from '../../components/tabbar/tabbar.vue' import request from '@/utils/request.js' import { getLocalUserInfo, - getToken + getToken, + setLocalUserInfo } from '@/utils/auth' export default { @@ -140,6 +141,7 @@ export default { return { msg: "3", selfInfo: {}, + selfInfoLocal: {}, coachDetails: {}, userDetails: {}, orderList: {}, @@ -175,8 +177,8 @@ export default { }; }, onLoad() { - this.selfInfo = getLocalUserInfo() - console.log("用户信息", this.selfInfo) + this.selfInfoLocal = getLocalUserInfo() + console.log("用户信息", this.selfInfoLocal) this.getUserInfo() }, onShow() { @@ -188,6 +190,7 @@ export default { onPullDownRefresh() { console.log("刷新"); uni.stopPullDownRefresh() + this.getUserInfo() }, onReachBottom() { // this.show = true @@ -228,35 +231,36 @@ export default { }) }, - getUserInfo() { - request({ - url: '/app-api/small/dl-drive-school-student/getByUserId', - method: 'GET', - params: { - userId: this.selfInfo.id, - }, - }).then(res => { - this.userDetails = res.data - this.getOrder() - console.log('userDetails', this.userDetails) - /* if (this.userDetails.sourceUserId !== null) { - this.getCoachDetails(this.userDetails.sourceUserId) - } */ - }) - }, + + + getUserInfo() { + request({ + url: '/app-api/small/dl-drive-school-student/getUsersInfo', + method: 'GET', + }).then(res => { + this.selfInfo = res.data + if(this.userInfo != null){ + setLocalUserInfo(this.selfInfo) + } + + this.getOrder() + console.log('userDetails', this.selfInfo) + }) + }, getCoachDetails(coachId) { request({ - url: '/app-api/dl-drive-school-coach-small/get', + url: '/app-api/dl-drive-school-coach-small/getCoachByUserId', method: 'GET', params: { - id: coachId + userId: coachId } }).then(res => { this.coachDetails = res.data console.log('coachDetails', this.coachDetails); }) }, + getOrder() { request({ url: '/app-api/small/drive/school-course-order/getCourseByLoginUser', @@ -270,6 +274,7 @@ export default { } }) }, + getProcess(courseId) { request({ url: '/app-api/process/getAllByCourseId', diff --git a/newPages/newIndex/index.vue b/newPages/newIndex/index.vue index 99ae040..9b3aefa 100644 --- a/newPages/newIndex/index.vue +++ b/newPages/newIndex/index.vue @@ -214,7 +214,7 @@ export default { switch (item.text) { case '学车报名': uni.navigateTo({ - // url: '/pages/enroll/index' + url: '/newPages/schoolList/index' }); break; case '预约训练': diff --git a/newPages/register/index.vue b/newPages/register/index.vue index 9f3d5cc..879275f 100644 --- a/newPages/register/index.vue +++ b/newPages/register/index.vue @@ -229,8 +229,8 @@ export default { } this.jlId = uni.getStorageSync('jlId'); this.courseId = option.courseId, - this.userId = option.userId, - this.tenantId = option.tenantId + this.userId = option.userId, + this.tenantId = option.tenantId this.userinfo = getLocalUserInfo() console.log("驾校id", this.jxId, "课程id", this.courseId) console.log("userId", this.userId, "tenantId", this.tenantId) @@ -274,16 +274,19 @@ export default { }, methods: { + // 定金价格 or 全款价格 updateDisplayPrice() { this.currentPrice = this.selectedPayType === 1 ? this.rightInfoList.reserveMoney : this.rightInfoList.price; }, + + // 教练信息 async getListAll() { this.columnjl = [] let res = await request({ - url: '/app-api/dl-drive-school-coach-small/page', - method: 'get', + url: '/app-api/dl-drive-school-coach-small/list', + method: 'GET', params: { tenantId: this.tenantId, }, @@ -291,7 +294,7 @@ export default { }) console.log(res); this.columnjl = [ - res.data.records.map(coach => ({ + res.data.map(coach => ({ label: coach.name, value: coach })) @@ -307,10 +310,11 @@ export default { this.popupShow = false // console.log('close'); }, + // 选择教练 jlconfirm(e) { console.log("选中教练:", e.value[0]); this.jlName = e.value[0].label; // 显示名称 - this.jlId = e.value[0].value.id; // 获取教练ID + this.jlId = e.value[0].value.userId; // 获取教练ID this.showjl = false; }, jlcancel() { @@ -333,11 +337,11 @@ export default { this.startPay = id }, - goBookingJl() { + /* goBookingJl() { uni.navigateTo({ url: '/pages/index/bookingJl', }) - }, + }, */ // 校验手机号 isValidPhoneNumber(phoneNumber) { @@ -485,7 +489,16 @@ export default { }); if (res.code === 0) { - const contractData = { /* ...合同数据... */}; + const contractData = { + adress: this.Address, + name: this.name, + tenantId: this.tenantId, + type: this.rightInfoList.price, + money: this.getRightInfoList, + indent: this.identity, + phone: this.phone, + time: this.getCurrentDateTime() + }; uni.navigateTo({ url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) }); @@ -551,14 +564,13 @@ export default { // 创建新订单 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; - + this.payPrice = reserveMoney await this.wxPayClick( this.name, this.phone, @@ -585,7 +597,6 @@ export default { if (event.name == '2') { this.videoUr = null } - }, // 新增图片 async afterRead(event) { @@ -660,6 +671,7 @@ export default { }); }, + // 插入学员信息 insertSchoolStudent() { request({ url: '/app-api/small/dl-drive-school-student/create', @@ -675,23 +687,24 @@ export default { userId: this.userinfo.id, tenantId: this.tenantId, idPhoto: this.sfzimg, - } }) this.updateSysUsersNickName() }, + // 修改users信息 updateSysUsersNickName(){ request({ url: '/app-api/system/user/update', method: 'PUT', - params: { - nickName: this.name, + data: { + nickname: this.name, id: this.userInfo.id } }) }, + // 校验是否登录 checkLogin() { const token = uni.getStorageSync('App-Token'); console.log(token) @@ -701,6 +714,8 @@ export default { } return true; }, + + // 格式化时间 getCurrentDateTime() { const now = new Date(); @@ -714,6 +729,8 @@ export default { return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; // return now; }, + + // 签合同 signContract() { const contractData = { adress: this.Address, @@ -729,6 +746,7 @@ export default { url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) }) }, + // 获取订单状态 async getPayStatus(orderId) { const res = await request({