1if (loading) {
2 return <Loading message="Loading order details..." />
3}
4
5if (error || !order) {
6 return (
7 <View style={[styles.centerContainer, { backgroundColor: colors.background }]}>
8 <Text style={[styles.errorText, { color: colors.text }]}>
9 {error || "Order not found"}
10 </Text>
11 <Button
12 title="Go to Home"
13 onPress={() => {
14
15 router.dismissAll()
16 router.replace("/(drawer)/(tabs)/(home)")
17 }}
18 style={styles.button}
19 />
20 </View>
21 )
22}
23
24return (
25 <ScrollView style={[styles.container, { backgroundColor: colors.background }]}>
26 <View style={styles.content}>
27 <View style={[styles.successIcon, { backgroundColor: colors.success }]}>
28 <Text style={styles.checkmark}>✓</Text>
29 </View>
30
31 <Text style={[styles.title, { color: colors.text }]}>Order Confirmed!</Text>
32 <Text style={[styles.subtitle, { color: colors.icon }]}>
33 We have received your order and will process it as soon as possible.
34 </Text>
35
36 <Button
37 title="Continue Shopping"
38 onPress={() => {
39
40 router.dismissAll()
41 router.replace("/(drawer)/(tabs)/(home)")
42 }}
43 style={styles.continueButton}
44 />
45
46 <View style={[styles.card, { backgroundColor: colors.background, borderColor: colors.icon + "30" }]}>
47 <Text style={[styles.cardTitle, { color: colors.text }]}>Order Details</Text>
48
49 <View style={styles.infoRow}>
50 <Text style={[styles.label, { color: colors.icon }]}>Order ID</Text>
51 <Text style={[styles.value, { color: colors.text }]}>{order.display_id}</Text>
52 </View>
53
54 <View style={styles.infoRow}>
55 <Text style={[styles.label, { color: colors.icon }]}>Email</Text>
56 <Text style={[styles.value, { color: colors.text }]}>{order.email}</Text>
57 </View>
58 </View>
59
60 <View style={[styles.card, { backgroundColor: colors.background, borderColor: colors.icon + "30" }]}>
61 <Text style={[styles.cardTitle, { color: colors.text }]}>Order Items</Text>
62
63 {order.items?.map((item, index) => (
64 <View
65 key={item.id}
66 style={[
67 styles.itemRow,
68 index === order.items!.length - 1 && styles.lastItemRow,
69 { borderBottomColor: colors.icon + "30" },
70 ]}
71 >
72 <Image
73 source={{ uri: item.thumbnail || "https://placehold.co/60" }}
74 style={[styles.itemImage, { backgroundColor: colors.imagePlaceholder }]}
75 contentFit="cover"
76 />
77 <View style={styles.itemInfo}>
78 <Text style={[styles.itemTitle, { color: colors.text }]}>
79 {item.product_title || item.title}
80 </Text>
81 {item.variant_title && (
82 <Text style={[styles.itemVariant, { color: colors.icon }]}>
83 {item.variant_title}
84 </Text>
85 )}
86 <Text style={[styles.itemQuantity, { color: colors.icon }]}>
87 Qty: {item.quantity}
88 </Text>
89 </View>
90 <Text style={[styles.itemPrice, { color: colors.text }]}>
91 {formatPrice(item.subtotal, order.currency_code)}
92 </Text>
93 </View>
94 ))}
95 </View>
96
97 <View style={[styles.card, { backgroundColor: colors.background, borderColor: colors.icon + "30" }]}>
98 <Text style={[styles.cardTitle, { color: colors.text }]}>Shipping</Text>
99
100 {order.shipping_address && (
101 <>
102 <Text style={[styles.sectionTitle, { color: colors.text }]}>
103 Shipping Address
104 </Text>
105 <Text style={[styles.addressText, { color: colors.text }]}>
106 {order.shipping_address.first_name} {order.shipping_address.last_name}
107 </Text>
108 <Text style={[styles.addressText, { color: colors.text }]}>
109 {order.shipping_address.address_1}
110 </Text>
111 <Text style={[styles.addressText, { color: colors.text }]}>
112 {order.shipping_address.city}, {order.shipping_address.postal_code}
113 </Text>
114 <Text style={[styles.addressText, { color: colors.text }]}>
115 {order.shipping_address.country_code?.toUpperCase()}
116 </Text>
117 </>
118 )}
119
120 {order.shipping_methods && order.shipping_methods.length > 0 && (
121 <>
122 <Text style={[styles.sectionTitle, { color: colors.text }]}>
123 Shipping Method
124 </Text>
125 {order.shipping_methods.map((method) => (
126 <Text key={method.id} style={[styles.addressText, { color: colors.text }]}>
127 {method.name} - {formatPrice(method.amount || 0, order.currency_code)}
128 </Text>
129 ))}
130 </>
131 )}
132 </View>
133
134 <View style={[styles.card, { backgroundColor: colors.background, borderColor: colors.icon + "30" }]}>
135 <Text style={[styles.cardTitle, { color: colors.text }]}>Payment</Text>
136
137 {order.payment_collections && order.payment_collections.length > 0 && (
138 <>
139 <Text style={[styles.sectionTitle, { color: colors.text }]}>
140 Payment Method
141 </Text>
142 {order.payment_collections[0].payments?.map((payment) => {
143 const providerInfo = getPaymentProviderInfo(payment.provider_id)
144 return (
145 <View key={payment.id} style={styles.paymentMethodRow}>
146 <IconSymbol
147 size={20}
148 name={providerInfo.icon as any}
149 color={colors.text}
150 />
151 <Text style={[styles.addressText, { color: colors.text, marginLeft: 8 }]}>
152 {providerInfo.title}
153 </Text>
154 </View>
155 )
156 })}
157 </>
158 )}
159
160 {order.billing_address && (
161 <>
162 <Text style={[styles.sectionTitle, { color: colors.text }]}>
163 Billing Address
164 </Text>
165 <Text style={[styles.addressText, { color: colors.text }]}>
166 {order.billing_address.first_name} {order.billing_address.last_name}
167 </Text>
168 <Text style={[styles.addressText, { color: colors.text }]}>
169 {order.billing_address.address_1}
170 </Text>
171 <Text style={[styles.addressText, { color: colors.text }]}>
172 {order.billing_address.city}, {order.billing_address.postal_code}
173 </Text>
174 <Text style={[styles.addressText, { color: colors.text }]}>
175 {order.billing_address.country_code?.toUpperCase()}
176 </Text>
177 </>
178 )}
179 </View>
180
181 <View style={[styles.card, { backgroundColor: colors.background, borderColor: colors.icon + "30" }]}>
182 <Text style={[styles.cardTitle, { color: colors.text }]}>Order Summary</Text>
183
184 <View style={styles.summaryRow}>
185 <Text style={[styles.summaryLabel, { color: colors.text }]}>Subtotal</Text>
186 <Text style={[styles.summaryValue, { color: colors.text }]}>
187 {formatPrice(order.item_subtotal || 0, order.currency_code)}
188 </Text>
189 </View>
190
191 <View style={styles.summaryRow}>
192 <Text style={[styles.summaryLabel, { color: colors.text }]}>Discount</Text>
193 <Text style={[styles.summaryValue, { color: colors.text }]}>
194 {(order.discount_total || 0) > 0 ? "-" : ""}{formatPrice(order.discount_total || 0, order.currency_code)}
195 </Text>
196 </View>
197
198 <View style={styles.summaryRow}>
199 <Text style={[styles.summaryLabel, { color: colors.text }]}>Shipping</Text>
200 <Text style={[styles.summaryValue, { color: colors.text }]}>
201 {formatPrice(order.shipping_total || 0, order.currency_code)}
202 </Text>
203 </View>
204
205 <View style={styles.summaryRow}>
206 <Text style={[styles.summaryLabel, { color: colors.text }]}>Tax</Text>
207 <Text style={[styles.summaryValue, { color: colors.text }]}>
208 {formatPrice(order.tax_total || 0, order.currency_code)}
209 </Text>
210 </View>
211
212 <View style={[styles.summaryRow, styles.totalRow, { borderTopColor: colors.border }]}>
213 <Text style={[styles.totalLabel, { color: colors.text }]}>Total</Text>
214 <Text style={[styles.totalValue, { color: colors.tint }]}>
215 {formatPrice(order.total, order.currency_code)}
216 </Text>
217 </View>
218 </View>
219 </View>
220 </ScrollView>
221)