|
@@ -1,5 +1,5 @@
|
|
|
import React, { PureComponent } from 'react';
|
|
|
-import { Divider, Modal, Table, Form, Card, Button, Tag } from 'antd';
|
|
|
+import { Divider, Popover, Modal, Table, Form, Card, Button, Tag, Icon } from 'antd';
|
|
|
import { connect } from 'dva';
|
|
|
import { routerRedux } from 'dva/router';
|
|
|
import queryString from 'query-string';
|
|
@@ -8,7 +8,7 @@ import FooterToolbar from '../../../components/FooterToolbar';
|
|
|
import DescriptionList from '../../../components/DescriptionList';
|
|
|
import NewPriceModal from './price';
|
|
|
import TagSelectModal from './tags';
|
|
|
-import { pageSize, productType, Codes } from '../../../utils/config';
|
|
|
+import { pageSize, productType, Codes, ossHost } from '../../../utils/config';
|
|
|
|
|
|
const { Description } = DescriptionList;
|
|
|
const confirm = Modal.confirm;
|
|
@@ -20,6 +20,200 @@ const confirm = Modal.confirm;
|
|
|
tagModel: state.tagModel,
|
|
|
}))
|
|
|
export default class MerchantProductEdit extends PureComponent {
|
|
|
+ handleProductDetail = (data) => {
|
|
|
+ const lessonTableColumns = [{
|
|
|
+ title: '课编号',
|
|
|
+ dataIndex: 'code',
|
|
|
+ key: 'code',
|
|
|
+ width: '40%',
|
|
|
+ },{
|
|
|
+ title: '课名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name',
|
|
|
+ width: '60%',
|
|
|
+ }];
|
|
|
+ const supportTableColumns = [{
|
|
|
+ title: '配套编号',
|
|
|
+ dataIndex: 'code',
|
|
|
+ key: 'code',
|
|
|
+ width: '40%',
|
|
|
+ },{
|
|
|
+ title: '配套名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name',
|
|
|
+ width: '60%',
|
|
|
+ }];
|
|
|
+ const imgTableColumns = [{
|
|
|
+ title: '位置',
|
|
|
+ dataIndex: 'sort',
|
|
|
+ key: 'sort',
|
|
|
+ render: (text, record, index) => index + 1,
|
|
|
+ },{
|
|
|
+ title: '缩略图',
|
|
|
+ dataIndex: 'path',
|
|
|
+ key: 'path',
|
|
|
+ render: (text, record) => (
|
|
|
+ <Popover
|
|
|
+ content={<img alt="" src={`${ossHost}/${text}`} width={350} />}
|
|
|
+ title={record.name}
|
|
|
+ >
|
|
|
+ <img alt="" src={`${ossHost}/${text}`} width={70} />
|
|
|
+ </Popover>
|
|
|
+ ),
|
|
|
+ }];
|
|
|
+ const comboTableColumns = [{
|
|
|
+ title: '编号',
|
|
|
+ dataIndex: 'code',
|
|
|
+ key: 'code',
|
|
|
+ width: '30%',
|
|
|
+ },{
|
|
|
+ title: '名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name',
|
|
|
+ width: '40%',
|
|
|
+ },{
|
|
|
+ title: '类型',
|
|
|
+ dataIndex: 'type',
|
|
|
+ key: 'type',
|
|
|
+ render: (text, record) => productType[text],
|
|
|
+ width: '30%',
|
|
|
+ }];
|
|
|
+ if (!data) {
|
|
|
+ return '暂无数据';
|
|
|
+ } else if (data.type === Codes.CODE_COURSE) {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <DescriptionList size="large" col={2}>
|
|
|
+ <Description term="课程编号">{data.code}</Description>
|
|
|
+ <Description term="课程名称">{data.name}</Description>
|
|
|
+ <Description term="课程简介">{data.digest}</Description>
|
|
|
+ <Description term="课程详情">{data.detail}</Description>
|
|
|
+ <Description term="课程子标题">{data.subTitle}</Description>
|
|
|
+ <Description term="面包屑导航">{data.breadCrumb}</Description>
|
|
|
+ <Description term="课程封面图片">
|
|
|
+ {!data.coverUrl ? null :
|
|
|
+ <Card
|
|
|
+ hoverable
|
|
|
+ bordered
|
|
|
+ cover={<img alt="" src={data.coverUrl.startsWith('http') ? data.coverUrl : `${ossHost}/${data.coverUrl}`} />}
|
|
|
+ style={{ width: 200 }}
|
|
|
+ >
|
|
|
+ </Card>}
|
|
|
+ </Description>
|
|
|
+ <Description term="课程背景图片">
|
|
|
+ {!data.bgUrl ? null :
|
|
|
+ <Card
|
|
|
+ hoverable
|
|
|
+ bordered
|
|
|
+ cover={<img alt="" src={data.bgUrl.startsWith('http') ? data.bgUrl : `${ossHost}/${data.bgUrl}`} />}
|
|
|
+ style={{ width: 200 }}
|
|
|
+ >
|
|
|
+ </Card>}
|
|
|
+ </Description>
|
|
|
+ <Description term="课程内课列表">
|
|
|
+ <Table
|
|
|
+ locale={{
|
|
|
+ emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>
|
|
|
+ 该课程下不包含任何课!</span>
|
|
|
+ }}
|
|
|
+ dataSource={data.subItemList || []}
|
|
|
+ columns={lessonTableColumns}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ bordered
|
|
|
+ pagination={false}
|
|
|
+ />
|
|
|
+ </Description>
|
|
|
+ <Description term="相关配套列表">
|
|
|
+ <Table
|
|
|
+ locale={{
|
|
|
+ emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>
|
|
|
+ 该课程无任何相关配套!</span>
|
|
|
+ }}
|
|
|
+ dataSource={data.supportList || []}
|
|
|
+ columns={supportTableColumns}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ bordered
|
|
|
+ pagination={false}
|
|
|
+ />
|
|
|
+ </Description>
|
|
|
+ </DescriptionList>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ } else if (data.type === Codes.CODE_SUPPORT) {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <DescriptionList size="large" col={2}>
|
|
|
+ <Description term="配套编号">{data.code}</Description>
|
|
|
+ <Description term="配套名称">{data.name}</Description>
|
|
|
+ <Description term="配套简介">{data.digest}</Description>
|
|
|
+ <Description term="配套详情">{data.detail}</Description>
|
|
|
+ </DescriptionList>
|
|
|
+ <DescriptionList size="large" col={1}>
|
|
|
+ <Description term="配套封面图片">
|
|
|
+ {!data.coverUrl ? null :
|
|
|
+ <img
|
|
|
+ alt=""
|
|
|
+ src={data.coverUrl.startsWith('http') ? data.coverUrl : `${ossHost}/${data.coverUrl}`}
|
|
|
+ style={{ width: 200 }}
|
|
|
+ />
|
|
|
+ }
|
|
|
+ </Description>
|
|
|
+ </DescriptionList>
|
|
|
+ <DescriptionList size="large" col={2} style={{ marginTop: 20 }}>
|
|
|
+ <Description term="配套图片列表">
|
|
|
+ <Table
|
|
|
+ locale={{
|
|
|
+ emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>
|
|
|
+ 该配套不包含任何图片!</span>
|
|
|
+ }}
|
|
|
+ dataSource={(data.imgList || []).map((item,index) => ({ id: index, path: item }))}
|
|
|
+ columns={imgTableColumns}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ bordered
|
|
|
+ pagination={false}
|
|
|
+ />
|
|
|
+ </Description>
|
|
|
+ <Description term="相关配套列表">
|
|
|
+ <Table
|
|
|
+ locale={{
|
|
|
+ emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>
|
|
|
+ 该配套无任何相关配套!</span>
|
|
|
+ }}
|
|
|
+ dataSource={data.supportList || []}
|
|
|
+ columns={supportTableColumns}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ bordered
|
|
|
+ pagination={false}
|
|
|
+ />
|
|
|
+ </Description>
|
|
|
+ </DescriptionList>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <DescriptionList size="large" col={1}>
|
|
|
+ <Description term="课程包编号">{data.code}</Description>
|
|
|
+ <Description term="课程包名称">{data.name}</Description>
|
|
|
+ <Description term="课程包内容">
|
|
|
+ <Table
|
|
|
+ simple
|
|
|
+ bordered
|
|
|
+ columns={comboTableColumns}
|
|
|
+ dataSource={data.products || []}
|
|
|
+ pagination={false}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ locale={{
|
|
|
+ emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>
|
|
|
+ 该课程包内暂无相关内容!</span>
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Description>
|
|
|
+ </DescriptionList>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
handleAddPriceClick = () => {
|
|
|
this.props.dispatch({
|
|
@@ -154,7 +348,7 @@ export default class MerchantProductEdit extends PureComponent {
|
|
|
|
|
|
render(){
|
|
|
const { mproductDetail, goodsModel, tagModel, location } = this.props;
|
|
|
- const { currentItem } = mproductDetail;
|
|
|
+ const { currentItem, productItem } = mproductDetail;
|
|
|
const { modalShow, tagModalShow, operation, goodsItem } = goodsModel;
|
|
|
const { list, listLoading, pagination } = tagModel;
|
|
|
const { goods, tags, type, code, name, merchantName } = currentItem;
|
|
@@ -226,13 +420,7 @@ export default class MerchantProductEdit extends PureComponent {
|
|
|
bordered={false}
|
|
|
title="详情"
|
|
|
style={{ marginBottom: 15 }}
|
|
|
- >
|
|
|
- <DescriptionList size="large" col={2} style={{ marginBottom: 32 }}>
|
|
|
- <Description term="商品编号">{code}</Description>
|
|
|
- <Description term="商品名称">{name}</Description>
|
|
|
- <Description term="商品类型">{productType[type]}</Description>
|
|
|
- <Description term="渠道名称">{merchantName}</Description>
|
|
|
- </DescriptionList>
|
|
|
+ >{this.handleProductDetail(productItem)}
|
|
|
</Card>
|
|
|
<Card
|
|
|
bordered={false}
|