|
|
|
@ -1,24 +1,23 @@
|
|
|
|
|
import { App, Radio, Row, Col, Tooltip, Flex, Form, Input, Button, InputNumber, Select, message } from 'antd'
|
|
|
|
|
import { Radio, Row, Col, Tooltip, Flex, Form, Input, Button, InputNumber, Select, message } from 'antd'
|
|
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
|
import HtmlPreview from './HtmlPreview'
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore'
|
|
|
|
|
import { useOrderStore } from '@/stores/OrderStore'
|
|
|
|
|
import { HomeOutlined, LoadingOutlined, InfoCircleOutlined, QuestionOutlined, QuestionCircleOutlined } from '@ant-design/icons'
|
|
|
|
|
import { InfoCircleOutlined } from '@ant-design/icons'
|
|
|
|
|
|
|
|
|
|
function GeneratePayment() {
|
|
|
|
|
const [messageApi, contextHolder] = message.useMessage()
|
|
|
|
|
|
|
|
|
|
const [generateForm] = Form.useForm()
|
|
|
|
|
|
|
|
|
|
const [getPrimaryEmail] = useAuthStore((s) => [s.getPrimaryEmail])
|
|
|
|
|
const [generatePayment] = useOrderStore((s) => [s.generatePayment])
|
|
|
|
|
const [getPrimaryEmail, loginUser] = useAuthStore(s => [s.getPrimaryEmail, s.loginUser])
|
|
|
|
|
const [generatePayment] = useOrderStore(s => [s.generatePayment])
|
|
|
|
|
|
|
|
|
|
const [isHtmlLoading, setHtmlLoading] = useState(false)
|
|
|
|
|
const [generatedObject, setGeneratedObject] = useState('')
|
|
|
|
|
|
|
|
|
|
const handleGenerate = () => {
|
|
|
|
|
setHtmlLoading(true)
|
|
|
|
|
console.info(generateForm.getFieldsValue())
|
|
|
|
|
generatePayment(generateForm.getFieldsValue())
|
|
|
|
|
.then((result) => {
|
|
|
|
|
setGeneratedObject(result)
|
|
|
|
@ -27,11 +26,6 @@ function GeneratePayment() {
|
|
|
|
|
.finally(() => setHtmlLoading(false))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const primaryEmail = getPrimaryEmail()
|
|
|
|
|
console.info('primaryEmail: %o', primaryEmail)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
@ -49,8 +43,10 @@ function GeneratePayment() {
|
|
|
|
|
langauge: 'US',
|
|
|
|
|
orderType: '227001',
|
|
|
|
|
currency: 'USD',
|
|
|
|
|
amount: 1
|
|
|
|
|
amount: 1,
|
|
|
|
|
userId: loginUser.userId
|
|
|
|
|
}}>
|
|
|
|
|
<Form.Item name='userId' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item label='订单类型' name='orderType'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
@ -154,11 +150,6 @@ function GeneratePayment() {
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</Flex>
|
|
|
|
|
<HtmlPreview value={generatedObject.payhtml} loading={isHtmlLoading} onCopied={() => messageApi.success('已复制')} />
|
|
|
|
|
{/* <pre >
|
|
|
|
|
<a href="https://www.chinahighlights.com/slink/d02824bb8bdabb5apay" target="_blank" rel="noreferrer">
|
|
|
|
|
<img src="https://data.chinahighlights.com/pic/pay-button.png" alt="Pay now" draggable="false" />
|
|
|
|
|
</a>
|
|
|
|
|
</pre> */}
|
|
|
|
|
<Flex gap='small'>
|
|
|
|
|
<span>支付链接</span>
|
|
|
|
|
<Tooltip placement='topLeft' title='发送 WhatsApp 使用'>
|
|
|
|
|