Commit 7e858c5b authored by 武广's avatar 武广

Merge branch 'feature/after-sales-address' into 'master'

Feature/after sales address

See merge request !70
parents a53c3146 389f8625
const isProduction = process.env.NODE_ENV === 'production'; const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre'; const isPre = process.env.PRE_ENV === 'pre';
const environment = 'yxm2'; const environment = 'xyqb';
const envAPi = { const envAPi = {
api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net', api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net',
kdspOpApi: `https://sc-merchant-api-${environment}.liangkebang.net`, kdspOpApi: `https://sc-merchant-api-${environment}.liangkebang.net`,
......
import React, { useRef } from 'react'; import React, { useRef, useState, useEffect } from 'react';
import { Form } from '@ant-design/compatible'; import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css'; import '@ant-design/compatible/assets/index.css';
import { Modal, Input, Cascader, notification, InputNumber } from 'antd'; import { Modal, Input, Cascader, notification, Select, Button } from 'antd';
import { shopAudit } from '../services'; import { history } from 'umi';
import { shopAudit, afterSalesAddrsPage } from '../services';
import styles from '../index.less'; import styles from '../index.less';
import LogisticsRecordModal from './LogisticsRecordModal'; import LogisticsRecordModal from './LogisticsRecordModal';
...@@ -14,9 +15,12 @@ const AuditModal = props => { ...@@ -14,9 +15,12 @@ const AuditModal = props => {
const { const {
visible, visible,
onCancel, onCancel,
form: { getFieldDecorator, getFieldValue, validateFields, resetFields }, form: { getFieldDecorator, getFieldValue, validateFields, resetFields, setFieldsValue },
formData = {}, formData = {},
} = props; } = props;
const [addrList, setAddrList] = useState([]);
console.log('formData :>> ', formData);
const logisticsRecordModalRef = useRef(); const logisticsRecordModalRef = useRef();
const handleCancel = isSuccess => { const handleCancel = isSuccess => {
resetFields(); resetFields();
...@@ -55,6 +59,10 @@ const AuditModal = props => { ...@@ -55,6 +59,10 @@ const AuditModal = props => {
label: '商品已超过售后期', label: '商品已超过售后期',
value: 7, value: 7,
}, },
{
label: '快递已签收,请申请退货退款,并上传快递面单和商品完好照片',
value: 8,
},
{ {
label: '其他', label: '其他',
value: 3, value: 3,
...@@ -104,6 +112,41 @@ const AuditModal = props => { ...@@ -104,6 +112,41 @@ const AuditModal = props => {
}); });
}; };
const toSetAddr = () => {
history.push('/afterSaleAddress');
};
const onAddrChange = e => {
try {
const obj = JSON.parse(e);
setFieldsValue({
receiveAddress:
obj.provinceName + obj.cityName + obj.countyName + (obj.townName || '') + obj.detail,
receiverName: obj.receiverName,
receiverPhone: obj.receiverTel,
});
} catch {
console.log('解析错误 :>> ', 111);
}
};
const getAddrList = async () => {
const res = await afterSalesAddrsPage();
if (res && res.data && res.data.records && res.data.records.length) {
setAddrList(
res.data.records.map(item => ({
label: item.addressName,
value: JSON.stringify(item),
})),
);
}
};
useEffect(() => {
if (props.visible && addrList.length === 0) {
getAddrList();
}
}, [props.visible]);
const openLogisticsRecord = () => { const openLogisticsRecord = () => {
const { orderNo, skuNo } = formData; const { orderNo, skuNo } = formData;
logisticsRecordModalRef.current.open({ orderNo, skuNo }); logisticsRecordModalRef.current.open({ orderNo, skuNo });
...@@ -121,8 +164,17 @@ const AuditModal = props => { ...@@ -121,8 +164,17 @@ const AuditModal = props => {
<Modal <Modal
title="售后操作确认" title="售后操作确认"
visible={visible} visible={visible}
onOk={() => handleOk()} footer={[
onCancel={() => handleCancel()} +formData.serviceType === 2 && (
<Button type="link" onClick={openLogisticsRecord}>
查看物流
</Button>
),
<Button onClick={handleCancel}>取消</Button>,
<Button type="primary" onClick={handleOk}>
确定
</Button>,
]}
> >
{+formData.serviceType === 1 && ( {+formData.serviceType === 1 && (
<div className={styles.redTip}> <div className={styles.redTip}>
...@@ -154,6 +206,14 @@ const AuditModal = props => { ...@@ -154,6 +206,14 @@ const AuditModal = props => {
</FormItem> </FormItem>
{isAgree() && +formData.serviceType === 2 && ( {isAgree() && +formData.serviceType === 2 && (
<div> <div>
<FormItem label="售后地址">
<div className={styles.saleAddr}>
<Select options={addrList} onChange={onAddrChange} />
<Button type="link" onClick={toSetAddr}>
新建
</Button>
</div>
</FormItem>
<FormItem label="退货地址"> <FormItem label="退货地址">
{getFieldDecorator('receiveAddress', { {getFieldDecorator('receiveAddress', {
initialValue: formData.address, initialValue: formData.address,
...@@ -167,7 +227,14 @@ const AuditModal = props => { ...@@ -167,7 +227,14 @@ const AuditModal = props => {
pattern: /[a-zA-Z0-9_\u4e00-\u9fa5]/g, pattern: /[a-zA-Z0-9_\u4e00-\u9fa5]/g,
}, },
], ],
})(<Input placeholder="最多输入50个字符" maxLength="50" allowClear />)} })(
<TextArea
placeholder="最多输入50个字符"
maxLength="50"
allowClear
autoSize={{ minRows: 3, maxRows: 6 }}
/>,
)}
</FormItem> </FormItem>
<FormItem label="收件人"> <FormItem label="收件人">
{getFieldDecorator('receiverName', { {getFieldDecorator('receiverName', {
...@@ -245,11 +312,6 @@ const AuditModal = props => { ...@@ -245,11 +312,6 @@ const AuditModal = props => {
</FormItem> </FormItem>
)} )}
</Form> </Form>
{+formData.serviceType === 2 && (
<div align="right" style={{ paddingRight: '42px', marginTop: '-25px' }}>
<a onClick={openLogisticsRecord}>查看物流</a>
</div>
)}
</Modal> </Modal>
<LogisticsRecordModal ref={logisticsRecordModalRef} /> <LogisticsRecordModal ref={logisticsRecordModalRef} />
</> </>
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
color: #ff1616; color: #ff1616;
font-weight: bold; font-weight: bold;
} }
.saleAddr {
display: flex;
}
.tab-box { .tab-box {
position: relative; position: relative;
......
...@@ -153,3 +153,19 @@ export function getAfterPendingNum(data) { ...@@ -153,3 +153,19 @@ export function getAfterPendingNum(data) {
data, data,
}); });
} }
// 查询供应商售后地址
export const afterSalesAddrsPage = () => {
const params = {
pageSize: 100,
pageNo: 1,
};
const data = request.post('/api/kdsp/supplier/after-sales-addrs-page', {
prefix: kdspApi,
data: stringify(_.omitBy(params, v => !v)),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
return data;
};
...@@ -142,11 +142,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -142,11 +142,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
)} )}
{!customer.isCard && ( {!customer.isCard && (
<Form.Item <Form.Item name="afterAddressId" label="售后地址">
name="afterAddressId"
label="售后地址"
rules={[{ required: true, message: '请选择售后地址!' }]}
>
<Select showSearch placeholder="请选择售后地址" filterOption={fileterBrandOptions}> <Select showSearch placeholder="请选择售后地址" filterOption={fileterBrandOptions}>
{(afterAddressList || []).map(item => ( {(afterAddressList || []).map(item => (
<Select.Option key={item.id} value={item.id}> <Select.Option key={item.id} value={item.id}>
......
...@@ -368,6 +368,7 @@ const TableList = props => { ...@@ -368,6 +368,7 @@ const TableList = props => {
width: 120, width: 120,
className: 'colStyle', className: 'colStyle',
hideInSearch: true, hideInSearch: true,
hideInTable: props.type !== 2,
render: (_, record) => renderContent(record, 'expressCompanyName'), render: (_, record) => renderContent(record, 'expressCompanyName'),
}, },
{ {
...@@ -377,6 +378,7 @@ const TableList = props => { ...@@ -377,6 +378,7 @@ const TableList = props => {
width: 210, width: 210,
className: 'colStyle', className: 'colStyle',
hideInSearch: true, hideInSearch: true,
hideInTable: props.type !== 2,
render: (_, record) => renderContent(record, 'deliveryNo'), render: (_, record) => renderContent(record, 'deliveryNo'),
}, },
// { // {
...@@ -385,6 +387,7 @@ const TableList = props => { ...@@ -385,6 +387,7 @@ const TableList = props => {
// key: 'action', // key: 'action',
// width: 150, // width: 150,
// hideInSearch: true, // hideInSearch: true,
// hideInTable: props.type !== 2,
// className: 'colStyle', // className: 'colStyle',
// render: (_, record) => renderContent(record, 'action'), // render: (_, record) => renderContent(record, 'action'),
// }, // },
......
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