优化本地Mock接单
This commit is contained in:
@@ -68,6 +68,7 @@ import {
|
||||
updateAdminWorkOrder,
|
||||
updateAdminWorkOrderSharing,
|
||||
} from '@/services/admin'
|
||||
import { fetchAdminKuaishouIndustryShops } from '@/services/admin/kuaishou-industry'
|
||||
import type {
|
||||
CollectField,
|
||||
UploadedFile,
|
||||
@@ -78,6 +79,7 @@ import type {
|
||||
import { ADMIN_DEFAULT_PAGE_SIZE, buildAdminTablePagination } from '@/utils/admin-pagination'
|
||||
import { hasAdminRole } from '@/utils/admin-auth'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
import { buildMockWorkOrderShopOptions } from '@/utils/mock-work-order'
|
||||
import {
|
||||
DeadlineCountdown,
|
||||
formatTimeoutPolicyLabel,
|
||||
@@ -2293,12 +2295,18 @@ function formatRequirementFieldsText(fields: CollectField[]): string {
|
||||
function MockWorkOrderForm({ onCreated }: { onCreated: () => Promise<void> }) {
|
||||
const { message } = App.useApp()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const shopsQuery = useQuery({
|
||||
queryKey: ['admin-kuaishou-industry-shops', 'mock-work-order'],
|
||||
queryFn: fetchAdminKuaishouIndustryShops,
|
||||
})
|
||||
const shopOptions = buildMockWorkOrderShopOptions(shopsQuery.data?.data.shops || [])
|
||||
|
||||
async function submit(values: {
|
||||
platformOrderId?: string
|
||||
productName?: string
|
||||
rewardAmount?: number
|
||||
paymentAmount?: number
|
||||
platformOrderId: string
|
||||
sellerId: string
|
||||
productName: string
|
||||
rewardAmount: number
|
||||
paymentAmount: number
|
||||
materialComplete?: boolean
|
||||
}) {
|
||||
setLoading(true)
|
||||
@@ -2314,32 +2322,58 @@ function MockWorkOrderForm({ onCreated }: { onCreated: () => Promise<void> }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<Form
|
||||
className="worker-order-mock-form"
|
||||
layout="inline"
|
||||
initialValues={{
|
||||
productName: '指挥官秘钥1个',
|
||||
rewardAmount: 25,
|
||||
materialComplete: false,
|
||||
}}
|
||||
onFinish={submit}
|
||||
>
|
||||
<Form.Item className="worker-order-mock-field-order" label="订单号" name="platformOrderId">
|
||||
<Input placeholder="留空自动生成" />
|
||||
<Form className="worker-order-mock-form" layout="inline" onFinish={submit}>
|
||||
<Form.Item
|
||||
className="worker-order-mock-field-order"
|
||||
label="订单号"
|
||||
name="platformOrderId"
|
||||
rules={[{ required: true, whitespace: true, message: '请填写订单号' }]}
|
||||
>
|
||||
<Input placeholder="请输入订单号" />
|
||||
</Form.Item>
|
||||
<Form.Item className="worker-order-mock-field-product" label="商品" name="productName">
|
||||
<Input />
|
||||
<Form.Item
|
||||
className="worker-order-mock-field-shop"
|
||||
label="店铺"
|
||||
name="sellerId"
|
||||
rules={[{ required: true, message: '请选择店铺' }]}
|
||||
>
|
||||
<Select
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
loading={shopsQuery.isLoading}
|
||||
options={shopOptions}
|
||||
placeholder={shopOptions.length > 0 ? '请选择店铺' : '暂无可用店铺'}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item className="worker-order-mock-field-amount" label="接单金额" name="rewardAmount">
|
||||
<Form.Item
|
||||
className="worker-order-mock-field-product"
|
||||
label="商品"
|
||||
name="productName"
|
||||
rules={[{ required: true, whitespace: true, message: '请填写商品名称' }]}
|
||||
>
|
||||
<Input placeholder="请输入商品名称" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
className="worker-order-mock-field-amount"
|
||||
label="接单金额"
|
||||
name="rewardAmount"
|
||||
rules={[
|
||||
{ required: true, message: '请填写接单金额' },
|
||||
{ type: 'number', min: 0.01, message: '接单金额必须大于 0' },
|
||||
]}
|
||||
>
|
||||
<InputNumber min={0.01} step={1} addonAfter="元" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
className="worker-order-mock-field-amount"
|
||||
label="用户付款金额"
|
||||
name="paymentAmount"
|
||||
tooltip="留空默认等于接单金额;填得比接单金额低,可测试超价提示"
|
||||
rules={[
|
||||
{ required: true, message: '请填写用户付款金额' },
|
||||
{ type: 'number', min: 0.01, message: '用户付款金额必须大于 0' },
|
||||
]}
|
||||
>
|
||||
<InputNumber min={0} step={1} addonAfter="元" placeholder="默认同接单金额" />
|
||||
<InputNumber min={0.01} step={1} addonAfter="元" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
className="worker-order-mock-field-complete"
|
||||
|
||||
Reference in New Issue
Block a user