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

fix: 处理商品批量下架问题,处理新增b2b订单非物流方式隐藏交付地址/物流方式显示异常

parent 7b363ccc
...@@ -479,7 +479,14 @@ const Products: React.FC<{}> = () => { ...@@ -479,7 +479,14 @@ const Products: React.FC<{}> = () => {
title: `确定要执行批量${type==='3'?'上架':'下架'}操作?`, title: `确定要执行批量${type==='3'?'上架':'下架'}操作?`,
icon: <ExclamationCircleOutlined />, icon: <ExclamationCircleOutlined />,
onOk() { onOk() {
clickUp(type==='3'?1:0, null) if(type === '3') {
clickUp(1, null)
} else {
PublicApi.postProductCommodityOffPublishCommodityBatch({idList: currentRef.current}).then(res => {
ref.current.reload()
setSelectedRowKeys([])
})
}
}, },
okType: type==='3'?'primary':'danger', okType: type==='3'?'primary':'danger',
onCancel() { onCancel() {
......
...@@ -10,8 +10,8 @@ export const AddressPop = (props) => { ...@@ -10,8 +10,8 @@ export const AddressPop = (props) => {
<Row> <Row>
<div> <div>
<h3><EnvironmentOutlined/> 自提地址</h3> <h3><EnvironmentOutlined/> 自提地址</h3>
<p>{pickInfo.receiver} / {pickInfo.phone}</p> <p>{pickInfo.receiver || pickInfo.shipperName} / {pickInfo.phone}</p>
<p>{pickInfo.address}</p> <p>{pickInfo.receiver ? pickInfo.address : `${pickInfo.provinceName}${pickInfo.cityName}${pickInfo.districtName}${pickInfo.address}`}</p>
</div> </div>
</Row> </Row>
}> }>
......
...@@ -81,25 +81,19 @@ export const filterProductDataById = (data, targetData) => { ...@@ -81,25 +81,19 @@ export const filterProductDataById = (data, targetData) => {
next.category = next.category || next.customerCategoryName next.category = next.category || next.customerCategoryName
next.unit = next.unit || next.unitName next.unit = next.unit || next.unitName
next.productName = next.productName || next.name next.productName = next.productName || next.name
next.deliverType = next.logistics.sendAddress // 保证和详情编辑字段一致
// if (logistics.deliveryType === 2) {
// const { code, data } = await PublicApi.getLogisticsShipperAddressGet({
// id: logistics.sendAddress
// }, { ttl: 60 * 1000, useCache: true })
// logistics.render = code === 1000 ? <AddressPop pickInfo={data}>{DELIVERY_TYPE[logistics.deliveryType]}</AddressPop> : DELIVERY_TYPE[logistics.deliveryType]
// } else {
// logistics.render = DELIVERY_TYPE[logistics.deliveryType]
// }
if (logistics.deliveryType === 2 && logistics.sendAddress) { if (logistics.deliveryType === 2 && logistics.sendAddress) {
const { code, data } = await PublicApi.getLogisticsShipperAddressGet({ const { code, data } = await PublicApi.getLogisticsShipperAddressGet({
id: logistics.sendAddress id: logistics.sendAddress
}, { ttl: 60 * 1000, useCache: true }) }, { ttl: 60 * 1000, useCache: true })
logistics.render = data logistics.render = {...data, deliverType: logistics.deliveryType}
} else { } else {
logistics.render = DELIVERY_TYPE[logistics.deliveryType] logistics.render = DELIVERY_TYPE[logistics.deliveryType]
} }
// 配送方式外置, 用于接口字段冗余 // 配送方式外置, 用于接口字段冗余
next.deliveryType = logistics.deliveryType next.deliverType = logistics.deliveryType
// id 存在集合中, 采用target中的数据, 否则采用data中的数据 // id 存在集合中, 采用target中的数据, 否则采用data中的数据
const findResult = data.find(v => v.id === next.id) const findResult = data.find(v => v.id === next.id)
......
...@@ -351,15 +351,16 @@ export const productInfoColumns: any[] = [ ...@@ -351,15 +351,16 @@ export const productInfoColumns: any[] = [
// 接口调用 // 接口调用
{ {
title: '配送方式', title: '配送方式',
dataIndex: 'logistics', dataIndex: 'deliverType',
align: 'center', align: 'center',
key: 'logistics', key: 'deliverType',
render: (t, r) => { render: (t, r) => {
if(r.logistics === 1) console.log(r, 'rr')
if(t === 1)
return "物流(默认)" return "物流(默认)"
else if(r.logistics === 2) else if(t === 2)
return <AddressPop pickInfo={t}>{DELIVERY_TYPE[t]}</AddressPop> return <AddressPop pickInfo={r.logistics.render}>自提</AddressPop>
else if(r.logistics === 3) else if(t === 3)
return "无需配送" return "无需配送"
} }
}, },
......
...@@ -87,7 +87,12 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor ...@@ -87,7 +87,12 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
const shopId = ctx.getFieldValue('shopId') const shopId = ctx.getFieldValue('shopId')
const products = value.map(item => ({ productId: item.commodityId, skuId: item.productId })) const products = value.map(item => ({ productId: item.commodityId, skuId: item.productId }))
if(shopId && products?.length) { if(shopId && products?.length) {
console.log(value) // 判断不存在物流 隐藏交付地址
if(!value.some(item => item.logistics.deliveryType === 1)) {
ctx.setFieldState('deliveryAddresId', state => state.visible = false )
} else {
ctx.setFieldState('deliveryAddresId', state => state.visible = true )
}
fetchOrderApi.getPayInfoList({ fetchOrderApi.getPayInfoList({
products: products, products: products,
memberId: productItem?.memberId, memberId: productItem?.memberId,
......
...@@ -254,22 +254,24 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -254,22 +254,24 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
} }
// 交付地址数据字段转换拼接 查询省市区冗余 // 交付地址数据字段转换拼接 查询省市区冗余
const { data: addressDetail} = await PublicApi.getLogisticsReceiverAddressGet({ if(params?.deliveryAddresId) {
id: params.deliveryAddresId?.id || params.deliveryAddresId const { data: addressDetail} = await PublicApi.getLogisticsReceiverAddressGet({
}) id: params.deliveryAddresId?.id || params.deliveryAddresId
params.consignee = { })
deliverDate: params.deliverDate, params.consignee = {
consigneeId: addressDetail.id, deliverDate: params.deliverDate,
consignee: addressDetail.receiverName, consigneeId: addressDetail.id,
provinceCode: addressDetail.provinceCode, consignee: addressDetail.receiverName,
cityCode: addressDetail.cityCode, provinceCode: addressDetail.provinceCode,
districtCode: addressDetail.districtCode, cityCode: addressDetail.cityCode,
address: addressDetail.address, districtCode: addressDetail.districtCode,
postalCode: addressDetail.postalCode, address: addressDetail.address,
countryCode: addressDetail.areaCode, postalCode: addressDetail.postalCode,
phone: addressDetail.phone, countryCode: addressDetail.areaCode,
telephone: addressDetail.tel, phone: addressDetail.phone,
defaultConsignee: !!addressDetail.isDefault, telephone: addressDetail.tel,
defaultConsignee: !!addressDetail.isDefault,
}
} }
// 其他需求 // 其他需求
......
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