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

fix: 处理副单位选择异常

parent d3577472
......@@ -733,9 +733,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
value={assistUnitValue}
defaultActiveFirstOption={false}
filterOption={false}
onSearch={handleUnitSearch}
onSearch={handleAssistUnitSearch}
onChange={(value,option)=>handleAssistUnitChange(value, option)}
onFocus={()=>handleUnitSearch(null)}
onFocus={()=>handleAssistUnitSearch(null)}
notFoundContent={null}
style={{width:'100%'}}
>
......
......@@ -44,44 +44,45 @@ const ParameterSetting: React.FC<{}> = () => {
}, [])
useEffect(() => {
// if(autoReceiveVisible) {
// // 重组 配置配送时段数据
// PublicApi.getOrderParamGetDeliveryTime().then(res => {
// const { data } = res
// setShopLists(() => [...shopLists].map(item => {
// const filterData = data.filter(_item => _item.shopId === item.shopId)
// if(filterData.length) {
// return {
// ...item,
// ...filterData[0]
// }
// } else {
// return {...item}
// }
// }))
// })
// } else {
// 重组 自动确认数据和商城列表数据
PublicApi.getOrderParamGetReceiverDay().then(res => {
const { data } = res
setShopLists(() => [...shopLists].map(item => {
const filterData = data.filter(_item => _item.shopId === item.shopId)
if(filterData.length) {
return {
...item,
...filterData[0]
}
} else {
return {...item}
let fn = null;
if(autoReceiveVisible) {
// 自动确认收货
fn = PublicApi.getOrderParamGetReceiverDay
} else if(forcastTimeVisible) {
// 预约时长
fn = PublicApi.getOrderParamGetAppointmentDay
} else if(expressTimeVisible) {
fn = PublicApi.getOrderParamGetDeliveryTime
}
fn && fn().then(res => {
const { data } = res
setShopLists(() => [...shopLists].map(item => {
const filterData = data.filter(_item => _item.shopId === item.shopId)
if(filterData.length) {
return {
...item,
...filterData[0],
paramList: expressTimeVisible ? filterData[0]['paramList'].map(param => {
return {
timeRange: [moment(param.startTime, 'HH:mm:ss'), moment(param.endTime, 'HH:mm:ss')]
}
}) : []
}
} else {
return {
...item,
days: null,
status: 0
}
}
}))
})
}, [autoReceiveVisible, forcastTimeVisible, expressTimeVisible])
}))
})
// }
}, [autoReceiveVisible, forcastTimeVisible])
useEffect(() => {
console.log(shopLists)
}, [shopLists])
const handleVisibleModalType = (id) => {
if(id === 1) {
......@@ -137,6 +138,7 @@ const ParameterSetting: React.FC<{}> = () => {
}
const onValuesChange = (changeValue, values, index) => {
console.log(changeValue, values, index)
setShopLists(() => [...shopLists].map(item => {
if(item.id === index) {
return {
......@@ -160,29 +162,25 @@ const ParameterSetting: React.FC<{}> = () => {
const handleSubmit = async (type?) => {
console.log(shopLists, 'shopLists')
let codeNumber = null
setConfirmLoading(true)
if(type === 'autoReceive') {
const { code } = await PublicApi.postOrderParamUpdateReceiverDay([...shopLists])
if(code === 1000) {
setAutoReceiveVisible(false)
setForcastTimeVisible(false)
setExpressTimeVisible(false)
}
codeNumber = code
} else if(type === 'forcastTime') {
const { code } = await PublicApi.postOrderParamUpdateAppointmentDay([...shopLists])
if(code === 1000) {
setAutoReceiveVisible(false)
setForcastTimeVisible(false)
setExpressTimeVisible(false)
}
codeNumber = code
} else if(type === 'timeLine') {
// const { code } = await PublicApi.postOrderParamUpdateDeliveryTime({ shopLists : [...shopLists] })
// if(code === 1000) {
// setAutoReceiveVisible(false)
// setForcastTimeVisible(false)
// setExpressTimeVisible(false)
// }
console.log(shopLists, 'shop')
const { code } = await PublicApi.postOrderParamUpdateDeliveryTime([...shopLists])
codeNumber = code
}
setConfirmLoading(false)
if(codeNumber === 1000) {
setAutoReceiveVisible(false)
setForcastTimeVisible(false)
setExpressTimeVisible(false)
}
setConfirmLoading(false)
}
const onChange = () => {}
......@@ -272,7 +270,7 @@ const ParameterSetting: React.FC<{}> = () => {
shopLists.map(item => (<Card style={{marginBottom: 16}} key={item.id}>
<div className={cx(styles.cardMain, styles.cardBodyMain)}>
<p><img src={item.logoUrl} alt={item.name} /><span>{item.name}</span></p>
<Switch defaultChecked={!!item.status} onChange={(v) => onChangeReceiveStatus(v, item.id)} />
<Switch defaultChecked={!!item.status} checked={!!item.status} onChange={(v) => onChangeReceiveStatus(v, item.id)} />
</div>
{ !!item.status ? <p className={styles.receiveDay}><span>收货天数:</span><InputNumber onChange={(v) => onChangeReceiveDays(v, item.id)} value={item.days} /></p> : null }
</Card>))
......@@ -303,7 +301,7 @@ const ParameterSetting: React.FC<{}> = () => {
shopLists.map(item => (<Card style={{marginBottom: 16}} key={item.id}>
<div className={cx(styles.cardMain, styles.cardBodyMain)}>
<p><img src={item.logoUrl} alt={item.name} /><span>{item.name}</span></p>
<Switch defaultChecked={!!item.status} onChange={(v) => onChangeReceiveStatus(v, item.id)} />
<Switch defaultChecked={!!item.status} checked={!!item.status} onChange={(v) => onChangeReceiveStatus(v, item.id)} />
</div>
{ !!item.status ? <p className={styles.receiveDay}><span>预约时长(天):</span><InputNumber onChange={(v) => onChangeReceiveDays(v, item.id)} value={item.days} /></p> : null }
</Card>))
......@@ -334,12 +332,12 @@ const ParameterSetting: React.FC<{}> = () => {
shopLists.map(item => (<Card style={{marginBottom: 16}} key={item.id}>
<div className={cx(styles.cardMain, styles.cardBodyMain)}>
<p><img src={item.logoUrl} alt={item.name} /><span>{item.name}</span></p>
<Switch defaultChecked={!!item.status} onChange={(v) => onChangeReceiveStatus(v, item.id)} />
<Switch defaultChecked={!!item.status} checked={!!item.status} onChange={(v) => onChangeReceiveStatus(v, item.id)} />
</div>
{
!!item.status ?
<div className={styles.deadLine}>
<Form name="express_time_line_form" autoComplete="off" onValuesChange={(c, v) => onValuesChange(c, v, item.id)}>
<Form name="express_time_line_form" autoComplete="off" onValuesChange={(c, v) => onValuesChange(c, v, item.id)} initialValues={{deadLine: item.paramList}}>
<Form.List name="deadLine">
{(fields, { add, remove }) => (
<>
......
import React, { useState, useRef, useCallback } from 'react'
import { Card, Button, Modal, Row, Col, message, Dropdown, Menu } from 'antd'
import { Card, Button, Modal, Row, Col, message } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
......@@ -18,6 +18,7 @@ import ModalForm from '@/components/ModalForm'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import TableOperation from '@/components/TableOperation'
import { ORDER_TYPE_POINTS } from '@/constants/order'
import axios from 'axios'
const SelectStyles = styled((props) => <div className='select-list' {...props}></div>)`
.select_style_border {
......@@ -80,6 +81,12 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
{ id: 2, name: "退货"},
{ id: 3, name: "维修"},
])
const [fetchParams, setFetchParams] = useState<any>()
const loadingTableData = (params) => {
setFetchParams(params)
return fetchTableData(params)
}
// 售后唤起弹窗
const handleSaleAfter = ({ orderId, orderType }) => {
......@@ -178,12 +185,32 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
}
}
const controllerBtns = <Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
const handleExport = async () => {
const downloadLink = document.createElement('a')
// const data = await PublicApi.getOrderBuyerExport({...fetchParams}, {extendsOptions: { responseType: "blob" }})
const data = await axios.get('/order/buyer/export', {
params: {...fetchParams},
headers: {
"Content-Type": "application/vnd.ms-excel;charset=UTF-8"
},
responseType: 'blob'
})
// @ts-ignore
let blob = new Blob([data], {type: 'application/vnd.ms-excel'})
downloadLink.style.display = 'none';
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = '采购订单列表.xls'
document.body.appendChild(downloadLink)
downloadLink.click()
document.body.removeChild(downloadLink)
}
const controllerBtns = <Button style={{width: 140}} onClick={handleExport} type='default'>导出</Button>
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
fetchTableData={params => loadingTableData(params)}
columns={secondColumns()}
currentRef={ref}
controlRender={
......
......@@ -49,7 +49,7 @@ export const fetchOrderApi = {
/** 查看状态正常的会员服务消费者列表 */
async getMemberConsumeLists(params) {
const { data } = await PublicApi.getMemberManageLowerConsumerMemberPage(params)
const { data } = await PublicApi.getMemberManageOrderAgentMembers(params)
return data
},
......
......@@ -358,8 +358,7 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
const handleMemberSearch = (value) => {
if(value) {
fetchOrderApi.getMemberConsumeLists({ name: value }).then(res => {
const { data } = res
fetchOrderApi.getMemberConsumeLists({ name: value }).then(data => {
addSchemaAction.setFieldState('buyerMemberId', state => {
state.props.enum = data.map(item => ({
...item,
......
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