|
@@ -1,7 +1,8 @@
|
|
/* eslint-disable no-trailing-spaces */
|
|
/* eslint-disable no-trailing-spaces */
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
import { connect } from 'dva';
|
|
import { connect } from 'dva';
|
|
-import { Card, Modal, Form, Table, List, Steps, Select, Button, Input, InputNumber, Icon } from 'antd';
|
|
|
|
|
|
+import { Tooltip, Card, Modal, Form, Table, List, Steps, Select, Button, Input, InputNumber, Icon } from 'antd';
|
|
|
|
+import Ellipsis from '../../../components/Ellipsis';
|
|
import Selector from '../../../components/AXTableSelector/Selector';
|
|
import Selector from '../../../components/AXTableSelector/Selector';
|
|
import FooterToolbar from '../../../components/FooterToolbar';
|
|
import FooterToolbar from '../../../components/FooterToolbar';
|
|
import { checkProductType, toDecimal2 } from '../../../utils/utils';
|
|
import { checkProductType, toDecimal2 } from '../../../utils/utils';
|
|
@@ -37,6 +38,8 @@ export default class OrderCreatePage extends Component {
|
|
deliveryInfo: {},
|
|
deliveryInfo: {},
|
|
terminalSelectorDestroy: true,
|
|
terminalSelectorDestroy: true,
|
|
goodsSelectorDestroy: true,
|
|
goodsSelectorDestroy: true,
|
|
|
|
+ packageFixModalDestroy: true,
|
|
|
|
+ packageContent: {},
|
|
width: '100%',
|
|
width: '100%',
|
|
};
|
|
};
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
@@ -132,6 +135,19 @@ export default class OrderCreatePage extends Component {
|
|
goodsSelectorDestroy: true,
|
|
goodsSelectorDestroy: true,
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+ // 套餐包详情模态框展现
|
|
|
|
+ handlePackageFixModalShow = (contents) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ packageFixModalDestroy: false,
|
|
|
|
+ packageContent: contents,
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ // 套餐包详情模态框取消
|
|
|
|
+ handlePackageFixCancel = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ packageFixModalDestroy: true,
|
|
|
|
+ });
|
|
|
|
+ };
|
|
// 响应价格变化
|
|
// 响应价格变化
|
|
handleGoodsSelectChange = (rowIndex, goodsId) => {
|
|
handleGoodsSelectChange = (rowIndex, goodsId) => {
|
|
const { selectedGoods } = this.state;
|
|
const { selectedGoods } = this.state;
|
|
@@ -219,8 +235,8 @@ export default class OrderCreatePage extends Component {
|
|
|
|
|
|
render() {
|
|
render() {
|
|
const {
|
|
const {
|
|
- currentStep, selectedGoods, adjustPrice = 0, deliveryInfo,
|
|
|
|
- terminalSelectorDestroy, goodsSelectorDestroy,
|
|
|
|
|
|
+ currentStep, selectedGoods, adjustPrice = 0, deliveryInfo, packageContent,
|
|
|
|
+ terminalSelectorDestroy, goodsSelectorDestroy, packageFixModalDestroy,
|
|
} = this.state;
|
|
} = this.state;
|
|
const {
|
|
const {
|
|
code, name, campusName, merchantName, contactName, mobile, address,
|
|
code, name, campusName, merchantName, contactName, mobile, address,
|
|
@@ -329,11 +345,11 @@ export default class OrderCreatePage extends Component {
|
|
};
|
|
};
|
|
const newRows = [];
|
|
const newRows = [];
|
|
for (let row of rows) {
|
|
for (let row of rows) {
|
|
- // 默认数量
|
|
|
|
|
|
+ // 设置默认数量
|
|
if (!row.quantity) {
|
|
if (!row.quantity) {
|
|
row.quantity = 1;
|
|
row.quantity = 1;
|
|
}
|
|
}
|
|
- // 默认选中价格
|
|
|
|
|
|
+ // 设置默认选中价格
|
|
if (!row.selectedGoodsId) {
|
|
if (!row.selectedGoodsId) {
|
|
const price = findSelectedPrice(row.goods);
|
|
const price = findSelectedPrice(row.goods);
|
|
row = { ...row, ...price };
|
|
row = { ...row, ...price };
|
|
@@ -382,28 +398,121 @@ export default class OrderCreatePage extends Component {
|
|
</Modal>
|
|
</Modal>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
+ // 修正课程包内配套数量
|
|
|
|
+ const getPackageFixModal = () => {
|
|
|
|
+ const { products } = packageContent;
|
|
|
|
+ const packageColumns = [{
|
|
|
|
+ title: '产品编号',
|
|
|
|
+ dataIndex: 'code',
|
|
|
|
+ key: 'code',
|
|
|
|
+ width: '20%',
|
|
|
|
+ }, {
|
|
|
|
+ title: '产品名称',
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ key: 'name',
|
|
|
|
+ width: '40%',
|
|
|
|
+ }, {
|
|
|
|
+ title: '产品类型',
|
|
|
|
+ dataIndex: 'type',
|
|
|
|
+ key: 'type',
|
|
|
|
+ render: text => checkProductType(text),
|
|
|
|
+ width: '20%',
|
|
|
|
+ align: 'center',
|
|
|
|
+ }, {
|
|
|
|
+ title: '单价',
|
|
|
|
+ dataIndex: 'merchantPrice',
|
|
|
|
+ key: 'merchantPrice',
|
|
|
|
+ width: '20%',
|
|
|
|
+ render: (text, record) => {
|
|
|
|
+ if (record.type !== Hotax.PRODUCT_SUPPORT) {
|
|
|
|
+ return '-';
|
|
|
|
+ }
|
|
|
|
+ return `¥${text}/件`;
|
|
|
|
+ },
|
|
|
|
+ align: 'center',
|
|
|
|
+ /* TODO: 套餐包内配套数量修改
|
|
|
|
+ }, {
|
|
|
|
+ title: '数量',
|
|
|
|
+ dataIndex: 'quantity',
|
|
|
|
+ key: 'quantity',
|
|
|
|
+ width: '20%',
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ if (record.type !== Hotax.PRODUCT_SUPPORT) {
|
|
|
|
+ return '-';
|
|
|
|
+ }
|
|
|
|
+ return (
|
|
|
|
+ <Input
|
|
|
|
+ style={{ width: 150 }}
|
|
|
|
+ addonBefore={
|
|
|
|
+ <Icon
|
|
|
|
+ type="minus"
|
|
|
|
+ className={styles.icon}
|
|
|
|
+ onClick={() => this.handleQuantityStepChange(index, 'minus', record.id)}
|
|
|
|
+ />
|
|
|
|
+ }
|
|
|
|
+ addonAfter={
|
|
|
|
+ <Icon
|
|
|
|
+ type="plus"
|
|
|
|
+ className={styles.icon}
|
|
|
|
+ onClick={() => this.handleQuantityStepChange(index, 'plus', record.id)}
|
|
|
|
+ />
|
|
|
|
+ }
|
|
|
|
+ value={text}
|
|
|
|
+ onChange={e => this.handleQuantityInputChange(index, e, record.id)}
|
|
|
|
+ />
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ align: 'center',
|
|
|
|
+ */
|
|
|
|
+ }];
|
|
|
|
+ return (
|
|
|
|
+ <Modal
|
|
|
|
+ visible
|
|
|
|
+ width={1100}
|
|
|
|
+ title="套餐包详情"
|
|
|
|
+ maskClosable={false}
|
|
|
|
+ onCancel={this.handlePackageFixCancel}
|
|
|
|
+ >
|
|
|
|
+ <Table
|
|
|
|
+ bordered
|
|
|
|
+ pagination={false}
|
|
|
|
+ columns={packageColumns}
|
|
|
|
+ dataSource={products}
|
|
|
|
+ rowKey={record => record.id}
|
|
|
|
+ scroll={{ y: 500 }}
|
|
|
|
+ />
|
|
|
|
+ </Modal>
|
|
|
|
+ );
|
|
|
|
+ };
|
|
const goodsColumns = [{
|
|
const goodsColumns = [{
|
|
title: '商品编号',
|
|
title: '商品编号',
|
|
dataIndex: 'code',
|
|
dataIndex: 'code',
|
|
key: 0,
|
|
key: 0,
|
|
- render: text => (
|
|
|
|
- <a>{text}</a>
|
|
|
|
- ),
|
|
|
|
- width: '16%',
|
|
|
|
|
|
+ render: (text, record) => {
|
|
|
|
+ if (record.type === Hotax.PRODUCT_PACKAGE) {
|
|
|
|
+ return (
|
|
|
|
+ <Tooltip placement="top" title="点击查看套餐包内容">
|
|
|
|
+ <a className="a-link" onClick={() => this.handlePackageFixModalShow(record)}>{text}</a>
|
|
|
|
+ </Tooltip>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ return text;
|
|
|
|
+ },
|
|
|
|
+ width: '17%',
|
|
}, {
|
|
}, {
|
|
title: '商品名称',
|
|
title: '商品名称',
|
|
dataIndex: 'name',
|
|
dataIndex: 'name',
|
|
key: 1,
|
|
key: 1,
|
|
|
|
+ width: '28%',
|
|
render: text => (
|
|
render: text => (
|
|
- <a>{text}</a>
|
|
|
|
|
|
+ <Ellipsis tooltip lines={1}>{text}</Ellipsis>
|
|
),
|
|
),
|
|
- width: '24%',
|
|
|
|
}, {
|
|
}, {
|
|
title: '商品类型',
|
|
title: '商品类型',
|
|
key: 2,
|
|
key: 2,
|
|
dataIndex: 'type',
|
|
dataIndex: 'type',
|
|
render: text => checkProductType(text),
|
|
render: text => checkProductType(text),
|
|
- width: '15%',
|
|
|
|
|
|
+ width: '12%',
|
|
align: 'center',
|
|
align: 'center',
|
|
}, {
|
|
}, {
|
|
title: '单价',
|
|
title: '单价',
|
|
@@ -435,7 +544,7 @@ export default class OrderCreatePage extends Component {
|
|
title: '数量',
|
|
title: '数量',
|
|
key: 4,
|
|
key: 4,
|
|
dataIndex: 'quantity',
|
|
dataIndex: 'quantity',
|
|
- width: '15%',
|
|
|
|
|
|
+ width: '13%',
|
|
render: (text, _, index) => {
|
|
render: (text, _, index) => {
|
|
return (
|
|
return (
|
|
<Input
|
|
<Input
|
|
@@ -483,6 +592,7 @@ export default class OrderCreatePage extends Component {
|
|
rowKey={record => record.id}
|
|
rowKey={record => record.id}
|
|
/>
|
|
/>
|
|
{!goodsSelectorDestroy && getGoodsModal()}
|
|
{!goodsSelectorDestroy && getGoodsModal()}
|
|
|
|
+ {!packageFixModalDestroy && getPackageFixModal()}
|
|
</Card>
|
|
</Card>
|
|
);
|
|
);
|
|
};
|
|
};
|