|
|
|
@ -2,6 +2,7 @@ import { Radio, Row, Col, Tooltip, Flex, Form, Input, Button, InputNumber, Selec
|
|
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
|
import HtmlPreview from './HtmlPreview'
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore'
|
|
|
|
|
import useConversationStore from '@/stores/ConversationStore'
|
|
|
|
|
import { useOrderStore } from '@/stores/OrderStore'
|
|
|
|
|
import { InfoCircleOutlined } from '@ant-design/icons'
|
|
|
|
|
|
|
|
|
@ -10,8 +11,9 @@ function GeneratePayment() {
|
|
|
|
|
|
|
|
|
|
const [generateForm] = Form.useForm()
|
|
|
|
|
|
|
|
|
|
const [getPrimaryEmail, loginUser] = useAuthStore(s => [s.getPrimaryEmail, s.loginUser])
|
|
|
|
|
const [generatePayment] = useOrderStore(s => [s.generatePayment])
|
|
|
|
|
const [getPrimaryEmail, loginUser] = useAuthStore((s) => [s.getPrimaryEmail, s.loginUser])
|
|
|
|
|
const [generatePayment, fetchOrderDetail] = useOrderStore((s) => [s.generatePayment, s.fetchOrderDetail])
|
|
|
|
|
const currentOrder = useConversationStore((state) => state.currentConversation?.coli_sn || '')
|
|
|
|
|
|
|
|
|
|
const [isHtmlLoading, setHtmlLoading] = useState(false)
|
|
|
|
|
const [generatedObject, setGeneratedObject] = useState('')
|
|
|
|
@ -26,6 +28,35 @@ function GeneratePayment() {
|
|
|
|
|
.finally(() => setHtmlLoading(false))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (currentOrder) {
|
|
|
|
|
fetchOrderDetail(currentOrder)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
const orderNumber = result.orderDetail.order_no
|
|
|
|
|
const travelAdvisor = loginUser.accountList.length > 0 ? loginUser.accountList[0].OPI_NameEN : ''
|
|
|
|
|
generateForm.setFieldsValue({
|
|
|
|
|
notifyEmail: getPrimaryEmail(),
|
|
|
|
|
orderNumber: orderNumber,
|
|
|
|
|
description: 'Tracking Code: ' + orderNumber + '\r\nTravel Advisor: ' + travelAdvisor + '\r\nContent: \r\n',
|
|
|
|
|
langauge: 'US',
|
|
|
|
|
orderType: '227001',
|
|
|
|
|
currency: 'USD',
|
|
|
|
|
amount: 1,
|
|
|
|
|
userId: loginUser.userId,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// .finally(() => setLoading(false))
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
// notification.error({
|
|
|
|
|
// message: "查询出错",
|
|
|
|
|
// description: reason.message,
|
|
|
|
|
// placement: "top",
|
|
|
|
|
// duration: 60,
|
|
|
|
|
// });
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}, [currentOrder])
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
@ -35,39 +66,33 @@ function GeneratePayment() {
|
|
|
|
|
span: 4,
|
|
|
|
|
}}
|
|
|
|
|
layout={'horizontal'}
|
|
|
|
|
form={generateForm}
|
|
|
|
|
initialValues={{
|
|
|
|
|
notifyEmail: getPrimaryEmail(),
|
|
|
|
|
description: 'Tracking Code:\r\nTravel Advisor: \r\nContent:\r\n',
|
|
|
|
|
orderNumber: 'lyj202411141004001',
|
|
|
|
|
langauge: 'US',
|
|
|
|
|
orderType: '227001',
|
|
|
|
|
currency: 'USD',
|
|
|
|
|
amount: 1,
|
|
|
|
|
userId: loginUser.userId
|
|
|
|
|
}}>
|
|
|
|
|
<Form.Item name='userId' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item label='订单类型' name='orderType'
|
|
|
|
|
form={generateForm}>
|
|
|
|
|
<Form.Item name='userId' className='hidden'>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label='订单类型'
|
|
|
|
|
name='orderType'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '订单类型必选',
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
]}>
|
|
|
|
|
<Radio.Group>
|
|
|
|
|
<Radio.Button value='227001'>线路订单</Radio.Button>
|
|
|
|
|
<Radio.Button value='227002'>商务订单</Radio.Button>
|
|
|
|
|
</Radio.Group>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label='语种' name='langauge'
|
|
|
|
|
<Form.Item
|
|
|
|
|
label='语种'
|
|
|
|
|
name='langauge'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '语种必选',
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
]}>
|
|
|
|
|
<Select
|
|
|
|
|
options={[
|
|
|
|
|
{ value: 'US', label: '英语' },
|
|
|
|
@ -80,24 +105,26 @@ function GeneratePayment() {
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label='订单号' name='orderNumber'
|
|
|
|
|
<Form.Item
|
|
|
|
|
label='订单号'
|
|
|
|
|
name='orderNumber'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '订单号必填',
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
]}>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label='金额' name='amount'
|
|
|
|
|
<Form.Item
|
|
|
|
|
label='金额'
|
|
|
|
|
name='amount'
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '金额填',
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
]}>
|
|
|
|
|
<InputNumber
|
|
|
|
|
addonBefore={
|
|
|
|
|
<Form.Item name='currency' noStyle>
|
|
|
|
@ -106,16 +133,14 @@ function GeneratePayment() {
|
|
|
|
|
width: 90,
|
|
|
|
|
}}
|
|
|
|
|
options={[
|
|
|
|
|
{value: 'USD', label: '美元'},
|
|
|
|
|
{value: 'CNY', label: '人民币'},
|
|
|
|
|
{value: 'EUR', label: '欧元'},
|
|
|
|
|
{value: 'JPY', label: '日元'},
|
|
|
|
|
{value: 'AUD', label: '澳元'},
|
|
|
|
|
{value: 'CAD', label: '加元'},
|
|
|
|
|
{value: 'HKD', label: '港币'},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
</Select>
|
|
|
|
|
{ value: 'USD', label: '美元' },
|
|
|
|
|
{ value: 'CNY', label: '人民币' },
|
|
|
|
|
{ value: 'EUR', label: '欧元' },
|
|
|
|
|
{ value: 'JPY', label: '日元' },
|
|
|
|
|
{ value: 'AUD', label: '澳元' },
|
|
|
|
|
{ value: 'CAD', label: '加元' },
|
|
|
|
|
{ value: 'HKD', label: '港币' },
|
|
|
|
|
]}></Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
}
|
|
|
|
|
min={1}
|
|
|
|
|