fix(worker): 用户付款金额仅待完善可修改并补后端校验
This commit is contained in:
@@ -6,7 +6,11 @@ import { updateAdminWorkOrder, updateAdminWorkOrderPaymentAmount } from '@/servi
|
||||
import type { WorkOrder } from '@/types/worker-platform'
|
||||
|
||||
import { formatMoney } from './shared'
|
||||
import { getRewardAbovePayment, getUserPaymentFen } from './work-order-panel-utils'
|
||||
import {
|
||||
canEditUserPaymentAmount,
|
||||
getRewardAbovePayment,
|
||||
getUserPaymentFen,
|
||||
} from './work-order-panel-utils'
|
||||
|
||||
/** 商品名:单击看详情,双击原地修改(仅未接走工单) */
|
||||
export function ProductNameEditableCell({
|
||||
@@ -101,7 +105,7 @@ export function UserPaymentAmountEditableCell({
|
||||
onSaved: () => Promise<void> | void
|
||||
}) {
|
||||
const { message } = App.useApp()
|
||||
const editable = order.capabilities?.canEdit === true
|
||||
const editable = canEditUserPaymentAmount(order)
|
||||
const currentFen = getUserPaymentFen(order)
|
||||
const [open, setOpen] = useState(false)
|
||||
const [draft, setDraft] = useState<number | null>(null)
|
||||
|
||||
@@ -3,7 +3,11 @@ import { Space, Tag, Typography } from 'antd'
|
||||
import type { CollectField, WorkOrder } from '@/types/worker-platform'
|
||||
import { resolveConsignmentWorkerDisplay } from '@/utils/consignment-display'
|
||||
|
||||
export { getRewardAbovePayment, getUserPaymentFen } from './work-order-payment'
|
||||
export {
|
||||
canEditUserPaymentAmount,
|
||||
getRewardAbovePayment,
|
||||
getUserPaymentFen,
|
||||
} from './work-order-payment'
|
||||
|
||||
const SKIP_PUBLISH_CONFIRM_KEY = 'admin-work-order-skip-publish-confirm'
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ export function getUserPaymentFen(order: PaymentSourceOrder): number | null {
|
||||
return fromColumn !== null && fromColumn > 0 ? fromColumn : null
|
||||
}
|
||||
|
||||
/** 用户付款金额仅在「待完善」阶段可编辑,与后端校验同口径。 */
|
||||
export function canEditUserPaymentAmount(order: { status?: string; rawStatus?: string }): boolean {
|
||||
return String(order.rawStatus || order.status || '').trim() === 'pending_material'
|
||||
}
|
||||
|
||||
/** 发单金额高于用户付款时返回两边金额,否则 null(付款未知时不提示) */
|
||||
export function getRewardAbovePayment(order: PaymentSourceOrder, rewardFen?: number) {
|
||||
const paymentFen = getUserPaymentFen(order)
|
||||
|
||||
Reference in New Issue
Block a user