|
@@ -8,6 +8,7 @@ import Selector from '../../../components/AXTableSelector/Selector';
|
|
|
import AXDragSortTable from '../../../components/AXDragSortTable';
|
|
|
import FooterToolbar from '../../../components/FooterToolbar';
|
|
|
import { renderStatus, statusToBool, boolToStatus, renderProductType } from '../../../utils/utils';
|
|
|
+import { Hotax } from '../../../utils/config';
|
|
|
import styles from './PersonalizeEdit.less';
|
|
|
|
|
|
const formItemLayout = {
|
|
@@ -29,6 +30,7 @@ const formItemLayout = {
|
|
|
shelves,
|
|
|
terminal,
|
|
|
tagType,
|
|
|
+ loading,
|
|
|
sLoading: loading.models.shelves,
|
|
|
tLoading: loading.models.tagType,
|
|
|
mtLoading: loading.models.tag,
|
|
@@ -62,6 +64,11 @@ export default class PersonalizeEditPage extends Component {
|
|
|
type: 'terminal/fetchTerminalRecommendCourse',
|
|
|
payload: { uid: this.state.uid },
|
|
|
});
|
|
|
+ // 加载全部
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'tagType/fetchTagTypeList',
|
|
|
+ payload: { pageSize: 1000 },
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -238,7 +245,7 @@ export default class PersonalizeEditPage extends Component {
|
|
|
handleUserTagSubmit = () => {
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
if (!err) {
|
|
|
- const { name, status } = values;
|
|
|
+ const { sort, name, status } = values;
|
|
|
const { uid } = this.state;
|
|
|
const { terminal } = this.props;
|
|
|
const { currentUserTagItem } = terminal;
|
|
@@ -248,12 +255,12 @@ export default class PersonalizeEditPage extends Component {
|
|
|
if (!id) {
|
|
|
this.props.dispatch({
|
|
|
type: 'terminal/createTerminalTagItem',
|
|
|
- payload: { uid, name, typeCode, status: newStatus, productList: pidList },
|
|
|
+ payload: { sort, uid, name, typeCode, status: newStatus, productList: pidList },
|
|
|
});
|
|
|
} else {
|
|
|
this.props.dispatch({
|
|
|
type: 'terminal/updateTerminalTagItem',
|
|
|
- payload: { id, uid, name, typeCode, status: newStatus, productList: pidList },
|
|
|
+ payload: { id, sort, uid, name, typeCode, status: newStatus, productList: pidList },
|
|
|
});
|
|
|
}
|
|
|
this.setState({ tagModalDestroy: true });
|
|
@@ -295,32 +302,44 @@ export default class PersonalizeEditPage extends Component {
|
|
|
recModalDestroy,
|
|
|
merchantTagModalDestroy,
|
|
|
} = this.state;
|
|
|
- const { sLoading, tLoading, mtLoading, terminal, shelves, tagType, tag, form } = this.props;
|
|
|
+ const {
|
|
|
+ sLoading, tLoading, mtLoading, loading, terminal, shelves, tagType, tag, form,
|
|
|
+ } = this.props;
|
|
|
const { getFieldDecorator } = form;
|
|
|
const { userTagList, userRecCourse, currentUserTagItem } = terminal;
|
|
|
- const { name, status, productList, typeCode, typeName } = currentUserTagItem;
|
|
|
+ const { sort, name, status, productList, typeCode, typeName } = currentUserTagItem;
|
|
|
|
|
|
// 用户标签列表表头
|
|
|
const tagColumns = [{
|
|
|
+ title: '标签位置',
|
|
|
+ dataIndex: 'sort',
|
|
|
+ width: '10%',
|
|
|
+ }, {
|
|
|
title: '标签名称',
|
|
|
dataIndex: 'name',
|
|
|
- key: 1,
|
|
|
- width: '30%',
|
|
|
+ width: '25%',
|
|
|
}, {
|
|
|
title: '标签类型',
|
|
|
dataIndex: 'typeCode',
|
|
|
- key: 2,
|
|
|
- width: '30%',
|
|
|
+ width: '25%',
|
|
|
+ filters: (tagType.list || []).map(item => ({ text: item.name, value: item.code })),
|
|
|
+ onFilter: (value, record) => record.typeCode.indexOf(value) === 0,
|
|
|
}, {
|
|
|
title: '标签状态',
|
|
|
dataIndex: 'status',
|
|
|
- key: 3,
|
|
|
width: '15%',
|
|
|
render: text => renderStatus(text),
|
|
|
+ filters: [{
|
|
|
+ text: '正常',
|
|
|
+ value: Hotax.STATUS_NORMAL,
|
|
|
+ }, {
|
|
|
+ text: '删除',
|
|
|
+ value: Hotax.STATUS_DELETE,
|
|
|
+ }],
|
|
|
+ onFilter: (value, record) => record.status === value,
|
|
|
align: 'center',
|
|
|
}, {
|
|
|
title: '操作',
|
|
|
- key: 4,
|
|
|
width: '25%',
|
|
|
align: 'right',
|
|
|
render: (_, record) => (
|
|
@@ -411,6 +430,7 @@ export default class PersonalizeEditPage extends Component {
|
|
|
dataSource={tagTypeData}
|
|
|
columns={tagTypeColumns}
|
|
|
className={styles.tagTable}
|
|
|
+ onChange={this.handleUserTagTableChange}
|
|
|
/>
|
|
|
</Card>
|
|
|
);
|
|
@@ -476,6 +496,13 @@ export default class PersonalizeEditPage extends Component {
|
|
|
<Input placeholder="请输入" />
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
+ <Form.Item hasFeedback label="标签位置" {...formItemLayout}>
|
|
|
+ {getFieldDecorator('sort', {
|
|
|
+ initialValue: sort,
|
|
|
+ })(
|
|
|
+ <Input placeholder="请输入" />
|
|
|
+ )}
|
|
|
+ </Form.Item>
|
|
|
<Form.Item label="标签类型" {...formItemLayout}>
|
|
|
<Button
|
|
|
disabled={tagTypeSelecting}
|
|
@@ -620,11 +647,12 @@ export default class PersonalizeEditPage extends Component {
|
|
|
<Button onClick={() => this.handleUserTagModalShow()} style={{ float: 'right' }} type="primary">新建标签</Button>
|
|
|
</div>
|
|
|
}
|
|
|
+ loading={loading.effects['terminal/fetchTerminalTagList']}
|
|
|
style={{ marginBottom: 16 }}
|
|
|
className={styles.tagCard}
|
|
|
>
|
|
|
<Table
|
|
|
- pagination={false}
|
|
|
+ pagination={{ pageSize: 15 }}
|
|
|
dataSource={userTagList}
|
|
|
columns={tagColumns}
|
|
|
rowKey={record => record.id}
|
|
@@ -640,6 +668,7 @@ export default class PersonalizeEditPage extends Component {
|
|
|
<Button onClick={this.handleUserRecModalShow} style={{ float: 'right' }} type="primary">更换课程</Button>
|
|
|
</div>
|
|
|
}
|
|
|
+ loading={loading.effects['terminal/fetchTerminalRecommendCourse']}
|
|
|
style={{ marginBottom: 70 }}
|
|
|
className={styles.tagCard}
|
|
|
>
|