This commit is contained in:
zpc 2026-02-23 20:31:26 +08:00
parent 788e1caf91
commit eb339da935
5 changed files with 136 additions and 16 deletions

View File

@ -114,6 +114,18 @@ public class PlannerBooking
/// </summary>
public int? ScorePolitics { get; set; }
/// <summary>
/// 家庭氛围
/// </summary>
[MaxLength(500)]
public string? FamilyAtmosphere { get; set; }
/// <summary>
/// 期望
/// </summary>
[MaxLength(500)]
public string? Expectation { get; set; }
/// <summary>
/// 状态1待确认 2已确认 3已完成 4已取消
/// </summary>

View File

@ -439,17 +439,40 @@ public class OrderService : IOrderService
else
{
// 规划订单 - 创建规划预约记录Requirements 8.2
// 解析预约日期时间
DateTime bookingDate = DateTime.Today;
string bookingTime = "待确认";
if (!string.IsNullOrEmpty(request.PlannerInfo!.BookDateTime))
{
if (DateTime.TryParse(request.PlannerInfo.BookDateTime, out var parsedDateTime))
{
bookingDate = parsedDateTime.Date;
bookingTime = parsedDateTime.ToString("HH:mm");
}
}
var plannerBooking = new MiAssessment.Model.Entities.PlannerBooking
{
UserId = userId,
OrderId = order.Id,
PlannerId = request.ProductId,
BookingDate = DateTime.Today, // 默认今天,后续可修改
BookingTime = "待确认",
Name = request.PlannerInfo!.Name,
BookingDate = bookingDate,
BookingTime = bookingTime,
Name = request.PlannerInfo.Name,
Phone = request.PlannerInfo.Phone,
Gender = 0, // 默认未知
Grade = 0, // 默认未知
Gender = 0,
Grade = request.PlannerInfo.Grade,
MajorName = request.PlannerInfo.MajorName,
ScoreChinese = request.PlannerInfo.ScoreChinese,
ScoreMath = request.PlannerInfo.ScoreMath,
ScoreEnglish = request.PlannerInfo.ScoreEnglish,
ScorePhysics = request.PlannerInfo.ScorePhysics,
ScoreChemistry = request.PlannerInfo.ScoreChemistry,
ScoreBiology = request.PlannerInfo.ScoreBiology,
ScoreGeography = request.PlannerInfo.ScoreGeography,
ScorePolitics = request.PlannerInfo.ScorePolitics,
FamilyAtmosphere = request.PlannerInfo.FamilyAtmosphere,
Expectation = request.PlannerInfo.Expectation,
Status = 1, // 待确认
CreateTime = now,
UpdateTime = now,

View File

@ -114,6 +114,18 @@ public class PlannerBooking
/// </summary>
public int? ScorePolitics { get; set; }
/// <summary>
/// 家庭氛围
/// </summary>
[MaxLength(500)]
public string? FamilyAtmosphere { get; set; }
/// <summary>
/// 期望
/// </summary>
[MaxLength(500)]
public string? Expectation { get; set; }
/// <summary>
/// 状态1待确认 2已确认 3已完成 4已取消
/// </summary>

View File

@ -92,6 +92,71 @@ public class PlannerInfoDto
/// </summary>
public string Phone { get; set; } = null!;
/// <summary>
/// 预约日期时间,如"2026-02-23 16:00"
/// </summary>
public string? BookDateTime { get; set; }
/// <summary>
/// 年级1小学 2初中 3高中 4大专 5本科 6研究生及以上
/// </summary>
public int Grade { get; set; }
/// <summary>
/// 专业名称(大专及以上时填写)
/// </summary>
public string? MajorName { get; set; }
/// <summary>
/// 语文成绩
/// </summary>
public int? ScoreChinese { get; set; }
/// <summary>
/// 数学成绩
/// </summary>
public int? ScoreMath { get; set; }
/// <summary>
/// 英语成绩
/// </summary>
public int? ScoreEnglish { get; set; }
/// <summary>
/// 物理成绩
/// </summary>
public int? ScorePhysics { get; set; }
/// <summary>
/// 化学成绩
/// </summary>
public int? ScoreChemistry { get; set; }
/// <summary>
/// 生物成绩
/// </summary>
public int? ScoreBiology { get; set; }
/// <summary>
/// 地理成绩
/// </summary>
public int? ScoreGeography { get; set; }
/// <summary>
/// 政治成绩
/// </summary>
public int? ScorePolitics { get; set; }
/// <summary>
/// 家庭氛围
/// </summary>
public string? FamilyAtmosphere { get; set; }
/// <summary>
/// 期望
/// </summary>
public string? Expectation { get; set; }
/// <summary>
/// 备注
/// </summary>

View File

@ -254,28 +254,36 @@ async function handleSubmit() {
try {
uni.showLoading({ title: '创建订单中...' })
//
const gradeMap = { '小学': 1, '初中': 2, '高中': 3, '大专': 4, '本科': 5, '研究生及以上': 6 }
//
const scoreData = {}
const scoreFields = {}
if (showScores.value) {
subjectList.value.forEach(s => {
if (scores.value[s.key]) scoreData[s.key] = scores.value[s.key]
if (scores.value[s.key]) {
const fieldMap = {
chinese: 'scoreChinese', math: 'scoreMath', english: 'scoreEnglish',
physics: 'scorePhysics', chemistry: 'scoreChemistry', biology: 'scoreBiology',
geography: 'scoreGeography', politics: 'scorePolitics'
}
scoreFields[fieldMap[s.key]] = parseInt(scores.value[s.key]) || null
}
})
}
const result = await processPayment({
productType: 2,
orderType: 2,
productId: plannerId.value,
userInfo: {
plannerInfo: {
name: formData.value.name,
phone: formData.value.phone,
grade: formData.value.grade,
majorName: formData.value.majorName || '',
scores: scoreData,
familyAtmosphere: formData.value.familyAtmosphere,
expectation: formData.value.expectation,
bookDateTime: `${selectedDate.value} ${selectedTime.value}`,
plannerId: plannerId.value,
plannerName: plannerInfo.value.name
grade: gradeMap[formData.value.grade] || 0,
majorName: showMajor.value ? formData.value.majorName : null,
...scoreFields,
familyAtmosphere: formData.value.familyAtmosphere,
expectation: formData.value.expectation
}
})