diff --git a/admin/src/views/appointments/index.vue b/admin/src/views/appointments/index.vue index a6f5ebd..2db18e6 100644 --- a/admin/src/views/appointments/index.vue +++ b/admin/src/views/appointments/index.vue @@ -70,8 +70,8 @@ @@ -137,7 +137,7 @@ {{ formatDate(row.createdAt) }} - + @@ -512,19 +516,16 @@ {{ appointmentDetails.user.nickname || '-' }} - - {{ appointmentDetails.user.realName || '-' }} + + {{ appointmentDetails.user.uid || '-' }} - - {{ appointmentDetails.user.phone || '-' }} - - - {{ appointmentDetails.user.whatsapp || '-' }} - - - {{ appointmentDetails.user.wechatId || '-' }} - - + + {{ getLanguageLabel(appointmentDetails.user.language) }} @@ -578,6 +579,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -633,6 +686,33 @@ const statusOptions = [ { value: 'cancelled', label: '已取消' } ] +// Payment order dialog state +const paymentDialogVisible = ref(false) +const paymentCreating = ref(false) +const paymentFormRef = ref(null) +const paymentForm = reactive({ + appointmentId: '', + appointmentNo: '', + userId: '', + userNickname: '', + serviceContent: '', + amount: 0, + paymentTime: '', + notes: '' +}) +const paymentRules = { + serviceContent: [ + { required: true, message: '请输入服务内容', trigger: 'blur' } + ], + amount: [ + { required: true, message: '请输入金额', trigger: 'blur' }, + { type: 'number', min: 0.01, message: '金额必须大于0', trigger: 'blur' } + ], + paymentTime: [ + { required: true, message: '请选择支付时间', trigger: 'change' } + ] +} + // Fetch categories for filter async function fetchCategories() { try { @@ -808,6 +888,51 @@ async function confirmUpdateStatus() { } } +// Handle create payment order +function handleCreatePaymentOrder(row) { + paymentForm.appointmentId = row.id + paymentForm.appointmentNo = row.appointmentNo + paymentForm.userId = row.user?.id || row.userId + paymentForm.userNickname = `${row.user?.nickname || '-'} (UID: ${row.user?.uid || '-'})` + paymentForm.serviceContent = row.service?.titleZh || row.hotService?.name_zh || row.serviceType || '' + paymentForm.amount = parseFloat(row.amount) || 0 + // 默认设置为当前时间 + paymentForm.paymentTime = new Date().toISOString().slice(0, 19).replace('T', ' ') + paymentForm.notes = '' + paymentDialogVisible.value = true +} + +// Confirm create payment order +async function confirmCreatePaymentOrder() { + if (!paymentFormRef.value) return + + await paymentFormRef.value.validate(async (valid) => { + if (!valid) return + + paymentCreating.value = true + try { + const response = await api.post('/api/v1/admin/payment-orders', { + userId: paymentForm.userId, + appointmentId: paymentForm.appointmentNo, + amount: paymentForm.amount, + serviceContent: paymentForm.serviceContent, + paymentTime: paymentForm.paymentTime, + notes: paymentForm.notes + }) + + if (response.data.success || response.data.code === 0) { + ElMessage.success('支付订单创建成功') + paymentDialogVisible.value = false + } + } catch (error) { + console.error('Failed to create payment order:', error) + ElMessage.error(error.response?.data?.message || '创建支付订单失败') + } finally { + paymentCreating.value = false + } + }) +} + // Helper functions function formatDate(dateStr) { if (!dateStr) return '-' @@ -1018,7 +1143,7 @@ onMounted(() => { color: #303133; } - .phone { + .uid { font-size: 12px; color: #909399; } diff --git a/admin/src/views/services/index.vue b/admin/src/views/services/index.vue index 4103a62..59ff7d7 100644 --- a/admin/src/views/services/index.vue +++ b/admin/src/views/services/index.vue @@ -72,7 +72,7 @@ - + - - - - - - - - - - - -