Commit 80d3df0c authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理intl影响阶梯价格校验问题

parent c839e734
......@@ -4,7 +4,6 @@ import { ISchema } from '@formily/antd';
import { Badge } from 'antd';
import { ColumnType } from 'antd/lib/table';
import moment from 'moment';
import React, { ReactNode } from 'react'
/** 商品 渠道商品 快捷修改单价 共用常量 */
......@@ -152,7 +151,6 @@ export const orderlyLadderPrice = (data) => {
/** 校验阶梯价格函数 min参数判断是否校验最小起订 */
export const validatorNumberRange = (rule: any, value: any, callback: any, min?: any) => {
const intl = useIntl();
try {
if (Array.isArray(value)) {
let range = value.map(item => {
......@@ -165,8 +163,9 @@ export const validatorNumberRange = (rule: any, value: any, callback: any, min?:
[]
)
let result = range.map(Number).reduce((a, b) => { if (a < b) return b })
if (!result) throw new Error(intl.formatMessage({ id: 'commodity.products.constant.validatorNumberRange.error.1' }));
if (min && (Number(range[0]) !== Number(min))) throw new Error(intl.formatMessage({ id: 'commodity.products.constant.validatorNumberRange.error.2' }));
console.log(result, 'result', range)
if (!result) throw new Error(getIntl().formatMessage({ id: 'commodity.products.constant.validatorNumberRange.error.1' }));
if (min && (Number(range[0]) !== Number(min))) throw new Error(getIntl().formatMessage({ id: 'commodity.products.constant.validatorNumberRange.error.2' }));
callback()
}
} catch (err) {
......
......@@ -103,7 +103,7 @@ export const procurementProcessField = (value) => {
weight: item.logistics.weight,
stock: item.stockCount,
discount: item.isMemberPrice ? item.memberPrice : 1, // 字段需求 无折扣为1
price: item.isMemberPrice ? Number((item.money / item.purchaseCount / item.memberPrice).toFixed(2)) : Number((item.money / item.purchaseCoun).toFixed(2)),
price: item.isMemberPrice ? Number((item.money / item.purchaseCount / item.memberPrice).toFixed(2)) : Number((item.money / item.purchaseCount).toFixed(2)),
tax: item.taxRate > 0,
vendorMemberId: item.memberId,
vendorRoleId: item.memberRoleId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment