1 line
7.4 KiB
Plaintext
1 line
7.4 KiB
Plaintext
{"version":3,"sources":["pages/mall/consumer/payment-success.uvue","pages/user/login.uvue","pages/main/index.uvue"],"sourcesContent":["<template>\r\n <view class=\"payment-success-page\">\r\n <view class=\"success-content\">\r\n <view class=\"icon-wrapper\">\r\n <text class=\"success-icon\">✓</text>\r\n </view>\r\n <text class=\"success-title\">支付成功</text>\r\n <text class=\"success-desc\">您的订单已支付成功,我们将尽快为您发货</text>\r\n \r\n <view class=\"order-info\" v-if=\"orderId\">\r\n <text class=\"info-text\">订单编号:{{ orderNo }}</text>\r\n <text class=\"info-text\">支付金额:¥{{ amount.toFixed(2) }}</text>\r\n </view>\r\n \r\n <view class=\"action-buttons\">\r\n <button class=\"btn primary-btn\" @click=\"viewOrder\">查看订单</button>\r\n <button class=\"btn secondary-btn\" @click=\"goHome\">返回首页</button>\r\n </view>\r\n </view>\r\n </view>\r\n</template>\r\n\r\n<script setup lang=\"uts\">\r\nimport { ref, onMounted } from 'vue'\r\nimport { supabaseService } from '@/utils/supabaseService.uts'\r\n\r\nconst orderId = ref('')\r\nconst orderNo = ref('')\r\nconst amount = ref(0)\r\n\r\n// 定义 loadOrderInfo 函数(必须在 onMounted 之前)\r\nconst loadOrderInfo = async () => {\r\n try {\r\n const response = await supabaseService.getOrderById(orderId.value)\r\n console.log('[payment-success] getOrderById response:', JSON.stringify(response))\r\n \r\n if (response != null) {\r\n const orderData = response as UTSJSONObject\r\n const totalAmount = orderData.getNumber('total_amount')\r\n const paidAmount = orderData.getNumber('paid_amount')\r\n console.log('[payment-success] total_amount:', totalAmount, 'paid_amount:', paidAmount)\r\n \r\n if (paidAmount != null && paidAmount > 0) {\r\n amount.value = paidAmount\r\n } else if (totalAmount != null && totalAmount > 0) {\r\n amount.value = totalAmount\r\n }\r\n \r\n const orderNoVal = orderData.getString('order_no')\r\n if (orderNoVal != null && orderNoVal != '') {\r\n orderNo.value = orderNoVal\r\n }\r\n }\r\n } catch (err) {\r\n console.error('[payment-success] 加载订单信息失败:', err)\r\n }\r\n}\r\n\r\nonLoad((options) => {\r\n if (options == null) return\r\n \r\n const orderIdValue = options['orderId']\r\n if (orderIdValue != null) {\r\n orderId.value = orderIdValue as string\r\n orderNo.value = orderIdValue as string\r\n \r\n const amountValue = options['amount']\r\n if (amountValue != null) {\r\n const amountStr = amountValue.toString()\r\n console.log('[payment-success] amountStr:', amountStr)\r\n const parsed = parseFloat(amountStr)\r\n console.log('[payment-success] parsed:', parsed)\r\n if (isNaN(parsed) == false) {\r\n amount.value = parsed\r\n }\r\n }\r\n \r\n if (amount.value == 0) {\r\n console.log('[payment-success] amount为0,尝试从数据库查询')\r\n }\r\n \r\n loadOrderInfo()\r\n }\r\n})\r\n\r\nonMounted(() => {\r\n // 逻辑已移到 onLoad\r\n})\r\n\r\nconst viewOrder = () => {\r\n uni.navigateTo({\r\n url: '/pages/mall/consumer/orders'\r\n })\r\n}\r\n\r\nconst goHome = () => {\r\n uni.switchTab({\r\n url: '/pages/main/index'\r\n })\r\n}\r\n</script>\r\n\r\n<style scoped>\r\n.payment-success-page {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n /* height: 100vh; */\r\n flex: 1;\r\n background-color: #ffffff;\r\n padding: 0 30px;\r\n}\r\n\r\n.success-content {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n width: 100%;\r\n}\r\n\r\n.icon-wrapper {\r\n width: 80px;\r\n height: 80px;\r\n border-radius: 40px;\r\n background-color: #4cd964;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n margin-bottom: 20px;\r\n box-shadow: 0 4px 10px rgba(76, 217, 100, 0.3);\r\n}\r\n\r\n.success-icon {\r\n font-size: 40px;\r\n color: #ffffff;\r\n font-weight: bold;\r\n}\r\n\r\n.success-title {\r\n font-size: 24px;\r\n font-weight: bold;\r\n color: #333333;\r\n margin-bottom: 10px;\r\n}\r\n\r\n.success-desc {\r\n font-size: 14px;\r\n color: #999999;\r\n text-align: center;\r\n margin-bottom: 30px;\r\n line-height: 1.5;\r\n}\r\n\r\n.order-info {\r\n background-color: #f9f9f9;\r\n padding: 15px 20px;\r\n border-radius: 8px;\r\n width: 100%;\r\n margin-bottom: 30px;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n}\r\n\r\n.info-text {\r\n font-size: 14px;\r\n color: #666666;\r\n margin-bottom: 5px;\r\n}\r\n\r\n.action-buttons {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n /* gap: 15px; */\r\n}\r\n\r\n.btn {\r\n width: 100%;\r\n height: 45px;\r\n line-height: 45px;\r\n text-align: center;\r\n border-radius: 22.5px;\r\n font-size: 16px;\r\n font-weight: bold;\r\n margin-bottom: 15px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n\r\n.primary-btn {\r\n background-color: #007aff;\r\n color: #ffffff;\r\n border: none;\r\n}\r\n\r\n.secondary-btn {\r\n background-color: #ffffff;\r\n color: #666666;\r\n border: 1px solid #cccccc;\r\n}\r\n</style>\r\n\r\n",null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;YA0BA,IAAM,UAAU,IAAI;YACpB,IAAM,UAAU,IAAI;YACpB,IAAM,SAAS,IAAI,CAAC;YAGpB,IAAM,gBAAgB,OAAK,WAAA,IAAA,EAAM;gBAAA,OAAA,eAAA;wBAC/B,IAAI;4BACF,IAAM,WAAW,MAAM,gBAAgB,YAAY,CAAC,QAAQ,KAAK;4BACjE,QAAQ,GAAG,CAAC,4CAA4C,KAAK,SAAS,CAAC,WAAQ;4BAE/E,IAAI,SAAQ,EAAA,CAAI,IAAI,EAAE;gCAClB,IAAM,YAAY,SAAQ,EAAA,CAAI;gCAC9B,IAAM,cAAc,UAAU,SAAS,CAAC;gCACxC,IAAM,aAAa,UAAU,SAAS,CAAC;gCACvC,QAAQ,GAAG,CAAC,mCAAmC,aAAa,gBAAgB,YAAS;gCAErF,IAAI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