# Read the file
with open('OrderDetailPage.vue', 'r') as f:
    lines = f.readlines()

# Find and remove the orphaned function body (lines 895-918)
# The orphaned code starts with "  let productUsd = 0" and ends with "}\n" before formatDate
output_lines = []
skip_mode = False
for i, line in enumerate(lines):
    # Start skipping after the new function definition
    if i >= 894 and line.strip().startswith('let productUsd = 0'):
        skip_mode = True
        continue
    
    # Stop skipping when we hit formatDate
    if skip_mode and line.strip().startswith('const formatDate'):
        skip_mode = False
    
    if not skip_mode:
        output_lines.append(line)

# Write back
with open('OrderDetailPage.vue', 'w') as f:
    f.writelines(output_lines)

print("Fixed!")
