Commit bf73abb5 authored by 武广's avatar 武广

fix: 修改售后地址信息

parent 63018594
const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre';
const environment = 'yxm2';
const environment = 'yxm';
const envAPi = {
api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.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 '@ant-design/compatible/assets/index.css';
import { Modal, Input, Cascader, notification, InputNumber } from 'antd';
import { shopAudit } from '../services';
import { Modal, Input, Cascader, notification, Select, Button } from 'antd';
import { history } from 'umi';
import { shopAudit, afterSalesAddrsPage } from '../services';
import styles from '../index.less';
import LogisticsRecordModal from './LogisticsRecordModal';
......@@ -14,9 +15,12 @@ const AuditModal = props => {
const {
visible,
onCancel,
form: { getFieldDecorator, getFieldValue, validateFields, resetFields },
form: { getFieldDecorator, getFieldValue, validateFields, resetFields, setFieldsValue },
formData = {},
} = props;
const [addrList, setAddrList] = useState([]);
console.log('formData :>> ', formData);
const logisticsRecordModalRef = useRef();
const handleCancel = isSuccess => {
resetFields();
......@@ -55,6 +59,10 @@ const AuditModal = props => {
label: '商品已超过售后期',
value: 7,
},
{
label: '快递已签收,请申请退货退款,并上传快递面单和商品完好照片',
value: 8,
},
{
label: '其他',
value: 3,
......@@ -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 { orderNo, skuNo } = formData;
logisticsRecordModalRef.current.open({ orderNo, skuNo });
......@@ -154,6 +197,14 @@ const AuditModal = props => {
</FormItem>
{isAgree() && +formData.serviceType === 2 && (
<div>
<FormItem label="售后地址">
<div className={styles.saleAddr}>
<Select options={addrList} onChange={onAddrChange} />
<Button type="link" onClick={toSetAddr}>
新建
</Button>
</div>
</FormItem>
<FormItem label="退货地址">
{getFieldDecorator('receiveAddress', {
initialValue: formData.address,
......
......@@ -30,6 +30,9 @@
color: #ff1616;
font-weight: bold;
}
.saleAddr {
display: flex;
}
.tab-box {
position: relative;
......
......@@ -153,3 +153,19 @@ export function getAfterPendingNum(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;
};
......@@ -148,11 +148,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
)}
{!customer.isCard && (
<Form.Item
name="afterAddressId"
label="售后地址"
rules={[{ required: true, message: '请选择售后地址!' }]}
>
<Form.Item name="afterAddressId" label="售后地址">
<Select showSearch placeholder="请选择售后地址" filterOption={fileterBrandOptions}>
{(afterAddressList || []).map(item => (
<Select.Option key={item.id} value={item.id}>
......
......@@ -361,24 +361,24 @@ const TableList = props => {
hideInSearch: true,
width: 350,
},
{
title: '物流公司',
dataIndex: 'expressCompanyName',
key: 'expressCompanyName',
width: 120,
className: 'colStyle',
hideInSearch: true,
render: (_, record) => renderContent(record, 'expressCompanyName'),
},
{
title: '物流单号',
dataIndex: 'deliveryNo',
key: 'deliveryNo',
width: 210,
className: 'colStyle',
hideInSearch: true,
render: (_, record) => renderContent(record, 'deliveryNo'),
},
// {
// title: '物流公司',
// dataIndex: 'expressCompanyName',
// key: 'expressCompanyName',
// width: 120,
// className: 'colStyle',
// hideInSearch: true,
// render: (_, record) => renderContent(record, 'expressCompanyName'),
// },
// {
// title: '物流单号',
// dataIndex: 'deliveryNo',
// key: 'deliveryNo',
// width: 210,
// className: 'colStyle',
// hideInSearch: true,
// render: (_, record) => renderContent(record, 'deliveryNo'),
// },
// {
// title: '物流信息',
// dataIndex: '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