Commit b57c505e authored by GuanHua's avatar GuanHua

feat:加入进货单添加交易流程判断接口的调用

parent b2869910
import React, { useState } from 'react'
import { EyeOutlined, CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'
import { Row, Col, Space } from 'antd'
import styled from 'styled-components'
import cx from 'classnames'
interface SelectAddressPropsType {
value: any,
dataSource: any
}
const SelectStyles = styled((props) => <div className='select-list' {...props}></div>)`
.select_style_border {
border: 1px solid #EEF0F3;
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 14px;
cursor: pointer;
line-height: 28px;
position:relative;
}
.select_style_border.active {
border: 1px solid #00B382;
}
.select_style_border.active::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid #00B37A;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
`
const SelectAddress: React.FC<SelectAddressPropsType> = (props) => {
const [showMore, setShowMore] = useState<boolean>(false)
let { value = {}, dataSource = [] } = props
if (typeof value === 'number') {
value = dataSource.find(v => v.id === value) || {}
}
// 当前选中的id
const checkedId = value.id || dataSource[0]?.id
const transformData = dataSource
const showDataSource = showMore ? [...transformData].splice(0, 3) : transformData
const handleCheck = (id) => {
}
const toogleMore = () => {
}
return (
<div style={{ width: '100%' }}>
<SelectStyles>
{
showDataSource.map(v => <div key={v.id} onClick={() => handleCheck(v)} className={cx('select_style_border', checkedId === v.id ? 'active' : '')}>
<div>
<Row style={{ color: '#303133' }}>
<Col>{v.receiverName}</Col>
<Col> / </Col>
<Col>{v.phone}</Col>
</Row>
<div style={{ color: '#909399' }}>{v.fullAddress}</div>
</div>
</div>)
}
</SelectStyles>
{transformData.length > 3 &&
<div onClick={toogleMore} style={{ textAlign: 'center', cursor: 'pointer' }}>
显示更多{showMore ? <CaretDownOutlined /> : <CaretUpOutlined />}
</div>
}
</div>
)
}
export default SelectAddress
import React from 'react'
import React, { useState } from 'react'
import InfoList from '../../../../components/InfoList'
import SelectAddress from '../../../../components/SelectAddress'
import styles from './index.less'
interface ReplaceAddressPropsType {
......@@ -8,13 +9,13 @@ interface ReplaceAddressPropsType {
const ReplaceAddress: React.FC<ReplaceAddressPropsType> = (props) => {
const [addressId, setAddressId] = useState<number>()
let detailList = [
{
label: '换货收货地址',
labelClassName: styles.flexStart,
value: <>
133
</>,
value: <SelectAddress value={addressId} dataSource={[]} />,
},
]
......
......@@ -53,11 +53,24 @@ const OrderDetail: React.FC<OrderDetailProps> = (props) => {
form.validateFields().then(values => {
console.log(values, "values")
if (!values.applyAbstract) {
setTabActiveKey('basicInfo')
return
}
}).catch(errors => {
console.log(errors, "errors")
})
}
/**
* 校验必填项
*/
const checkRequiredItem = () => {
}
return (
<>
<Helmet>
......
......@@ -345,16 +345,20 @@ const CommodityDetail = (props) => {
postFn = PublicApi.postSearchShopPurchaseSaveOrUpdatePurchase
break;
}
postFn && postFn(param).then(res => {
clickFlag = true
PublicApi.postOrderDirectPayment({ productId: selectCommodityId }).then(res => {
if (res.code === 1000) {
message.destroy()
setPurchaseCount(res.data)
setAddSuccessVisible(true)
postFn && postFn(param).then(res => {
clickFlag = true
if (res.code === 1000) {
message.destroy()
setPurchaseCount(res.data)
setAddSuccessVisible(true)
}
}).catch(() => {
clickFlag = true
})
}
}).catch(() => {
clickFlag = true
})
}
}
......
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