Commit 94402b84 authored by GuanHua's avatar GuanHua

fix:1.修复进货单会员折扣价显示问题;2,商品详情交易评价图片显示问题

parent 0d99cc6c
...@@ -4,6 +4,7 @@ import proxy from './proxy' ...@@ -4,6 +4,7 @@ import proxy from './proxy'
import theme from './lingxi.theme.config' import theme from './lingxi.theme.config'
const OPEN_THEME_BUILD = process.env.NODE_ENV === 'production' ? true : false // 是否开启动态主题 const OPEN_THEME_BUILD = process.env.NODE_ENV === 'production' ? true : false // 是否开启动态主题
const isProduction = process.env.NODE_ENV === 'production' ? true : false
const config: any = { const config: any = {
// 如需写入环境变量 需在config中先写入 // 如需写入环境变量 需在config中先写入
...@@ -49,9 +50,9 @@ const config: any = { ...@@ -49,9 +50,9 @@ const config: any = {
defaultSizes: 'parsed', // stat // gzip defaultSizes: 'parsed', // stat // gzip
}, },
inlineLimit: 10000, inlineLimit: 10000,
chunks: ['vendors', 'umi'], chunks: isProduction && ['vendors', 'umi'],
chainWebpack: function (config, { webpack }) { chainWebpack: function (config, { webpack }) {
config.merge({ isProduction && config.merge({
optimization: { optimization: {
minimize: true, minimize: true,
splitChunks: { splitChunks: {
......
...@@ -21,13 +21,13 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => { ...@@ -21,13 +21,13 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
if (min || min === 0) { if (min || min === 0) {
setMinCount(min) setMinCount(min)
if (value < min) { if (value < min) {
onChange(min) onChange(min, 'blur')
} }
} }
if (max || max === 0) { if (max || max === 0) {
setMaxCount(max) setMaxCount(max)
if (value > max) { if (value > max) {
onChange(max) onChange(max, 'blur')
} }
} }
}, [min, max]) }, [min, max])
...@@ -35,14 +35,14 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => { ...@@ -35,14 +35,14 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const handleReduce = (e) => { const handleReduce = (e) => {
e.stopPropagation() e.stopPropagation()
if (value > minCount) { if (value > minCount) {
onChange(Number(value) - 1) onChange(Number(value) - 1, 'click')
} }
} }
const handleAdd = (e) => { const handleAdd = (e) => {
e.stopPropagation() e.stopPropagation()
if (value < maxCount) { if (value < maxCount) {
onChange(Number(value) + 1) onChange(Number(value) + 1, 'click')
} }
} }
...@@ -50,17 +50,22 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => { ...@@ -50,17 +50,22 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const { value } = e.target; const { value } = e.target;
const reg = /^\d*?$/; const reg = /^\d*?$/;
if (reg.test(value)) { if (reg.test(value)) {
onChange(value) onChange(value, 'change')
} }
} }
const handleBlur = (e) => { const handleBlur = (e) => {
const { value } = e.target; const { value } = e.target;
if (value === "") { if (value === "") {
onChange(minCount) onChange(minCount, 'blur')
} else { } else {
Number(value) < minCount && onChange(minCount) if(Number(value) < minCount) {
Number(value) > maxCount && onChange(maxCount) onChange(minCount, 'blur')
} else if(Number(value) > maxCount) {
onChange(maxCount, 'blur')
} else {
onChange(value, 'blur')
}
} }
} }
......
...@@ -195,7 +195,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref) ...@@ -195,7 +195,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
setConfirmLoading(true) setConfirmLoading(true)
let newParam: any = JSON.parse(JSON.stringify(newProps)) let newParam: any = JSON.parse(JSON.stringify(newProps))
newParam.advertList = newParam.advertList.map((item) => { newParam.advertList = newParam.advertList.map((item) => {
if (!item.link.startsWith('http://') && !item.link.startsWith('https://')) { if (!item.link && !item.link.startsWith('http://') && !item.link.startsWith('https://')) {
item.link = `http://${item.link}` item.link = `http://${item.link}`
} }
return item return item
......
...@@ -42,7 +42,7 @@ const Comment: React.FC<CommentPropsType> = (props) => { ...@@ -42,7 +42,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
}, [current]) }, [current])
const fetchCommentList = (type = '') => { const fetchCommentList = (type = '') => {
let param: any = { const param: any = {
current, current,
pageSize, pageSize,
productIds: productIds.toString() // '2339' productIds: productIds.toString() // '2339'
...@@ -55,7 +55,7 @@ const Comment: React.FC<CommentPropsType> = (props) => { ...@@ -55,7 +55,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
param.starLevel = 1 param.starLevel = 1
} }
setSpinLoading(true) setSpinLoading(true)
//@ts-ignore
PublicApi.getMemberCommentMallTradeHistoryPage(param).then(res => { PublicApi.getMemberCommentMallTradeHistoryPage(param).then(res => {
setSpinLoading(false) setSpinLoading(false)
if (res.code === 1000) { if (res.code === 1000) {
...@@ -85,7 +85,7 @@ const Comment: React.FC<CommentPropsType> = (props) => { ...@@ -85,7 +85,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
let middleCount = 0 let middleCount = 0
let badCount = 0 let badCount = 0
if (data) { if (data) {
for (let item of data) { for (const item of data) {
switch (item.star) { switch (item.star) {
case 1: case 1:
case 2: case 2:
...@@ -103,9 +103,9 @@ const Comment: React.FC<CommentPropsType> = (props) => { ...@@ -103,9 +103,9 @@ const Comment: React.FC<CommentPropsType> = (props) => {
} }
} }
} }
let allCount = goodCount + middleCount + badCount const allCount = goodCount + middleCount + badCount
let result = [{ const result = [{
title: '全部评价', title: '全部评价',
sum: allCount, sum: allCount,
sumText: allCount > 200 ? `(200+)` : `(${allCount})`, sumText: allCount > 200 ? `(200+)` : `(${allCount})`,
......
...@@ -8,15 +8,10 @@ interface ImageViewListPropsType { ...@@ -8,15 +8,10 @@ interface ImageViewListPropsType {
} }
const ImageViewList: React.FC<ImageViewListPropsType> = (props) => { const ImageViewList: React.FC<ImageViewListPropsType> = (props) => {
const { imgList = []} = props
const [previewImage, setPreviewImage] = useState<number>(-1) const [previewImage, setPreviewImage] = useState<number>(-1)
const [rotateZ, setRotateZ] = useState<number>(0) const [rotateZ, setRotateZ] = useState<number>(0)
const imgList = [
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg",
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-5.jpg",
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-3.jpg"
]
const handlePreviewImg = (index: number) => { const handlePreviewImg = (index: number) => {
if (previewImage !== index) { if (previewImage !== index) {
setPreviewImage(index) setPreviewImage(index)
...@@ -39,7 +34,7 @@ const ImageViewList: React.FC<ImageViewListPropsType> = (props) => { ...@@ -39,7 +34,7 @@ const ImageViewList: React.FC<ImageViewListPropsType> = (props) => {
setRotateZ(0) setRotateZ(0)
break break
case 'preview': case 'preview':
let el = document.createElement('a') const el = document.createElement('a')
el.href = imgList[previewImage]; el.href = imgList[previewImage];
el.target = '_blank'; el.target = '_blank';
el.click() el.click()
......
...@@ -31,12 +31,12 @@ const Logistics_Type = { ...@@ -31,12 +31,12 @@ const Logistics_Type = {
3: '无需配送' 3: '无需配送'
} }
interface selectAttrValType { interface SelectAttrValType {
attrId: number; attrId: number;
attrValId: number; attrValId: number;
} }
interface imgItemType { interface ImgItemType {
id: number; id: number;
commodityPic: string; commodityPic: string;
} }
...@@ -65,9 +65,9 @@ const CommodityDetail = (props) => { ...@@ -65,9 +65,9 @@ const CommodityDetail = (props) => {
const [attributeList, setAttributeList] = useState([]) const [attributeList, setAttributeList] = useState([])
const [commodityDetail, setCommodityDetail] = useState<GetSearchShopStoreGetCommodityDetailResponse & GetSearchShopChannelGetCommodityDetailResponse>() const [commodityDetail, setCommodityDetail] = useState<GetSearchShopStoreGetCommodityDetailResponse & GetSearchShopChannelGetCommodityDetailResponse>()
const [attrAndValList, setAttrAndValList] = useState<any>({}) const [attrAndValList, setAttrAndValList] = useState<any>({})
const [selectAttrVal, setSelectAttrVal] = useState<selectAttrValType[]>([]) const [selectAttrVal, setSelectAttrVal] = useState<SelectAttrValType[]>([])
const [stockCount, setStockCount] = useState<number>(0) const [stockCount, setStockCount] = useState<number>(0)
const [commodityImgList, setCommodityImgList] = useState<imgItemType[]>([]) const [commodityImgList, setCommodityImgList] = useState<ImgItemType[]>([])
const [commodityPriceInfo, setCommodityPriceInfo] = useState([]) const [commodityPriceInfo, setCommodityPriceInfo] = useState([])
const [parameter, setParameter] = useState<number>() // 权益参数 const [parameter, setParameter] = useState<number>() // 权益参数
const [selectCommodityId, setSelectCommodityId] = useState<number>() const [selectCommodityId, setSelectCommodityId] = useState<number>()
...@@ -91,7 +91,7 @@ const CommodityDetail = (props) => { ...@@ -91,7 +91,7 @@ const CommodityDetail = (props) => {
* @param priceType * @param priceType
*/ */
const fetchCommonCategoryCommodityList = (categoryId: number, priceType: number) => { const fetchCommonCategoryCommodityList = (categoryId: number, priceType: number) => {
let param: any = { const param: any = {
current: 1, current: 1,
pageSize: 10, pageSize: 10,
categoryId categoryId
...@@ -162,7 +162,7 @@ const CommodityDetail = (props) => { ...@@ -162,7 +162,7 @@ const CommodityDetail = (props) => {
*/ */
const fetchDetail = () => { const fetchDetail = () => {
let getDetailFn let getDetailFn
let params: any = { const params: any = {
commodityId: id commodityId: id
} }
let headers = {} let headers = {}
...@@ -217,8 +217,10 @@ const CommodityDetail = (props) => { ...@@ -217,8 +217,10 @@ const CommodityDetail = (props) => {
if (!memberId) { if (!memberId) {
return return
} }
//@ts-ignore const param: any = {
PublicApi.getPayPayWayList({ memberId }).then(res => { memberId
}
PublicApi.getPayPayWayList(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
initPayWayList(res.data) initPayWayList(res.data)
} }
...@@ -234,7 +236,7 @@ const CommodityDetail = (props) => { ...@@ -234,7 +236,7 @@ const CommodityDetail = (props) => {
return [] return []
} }
let result = [] let result = []
for (let item of data) { for (const item of data) {
if (result.some(tempItem => tempItem.payType === item.payType)) { if (result.some(tempItem => tempItem.payType === item.payType)) {
result = result.map(resItem => { result = result.map(resItem => {
if (resItem.payType === item.payType) { if (resItem.payType === item.payType) {
...@@ -274,7 +276,7 @@ const CommodityDetail = (props) => { ...@@ -274,7 +276,7 @@ const CommodityDetail = (props) => {
* @param memberRoleId * @param memberRoleId
*/ */
const getMemberCredit = (memberId, memberRoleId) => { const getMemberCredit = (memberId, memberRoleId) => {
let param = { const param = {
parentMemberId: memberId, parentMemberId: memberId,
parentMemberRoleId: memberRoleId parentMemberRoleId: memberRoleId
} }
...@@ -299,9 +301,9 @@ const CommodityDetail = (props) => { ...@@ -299,9 +301,9 @@ const CommodityDetail = (props) => {
const getCommodityPriceRange = () => { const getCommodityPriceRange = () => {
if (commodityDetail?.unitPricePicList) { if (commodityDetail?.unitPricePicList) {
for (let item of commodityDetail?.unitPricePicList) { for (const item of commodityDetail?.unitPricePicList) {
let temp = item.attributeAndValueList.map(attrItem => { const temp = item.attributeAndValueList.map(attrItem => {
return { return {
attrId: attrItem.customerAttribute.id, attrId: attrItem.customerAttribute.id,
attrValId: attrItem.customerAttributeValue.id attrValId: attrItem.customerAttributeValue.id
...@@ -320,7 +322,7 @@ const CommodityDetail = (props) => { ...@@ -320,7 +322,7 @@ const CommodityDetail = (props) => {
const judgeArrisCommon = (list, otherList) => { const judgeArrisCommon = (list, otherList) => {
if (list.length === otherList.length) { if (list.length === otherList.length) {
let result = list.every(listItem => { const result = list.every(listItem => {
return otherList.some(item => { return otherList.some(item => {
return JSON.stringify(item) === JSON.stringify(listItem) return JSON.stringify(item) === JSON.stringify(listItem)
}) })
...@@ -352,7 +354,7 @@ const CommodityDetail = (props) => { ...@@ -352,7 +354,7 @@ const CommodityDetail = (props) => {
if (clickFlag) { if (clickFlag) {
clickFlag = false clickFlag = false
let param: any = { const param: any = {
commodityUnitPriceId: selectCommodityId, commodityUnitPriceId: selectCommodityId,
count: buyCount count: buyCount
} }
...@@ -482,11 +484,10 @@ const CommodityDetail = (props) => { ...@@ -482,11 +484,10 @@ const CommodityDetail = (props) => {
if (clickFlag) { if (clickFlag) {
clickFlag = false clickFlag = false
//@ts-ignore
PublicApi.postOrderDirectPayment({ productId: selectCommodityId, memberId }).then(res => { PublicApi.postOrderDirectPayment({ productId: selectCommodityId, memberId }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
message.destroy() message.destroy()
let buyCommodityInfo = { const buyCommodityInfo = {
id: selectCommodityId, id: selectCommodityId,
count: buyCount, count: buyCount,
unitName: commodityDetail.unitName, unitName: commodityDetail.unitName,
...@@ -503,9 +504,9 @@ const CommodityDetail = (props) => { ...@@ -503,9 +504,9 @@ const CommodityDetail = (props) => {
attribute: attrAndValList.attributeAndValueList attribute: attrAndValList.attributeAndValueList
} }
let sessionKey = `${commodityDetail.id}${new Date().getTime()}` const sessionKey = `${commodityDetail.id}${new Date().getTime()}`
let buyOrderInfo: any = { const buyOrderInfo: any = {
logistics: commodityDetail.logistics, logistics: commodityDetail.logistics,
payWayList: priceType === COMMODITY_TYPE.integral ? integralPayWay : payWayList, payWayList: priceType === COMMODITY_TYPE.integral ? integralPayWay : payWayList,
supplyMembersName: commodityDetail.memberName, supplyMembersName: commodityDetail.memberName,
...@@ -547,7 +548,7 @@ const CommodityDetail = (props) => { ...@@ -547,7 +548,7 @@ const CommodityDetail = (props) => {
}) })
const JoinValue = values.reverse().join('/'); const JoinValue = values.reverse().join('/');
let inquiryParam = { const inquiryParam = {
id: selectCommodityId, id: selectCommodityId,
brand: commodityDetail.brand, brand: commodityDetail.brand,
logistics: commodityDetail.logistics, logistics: commodityDetail.logistics,
...@@ -562,7 +563,7 @@ const CommodityDetail = (props) => { ...@@ -562,7 +563,7 @@ const CommodityDetail = (props) => {
category: commodityDetail.customerCategory.name category: commodityDetail.customerCategory.name
} }
let sessionKey = `inquiry${selectCommodityId}${new Date().getTime()}` const sessionKey = `inquiry${selectCommodityId}${new Date().getTime()}`
updateOrderInfo(inquiryParam, sessionKey).then(() => { updateOrderInfo(inquiryParam, sessionKey).then(() => {
window.location.href = `/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/rfq?id=${id}&memberId=${memberId}&spam_id=${sessionKey}` window.location.href = `/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/rfq?id=${id}&memberId=${memberId}&spam_id=${sessionKey}`
}) })
...@@ -598,8 +599,8 @@ const CommodityDetail = (props) => { ...@@ -598,8 +599,8 @@ const CommodityDetail = (props) => {
* @param addList * @param addList
*/ */
const deleteRepeatImg = (list, addList) => { const deleteRepeatImg = (list, addList) => {
let result = [...list] const result = [...list]
for (let addItem of addList) { for (const addItem of addList) {
if (list.every(item => item.commodityPic !== addItem.commodityPic)) { if (list.every(item => item.commodityPic !== addItem.commodityPic)) {
result.push(addItem) result.push(addItem)
} }
...@@ -612,19 +613,19 @@ const CommodityDetail = (props) => { ...@@ -612,19 +613,19 @@ const CommodityDetail = (props) => {
* @param unitPricePicList * @param unitPricePicList
*/ */
const initAttributeAndValueList = (dataInfo: any) => { const initAttributeAndValueList = (dataInfo: any) => {
let unitPricePicList = dataInfo?.unitPricePicList const unitPricePicList = dataInfo?.unitPricePicList
if (!unitPricePicList) { if (!unitPricePicList) {
return return
} }
let tempAttrList = [] const tempAttrList = []
let tempImgList: any = [{ let tempImgList: any = [{
id: dataInfo.id, id: dataInfo.id,
commodityPic: dataInfo.mainPic commodityPic: dataInfo.mainPic
}] }]
for (let item of unitPricePicList) { for (const item of unitPricePicList) {
// 初始化商品图片-》 商品主图加上商品属性图片 // 初始化商品图片-》 商品主图加上商品属性图片
if (item.commodityPic) { if (item.commodityPic) {
let tempCommodityPic = item.commodityPic.map((picItem, picIndex) => { const tempCommodityPic = item.commodityPic.map((picItem, picIndex) => {
return { return {
id: `${item.id}-${picIndex}`, id: `${item.id}-${picIndex}`,
commodityPic: picItem commodityPic: picItem
...@@ -633,7 +634,7 @@ const CommodityDetail = (props) => { ...@@ -633,7 +634,7 @@ const CommodityDetail = (props) => {
tempImgList = deleteRepeatImg(tempImgList, tempCommodityPic) tempImgList = deleteRepeatImg(tempImgList, tempCommodityPic)
} }
for (let attrListItem of item.attributeAndValueList) { for (const attrListItem of item.attributeAndValueList) {
if (judgeAttrInList(tempAttrList, attrListItem.customerAttribute.id)) { if (judgeAttrInList(tempAttrList, attrListItem.customerAttribute.id)) {
let tempAttrListIndex = 0 let tempAttrListIndex = 0
tempAttrList.map((item, index) => { tempAttrList.map((item, index) => {
...@@ -648,7 +649,7 @@ const CommodityDetail = (props) => { ...@@ -648,7 +649,7 @@ const CommodityDetail = (props) => {
tempAttrList[tempAttrListIndex].customerAttributeValueList = [...tempAttrList[tempAttrListIndex].customerAttributeValueList, attrListItem.customerAttributeValue] tempAttrList[tempAttrListIndex].customerAttributeValueList = [...tempAttrList[tempAttrListIndex].customerAttributeValueList, attrListItem.customerAttributeValue]
} }
} else { } else {
let temp: any = {} const temp: any = {}
temp.id = attrListItem.id temp.id = attrListItem.id
temp.customerAttribute = attrListItem.customerAttribute temp.customerAttribute = attrListItem.customerAttribute
...@@ -674,7 +675,7 @@ const CommodityDetail = (props) => { ...@@ -674,7 +675,7 @@ const CommodityDetail = (props) => {
return return
} }
let total = 0 let total = 0
for (let item of unitPricePicList) { for (const item of unitPricePicList) {
total += item.stockCount total += item.stockCount
} }
setStockCount(total) setStockCount(total)
...@@ -691,7 +692,7 @@ const CommodityDetail = (props) => { ...@@ -691,7 +692,7 @@ const CommodityDetail = (props) => {
if (Object.keys(priceObj).length <= 1) { if (Object.keys(priceObj).length <= 1) {
return priceObj return priceObj
} }
let tempList = [] const tempList = []
Object.keys(priceObj).forEach(key => { Object.keys(priceObj).forEach(key => {
tempList.push({ tempList.push({
key, key,
...@@ -700,13 +701,13 @@ const CommodityDetail = (props) => { ...@@ -700,13 +701,13 @@ const CommodityDetail = (props) => {
}) })
for (let i = 0; i < tempList.length; i++) { for (let i = 0; i < tempList.length; i++) {
if (tempList[i + 1] && tempList[i].value < tempList[i + 1].value) { if (tempList[i + 1] && tempList[i].value < tempList[i + 1].value) {
let temp = tempList[i] const temp = tempList[i]
tempList[i] = tempList[i + 1] tempList[i] = tempList[i + 1]
tempList[i + 1] = temp tempList[i + 1] = temp
} }
} }
let result = {} const result = {}
for (let tempItem of tempList) { for (const tempItem of tempList) {
result[tempItem.key] = tempItem.value result[tempItem.key] = tempItem.value
} }
return result return result
...@@ -717,12 +718,12 @@ const CommodityDetail = (props) => { ...@@ -717,12 +718,12 @@ const CommodityDetail = (props) => {
* @param uniPrice * @param uniPrice
*/ */
const setCurrentPriceRange = (uniPrice) => { const setCurrentPriceRange = (uniPrice) => {
let initPriceRange = uniPrice const initPriceRange = uniPrice
let tempPriceRange = [] const tempPriceRange = []
Object.keys(initPriceRange).forEach((key) => { Object.keys(initPriceRange).forEach((key) => {
let keyArr = key.split('-') const keyArr = key.split('-')
let min = keyArr[0] const min = keyArr[0]
let max = keyArr[1] const max = keyArr[1]
tempPriceRange.push({ tempPriceRange.push({
range: key, range: key,
min, min,
...@@ -755,13 +756,13 @@ const CommodityDetail = (props) => { ...@@ -755,13 +756,13 @@ const CommodityDetail = (props) => {
// return // return
// } // }
if (judgeSelectAttrInList(selectAttrVal, attrId, 'attrId')) { if (judgeSelectAttrInList(selectAttrVal, attrId, 'attrId')) {
let result = [] const result = []
for (let item of selectAttrVal) { for (const item of selectAttrVal) {
if (item.attrId === attrId && item.attrValId !== attrValId) { if (item.attrId === attrId && item.attrValId !== attrValId) {
item.attrValId = attrValId item.attrValId = attrValId
result.push(item) result.push(item)
} else if (item.attrId === attrId && item.attrValId === attrValId) { } else if (item.attrId === attrId && item.attrValId === attrValId) {
console.log('')
} else { } else {
result.push(item) result.push(item)
} }
...@@ -784,11 +785,11 @@ const CommodityDetail = (props) => { ...@@ -784,11 +785,11 @@ const CommodityDetail = (props) => {
if (commodityPriceInfo.length <= 1) { if (commodityPriceInfo.length <= 1) {
unitPrice = commodityPriceInfo[0]?.price unitPrice = commodityPriceInfo[0]?.price
} else { } else {
let temp = commodityPriceInfo.filter(item => { const temp = commodityPriceInfo.filter(item => {
return Number(buyCount) >= Number(item.min) && Number(buyCount) <= Number(item.max) return Number(buyCount) >= Number(item.min) && Number(buyCount) <= Number(item.max)
}) })
if (isEmpty(temp)) { if (isEmpty(temp)) {
let maxItem = getMaxCountRange() const maxItem = getMaxCountRange()
unitPrice = maxItem.price unitPrice = maxItem.price
} else { } else {
unitPrice = temp[0]?.price unitPrice = temp[0]?.price
...@@ -807,8 +808,8 @@ const CommodityDetail = (props) => { ...@@ -807,8 +808,8 @@ const CommodityDetail = (props) => {
* 获取合计金额 * 获取合计金额
*/ */
const getAmount = (state = true) => { const getAmount = (state = true) => {
let unitPrice = getUnitPrice() const unitPrice = getUnitPrice()
let amount = unitPrice * (Number(buyCount) || 0) const amount = unitPrice * (Number(buyCount) || 0)
return state ? priceFormat(amount) : amount return state ? priceFormat(amount) : amount
} }
...@@ -817,7 +818,7 @@ const CommodityDetail = (props) => { ...@@ -817,7 +818,7 @@ const CommodityDetail = (props) => {
*/ */
const getMaxCountRange = () => { const getMaxCountRange = () => {
let maxItem: any = {} let maxItem: any = {}
for (let item of commodityPriceInfo) { for (const item of commodityPriceInfo) {
if (Number(item.max) > Number(maxItem.max || 0)) { if (Number(item.max) > Number(maxItem.max || 0)) {
maxItem = item maxItem = item
} }
...@@ -830,13 +831,13 @@ const CommodityDetail = (props) => { ...@@ -830,13 +831,13 @@ const CommodityDetail = (props) => {
*/ */
const judgeHasAttr = (attrId: number, attrValId: number) => { const judgeHasAttr = (attrId: number, attrValId: number) => {
let result = true let result = true
let newSelectAttrVal = JSON.parse(JSON.stringify(selectAttrVal)) const newSelectAttrVal = JSON.parse(JSON.stringify(selectAttrVal))
if (selectAttrVal.length > 0) { if (selectAttrVal.length > 0) {
// newSelectAttrVal.pop() // newSelectAttrVal.pop()
if (commodityDetail?.unitPricePicList) { if (commodityDetail?.unitPricePicList) {
let tempList = [] const tempList = []
for (let item of commodityDetail?.unitPricePicList) { for (const item of commodityDetail?.unitPricePicList) {
let temp = item.attributeAndValueList.map(attrItem => { const temp = item.attributeAndValueList.map(attrItem => {
return { return {
attrId: attrItem.customerAttribute.id, attrId: attrItem.customerAttribute.id,
attrValId: attrItem.customerAttributeValue.id attrValId: attrItem.customerAttributeValue.id
...@@ -859,8 +860,8 @@ const CommodityDetail = (props) => { ...@@ -859,8 +860,8 @@ const CommodityDetail = (props) => {
* 判断选的的数组是有在商品属性数组中 * 判断选的的数组是有在商品属性数组中
*/ */
const judegeListInList = (mainList, subList) => { const judegeListInList = (mainList, subList) => {
let result = subList.every(listItem => { const result = subList.every(listItem => {
let subRes = mainList.some(item => { const subRes = mainList.some(item => {
return JSON.stringify(item) === JSON.stringify(listItem) return JSON.stringify(item) === JSON.stringify(listItem)
}) })
return subRes return subRes
......
...@@ -48,7 +48,11 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -48,7 +48,11 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
}, [categoryIds]) }, [categoryIds])
const fetchPurchaseList = (initState = false) => { /**
* 获取进货单数据
* @param initState
*/
const fetchPurchaseList = () => {
let getFn let getFn
switch (layoutType) { switch (layoutType) {
case LAYOUT_TYPE.channel: case LAYOUT_TYPE.channel:
...@@ -62,7 +66,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -62,7 +66,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
getFn && getFn().then(res => { getFn && getFn().then(res => {
if (res.code === 1000) { if (res.code === 1000) {
initPurchaseList(res.data, initState) initPurchaseList(res.data)
getCategoryIds(res.data) getCategoryIds(res.data)
} }
}) })
...@@ -73,9 +77,9 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -73,9 +77,9 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
* @param purchaseList * @param purchaseList
*/ */
const getCategoryIds = (purchaseList) => { const getCategoryIds = (purchaseList) => {
let ids = [] const ids = []
for (let item of purchaseList) { for (const item of purchaseList) {
let categoryId = item.commodityUnitPrice.commodity.customerCategory.id const categoryId = item.commodityUnitPrice.commodity.customerCategory.id
if (!ids.includes(categoryId)) { if (!ids.includes(categoryId)) {
ids.push(categoryId) ids.push(categoryId)
} }
...@@ -83,54 +87,71 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -83,54 +87,71 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
setCategoryIds(ids) setCategoryIds(ids)
} }
const initPurchaseList = (list: GetSearchShopPurchaseGetPurchaseListResponse, initState) => { /**
* 初始化进货单数据
* @param list
* @param initState
*/
const initPurchaseList = async (list: GetSearchShopPurchaseGetPurchaseListResponse) => {
let result = [] let result = []
for (let item of list) { for (const item of list) {
// 判断店铺id是否已存在数组中 // 判断店铺id是否已存在数组中
if (result.some(resItem => resItem.id === item.commodityUnitPrice.commodity.storeId)) { if (result.some(resItem => resItem.id === item.commodityUnitPrice.commodity.storeId)) {
result = result.map(tempItem => { const tempResult = []
for(const tempItem of result) {
if (tempItem.id === item.commodityUnitPrice.commodity.storeId) { if (tempItem.id === item.commodityUnitPrice.commodity.storeId) {
let tempPriceRange = [] const tempPriceRange = []
let unitPrice = item.commodityUnitPrice.unitPrice const unitPrice = item.commodityUnitPrice.unitPrice
let parameter: any = 1
const isMemberPrice = item.commodityUnitPrice.commodity.isMemberPrice
// 如果可以使用会员折扣
if(isMemberPrice) {
parameter = await getMemberCredit(item.commodityUnitPrice.commodity.memberId, item.commodityUnitPrice.commodity.memberRoleId)
}
Object.keys(unitPrice).forEach(key => { Object.keys(unitPrice).forEach(key => {
let keyArr = key.split('-') const keyArr = key.split('-')
let min = keyArr[0] const min = keyArr[0]
let max = keyArr[1] const max = keyArr[1]
tempPriceRange.push({ tempPriceRange.push({
range: key, range: key,
min, min,
max, max,
price: unitPrice[key] price: isMemberPrice ? Number(unitPrice[key]) * Number(parameter) : unitPrice[key]
}) })
}) })
// TODO 暂时给个库存数量
item.stockCount = item.stockCount
item.commodityUnitPrice['priceRange'] = tempPriceRange item.commodityUnitPrice['priceRange'] = tempPriceRange
tempItem.orderList = [...tempItem.orderList, item] tempItem.orderList = [...tempItem.orderList, item]
tempResult.push(tempItem)
} }
return tempItem }
}) result = tempResult
} else { } else {
let temp: any = {} const temp: any = {}
temp.id = item.commodityUnitPrice.commodity.storeId temp.id = item.commodityUnitPrice.commodity.storeId
temp.memberId = item.commodityUnitPrice.commodity.memberId temp.memberId = item.commodityUnitPrice.commodity.memberId
temp.memberRoleId = item.commodityUnitPrice.commodity.memberRoleId temp.memberRoleId = item.commodityUnitPrice.commodity.memberRoleId
temp.shopname = item.commodityUnitPrice.commodity.memberName temp.shopname = item.commodityUnitPrice.commodity.memberName
let tempPriceRange = [] const tempPriceRange = []
let unitPrice = item.commodityUnitPrice.unitPrice const unitPrice = item.commodityUnitPrice.unitPrice
let parameter: any = 1
const isMemberPrice = item.commodityUnitPrice.commodity.isMemberPrice
// 如果可以使用会员折扣
if(isMemberPrice) {
parameter = await getMemberCredit(item.commodityUnitPrice.commodity.memberId, item.commodityUnitPrice.commodity.memberRoleId)
}
Object.keys(unitPrice).forEach(key => { Object.keys(unitPrice).forEach(key => {
let keyArr = key.split('-') const keyArr = key.split('-')
let min = keyArr[0] const min = keyArr[0]
let max = keyArr[1] const max = keyArr[1]
tempPriceRange.push({ tempPriceRange.push({
range: key, range: key,
min, min,
max, max,
price: unitPrice[key] price: isMemberPrice ? Number(unitPrice[key]) * Number(parameter) : unitPrice[key]
}) })
}) })
item.stockCount = item.stockCount
item.commodityUnitPrice['priceRange'] = tempPriceRange item.commodityUnitPrice['priceRange'] = tempPriceRange
temp.orderList = [item] temp.orderList = [item]
result.push(temp) result.push(temp)
...@@ -140,7 +161,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -140,7 +161,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
const initData = (list: any, initChecked?: any) => { const initData = (list: any, initChecked?: any) => {
let result = list.map(item => { const result = list.map(item => {
return Object.assign(item, { return Object.assign(item, {
checkedList: initChecked ? initChecked : item.orderList.map(item => item.id), checkedList: initChecked ? initChecked : item.orderList.map(item => item.id),
defaultCheckedList: item.orderList.map(item => item.id) defaultCheckedList: item.orderList.map(item => item.id)
...@@ -167,10 +188,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -167,10 +188,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const handleChildGroupChange = (list, id: number) => { const handleChildGroupChange = (list, id: number) => {
let flag = false let flag = false
let result = orderList.map(item => { const result = orderList.map(item => {
if (item.id === id) { if (item.id === id) {
if (list.length === item.defaultCheckedList.length) { if (list.length === item.defaultCheckedList.length) {
let temp = [...checkedList, id] const temp = [...checkedList, id]
setCheckedList(temp) setCheckedList(temp)
if (temp.length === getAllKeys().length) { if (temp.length === getAllKeys().length) {
setIndeterminate(false) setIndeterminate(false)
...@@ -190,7 +211,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -190,7 +211,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
if (list.length === 0) { if (list.length === 0) {
let index = checkedList.indexOf(id) const index = checkedList.indexOf(id)
checkedList.splice(index, 1) checkedList.splice(index, 1)
setCheckedList(checkedList) setCheckedList(checkedList)
} }
...@@ -201,7 +222,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -201,7 +222,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
const onCheckChildAllChange = (e: any, id: number) => { const onCheckChildAllChange = (e: any, id: number) => {
let result = orderList.map((item: any) => { const result = orderList.map((item: any) => {
if (item.id === id) { if (item.id === id) {
return e.target.checked ? Object.assign(item, { checkedList: item.defaultCheckedList }) : Object.assign(item, { checkedList: [] }) return e.target.checked ? Object.assign(item, { checkedList: item.defaultCheckedList }) : Object.assign(item, { checkedList: [] })
} else { } else {
...@@ -216,12 +237,14 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -216,12 +237,14 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
* @param count * @param count
* @param id * @param id
*/ */
const handleCountChange = (count: number, id: number) => { const handleCountChange = (count: number, id: number, type: string) => {
handleChangeFinishCount(count, id)
if(type === 'click' || type === 'blur') {
if (countState) { if (countState) {
countState = false countState = false
let param: any = { const param: any = {
id, id,
count count: Number(count)
} }
let postFn let postFn
...@@ -240,8 +263,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -240,8 +263,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
countState = true countState = true
if (res.code === 1000) { if (res.code === 1000) {
message.destroy() message.destroy()
// fetchPurchaseList()
handleChangeFinishCount(count, id)
} }
}).catch(() => { }).catch(() => {
countState = true countState = true
...@@ -249,8 +270,15 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -249,8 +270,15 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
} }
}
const handleBlur = (count: number, id: number) => {
console.log(countState, count, "handleBlur")
}
const handleChangeFinishCount = (count, id) => { const handleChangeFinishCount = (count, id) => {
let result = orderList.map(item => { const result = orderList.map(item => {
item.orderList = item.orderList.map(childItem => { item.orderList = item.orderList.map(childItem => {
if (childItem.id === id) { if (childItem.id === id) {
childItem.count = count childItem.count = count
...@@ -273,7 +301,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -273,7 +301,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
return parseFloat(priceRange[0].price) * count return parseFloat(priceRange[0].price) * count
} else { } else {
let priceItem: any = {} let priceItem: any = {}
for (let item of priceRange) { for (const item of priceRange) {
if (Number(item.min) <= count && count <= Number(item.max)) { if (Number(item.min) <= count && count <= Number(item.max)) {
priceItem = item priceItem = item
} }
...@@ -330,7 +358,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -330,7 +358,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
*/ */
const handleBatchDelete = () => { const handleBatchDelete = () => {
let idList = [] let idList = []
for (let item of orderList) { for (const item of orderList) {
idList = [...idList, ...item.checkedList] idList = [...idList, ...item.checkedList]
} }
if (idList.length <= 0) { if (idList.length <= 0) {
...@@ -364,10 +392,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -364,10 +392,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
* @param ids * @param ids
*/ */
const deleteListItems = (ids: number[]) => { const deleteListItems = (ids: number[]) => {
let newOrderList = JSON.parse(JSON.stringify(orderList)) const newOrderList = JSON.parse(JSON.stringify(orderList))
let result = [] const result = []
for (let item of newOrderList) { for (const item of newOrderList) {
let newItem = item const newItem = item
newItem.orderList = newItem.orderList.filter(orderItem => !ids.includes(orderItem.id)) newItem.orderList = newItem.orderList.filter(orderItem => !ids.includes(orderItem.id))
if (newItem.orderList.length > 0) { if (newItem.orderList.length > 0) {
result.push(newItem) result.push(newItem)
...@@ -381,8 +409,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -381,8 +409,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
*/ */
const handleComputeSelectCount = () => { const handleComputeSelectCount = () => {
let count = 0 let count = 0
for (let item of orderList) { for (const item of orderList) {
for (let orderItem of item.orderList) { for (const orderItem of item.orderList) {
if (item.checkedList.includes(orderItem.id)) { if (item.checkedList.includes(orderItem.id)) {
count += orderItem.count count += orderItem.count
} }
...@@ -397,10 +425,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -397,10 +425,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
*/ */
const handleComputeSelectPrice = () => { const handleComputeSelectPrice = () => {
let price = 0 let price = 0
for (let item of orderList) { for (const item of orderList) {
for (let orderItem of item.orderList) { for (const orderItem of item.orderList) {
if (item.checkedList.includes(orderItem.id)) { if (item.checkedList.includes(orderItem.id)) {
let commodityPrice = computeItemPrice(orderItem.commodityUnitPrice.priceRange, orderItem.count) const commodityPrice = computeItemPrice(orderItem.commodityUnitPrice.priceRange, orderItem.count)
price += commodityPrice price += commodityPrice
} }
} }
...@@ -415,7 +443,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -415,7 +443,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
*/ */
const getMemberCredit = (memberId, memberRoleId) => { const getMemberCredit = (memberId, memberRoleId) => {
return new Promise((resolve) => { return new Promise((resolve) => {
let param = { const param = {
parentMemberId: memberId, parentMemberId: memberId,
parentMemberRoleId: memberRoleId parentMemberRoleId: memberRoleId
} }
...@@ -433,8 +461,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -433,8 +461,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
resolve([]) resolve([])
return return
} }
//@ts-ignore const param: any = {
PublicApi.getPayPayWayList({ memberId }).then(res => { memberId
}
PublicApi.getPayPayWayList(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
resolve(initPayWayList(res.data)) resolve(initPayWayList(res.data))
} }
...@@ -447,7 +477,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -447,7 +477,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
return [] return []
} }
let result = [] let result = []
for (let item of data) { for (const item of data) {
if (result.some(tempItem => tempItem.payType === item.payType)) { if (result.some(tempItem => tempItem.payType === item.payType)) {
result = result.map(resItem => { result = result.map(resItem => {
if (resItem.payType === item.payType) { if (resItem.payType === item.payType) {
...@@ -495,18 +525,18 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -495,18 +525,18 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const selectList = orderList.filter(item => item.checkedList.length > 0) const selectList = orderList.filter(item => item.checkedList.length > 0)
const selectItem = selectList[0] const selectItem = selectList[0]
let productIds = [] const productIds = []
let buyOrderlist = [] const buyOrderlist = []
const selectOrderList = selectItem.orderList.filter(item => selectItem.checkedList.includes(item.id)) const selectOrderList = selectItem.orderList.filter(item => selectItem.checkedList.includes(item.id))
let commonLogistics = {} let commonLogistics = {}
setConfirmLoading(true) setConfirmLoading(true)
let purchaseIds = [] const purchaseIds = []
for (let item of selectOrderList) { for (const item of selectOrderList) {
purchaseIds.push(item.id) purchaseIds.push(item.id)
productIds.push(item.commodityUnitPrice.id) productIds.push(item.commodityUnitPrice.id)
commonLogistics = item.commodityUnitPrice.commodity.logistics commonLogistics = item.commodityUnitPrice.commodity.logistics
let buyCommodityInfo: any = { const buyCommodityInfo: any = {
id: item.commodityUnitPrice.id, id: item.commodityUnitPrice.id,
purchaseId: item.id, purchaseId: item.id,
count: item.count, count: item.count,
...@@ -529,7 +559,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -529,7 +559,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
buyOrderlist.push(buyCommodityInfo) buyOrderlist.push(buyCommodityInfo)
} }
let buyOrderInfo: any = { const buyOrderInfo: any = {
purchaseOrder: true, // 是否进货单下单 purchaseOrder: true, // 是否进货单下单
idList: purchaseIds, idList: purchaseIds,
productType: (layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? 2 : 1, productType: (layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? 2 : 1,
...@@ -546,7 +576,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -546,7 +576,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId) buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId)
//@ts-ignore
PublicApi.postOrderIsWorkFlow({ productIds, memberId: selectItem.memberId }).then(res => { PublicApi.postOrderIsWorkFlow({ productIds, memberId: selectItem.memberId }).then(res => {
setConfirmLoading(false) setConfirmLoading(false)
if (res.code === 1000) { if (res.code === 1000) {
...@@ -554,7 +583,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -554,7 +583,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
PublicApi.postOrderDirectPayment({ productId: productIds[0], memberId: selectItem.memberId }).then(res => { PublicApi.postOrderDirectPayment({ productId: productIds[0], memberId: selectItem.memberId }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
message.destroy() message.destroy()
let sessionKey = `${selectItem.id}${new Date().getTime()}` const sessionKey = `${selectItem.id}${new Date().getTime()}`
updateOrderInfo(buyOrderInfo, sessionKey).then(() => { updateOrderInfo(buyOrderInfo, sessionKey).then(() => {
if (res.data) { if (res.data) {
...@@ -591,11 +620,11 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -591,11 +620,11 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
if (detail.priceRange.length <= 1) { if (detail.priceRange.length <= 1) {
unitPrice = detail.priceRange[0]?.price unitPrice = detail.priceRange[0]?.price
} else { } else {
let temp = detail.priceRange.filter(item => { const temp = detail.priceRange.filter(item => {
return Number(count) >= Number(item.min) && Number(count) <= Number(item.max) return Number(count) >= Number(item.min) && Number(count) <= Number(item.max)
}) })
if (isEmpty(temp)) { if (isEmpty(temp)) {
let maxItem = getMaxCountRange(detail.priceRange) const maxItem = getMaxCountRange(detail.priceRange)
unitPrice = maxItem.price unitPrice = maxItem.price
} else { } else {
unitPrice = temp[0]?.price unitPrice = temp[0]?.price
...@@ -607,7 +636,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -607,7 +636,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const getMaxCountRange = (priceRange) => { const getMaxCountRange = (priceRange) => {
let maxItem: any = {} let maxItem: any = {}
for (let item of priceRange) { for (const item of priceRange) {
if (Number(item.max) > Number(maxItem.max || 0)) { if (Number(item.max) > Number(maxItem.max || 0)) {
maxItem = item maxItem = item
} }
...@@ -647,7 +676,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -647,7 +676,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const handleCollect = (commodityId: number) => { const handleCollect = (commodityId: number) => {
let param: any = { const param: any = {
commodityId: commodityId, commodityId: commodityId,
type: getLayoutType() type: getLayoutType()
} }
...@@ -736,7 +765,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -736,7 +765,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
</div> </div>
<div className={cx(styles.order_list_item_item, styles.count)}> <div className={cx(styles.order_list_item_item, styles.count)}>
<InputNumber max={childItem.stockCount || 0} disabled={childItem.stockCount === 0} min={childItem.commodityUnitPrice.commodity.minOrder || 1} value={childItem.count} onChange={(value) => handleCountChange(value, childItem.id)} /> <InputNumber max={childItem.stockCount || 0} disabled={childItem.stockCount === 0} min={childItem.commodityUnitPrice.commodity.minOrder || 1} value={childItem.count} onChange={(value, type) => handleCountChange(value, childItem.id, type)} />
<div className={styles.stock}> <div className={styles.stock}>
<span>(库存{numFormat(childItem.stockCount)}{childItem.commodityUnitPrice.commodity.unitName})</span> <span>(库存{numFormat(childItem.stockCount)}{childItem.commodityUnitPrice.commodity.unitName})</span>
</div> </div>
...@@ -797,3 +826,4 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -797,3 +826,4 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
} }
export default observer(PurchaseOrder) export default observer(PurchaseOrder)
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