Commit 1f80ea46 authored by beisir's avatar beisir

fix: 更新二级规格修改

parent 30a4c555
...@@ -3,12 +3,11 @@ const isProduction = process.env.NODE_ENV === 'production'; ...@@ -3,12 +3,11 @@ const isProduction = process.env.NODE_ENV === 'production';
let envAPi = { let envAPi = {
api: '//backstms-test1.liangkebang.net', api: '//backstms-test1.liangkebang.net',
kdspOpApi: 'https://kdsp-operation-test1.liangkebang.net', kdspOpApi: 'https://kdsp-operation-test1.liangkebang.net',
// kdspApi: 'http://192.168.28.107:7000',
kdspApi: 'https://sc-op-api-test1.liangkebang.net', kdspApi: 'https://sc-op-api-test1.liangkebang.net',
goodsApi: 'https://sc-op-api-test1.liangkebang.net',
prologueDomain: 'https://prologue-test1.liangkebang.net', prologueDomain: 'https://prologue-test1.liangkebang.net',
qiniuHost: 'https://appsync.lkbang.net', qiniuHost: 'https://appsync.lkbang.net',
opapiHost: 'https://opapi-test1.liangkebang.net', opapiHost: 'https://opapi-test1.liangkebang.net',
// opapiHost: 'http://192.168.29.45:7000',
}; };
let prodApi = { let prodApi = {
...@@ -16,6 +15,7 @@ let prodApi = { ...@@ -16,6 +15,7 @@ let prodApi = {
kdspOpApi: '//kdsp-operation.q-gp.com', kdspOpApi: '//kdsp-operation.q-gp.com',
prologueDomain: '//prologue.q-gp.com', prologueDomain: '//prologue.q-gp.com',
kdspApi: '//sc-op-api.q-gp.com', kdspApi: '//sc-op-api.q-gp.com',
goodsApi: 'https://sc-merchant-api.q-gp.com',
qiniuHost: 'https://appsync.lkbang.net', qiniuHost: 'https://appsync.lkbang.net',
opapiHost: 'https://opapi.xyqb.com', opapiHost: 'https://opapi.xyqb.com',
}; };
......
import { Modal, Button, Row, Col } from 'antd';
import React, { Component } from 'react';
import styles from '../style.less';
// eslint-disable-next-line react/prefer-stateless-function
class imgModal extends Component {
state = {
imgModal: false,
selectImg: '',
};
render() {
const { visible, data = [] } = this.props;
const { detailImageList = [], skuSpecImageList = [] } = data;
return (
<Modal
title="图片素材"
visible={visible}
footer={null}
onCancel={this.props.onCancel}
width="700px"
>
<div>
{skuSpecImageList.map(skuImg => (
<Row type="flex" justify="start" align="middle">
<Col span={4}>{`滑动图${skuImg.colorSpecValue || ''}:`}</Col>
<Col span={20}>
{skuImg.skuSpecImageList.map(item => (
<img
onClick={() => {
this.setState({ imgModal: true, selectImg: item });
}}
key={item}
width={200}
alt=""
src={item}
style={{ margin: 5 }}
></img>
))}
</Col>
</Row>
))}
<Row type="flex" justify="start" align="middle">
<Col span={4}>{detailImageList.length ? '详情图:' : ''}</Col>
<Col span={20}>
{detailImageList.map(item => (
<img
onClick={() => {
this.setState({ imgModal: true, selectImg: item });
}}
key={item}
width={200}
alt=""
src={item}
style={{ margin: 5 }}
></img>
))}
</Col>
</Row>
</div>
<Button type="primary" onClick={this.props.onCancel} className={styles.logBtn}>
取消
</Button>
<Modal
title="图片详情"
visible={this.state.imgModal}
footer={null}
onCancel={() => this.setState({ imgModal: false })}
width="800px"
>
<img width="700px" src={this.state.selectImg} alt=""></img>
</Modal>
</Modal>
);
}
}
export default imgModal;
...@@ -103,7 +103,7 @@ const LogModal = props => { ...@@ -103,7 +103,7 @@ const LogModal = props => {
return ( return (
<Modal title="日志详情" visible={visible} footer={null} onCancel={bundleOnCancel} width="800px"> <Modal title="日志详情" visible={visible} footer={null} onCancel={bundleOnCancel} width="800px">
<Tabs type="card" onChange={bundleOnTabChange} activeKey={tabActiveKey}> <Tabs type="card" onChange={bundleOnTabChange} activeKey={tabActiveKey}>
<Tabs.TabPane tab="订单详情" key="0"> <Tabs.TabPane tab="商品详情" key="0">
<Table <Table
dataSource={tableData.records} dataSource={tableData.records}
bordered bordered
......
...@@ -3,7 +3,7 @@ import React, { Component } from 'react'; ...@@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import styles from '../style.less'; import styles from '../style.less';
import { stateList } from '../staticdata'; import { stateList } from '../staticdata';
import { batchPushedOrOffline, offline, uploadFile, importJdSkus } from '../service'; import { uploadFile } from '../service';
const FormItem = Form.Item; const FormItem = Form.Item;
const { Option } = Select; const { Option } = Select;
...@@ -30,44 +30,10 @@ class goodsManage extends Component { ...@@ -30,44 +30,10 @@ class goodsManage extends Component {
this.props.onReset(); this.props.onReset();
}; };
onConfirm = async isOffline => {
const data = isOffline
? await offline(this.props.selectedRowKeys)
: await batchPushedOrOffline({
ids: this.props.selectedRowKeys.join(),
type: 2,
productState: 6,
offlineReason: '',
});
if (data.businessCode !== '0000') {
this.props.onLoad(data.error);
} else {
this.props.onLoad(null);
}
};
addSpu = () => { addSpu = () => {
this.props.addSpu(); this.props.addSpu();
}; };
addVirtualSpu = () => {
this.props.addVirtualSpu();
};
importSkus = async (info, type) => {
const result = await importJdSkus(info.file, type);
if (result.businessCode === '0000') {
this.handleSearch();
notification.success({
message: '商品上传成功',
});
} else {
notification.warning({
message: result.msg,
});
}
};
render() { render() {
const { const {
form: { getFieldDecorator, getFieldValue }, form: { getFieldDecorator, getFieldValue },
...@@ -165,8 +131,7 @@ class goodsManage extends Component { ...@@ -165,8 +131,7 @@ class goodsManage extends Component {
icon="download" icon="download"
ghost ghost
onClick={() => { onClick={() => {
window.location.href = window.location.href = 'https://kdspstatic.q-gp.com/批量修改库存模板.xlsx';
'https://kdspstatic.q-gp.com/批量修改库存模板.xlsx';
}} }}
> >
模版 模版
......
import { Modal, Table, Button } from 'antd';
import React, { Component } from 'react';
import styles from '../style.less';
class DetailModal extends Component {
getColumns = (firstSpe, secondSpe, type) => {
const arr = [
{
title: '供应商',
dataIndex: 'supplierName',
key: 'supplierName',
align: 'center',
width: 50,
render: (val, row) => {
const obj = {
children: val,
props: {},
};
if (row.listLength) {
obj.props.rowSpan = row.listLength;
} else {
obj.props.rowSpan = 0;
}
return obj;
},
},
];
if (firstSpe) {
arr.push({
title: firstSpe,
dataIndex: 'firstSpecValue',
key: 'firstSpecValue',
align: 'center',
width: 50,
render: (val, row) => {
const obj = {
children: val,
props: {},
};
if (row.length) {
obj.props.rowSpan = row.length;
} else {
obj.props.rowSpan = 0;
}
return obj;
},
});
}
if (secondSpe) {
arr.push({
title: secondSpe,
align: 'center',
key: 'secondSpecValue',
dataIndex: 'secondSpecValue',
width: 50,
});
}
const newTable = arr.concat([
{
title: '供应商编码',
align: 'center',
key: 'supplierCode',
dataIndex: 'supplierCode',
width: 50,
},
{
title: '库存',
align: 'center',
key: 'stock',
dataIndex: 'stock',
width: 50,
},
{
title: '供货价',
align: 'center',
key: 'supplyPrice',
dataIndex: 'supplyPrice',
width: 50,
},
{
title: '市场价',
align: 'center',
key: 'marketPrice',
dataIndex: 'marketPrice',
width: 50,
},
{
title: '国际编码',
align: 'center',
key: 'thirdSkuNo',
dataIndex: 'thirdSkuNo',
width: 50,
},
]);
if (type === 1) {
newTable.splice(newTable.length - 1, 0, {
title: '重量(kg)',
align: 'center',
key: 'weight',
dataIndex: 'weight',
width: 90,
});
}
return newTable;
};
updateStatus = (row, productState) => {
this.props.updateStatus(row, productState);
};
dataInit = list => {
const obj = {};
let finialList = [];
list.map(item => {
obj[item.firstSpecValue] = [];
return obj;
});
list.map(item => obj[item.firstSpecValue].push(item));
const keys = Object.keys(obj);
// eslint-disable-next-line no-return-assign
keys.map(key => {
obj[key].forEach((i, index) => {
if (index === 0) {
i.length = obj[key].length;
}
});
finialList = finialList.concat(obj[key]);
return finialList;
});
if (finialList.length) {
finialList[0].listLength = finialList.length;
}
return finialList;
};
render() {
const { visible, data = [], type } = this.props;
const initdata = this.dataInit(data);
const firstName = data.length ? data[0].firstSpec : '';
const secondName = data.length ? data[0].secondSpec : '';
return (
<Modal
title="供货详情"
visible={visible}
footer={null}
onCancel={this.props.onCancel}
width="900px"
>
<Table
dataSource={initdata}
bordered
columns={this.getColumns(firstName, secondName, type)}
rowKey="id"
pagination={false}
scroll={{ x: '100%' }}
/>
<Button type="primary" onClick={this.props.onCancel} className={styles.logBtn}>
关闭
</Button>
</Modal>
);
}
}
export default DetailModal;
import { Modal, InputNumber, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import { updatePrice } from '../service';
import styles from './style.less';
export default function UpdatePrice(props) {
const [visible, setVisible] = useState(props.visible);
const [supplyPrice, setSupplyPrice] = useState(props.info.supplyPrice);
const [marketPrice, setMarketPrice] = useState(props.info.marketPrice);
// const [salePrice, setSalePrice] = useState(props.info.salePrice);
useEffect(() => {
setVisible(props.visible);
setSupplyPrice(props.info.supplyPrice);
setMarketPrice(props.info.marketPrice);
// setSalePrice(props.info.salePrice);
}, [props]);
const submit = async () => {
if (!supplyPrice || !marketPrice) {
notification.error({ message: '价格不可为空!' });
return;
}
const error = await updatePrice({
// salePrice,
supplyPrice,
marketPrice,
id: props.info.id,
supplierId: props.info.supplierId,
});
if (!error) {
notification.success({ message: '修改成功' });
props.onCancel('success');
}
};
return (
<Modal
title="修改价格"
visible={visible}
onCancel={() => props.onCancel()}
onOk={submit}
width={400}
>
<div className={styles.center}>
供货价:
<InputNumber
min={0}
precision={2}
value={supplyPrice}
onChange={value => setSupplyPrice(value)}
className={styles.inputNW}
/>
<br />
<br />
市场价:
<InputNumber
min={0}
precision={2}
value={marketPrice}
onChange={value => setMarketPrice(value)}
className={styles.inputNW}
/>
<br />
<br />
{/* 销售价:
<InputNumber
min={0}
precision={2}
value={salePrice}
onChange={value => setSalePrice(value)}
className={styles.inputNW}
/> */}
</div>
</Modal>
);
}
.inputNW {
width: 200px;
}
.center {
text-align: center;
}
import { Modal, InputNumber, notification, Form, Input, Radio } from 'antd'; import { Modal, InputNumber, notification, Form, Input, Radio } from 'antd';
import React from 'react'; import React from 'react';
import { updateStock } from '../service'; import { updateStock } from '../service';
import styles from '../UpdatePrice/style.less';
const UpdateStock = props => { const UpdateStock = props => {
const { getFieldDecorator, validateFields, resetFields, getFieldValue } = props.form; const { getFieldDecorator, validateFields, resetFields, getFieldValue } = props.form;
...@@ -64,14 +63,7 @@ const UpdateStock = props => { ...@@ -64,14 +63,7 @@ const UpdateStock = props => {
{ validator: validatorCallback, message: '减库存,输入库存数不可大于可售库存!' }, { validator: validatorCallback, message: '减库存,输入库存数不可大于可售库存!' },
], ],
validateTrigger: ['onSubmit'], validateTrigger: ['onSubmit'],
})( })(<InputNumber min={0} precision={0} placeholder="请输入库存" style={{ width: 200 }} />)}
<InputNumber
min={0}
precision={0}
placeholder="请输入库存"
className={styles.inputNW}
/>,
)}
</Form.Item> </Form.Item>
<Form.Item label="变更原因:"> <Form.Item label="变更原因:">
{getFieldDecorator('changeReason', { {getFieldDecorator('changeReason', {
......
...@@ -476,12 +476,8 @@ class goodsManage extends Component { ...@@ -476,12 +476,8 @@ class goodsManage extends Component {
const filterOption = (input, op) => op.props.children.includes(input); const filterOption = (input, op) => op.props.children.includes(input);
// ---------------------驳回编辑规格时候,过滤掉colors中为null的数据--------------------- // ---------------------驳回编辑规格时候,过滤掉colors中为null的数据---------------------
if (isEdit) { if (isEdit && !initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
if (!initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) { colorKeys = colorKeys.length > 1 ? colorKeys.filter(item => item !== 'null') : colorKeys;
if (colorKeys.length > 1) {
colorKeys = colorKeys.filter(item => item !== 'null');
}
}
} }
return ( return (
<Modal <Modal
......
...@@ -76,12 +76,11 @@ export function createNewList(first, second, firstSpecId, secondSpecId) { ...@@ -76,12 +76,11 @@ export function createNewList(first, second, firstSpecId, secondSpecId) {
// 缺少一级和二级规格时生成的编辑表格 // 缺少一级和二级规格时生成的编辑表格
list.push(sku); list.push(sku);
} }
console.log(list);
return list; return list;
} }
export function createEditData(values, initData) { export function createEditData(values, initData) {
console.log(values); // console.log(values);
let list = null; let list = null;
const first = values.first?.filter(item => item && !item.match(/^[ ]*$/)) || []; const first = values.first?.filter(item => item && !item.match(/^[ ]*$/)) || [];
const second = const second =
...@@ -103,7 +102,6 @@ export function createEditData(values, initData) { ...@@ -103,7 +102,6 @@ export function createEditData(values, initData) {
if (!isFirstSame && !isSecondSame) { if (!isFirstSame && !isSecondSame) {
if (!initData.id) { if (!initData.id) {
list = createNewList(first, second, values.firstSpecId, values.secondSpecId); list = createNewList(first, second, values.firstSpecId, values.secondSpecId);
// this.setState({ editData: list });
} else { } else {
const list1 = first.length const list1 = first.length
? createNewList(first, initData.secondSpecList, values.firstSpecId, values.secondSpecId) ? createNewList(first, initData.secondSpecList, values.firstSpecId, values.secondSpecId)
...@@ -111,42 +109,43 @@ export function createEditData(values, initData) { ...@@ -111,42 +109,43 @@ export function createEditData(values, initData) {
const list2 = second.length const list2 = second.length
? createNewList(newFirst, second, values.firstSpecId, values.secondSpecId) ? createNewList(newFirst, second, values.firstSpecId, values.secondSpecId)
: []; : [];
// console.log('list1===========>', list1); // console.log('list1=================>', list1);
// console.log('list2===========>', list2); // console.log('list2=================>', list2);
console.log('initData===========>', initData); // console.log('initData===========>', initData);
// console.log('first===========>', first);
// console.log('second===========>', second);
// 初次添加规格时没有选择规格,添加一条没有规格的商品,被驳回之后编辑时选择规格之后需要重新创建 // 初次添加规格时没有选择规格,添加一条没有规格的商品,被驳回之后编辑时选择规格之后需要重新创建
// 编辑时回显时的id需要给重新创建的数据第一条加上 回显的id // 编辑时回显时的id需要给重新创建的数据第一条加上 回显的id
if (!initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) { if (!initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
list = createNewList(first, second, values.firstSpecId, values.secondSpecId); // 这种情况出现时items中只有一条数据,且没有一级规格和二级规格
// 这种情况出现时items中只有一条数据
// 第一次无规格时,重新生成的数据,必须保留第一条数据的id是items里面第一条数据的id // 第一次无规格时,重新生成的数据,必须保留第一条数据的id是items里面第一条数据的id
list = createNewList(first, second, values.firstSpecId, values.secondSpecId);
list[0].id = initData.editData[0].id; list[0].id = initData.editData[0].id;
} else if (initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) { } else if (initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
console.log('只有一级规格================>'); // console.log('只有一级规格================>');
console.log(first); // 只有一级规格的情况下需要
console.log(second); // 重新更具规格创建表格,但是需要把历史记录赋值给表格的其中几项
list = createNewList( // 其中新建的记录和历史编辑记录
const createList = createNewList(
[...initData.firstSpecList, ...first], [...initData.firstSpecList, ...first],
second, second,
values.firstSpecId, values.firstSpecId,
values.secondSpecId, values.secondSpecId,
); );
const setp = createList.length / initData.firstSpecList.concat(first).length;
// const editObject = initData.editData.concat(list1).reduce((itemObject, item) => { list = createList.map((item, index) => {
// itemObject[item.firstSpecValue] = item; if (index % setp === 0) {
// return itemObject; const newItem =
// }, {}); initData.editData.find(val => val.firstSpecValue === item.firstSpecValue) || {};
// const newList = createNewList([...initData.firstSpecList, ...first], second, values.firstSpecId, values.secondSpecId); item = Object.assign({}, item, newItem, {
// list = newList.map(item => { secondSpec: initData.secondSpecName,
// console.log(initData.firstSpecList, item.firstSpecValue, editObject); secondSpecId: item.secondSpecId,
// if (Object.keys(editObject).includes(item.firstSpecValue)) { secondSpecValue: item.secondSpecValue,
// item = Object.assign({}, editObject[item.firstSpecValue], item); length: setp,
// delete editObject[item.firstSpecValue]; });
// console.log('============>拼装', editObject, editObject[item.firstSpecValue]); }
// } return item;
// return item; });
// });
console.log(list);
} else { } else {
list = sortBy(initData.editData.concat(list1.concat(list2)), item => item.firstSpecValue); list = sortBy(initData.editData.concat(list1.concat(list2)), item => item.firstSpecValue);
} }
......
...@@ -6,21 +6,11 @@ import { sortBy } from 'lodash'; ...@@ -6,21 +6,11 @@ import { sortBy } from 'lodash';
import styles from './style.less'; import styles from './style.less';
import LocalStroage from '@/utils/localStorage'; import LocalStroage from '@/utils/localStorage';
import configApi from '../../../config/env.config'; import configApi from '../../../config/env.config';
import UpdatePrice from './UpdatePrice';
import UpdateStock from './UpdateStock'; import UpdateStock from './UpdateStock';
import { import { spuDetail, categoryList, getVirtualCategory } from './service';
update,
spuDetail,
detail,
batchPushedOrOffline,
categoryList,
getVirtualCategory,
} from './service';
import LogModal from './LogModal'; import LogModal from './LogModal';
import CreateModal from './createModal'; import CreateModal from './createModal';
import SupplyModal from './SupplyModal';
import ReasonModal from './reasonModal';
import { column, JDSHOPID } from './staticdata'; import { column, JDSHOPID } from './staticdata';
import SearchForm from './SearchForm'; import SearchForm from './SearchForm';
...@@ -37,18 +27,11 @@ class goodsManage extends Component { ...@@ -37,18 +27,11 @@ class goodsManage extends Component {
priceInfo: {}, priceInfo: {},
logVisible: false, logVisible: false,
previewVisible: false, previewVisible: false,
supplyVisible: false,
createVisible: false, // 新增or编辑普通商品modal createVisible: false, // 新增or编辑普通商品modal
offlineVisible: false,
selectedParams: {},
detailData: [],
detailSpuId: '',
selectedRowKeys: [], selectedRowKeys: [],
updatePriceVisible: false,
updateStockVisible: false, updateStockVisible: false,
initData: {}, initData: {},
createloading: false, createloading: false,
type: 1,
}; };
currentLog = null; currentLog = null;
...@@ -63,17 +46,6 @@ class goodsManage extends Component { ...@@ -63,17 +46,6 @@ class goodsManage extends Component {
this.getVirtualCategory(); this.getVirtualCategory();
} }
openOffline = (ids, type, productState) => {
const obj = { ids, type, productState };
this.setState({ selectedParams: obj });
this.setState({ offlineVisible: true });
};
showSupply = async (id, type) => {
const { data } = await detail({ id });
this.setState({ supplyVisible: true, detailData: data, type });
};
handleSearch = page => { handleSearch = page => {
const currentPage = this.state.pageNo; const currentPage = this.state.pageNo;
this.setState( this.setState(
...@@ -175,11 +147,6 @@ class goodsManage extends Component { ...@@ -175,11 +147,6 @@ class goodsManage extends Component {
} }
}; };
onUpdate = async updateData => {
const [, error] = await update(updateData);
this.onLoad(error);
};
onLoad = error => { onLoad = error => {
if (!error) { if (!error) {
notification.success({ message: '操作成功' }); notification.success({ message: '操作成功' });
...@@ -197,24 +164,6 @@ class goodsManage extends Component { ...@@ -197,24 +164,6 @@ class goodsManage extends Component {
}); });
}; };
updateStatus = async (ids, productState, offlineReason, fromDetail) => {
const data = await batchPushedOrOffline({
ids,
productState,
offlineReason,
});
if (data.businessCode === '0000') {
this.handleSearch();
notification.success({
message: productState === 6 ? '上架成功' : '下架成功',
});
this.setState({ offlineVisible: false });
if (fromDetail) {
this.showDetail(this.state.detailSpuId);
}
}
};
audit = skuId => { audit = skuId => {
this.setState({ this.setState({
previewVisible: true, previewVisible: true,
...@@ -224,11 +173,6 @@ class goodsManage extends Component { ...@@ -224,11 +173,6 @@ class goodsManage extends Component {
}); });
}; };
offLine = (ids, productState) => {
const obj = { ids, productState };
this.setState({ offlineVisible: true, selectedParams: obj });
};
filterShopList = (list = [], isEdit) => filterShopList = (list = [], isEdit) =>
list.filter(item => isEdit || !JDSHOPID.includes(item.id)); list.filter(item => isEdit || !JDSHOPID.includes(item.id));
...@@ -248,8 +192,6 @@ class goodsManage extends Component { ...@@ -248,8 +192,6 @@ class goodsManage extends Component {
let visible = {}; let visible = {};
if (isStock) { if (isStock) {
visible = { updateStockVisible: true }; visible = { updateStockVisible: true };
} else {
visible = { updatePriceVisible: true };
} }
this.setState({ this.setState({
...visible, ...visible,
...@@ -267,7 +209,7 @@ class goodsManage extends Component { ...@@ -267,7 +209,7 @@ class goodsManage extends Component {
}; };
cancel = query => { cancel = query => {
this.setState({ updatePriceVisible: false, updateStockVisible: false }); this.setState({ updateStockVisible: false });
if (query) { if (query) {
this.handleSearch(); this.handleSearch();
} }
...@@ -298,13 +240,6 @@ class goodsManage extends Component { ...@@ -298,13 +240,6 @@ class goodsManage extends Component {
goodsManage: { tableData = {} }, goodsManage: { tableData = {} },
} = this.props; } = this.props;
const { pageNo, pageSize, selectedRowKeys } = this.state; const { pageNo, pageSize, selectedRowKeys } = this.state;
// const rowSelection = {
// selectedRowKeys,
// onChange: this.onSelectChange,
// getCheckboxProps: record => ({
// disabled: +record.state === 6, // Column configuration not to be checked
// }),
// };
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Spin spinning={this.state.createloading}> <Spin spinning={this.state.createloading}>
...@@ -330,7 +265,6 @@ class goodsManage extends Component { ...@@ -330,7 +265,6 @@ class goodsManage extends Component {
rowKey={record => record.skuId} rowKey={record => record.skuId}
pagination={false} pagination={false}
className={styles.tabletop} className={styles.tabletop}
// rowSelection={rowSelection}
scroll={{ x: '100%', y: 500 }} scroll={{ x: '100%', y: 500 }}
/> />
</Spin> </Spin>
...@@ -385,30 +319,7 @@ class goodsManage extends Component { ...@@ -385,30 +319,7 @@ class goodsManage extends Component {
treeData={this.state.treeData} treeData={this.state.treeData}
virtualTreeData={this.state.virtualTreeData} virtualTreeData={this.state.virtualTreeData}
></CreateModal> ></CreateModal>
<SupplyModal
data={this.state.detailData}
visible={this.state.supplyVisible}
type={this.state.type}
onCancel={() => {
this.setState({ supplyVisible: false });
}}
></SupplyModal>
<ReasonModal
visible={this.state.offlineVisible}
submit={reason => {
const { ids, productState } = this.state.selectedParams;
this.updateStatus(ids, productState, reason);
}}
onCancel={() => {
this.setState({ offlineVisible: false });
}}
></ReasonModal>
<UpdatePrice
visible={this.state.updatePriceVisible}
info={this.state.priceInfo}
onCancel={this.cancel}
/>
<UpdateStock <UpdateStock
visible={this.state.updateStockVisible} visible={this.state.updateStockVisible}
info={this.state.priceInfo} info={this.state.priceInfo}
......
...@@ -26,20 +26,6 @@ const Model = { ...@@ -26,20 +26,6 @@ const Model = {
}, },
}); });
}, },
*getDataList({ payload }, { call, put, all }) {
const [[shopList], [statusList]] = yield all([
yield call(api.shopList, payload),
yield call(api.statusList, payload),
]);
if (!shopList && !statusList) return;
yield put({
type: 'dataList',
payload: {
shopList,
statusList,
},
});
},
*categoryList({ payload }, { call, put }) { *categoryList({ payload }, { call, put }) {
const [data] = yield call(api.categoryList, payload.value); const [data] = yield call(api.categoryList, payload.value);
if (!data) return; if (!data) return;
......
import { Modal, Input, notification } from 'antd';
import React, { Component } from 'react';
const { TextArea } = Input;
// eslint-disable-next-line react/prefer-stateless-function
class reasonModal extends Component {
state = {
remarks: '',
};
inputChange = ({ target: { value } }) => {
this.setState({ remarks: value });
};
onCancel = () => {
this.setState({ remarks: '' });
this.props.onCancel();
};
submit = () => {
if (!this.state.remarks) {
notification.error({
message: '请输入下架原因',
});
return;
}
this.props.submit(this.state.remarks);
this.setState({ remarks: '' });
};
render() {
const { visible } = this.props;
return (
<Modal
title="下架原因"
visible={visible}
onOk={this.submit}
onCancel={() => this.onCancel()}
width="700px"
>
<div>
<TextArea value={this.state.remarks} rows={4} onChange={this.inputChange} />
</div>
</Modal>
);
}
}
export default reasonModal;
...@@ -4,16 +4,14 @@ import config from '../../../config/env.config'; ...@@ -4,16 +4,14 @@ import config from '../../../config/env.config';
import { stringify } from 'qs'; import { stringify } from 'qs';
import _ from 'lodash'; import _ from 'lodash';
const { kdspApi } = config; const { goodsApi } = config;
// const kdspApi = 'http://yapi.quantgroups.com/mock/389';
// 分页查询所有数据
const headers = { const headers = {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
}; };
export async function searchList(params) { export async function searchList(params) {
return request.post('/product/api/merchant/page', { return request.post('/product/api/merchant/page', {
prefix: kdspApi, prefix: goodsApi,
data: stringify(_.omitBy(params, v => !v)), data: stringify(_.omitBy(params, v => !v)),
headers, headers,
role: true, role: true,
...@@ -23,7 +21,7 @@ export async function searchList(params) { ...@@ -23,7 +21,7 @@ export async function searchList(params) {
// 新增商品 // 新增商品
export async function addGoods(params) { export async function addGoods(params) {
return request.post('/product/api/merchant/add', { return request.post('/product/api/merchant/add', {
prefix: kdspApi, prefix: goodsApi,
data: params, data: params,
}); });
} }
...@@ -32,28 +30,22 @@ export async function addGoods(params) { ...@@ -32,28 +30,22 @@ export async function addGoods(params) {
export async function editGoods(params) { export async function editGoods(params) {
return request.post('/product/api/merchant/edit', { return request.post('/product/api/merchant/edit', {
prefix: kdspApi, prefix: goodsApi,
data: params, data: params,
}); });
} }
// 供应商列表
export async function getSupplierList() {
return request.post('/channel/supplier/list', {
prefix: kdspApi,
});
}
// 获取商品品牌 // 获取商品品牌
export async function getBrandList() { export async function getBrandList() {
return request.post('/product/brand/api/merchant/list', { return request.post('/product/brand/api/merchant/list', {
prefix: kdspApi, prefix: goodsApi,
}); });
} }
// 编辑--获取详情 // 编辑--获取详情
export async function spuDetail(params) { export async function spuDetail(params) {
return request.post('/product/api/merchant/detail', { return request.post('/product/api/merchant/detail', {
prefix: kdspApi, prefix: goodsApi,
params, params,
headers, headers,
}); });
...@@ -62,7 +54,7 @@ export async function spuDetail(params) { ...@@ -62,7 +54,7 @@ export async function spuDetail(params) {
// 商品规格 // 商品规格
export async function getSpecList() { export async function getSpecList() {
return request.post('/product/spec/api/merchant/list', { return request.post('/product/spec/api/merchant/list', {
prefix: kdspApi, prefix: goodsApi,
}); });
} }
...@@ -70,23 +62,15 @@ export async function getSpecList() { ...@@ -70,23 +62,15 @@ export async function getSpecList() {
export async function getImageInfo(spuNo) { export async function getImageInfo(spuNo) {
return request.post('/product/api/merchant/imageInfo', { return request.post('/product/api/merchant/imageInfo', {
params: { spuNo }, params: { spuNo },
prefix: kdspApi, prefix: goodsApi,
headers, headers,
}); });
} }
// 状态
export async function statusList() {
return request.post('/api/kdsp/op/mch_sku/status_list');
}
// 商品来源
export async function skuSource() {
return request.post('/api/kdsp/sku/sku-info/getSkuSource');
}
// 商品分类 // 商品分类
export async function categoryList() { export async function categoryList() {
return request.post('/product/category/api/merchant/getAll', { return request.post('/product/category/api/merchant/getAll', {
prefix: kdspApi, prefix: goodsApi,
}); });
} }
...@@ -94,78 +78,30 @@ export async function categoryList() { ...@@ -94,78 +78,30 @@ export async function categoryList() {
export async function uploadFile(file) { export async function uploadFile(file) {
const params = new FormData(); const params = new FormData();
params.append('file', file); params.append('file', file);
// const data = await request.post('/product/item/batchUpdate', {
const data = await request.post('/product/api/merchant/BatchUpdateStock', { const data = await request.post('/product/api/merchant/BatchUpdateStock', {
prefix: kdspApi, prefix: goodsApi,
data: params, data: params,
notTip: true, notTip: true,
}); });
return data; return data;
} }
// 批量倒入京东skus
export async function importJdSkus(file, sourceType) {
const params = new FormData();
params.append('file', file);
params.append('sourceType', sourceType);
const data = await request.post('/product/importJdSkus', {
data: params,
prefix: kdspApi,
// rawData: true,
});
return data;
}
// 批量上架
export async function pushed(data) {
return request.post('/api/kdsp/op/mch_sku/pushed', data);
}
// 批量下架
export async function offline(data) {
return request.post('/api/kdsp/op/mch_sku/offline', data);
}
// 最新批量上下架
export async function batchPushedOrOffline(data) {
return request.post('/product/pushedOrOffline/batch', {
prefix: kdspApi,
data: stringify(_.omitBy(data, v => !v)),
headers,
});
}
// 商品修改
export async function update(params) {
return request.post('/api/kdsp/op/mch_sku/update', params, {
emulateJSON: true,
});
}
// 商品修改日志 // 商品修改日志
export async function changeLog(params) { export async function changeLog(params) {
return request.post('/product/logs/api/merchant/page', { return request.post('/product/logs/api/merchant/page', {
data: stringify(_.omitBy(params, v => !v)), data: stringify(_.omitBy(params, v => !v)),
prefix: kdspApi, prefix: goodsApi,
headers, headers,
}); });
} }
// 审核详情日志
export async function productMerchantLog(productId) { export async function productMerchantLog(productId) {
return request.get('/product/api/merchant/auditLog', { return request.get('/product/api/merchant/auditLog', {
params: { params: {
productId, productId,
}, },
prefix: kdspApi, prefix: goodsApi,
});
}
// 商品详情
export async function detail(params) {
return request.post('/product/supply/list', {
data: stringify(_.omitBy(params, v => !v)),
prefix: kdspApi,
headers,
}); });
} }
...@@ -173,50 +109,27 @@ export async function detail(params) { ...@@ -173,50 +109,27 @@ export async function detail(params) {
export async function getJdPicList(params) { export async function getJdPicList(params) {
const { data } = await request.post('/product/api/merchant/item/getJdPicList', { const { data } = await request.post('/product/api/merchant/item/getJdPicList', {
data: stringify(_.omitBy(params, v => !v)), data: stringify(_.omitBy(params, v => !v)),
prefix: kdspApi, prefix: goodsApi,
headers, headers,
}); });
return data; return data;
} }
// 添加商品
export async function addSku(params) {
const [, error] = await request.post('/api/kdsp/op/mch_sku/add_sku', params);
return error;
}
// 修改商品
export async function updateSku(params) {
const [, error] = await request.post('/api/kdsp/op/mch_sku/update', params);
return error;
}
// 图片上传 // 图片上传
export async function uploadImg(files) { export async function uploadImg(files) {
const params = new FormData(); const params = new FormData();
files.forEach(file => params.append('file', file)); files.forEach(file => params.append('file', file));
const data = await request.post('/image/api/merchant/upload', { const data = await request.post('/image/api/merchant/upload', {
prefix: kdspApi, prefix: goodsApi,
data: params, data: params,
}); });
return data; return data;
} }
// 修改商品价格
export async function updatePrice(params) {
const data = await request.post('/product/item/updatePrice', {
prefix: kdspApi,
data: stringify(_.omitBy(params, v => !v)),
headers,
});
if (data.businessCode === '0000') {
return null;
}
return data.msg;
}
// 修改商品库存 // 修改商品库存
export async function updateStock(params) { export async function updateStock(params) {
const data = await request.post('/product/item/api/merchant/updateStock', { const data = await request.post('/product/item/api/merchant/updateStock', {
prefix: kdspApi, prefix: goodsApi,
data: stringify(_.omitBy(params, v => !v)), data: stringify(_.omitBy(params, v => !v)),
headers, headers,
}); });
...@@ -229,7 +142,7 @@ export async function updateStock(params) { ...@@ -229,7 +142,7 @@ export async function updateStock(params) {
// 获取虚拟商品类目 // 获取虚拟商品类目
export async function getVirtualCategory() { export async function getVirtualCategory() {
const data = await request.post('/product/category/api/merchant/getByParentId', { const data = await request.post('/product/category/api/merchant/getByParentId', {
prefix: kdspApi, prefix: goodsApi,
data: stringify(_.omitBy({ id: 100018 }, v => !v)), data: stringify(_.omitBy({ id: 100018 }, v => !v)),
headers, headers,
}); });
......
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