Commit 626aea3c authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:价格策略设置阶梯价格添加最小起订校验,采购下单输入采购数量添加最起订数校验

parent 601f76d0
......@@ -1152,7 +1152,8 @@ export const SaleOrderTransformInsideWorkStateTexts = {
13: '不接受订单',
14: '确认未到账',
15: '审核不通过',
16: '不接受物流单'
16: '不接受物流单',
17: '审核不通过',
}
export const PayOutWorkStateTexts = {
......
......@@ -50,7 +50,7 @@ export const constructTableData = (data: any, ctx: ISchemaFormActions | ISchemaF
let col: any = [...columnsUnitProduct]
let temp: any = []
console.log(data, 'dataSoruce')
// 兼容编辑价格策略 新增使用data 编辑使用data[0].commodityUnitPrice
let _data_column = pageStatus === PageStatus.ADD ? data[0] : data[0]["commodityUnitPrice"]
_data_column.attributeAndValueList.map(_item => {
......
......@@ -130,6 +130,7 @@ const PriceModal:React.FC<PriceModalProps> = (props) => {
)
let result = range.map(Number).reduce((a, b) => { if(a<b) return b })
if(!result) throw new Error('请正确输入阶梯数量范围');
if(Number(range[0]) !== schemaAction.getFieldValue("minOrder")) throw new Error('阶段的起始值必须为最小起订数');
callback()
}
} catch (err) {
......
......@@ -91,6 +91,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
}
const handleSetProductPrice = (record: any) => {
console.log(record, 'record')
if(record?.id) {
priceRef.current.setVisible(true)
priceRef.current.setCurrentSetPriceRow(record)
......
......@@ -66,6 +66,7 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
schemaAction.setFieldValue('productName', selectResult.name)
schemaAction.setFieldValue('productId', selectResult.id)
schemaAction.setFieldValue('minOrder', selectResult.minOrder)
clearModalParams()
}
......
......@@ -234,6 +234,10 @@ export const setPriceSchema: ISchema = {
type: 'string',
display: false
},
minOrder: {
type: 'number',
display: false
},
priceType: {
type: 'radio',
title: '商品定价',
......
......@@ -83,6 +83,19 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
}
}
// 校验最小起订
const validatorNumber = (rule, value, callback) => {
try {
let _value = Number(value)
if(isNaN(_value) || _value < Number(record["minOrder"])) {
throw new Error(`数量不小于最小起订数${record["minOrder"]}`)
}
callback()
} catch (err) {
callback(err)
}
}
let childNode = children;
if (editable) {
childNode =
......@@ -99,6 +112,9 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
pattern: /^\d+(\.\d{1,3})?$/,
message: '采购数量仅限三位小数',
},
{
validator: validatorNumber
}
]}
>
{chooseFormItem(formItem, record[dataIndex] || '')}
......
......@@ -355,9 +355,9 @@ export const mergeParentTableColumns: any[] = [
},
{
title: '采购商名称',
dataIndex: 'supplyMembersName',
dataIndex: 'membersName',
align: 'center',
key: 'supplyMembersName',
key: 'membersName',
},
{
title: '下单时间',
......
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