fix(pay): 优化订阅号获取逻辑并调整支付组件样式

- 优先从小程序码 scene 参数读取 subscriptionNo,提升参数兼容性
- 对 scene 参数进行解码,避免编码引起的问题
- 移除支付组件价格显示处的固定颜色设置,增强样式灵活性
This commit is contained in:
2026-06-30 17:03:10 +08:00
parent 5f71295aae
commit 93c66e1f14
2 changed files with 33 additions and 2 deletions

View File

@@ -39,10 +39,13 @@ const PayPage: React.FC = () => {
const [paid, setPaid] = useState(false)
// 从页面参数中获取 subscriptionNo
// 小程序码 scene 会作为 query.scene 传入,需解码
const getSubscriptionNo = useCallback(() => {
const instance = Taro.getCurrentInstance()
const params = instance?.router?.params || {}
return params.subscriptionNo || ''
// 优先读取 scene小程序码参数再读取 subscriptionNo(普通链接参数)
const scene = params.scene ? decodeURIComponent(params.scene) : ''
return scene || params.subscriptionNo || ''
}, [])
// 获取订阅详情
@@ -234,7 +237,6 @@ const PayPage: React.FC = () => {
price={detail?.payPrice}
size="large"
thousands
color="#e53e3e"
/>
</View>