Commit 8f251c0d authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:快捷修改价格

parent c66800e3
......@@ -46,25 +46,15 @@ const FastModifyPrice: React.FC<{}> = () => {
const [setForm] = Form.useForm()
const [modifyModal, setModifyModal] = useState(false)
const [ladderPrice, setLadderPrice] = useState(false)
const [currentRow, setCurrentRow] = useState<any>()
let [isHighSearch, setIsHighSearch] = useState(false)
const layout = {
labelCol: { span: 24 },
wrapperCol: { span: 24 },
};
}
// const [filterParams, setFilterParams] = useState<paramItem>({
// name: '',
// code: '',
// priceType: null,
// min: null,
// max: null,
// brandId: 0,
// customerCategoryId: 0,
// status: null,
// })
const [filterParams, setFilterParams] = useState<any>({})
const [brandData, setBrandData] = useState<any>([])
const [brandValue, setBrandValue] = useState(undefined)
......@@ -191,6 +181,7 @@ const FastModifyPrice: React.FC<{}> = () => {
const handleModify = (record: any) => {
console.log('点击修改价格', record)
setCurrentRow(record)
const { id, unitPrice, priceType } = record
// 阶梯价格回显处理
setModifyModal(true)
......@@ -259,7 +250,23 @@ const FastModifyPrice: React.FC<{}> = () => {
const handleOk = () => {
setForm.validateFields().then(v=>{
console.log(v, 'v')
const { ladderPrice, ladderRange } = v
let _priceRange = {}
if(ladderPrice){ // 判断阶梯价格
ladderRange.length>0 && ladderRange.map(_item => {
_priceRange[`${_item.numberRange.numberMin}-${_item.numberRange.numberMax}`] = _item.numberPrice
})
}else{
_priceRange['0-0'] = v.uniquePrice
}
console.log(_priceRange)
PublicApi.postProductCommodityUpdateCommodityPrice({ commodityId: currentRow.id, unitPriceAndPicId: currentRow.commodityId, unitPrice: _priceRange }).then(res => {
if(res.code === 100){
ref.current.reload()
setModifyModal(false)
}
})
})
}
......@@ -294,7 +301,7 @@ const FastModifyPrice: React.FC<{}> = () => {
},
[]
)
let result = range.reduce((a, b) => { console.log(a, b); if(a<b) return b })
let result = range.reduce((a, b) => { if(a<b) return b })
// console.log(result, 'result')
if(!result) throw new Error('请正确输入阶梯数量范围');
callback()
......
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