小程序修改代码
This commit is contained in:
6
app.json
6
app.json
@ -60,12 +60,6 @@
|
||||
"selectedColor": "#FC7E09",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/projectModule/projectList/projectList",
|
||||
"text": "接单",
|
||||
"iconPath": "/static/jd1.png",
|
||||
"selectedIconPath": "/static/jd2.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/course/homepage/homepage",
|
||||
"text": "课程",
|
||||
|
@ -117,7 +117,9 @@ Page({
|
||||
},
|
||||
|
||||
// 取消订单
|
||||
cancelOrder() {
|
||||
cancelOrder(e) {
|
||||
// console.log(e);
|
||||
const id = e.currentTarget.dataset.id;
|
||||
wx.showModal({
|
||||
title: '取消订单',
|
||||
content: '是否要取消订单?',
|
||||
@ -126,9 +128,9 @@ Page({
|
||||
wx.request({
|
||||
url: baseUrl + "/courseOrder/cancel",
|
||||
method: 'POST',
|
||||
data: { courseId: this.data.orderId },
|
||||
data: { courseId: id },
|
||||
header: { Authorization: wx.getStorageSync('token') },
|
||||
success: () => this.getOrderDetail()
|
||||
success: () => this.fetchOrders()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
<text class="font_6 text_5">{{ item.createTime }}</text>
|
||||
<view class="flex-row">
|
||||
<!-- 仅待支付时可操作 -->
|
||||
<view wx:if="{{ item.orderStatus === '待支付' }}" class="flex-col justify-start items-center text-wrapper" catch:tap="cancelOrder">
|
||||
<view wx:if="{{ item.orderStatus === '待支付' }}" class="flex-col justify-start items-center text-wrapper" catch:tap="cancelOrder" data-id="{{ item.id }}">
|
||||
<text class="font_7">取消订单</text>
|
||||
</view>
|
||||
<view wx:if="{{ item.orderStatus === '待支付' }}" class="flex-col justify-start items-center text-wrapper_2 ml-11" catch:tap="payOrder">
|
||||
|
@ -9,9 +9,9 @@
|
||||
<view class="flex-col flex-1 ml-11">
|
||||
<text class="self-start text">{{ courseObj.name }}</text>
|
||||
<view class="flex-row items-center self-stretch group mt-15">
|
||||
<text class="text_2">¥{{ courseObj.originPrice }}</text>
|
||||
<text class="text_2">¥{{ courseObj.discountPrice }}</text>
|
||||
<view class="flex-col justify-start relative ml-1">
|
||||
<text class="text_3">¥{{ courseObj.discountPrice }}</text>
|
||||
<text class="text_3">¥{{ courseObj.originPrice }}</text>
|
||||
<view class="divider pos"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -55,15 +55,15 @@
|
||||
<view class="mt-16 flex-col section_4">
|
||||
<view class="flex-row justify-between items-center">
|
||||
<text class="font text_12">课程价格</text>
|
||||
<text class="font_4">¥{{ orderObj.totalAmount }}</text>
|
||||
<text class="font_4">¥{{ orderObj.originPrice }}</text>
|
||||
</view>
|
||||
<view class="flex-row justify-between items-center mt-11">
|
||||
<text class="font text_13">价格折扣</text>
|
||||
<text class="font_4 text_14">-¥{{ orderObj.totalAmount - orderObj.originPrice }}</text>
|
||||
<text class="font_4 text_14">-¥{{ orderObj.originPrice - orderObj.totalAmount }}</text>
|
||||
</view>
|
||||
<view class="flex-row justify-between items-center group_9 mt-11">
|
||||
<text class="font_2 text_15">订单金额</text>
|
||||
<text class="font_4 text_16">¥{{ orderObj.originPrice }}</text>
|
||||
<text class="font_4 text_16">¥{{ orderObj.totalAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<view class="flex-row items-center section">
|
||||
<image
|
||||
class="image"
|
||||
src="https://ide.code.fun/api/image?token=6854f3c94ae84d0012332367&name=f2d91149603a9b9bbd30ffd5a77c2043.png"
|
||||
src="./images/sousuo.png"
|
||||
/>
|
||||
<input class="text ml-3" placeholder="搜索更多好课" />
|
||||
</view>
|
||||
|
@ -58,22 +58,35 @@ Page({
|
||||
// 搜索按钮点击
|
||||
onSearch() {
|
||||
const { role } = this.data;
|
||||
// 校验:确保主管名称、手机号和排序条件不能为空
|
||||
if (!this.data.nickName || !this.data.phoneNumber) {
|
||||
wx.showToast({
|
||||
title: '主管名称和手机号不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// —— 新增:校验主管名称 ——
|
||||
const nameRegex = /^[\u4e00-\u9fa5]+$/;
|
||||
if (!this.data.nickName) {
|
||||
wx.showToast({ title: '主管名称不能为空', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!nameRegex.test(this.data.nickName)) {
|
||||
wx.showToast({ title: '主管名称只能为汉字', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.data.selectedSortField === '待选择') {
|
||||
wx.showToast({
|
||||
title: '排序条件不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// —— 新增:校验手机号 ——
|
||||
if (!this.data.phoneNumber) {
|
||||
wx.showToast({ title: '手机号不能为空', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (this.data.phoneNumber.length < 11) {
|
||||
wx.showToast({ title: '手机号不够11位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 原排序条件校验,保持不变
|
||||
if (this.data.selectedSortField === '待选择') {
|
||||
wx.showToast({
|
||||
title: '排序条件不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示加载中
|
||||
wx.showLoading({
|
||||
|
@ -20,7 +20,7 @@ Page({
|
||||
onSearch() {
|
||||
const nickName = this.data.nickName.trim();
|
||||
const phoneNumber = this.data.phoneNumber.trim();
|
||||
const supervisorUserId = this.data;
|
||||
const { supervisorUserId } = this.data;
|
||||
|
||||
if (!nickName) {
|
||||
wx.showToast({ title: '请输入主管名称', icon: 'none' });
|
||||
@ -37,7 +37,11 @@ Page({
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token')
|
||||
},
|
||||
data: { nickName, phoneNumber, supervisorUserId},
|
||||
data: {
|
||||
nickName: nickName,
|
||||
phoneNumber: phoneNumber,
|
||||
supervisorUserId: supervisorUserId,
|
||||
},
|
||||
success: (res) => {
|
||||
console.log('--->后端返回记录',res.data);
|
||||
if (res.data.code === 1) {
|
||||
@ -105,7 +109,7 @@ Page({
|
||||
onLoad(options) {
|
||||
console.log('--->',options);
|
||||
this.setData({
|
||||
supervisorUserId: options.supId,
|
||||
supervisorUserId: options.id,
|
||||
})
|
||||
this.onSearchSupId();
|
||||
},
|
||||
|
@ -8,6 +8,7 @@ Page({
|
||||
showList: false, // 是否显示绩效列表
|
||||
performanceList: [], // 绩效列表数据,含 ratePercent 字段
|
||||
userRole: '', // 用户角色
|
||||
id: 0,
|
||||
},
|
||||
|
||||
onNameInput(e) {
|
||||
@ -20,6 +21,7 @@ Page({
|
||||
onSearch() {
|
||||
const nickName = this.data.nickName.trim();
|
||||
const phoneNumber = this.data.phoneNumber.trim();
|
||||
const { id } = this.data
|
||||
|
||||
if (!nickName) {
|
||||
wx.showToast({ title: '请输入主管名称', icon: 'none' });
|
||||
@ -36,7 +38,10 @@ Page({
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token')
|
||||
},
|
||||
data: { nickName, phoneNumber },
|
||||
data: {
|
||||
nickName: nickName,
|
||||
phoneNumber: phoneNumber,
|
||||
},
|
||||
success: (res) => {
|
||||
console.log('--->后端返回记录',res.data);
|
||||
if (res.data.code === 1) {
|
||||
@ -71,7 +76,8 @@ Page({
|
||||
onLoad(options) {
|
||||
console.log('--->',options);
|
||||
this.setData({
|
||||
userRole: options.role
|
||||
userRole: options.role,
|
||||
id: options.id,
|
||||
})
|
||||
let showRole = '';
|
||||
switch (options.role) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
<!-- 显示查询结果 -->
|
||||
<view class="flex-col mt-18">
|
||||
<!-- 审核失败 -->
|
||||
<view wx:if="{{status === '审核失败'}}" class="flex-col section_2">
|
||||
<view wx:if="{{status === '已拒绝'}}" class="flex-col section_2">
|
||||
<view class="flex-row justify-center self-start section_3">
|
||||
<image class="image_2" src="./images/flase.png" />
|
||||
<text class="font text_2 ml-8">审核失败</text>
|
||||
|
@ -10,7 +10,15 @@ Page({
|
||||
confirmPwd: '',
|
||||
countdown: 0,
|
||||
codeButtonText: '发送验证码',
|
||||
_timer: null
|
||||
_timer: null,
|
||||
role: '',
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
console.log(options);
|
||||
this.setData({
|
||||
role: options.role
|
||||
})
|
||||
},
|
||||
|
||||
// 手机号输入
|
||||
@ -92,7 +100,7 @@ Page({
|
||||
|
||||
// 重置密码
|
||||
resetPassword() {
|
||||
const { phone, code, newPwd, confirmPwd } = this.data;
|
||||
const { phone, code, newPwd, confirmPwd, role } = this.data;
|
||||
// 1. 非空校验
|
||||
if (!validate(this.data, {
|
||||
phone: '请输入手机号',
|
||||
@ -117,7 +125,8 @@ Page({
|
||||
verificationCode: code,
|
||||
userPassword: newPwd,
|
||||
userConfirmPassword: confirmPwd,
|
||||
sourceToken: null
|
||||
sourceToken: null,
|
||||
role: role
|
||||
},
|
||||
success: res => {
|
||||
if (res.data.code === 1) {
|
||||
|
@ -183,7 +183,7 @@ Page({
|
||||
|
||||
setTimeout(() => {
|
||||
wx.reLaunch({
|
||||
url: '/pages/projectModule/projectList/projectList',
|
||||
url: '/pages/course/homepage/homepage',
|
||||
})
|
||||
}, 1000); // 1000ms = 1秒
|
||||
} else {
|
||||
@ -201,8 +201,10 @@ Page({
|
||||
|
||||
// 跳转忘记密码
|
||||
gotoForgetPwd() {
|
||||
|
||||
const { role } = this.data;
|
||||
wx.navigateTo({
|
||||
url: '/pages/loginModule/forgetPwd/forgetPwd',
|
||||
url: `/pages/loginModule/forgetPwd/forgetPwd?role=${role}`,
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -17,6 +17,7 @@ Page({
|
||||
showPopup: false, // 控制弹窗显示与否
|
||||
qrcode: "https://img.picui.cn/free/2025/05/29/6837c53582068.gif", // 设置二维码图片的路径
|
||||
userRole: "",
|
||||
id: 0,
|
||||
},
|
||||
|
||||
// 跳转课程订单页面
|
||||
@ -143,6 +144,7 @@ Page({
|
||||
userAccount: res.data.data.userAccount,
|
||||
invitationCode: res.data.data.invitationCode,
|
||||
userRole: res.data.data.userRole,
|
||||
id: res.data.data.id,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -185,15 +187,16 @@ Page({
|
||||
|
||||
// 跳转查看绩效
|
||||
checkPerformance() {
|
||||
const { userRole } = this.data
|
||||
const { userRole } = this.data;
|
||||
const { id } = this.data;
|
||||
|
||||
if (userRole === 'manager' || userRole === 'supervisor') {
|
||||
if (userRole === 'manager') {
|
||||
wx.navigateTo({
|
||||
url: `/pages/dashboardModule/supervisorPerformance/supervisorPerformance?role=${userRole}`,
|
||||
url: `/pages/dashboardModule/supervisorPerformance/supervisorPerformance?role=${userRole}&id=${id}`,
|
||||
})
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: `/pages/dashboardModule/staffPerformance/staffPerformance?role=${userRole}`,
|
||||
url: `/pages/dashboardModule/staffPerformance/staffPerformance?role=${userRole}&id=${id}`,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -247,7 +247,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-col mt-22" >
|
||||
<view class="flex-row items-start equal-division section_3" wx:if="{{ userRole != 'user' }}" >
|
||||
<view class="flex-row items-start equal-division section_3" wx:if="{{ userRole != 'user' }}">
|
||||
<view class="flex-col items-center equal-division-item_1 group_3" bind:tap="checkPerformance">
|
||||
<image
|
||||
class="image_5"
|
||||
|
Reference in New Issue
Block a user