|
@@ -5,7 +5,7 @@ import { connect } from 'dva';
|
|
|
import { Spin, Badge, Table, Radio, Card, Form, Input, Icon, Button, Select } from 'antd';
|
|
|
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
|
|
|
import ItemSortModal from './modal';
|
|
|
-import { Codes, itemStatuses, tagType } from '../../../utils/config';
|
|
|
+import { Codes, itemStatuses, productType } from '../../../utils/config';
|
|
|
|
|
|
@Form.create()
|
|
|
@connect(state => ({
|
|
@@ -38,7 +38,7 @@ export default class TagDetail extends PureComponent {
|
|
|
const { dispatch } = this.props;
|
|
|
dispatch({
|
|
|
type: 'tagDetail/saveSortResult',
|
|
|
- payload: { itemList: data }
|
|
|
+ payload: { productList: data }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -65,13 +65,13 @@ export default class TagDetail extends PureComponent {
|
|
|
status: Codes.CODE_NORMAL
|
|
|
};
|
|
|
} else if (operType == 'update') {
|
|
|
- const { id, groupId, itemList, name, status } = currentItem;
|
|
|
+ const { id, groupId, productList, name, status } = currentItem;
|
|
|
data = {
|
|
|
id,
|
|
|
groupId,
|
|
|
name,
|
|
|
status,
|
|
|
- itemList: (itemList || []).map(item => item.id),
|
|
|
+ productList: (productList || []).map(item => item.pid),
|
|
|
...getFieldsValue(),
|
|
|
};
|
|
|
}
|
|
@@ -106,29 +106,30 @@ export default class TagDetail extends PureComponent {
|
|
|
const { itemLoading, currentItem, filters, modalVisible } = tagDetail;
|
|
|
const { getFieldDecorator } = form;
|
|
|
const { list } = group;
|
|
|
- const { itemList, name, code, type, groupId } = currentItem;
|
|
|
+ const { productList, name, code, type, groupId } = currentItem;
|
|
|
|
|
|
const itemTableColumns = [{
|
|
|
title: '位置',
|
|
|
dataIndex: 'sort',
|
|
|
key: 'sort',
|
|
|
+ render: (text, _, index) => index + 1,
|
|
|
},{
|
|
|
- title: '商品名称',
|
|
|
+ title: '产品名称',
|
|
|
dataIndex: 'name',
|
|
|
key: 'name',
|
|
|
},{
|
|
|
- title: '商品状态',
|
|
|
+ title: '产品状态',
|
|
|
dataIndex: 'status',
|
|
|
key: 'status',
|
|
|
- render: (text, record) => {
|
|
|
- const statusMap = {[Codes.CODE_SALE]: 'success', [Codes.CODE_DELETE]: 'error'};
|
|
|
- return (<Badge status={statusMap[record.status]} text={itemStatuses[record.status]} />);
|
|
|
+ render: text => {
|
|
|
+ const statusMap = {[Codes.CODE_NORMAL]: 'success', [Codes.CODE_DELETE]: 'error'};
|
|
|
+ return (<Badge status={statusMap[text]} text={itemStatuses[text]} />);
|
|
|
},
|
|
|
},{
|
|
|
- title: '商品类型',
|
|
|
+ title: '产品类型',
|
|
|
dataIndex: 'type',
|
|
|
key: 'type',
|
|
|
- render: (text, record) => (<span>{tagType[record.type]}</span>),
|
|
|
+ render: text => (<span>{productType[text]}</span>),
|
|
|
}];
|
|
|
|
|
|
const formItemLayout = {
|
|
@@ -186,15 +187,15 @@ export default class TagDetail extends PureComponent {
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item label="商品排序" {...formItemLayout}>
|
|
|
- <Button onClick={this.handleModalShow} disabled={!(itemList || []).length} type="primary" size="small" icon="edit">排序</Button>
|
|
|
+ <Button onClick={this.handleModalShow} disabled={!(productList || []).length} type="primary" size="small" icon="edit">排序</Button>
|
|
|
</Form.Item>
|
|
|
<Form.Item wrapperCol={{ offset: 7, span: 12 }}>
|
|
|
<Table
|
|
|
locale={{
|
|
|
emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>
|
|
|
- 该标签下不包含任何商品,无法排序,请先去关联商品吧!</span>
|
|
|
+ 该标签下未上架任何产品,无法排序,请先去上架产品吧!</span>
|
|
|
}}
|
|
|
- dataSource={itemList}
|
|
|
+ dataSource={productList || []}
|
|
|
columns={itemTableColumns}
|
|
|
rowKey={record => record.id}
|
|
|
bordered
|
|
@@ -207,7 +208,7 @@ export default class TagDetail extends PureComponent {
|
|
|
</Form.Item>
|
|
|
</Form>
|
|
|
<ItemSortModal
|
|
|
- itemList={itemList || []}
|
|
|
+ itemList={productList || []}
|
|
|
rowKeyName="id"
|
|
|
modalVisible={modalVisible}
|
|
|
onCancel={this.handleModalCancel}
|