diff --git a/newPages/newIndex/index.vue b/newPages/newIndex/index.vue index cbaa808..d456ed4 100644 --- a/newPages/newIndex/index.vue +++ b/newPages/newIndex/index.vue @@ -346,7 +346,7 @@ case '学车报名': uni.navigateTo({ url: '/newPages/schoolList/index' - // url: '/pagesA/guideContent/index' + // url: `/pagesA/guideContent/index?tenantId=${180}` }); break; case '预约训练': diff --git a/pages/login/login.vue b/pages/login/login.vue index 5029dc1..5387ca5 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -112,6 +112,7 @@ success(res) { if (res.code) { uni.setStorageSync('c1', res.code); + } else { console.log('登录失败!' + res.errMsg) } @@ -333,6 +334,8 @@ } }, 1000); }, + + } } diff --git a/pagesA/components/header/guideHeaders.vue b/pagesA/components/header/guideHeaders.vue new file mode 100644 index 0000000..7be421d --- /dev/null +++ b/pagesA/components/header/guideHeaders.vue @@ -0,0 +1,66 @@ + + + + + \ No newline at end of file diff --git a/pagesA/courseDetail/index.vue b/pagesA/courseDetail/index.vue index 018acec..1452a0f 100644 --- a/pagesA/courseDetail/index.vue +++ b/pagesA/courseDetail/index.vue @@ -152,11 +152,29 @@ }); return; } + this.requestPushPermission() uni.navigateTo({ url: `/pagesA/register/index?courseId=${this.courseDetails.id}&userId=${this.userDetails.id}&tenantId=${this.tenantId}`, // url: '/pages/index/bmPage' }); }, + requestPushPermission() { + wx.requestSubscribeMessage({ + tmplIds: ['CQpqLkmS2xk9Uz5J6tLoNuoaoHu_C7i6t7aCxtg_btc'], + success: (res) => { + if (res['CQpqLkmS2xk9Uz5J6tLoNuoaoHu_C7i6t7aCxtg_btc'] === 'accept') { + console.log('用户同意接收推送'); + uni.setStorageSync('agreePush', true) + } else { + console.log('用户拒绝接收推送'); + uni.setStorageSync('agreePush', false) + } + }, + fail: (err) => { + console.log('请求授权失败', err); + } + }) + }, } }; diff --git a/pagesA/guideContent/index.vue b/pagesA/guideContent/index.vue index 6194f1f..434aca2 100644 --- a/pagesA/guideContent/index.vue +++ b/pagesA/guideContent/index.vue @@ -1,16 +1,34 @@ @@ -21,11 +39,13 @@ } from "@/utils/auth"; import VNavigationBar from '@/components/tabbar/VNavigationBar.vue' import request from '@/utils/request.js' + import headers from "@/pagesA/components/header/guideHeaders.vue"; export default { name: "content", components: { - VNavigationBar + VNavigationBar, + headers }, filters: { formatRichText(html) { @@ -39,11 +59,14 @@ toUrl: null, tenantId: null, guideDetails: [], + + }; }, onLoad(data) { console.log('data', data.tenantId) this.tenantId = data.tenantId + console.log('tenantId', this.tenantId) this.getGuideByTenantId() }, methods: { @@ -52,8 +75,7 @@ url: '/app-api/jx/driveSchool/smallProgram/guide/list', method: 'GET', params: { - // tenantId: this.tenantId - tenantId: '181' + tenantId: this.tenantId } }).then(res => { const list = res.data || [] @@ -62,12 +84,18 @@ this.guideDetails = list.length > 0 ? list[0] : null console.log('最新指南 guideDetails', this.guideDetails) console.log('更新时间 guideDetails', this.guideDetails.updateTime) + }).catch(() => { + this.guideDetails = null }) }, + handleBack() { + uni.switchTab({ + url: '/newPages/newIndex/index' + }); + }, // 格式化时间 getCurrentDateTime() { const now = new Date(); - const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0'); @@ -76,7 +104,6 @@ const seconds = String(now.getSeconds()).padStart(2, '0'); return `${year}-${month}-${day} ${hours}:${minutes}`; - // return now; }, } } diff --git a/pagesA/register/index.vue b/pagesA/register/index.vue index 6bf5e53..099e85a 100644 --- a/pagesA/register/index.vue +++ b/pagesA/register/index.vue @@ -174,6 +174,9 @@ getStaffType, getToken } from '../../utils/auth' + import { + sendSubscriptionMessage + } from '@/pagesA/register/pushService.js'; export default { data() { @@ -230,6 +233,7 @@ localStaffType: null, localCoachId: null, userDetails: [], + orderTime: null, columns: [ [{ label: '全款', @@ -303,6 +307,7 @@ }, methods: { + sendSubscriptionMessage, // 定金价格 or 全款价格 updateDisplayPrice() { this.currentPrice = this.selectedPayType === 1 ? @@ -599,6 +604,8 @@ time: this.getCurrentDateTime(), endTime: this.getEndTime(), }; + this.orderTime = contractData.time, + this.orderId = res.data uni.navigateTo({ url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) + '&callback=' + encodeURIComponent('handleContractSigned') @@ -619,6 +626,7 @@ }) this.rightInfoList = res.data, this.currentPrice = this.rightInfoList.price; + console.log('rightInfoList', this.rightInfoList) }, // 线下支付合同签署完成后调用的方法 @@ -910,19 +918,26 @@ }; // 如果选择了教练,添加source和sourceUserId - if (this.localCoachId && this.localStaffType == '01') { + if (getCoachId() && this.localStaffType == '01') { studentData.source = '01'; studentData.sourceUserId = getCoachId(); // 设置来源用户ID为员工ID this.sendMessages(this.name, this.rightInfoList.name, this.jlId) - } else if (this.localCoachId && this.localStaffType == '02') { + console.log('this.jlId01', this.jlId) + } else if (getCoachId() && this.localStaffType == '02') { studentData.source = '02'; studentData.sourceUserId = getCoachId(); // 设置来源用户ID为教练ID this.sendMessages(this.name, this.rightInfoList.name, getCoachId()) + console.log('this.jlId02', this.jlId) + if (this.jlId === String(getCoachId())) { + console.log('this.jlId03', this.jlId) + this.autoAssignCoach() + } + } else { studentData.source = '03'; // 自来客户 this.sendMessages(this.name, this.rightInfoList.name, this.jlId) } - + console.log('studentData', studentData) request({ url: '/app-api/small/dl-drive-school-student/create', method: 'post', @@ -930,6 +945,15 @@ }); this.updateSysUsersNickName(); + const dynamicData = { + tenantId: this.tenantId, + name: this.name, + courseName: this.rightInfoList.name, + licenseType: this.rightInfoList.type, + price: this.rightInfoList.price, + orderTime: this.orderTime + } + this.sendSubscriptionMessage(dynamicData) }, // 修改users信息 @@ -1003,9 +1027,10 @@ time: this.getCurrentDateTime(), endTime: this.getEndTime(), }; - uni.navigateTo({ - url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) - }) + this.orderTime = contractData.time, + uni.navigateTo({ + url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) + }) }, // 获取三年后的时间 @@ -1047,6 +1072,22 @@ }) }, + // 教练自招,自动分配教练 + autoAssignCoach() { + const process = { + orderId: this.orderId, + courseId: this.courseId, + coachId: this.jlId, + coachName: this.jlName, + userName: this.name + } + request({ + url: '/app-api/process/autoAssignCoach', + method: 'POST', + data: process, + }) + } + } } @@ -1310,4 +1351,4 @@ .size-lv { margin-right: 35px; } - + \ No newline at end of file diff --git a/pagesA/register/pushService.js b/pagesA/register/pushService.js new file mode 100644 index 0000000..31808fb --- /dev/null +++ b/pagesA/register/pushService.js @@ -0,0 +1,57 @@ +// utils/sendSubscriptionMessage.js +import request from '@/utils/request' + +/** + * 发送订阅消息 + * @param {Object} dynamicData + */ +export async function sendSubscriptionMessage(dynamicData) { + try { + // 检查用户是否同意接收推送 + const agreePush = uni.getStorageSync('agreePush'); + if (!agreePush) { + console.log('用户未同意推送消息'); + return; + } + + // 准备要推送的数据 + const messageData = { + openid: uni.getStorageSync('userInfo').driverOpenId, + templateId: 'CQpqLkmS2xk9Uz5J6tLoNuoaoHu_C7i6t7aCxtg_btc', + page: `pagesA/guideContent/index?tenantId=${dynamicData.tenantId || ''}`, + data: { + // 学员姓名 + name4: { + value: dynamicData.name || '' + }, + // 报名班型 + thing6: { + value: dynamicData.courseName || '' + }, + // 驾照类型 + character_string12: { + value: dynamicData.licenseType || '' + }, + // 班型价格 + amount7: { + value: dynamicData.price || '' + }, + // 下单时间 + date1: { + value: dynamicData.orderTime || '' + } + } + }; + + // 发送订阅消息 + await request({ + url: '/app-api/wxPush/message/sendOnce', + method: 'post', + data: messageData + }); + + console.log('订阅消息发送成功'); + } catch (error) { + console.error('发送订阅消息失败:', error); + } +} \ No newline at end of file diff --git a/static/imgs/noData.png b/static/imgs/noData.png new file mode 100644 index 0000000..8b28751 Binary files /dev/null and b/static/imgs/noData.png differ