Commit 9fde9c77 by chengming

修改ip配置

parent 01dbcb9b
var os = require('os'), IP = 'http://47.116.126.39:8080', ifaces = os.networkInterfaces() // 获取本机IP var os = require('os'), IP = "http://10.10.12.94:8090", ifaces = os.networkInterfaces() // 获取本机IP
out: out:
for (var i in ifaces) { for (var i in ifaces) {
for (var j in ifaces[i]) { for (var j in ifaces[i]) {
......
...@@ -424,20 +424,11 @@ class News extends React.Component { ...@@ -424,20 +424,11 @@ class News extends React.Component {
}; };
render() { render() {
const { const {
table,
postNewsTable,
systemtable,
postSystemTable,
customsee, customsee,
postHandleMessage, postHandleMessage,
handlemessagetable, handlemessagetable,
handlemessagetableget,
} = this.props; } = this.props;
const { const {
customcurrent,
custompageSize,
systemcurrent,
systempageSize,
handleMessagepageSize, handleMessagepageSize,
handleMessagecurrent, handleMessagecurrent,
lookState, lookState,
......
...@@ -25,12 +25,6 @@ import { ...@@ -25,12 +25,6 @@ import {
} from "./redux/action"; } from "./redux/action";
import Styles from "./index.less"; import Styles from "./index.less";
import ModalForm from "./ModalForm"; import ModalForm from "./ModalForm";
const Search = Input.Search;
const FormItem = Form.Item;
var companyCode = location.pathname.split("/")[1];
var siteCode = location.pathname.split("/")[2];
class ActiveOption extends React.Component { class ActiveOption extends React.Component {
state = { state = {
visible: false, visible: false,
...@@ -38,25 +32,12 @@ class ActiveOption extends React.Component { ...@@ -38,25 +32,12 @@ class ActiveOption extends React.Component {
current: "1", current: "1",
pageSize: "10", pageSize: "10",
type: "", type: "",
values: "",
}; };
componentDidMount() { componentDidMount() {
this.props.getPointTable({ pageNo: 1, pageSize: 20 }); this.props.getPointTable({ pageNo: 1, pageSize: 20 });
this.props.getCodeList({ code: "point_activity" }); this.props.getCodeList({ code: "point_activity" });
} }
//获取头部查询的值
onSearch = value => {
this.setState({ values: value });
let reg = /[@#\$%\^&\*{}|\\]+/g.test(value);
if (!reg) {
this.setState({ activityName: value }, () => {
this.props.getPointTable({ activityName: value });
});
} else {
return message.warning("不能输入特殊字符!");
}
};
//上架 //上架
onShelf = record => { onShelf = record => {
const { current, pageSize } = this.state; const { current, pageSize } = this.state;
...@@ -67,7 +48,6 @@ class ActiveOption extends React.Component { ...@@ -67,7 +48,6 @@ class ActiveOption extends React.Component {
this.props.getPointTable({ this.props.getPointTable({
pageNo: current, pageNo: current,
pageSize: pageSize, pageSize: pageSize,
activityName: this.state.values,
}); //bug-11053-liyuan 管理端-积分管理 -积分活动策略 分页控件问题 }); //bug-11053-liyuan 管理端-积分管理 -积分活动策略 分页控件问题
} }
); );
...@@ -82,7 +62,6 @@ class ActiveOption extends React.Component { ...@@ -82,7 +62,6 @@ class ActiveOption extends React.Component {
this.props.getPointTable({ this.props.getPointTable({
pageNo: current, pageNo: current,
pageSize: pageSize, pageSize: pageSize,
activityName: this.state.values,
}); //bug-11053-liyuan 管理端-积分管理 -积分活动策略 分页控件问题 }); //bug-11053-liyuan 管理端-积分管理 -积分活动策略 分页控件问题
} }
); );
...@@ -101,6 +80,7 @@ class ActiveOption extends React.Component { ...@@ -101,6 +80,7 @@ class ActiveOption extends React.Component {
const { current, pageSize, record, type, activityName } = this.state; const { current, pageSize, record, type, activityName } = this.state;
const form = this.formRef.props.form; const form = this.formRef.props.form;
form.validateFields((err, values) => { form.validateFields((err, values) => {
console.log(values,record,'values');
if (err) { if (err) {
return; return;
} }
...@@ -109,17 +89,13 @@ class ActiveOption extends React.Component { ...@@ -109,17 +89,13 @@ class ActiveOption extends React.Component {
this.props.postPointModify( this.props.postPointModify(
{ {
id: record.id, id: record.id,
activityName: values.activityName, productImg: values.productImg,
code: values.code, productName: values.productName,
activityType: values.activityType, point: values.point,
multiple: values.multiple,
startTime: values.time[0],
endTime: values.time[1],
}, },
{ pageNo: current, pageSize: pageSize }, '',
() => { () => {
this.props.getPointTable({ this.props.getPointTable({
activityName: this.state.values,
pageNo: current, pageNo: current,
pageSize: pageSize, pageSize: pageSize,
}); });
...@@ -128,17 +104,13 @@ class ActiveOption extends React.Component { ...@@ -128,17 +104,13 @@ class ActiveOption extends React.Component {
} else { } else {
this.props.postPointAdd( this.props.postPointAdd(
{ {
activityName: values.activityName, productImg: values.productImg,
code: values.code, productName: values.productName,
activityType: values.activityType, point: values.point,
multiple: values.multiple,
startTime: values.time[0],
endTime: values.time[1],
}, },
{ pageNo: current, pageSize: pageSize }, { pageNo: current, pageSize: pageSize },
() => { () => {
this.props.getPointTable({ this.props.getPointTable({
activityName: this.state.values,
pageNo: current, pageNo: current,
pageSize: pageSize, pageSize: pageSize,
}); });
...@@ -162,78 +134,41 @@ class ActiveOption extends React.Component { ...@@ -162,78 +134,41 @@ class ActiveOption extends React.Component {
render() { render() {
const that = this; const that = this;
const { current, pageSize, activityName } = this.state;
const { table, getPointTable, codeList } = this.props; const { table, getPointTable, codeList } = this.props;
const columns = [ const columns = [
{ {
title: "活动策略名称", title: "商品图片",
dataIndex: "activityName", dataIndex: "productImg",
key: "activityName", key: "productImg",
//width: 300, //bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug render: src => {
render: text => {
//bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug
return ( return (
<span <img src={src} style={{width: 65, height: 60}}/>
title={text}
style={{
display: "block",
width: "200px",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
cursor: "default",
}}
>
{text}
</span>
); );
}, },
}, },
{ {
title: "积分编号", title: "商品名称",
dataIndex: "code", dataIndex: "productName",
key: "code", key: "productName",
// width: 200, //bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug
render: text => {
return codeList?.data?.find(item => item.code == text).cnName;
},
}, },
{ {
title: "积分类型", title: "所需积分",
dataIndex: "activityType", dataIndex: "point",
key: "activityType", key: "point",
// width: 200, //bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug
render: text => {
return <span>{text == "1" ? "否" : text}</span>;
},
}, },
{ {
title: "积分倍数", title: "创建时间",
dataIndex: "multiple", dataIndex: "createTime",
key: "multiple", key: "createTime",
// width: 200, //bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug
render: text => {
return <span>{text == "1" ? "否" : text}</span>;
},
},
{
title: "发放有效期",
dataIndex: "time",
key: "time",
// width: 400, //bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug
render: (text, record) => { render: (text, record) => {
return ( return (
<span> <span>{moment(record.createTime).format("YYYY-MM-DD HH:mm:ss")}</span>
{moment(record.startTime).format("YYYY-MM-DD HH:mm:ss")} ~{" "}
{moment(record.endTime).format("YYYY-MM-DD HH:mm:ss")}
</span>
); );
}, },
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
width: 300, //bug-11246-liyuan 管理端-积分管理 -积分活动策略 UI bug
render: (text, record, index) => ( render: (text, record, index) => (
<span> <span>
{record.state == "2" ? ( {record.state == "2" ? (
...@@ -270,20 +205,6 @@ class ActiveOption extends React.Component { ...@@ -270,20 +205,6 @@ class ActiveOption extends React.Component {
"" ""
)} )}
<Divider type="vertical" /> <Divider type="vertical" />
<Link
to={{
pathname:
"/" +
companyCode +
"/" +
siteCode +
"/index/manager/point/Detailed-option",
state: { record },
}}
>
积分明细
</Link>
<Divider type="vertical" />
<Popconfirm <Popconfirm
title="确定要删除吗?" title="确定要删除吗?"
okText="确定" okText="确定"
...@@ -293,7 +214,6 @@ class ActiveOption extends React.Component { ...@@ -293,7 +214,6 @@ class ActiveOption extends React.Component {
if (res.code === "1000") { if (res.code === "1000") {
message.success("删除成功"); message.success("删除成功");
this.props.getPointTable({ this.props.getPointTable({
activityName: this.state.values,
pageNo: this.state.current, pageNo: this.state.current,
pageSize: this.state.pageSize, pageSize: this.state.pageSize,
}); });
...@@ -312,9 +232,9 @@ class ActiveOption extends React.Component { ...@@ -312,9 +232,9 @@ class ActiveOption extends React.Component {
const pagination = { const pagination = {
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
total: table && table.page.pageTotal, total: table && table.total,
showTotal: total => `共 ${table.page.pageTotal} 条`, showTotal: total => `共 ${table.total} 条`,
pageSize: table && table.page.pageSize, pageSize: table && table.size,
onShowSizeChange(current, pageSize) { onShowSizeChange(current, pageSize) {
getPointTable({ pageNo: current, pageSize: pageSize }); getPointTable({ pageNo: current, pageSize: pageSize });
that.setState({ current: current, pageSize: pageSize }); that.setState({ current: current, pageSize: pageSize });
...@@ -326,25 +246,19 @@ class ActiveOption extends React.Component { ...@@ -326,25 +246,19 @@ class ActiveOption extends React.Component {
}; };
return ( return (
<div className={Styles.list}> <div className={Styles.list}>
<Breadcrumb title="活动策略设置" /> <Breadcrumb title="商品设置" />
<div className={Styles.listBtn}> <div className={Styles.listBtn}>
<div style={{ float: "left" }}> <div style={{ float: "left" }}>
<Button type="primary" onClick={this.showModal}> <Button type="primary" onClick={this.showModal}>
创建活动策略 新增商品
</Button> </Button>
</div> </div>
<div style={{ float: "right" }}>
<Search
placeholder="请输入活动策略名称"
enterButton
onSearch={this.onSearch}
/>
</div>
</div> </div>
{table ? ( {table ? (
<Table <Table
columns={columns} columns={columns}
dataSource={table.data} dataSource={table && table.records}
pagination={pagination} pagination={pagination}
rowKey={record => record.id} rowKey={record => record.id}
/> />
......
import React from "react"; import React from "react";
import { Form, Input, Button, Radio, Upload, Icon } from "antd"; import { Input, Button, Table, Modal, message, Pagination } from "antd";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { gupfetch } from "@/common/UpLoad/redux/actions";
import { postPointSet, postPointEdit, excl } from "./redux/action";
import Breadcrumb from "@/common/Breadcrumb"; import Breadcrumb from "@/common/Breadcrumb";
import {
postUserList,
postPointExchange,
} from "./redux/action";
const Search = Input.Search;
const FormItem = Form.Item;
class CurrencyOption extends React.Component { class CurrencyOption extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
show: true, //初始话默认显示欢迎页 searchValue: "",
uploadAction: "", userList: [],
uploadParams: {}, currentPage: 1,
responseList: [], pageSize: 10,
fileList: [], total: 0,
exchangeModalVisible: false,
selectedUser: null,
deductPoints: 0,
loading: false
}; };
this.props.gupfetch();
this.beforeUpload = this.beforeUpload.bind(this);
this.handleUploadChange = this.handleUploadChange.bind(this);
} }
componentDidMount() { componentDidMount() {
this.props.postPointSet({}, res => { // 加载用户列表数据
if (res.code == 1000) { this.props.postUserList({ name: "", pageNo: 1, pageSize: 20 });
this.setState({
show: res.data.state == 1 ? true : false,
});
} }
}); // 搜索处理
handleSearch = (value) => {
this.props.postUserList({ name: value, pageNo: 1, pageSize: 20 });
} }
//上传文件
beforeUpload(file, fileList) { // 显示兑换弹窗
const { param } = this.props; showExchangeModal = (user) => {
if (param !== null) {
this.setState({
uploadParams: {
Filename: param.dir + "/" + file.uid + "." + file.name.split(".")[1],
key: param.dir + "/" + file.uid + "." + file.name.split(".")[1],
policy: param.policy,
OSSAccessKeyId: param.accessid,
success_action_status: "200",
signature: param.signature,
},
uploadAction: param.host,
});
this.setState({ this.setState({
hostAndDir: param.host + "/" + param.dir, exchangeModalVisible: true,
fileList: [], selectedUser: user,
deductPoints: 0
}); });
} }
}
//123 // 隐藏兑换弹窗
handleUploadChange({ file, fileList }) { hideExchangeModal = () => {
//判断类型`
const reg = /(xls|xlsx)$/g; //正则匹配格式
if (!reg.test(file.name)) {
message.error("文件类型不对");
return false;
}
let temp = this.state.fileList;
if (file.status == "removed") {
temp = temp.filter(item => {
return item.uid != file.uid;
});
this.setState({
fileList: temp,
responseList: temp.map(item => {
return {
fileName: item.name,
fileUrl: item.fileUrl
? item.fileUrl
: this.state.hostAndDir +
"/" +
item.uid +
"." +
item.name.split(".")[1],
size: item.size + "",
suffix: "." + item.name.split(".")[1],
};
}),
});
} else {
temp.push(fileList.pop());
this.setState({ this.setState({
fileList: temp.map(item => { exchangeModalVisible: false,
return { selectedUser: null,
uid: item.uid, deductPoints: 0
name: item.name,
size: item.size,
fileUrl: item.fileUrl,
};
}),
}); });
//this.props.gupList(temp);
this.setState({
responseList: temp.map(item => {
return {
fileName: item.name,
fileUrl: item.fileUrl
? item.fileUrl
: this.state.hostAndDir +
"/" +
item.uid +
"." +
item.name.split(".")[1],
size: item.size + "",
suffix: "." + item.name.split(".")[1],
};
}),
});
}
}
//保存
handleSubmit = e => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
this.props.postPointEdit(values);
if (this.state.responseList.length > 0) {
this.props.excl({ ossUrl: this.state.responseList[0].fileUrl });
} }
// 处理积分扣除
handleExchange = () => {
const { deductPoints, selectedUser } = this.state;
if (!deductPoints || deductPoints <= 0) {
message.error("请输入有效的积分数量");
return;
} }
});
}; if (deductPoints > selectedUser.totalPoint) {
change(e) { message.error("扣除积分不能超过用户当前积分余额");
if (e.target.value == 0) { return;
this.setState({
show: false,
});
} else {
this.setState({
show: true,
});
} }
// 模拟兑换操作
this.props.postPointExchange({ userId: selectedUser.userId, point: deductPoints });
this.hideExchangeModal();
// 重新加载列表
this.props.postUserList({ name: this.state.searchValue, pageNo: this.state.currentPage, pageSize: this.state.pageSize });
} }
render() { render() {
const { form, set } = this.props; const { exchangeList, postUserList } = this.props;
const { getFieldDecorator } = form; // 表格列配置
const formItemLayout = { const columns = [
labelCol: { {
xs: { span: 24 }, title: "用户名",
sm: { span: 8 }, dataIndex: "userName",
key: "userName",
ellipsis: true,
}, },
wrapperCol: { {
xs: { span: 24 }, title: "姓名",
sm: { span: 8 }, dataIndex: "name",
key: "name",
ellipsis: true,
}, },
}; {
const tailFormItemLayout = { title: "积分余额",
wrapperCol: { dataIndex: "totalPoint",
xs: { key: "totalPoint",
span: 24, render: (text) => <span style={{ color: '#1890ff', fontWeight: 'bold' }}>{text}</span>,
offset: 0, },
{
title: "操作",
key: "action",
render: (text, record) => (
<Button
type="primary"
size="small"
onClick={() => this.showExchangeModal(record)}
>
兑换
</Button>
),
}, },
sm: { ];
span: 16, const pagination = {
offset: 8, showQuickJumper: true,
showSizeChanger: true,
total: exchangeList && exchangeList.total,
showTotal: total => `共 ${exchangeList.total} 条`,
pageSize: exchangeList && exchangeList.size,
onShowSizeChange(current, pageSize) {
postUserList({ pageNo: current, pageSize: pageSize });
that.setState({ current: current, pageSize: pageSize });
}, },
onChange(current, pageSize) {
postUserList({ pageNo: current, pageSize: pageSize });
that.setState({ current: current, pageSize: pageSize });
}, },
}; };
return ( return (
<div> <div>
<Breadcrumb title="积分设置"/> <Breadcrumb title="积分兑换" />
<Form onSubmit={this.handleSubmit}>
<FormItem {...formItemLayout} label="积分是否启用"> {/* 用户积分搜索和兑换功能 */}
{getFieldDecorator("state", { <div style={{ marginBottom: 24, background: '#fff', padding: '16px 24px', borderRadius: '4px' }}>
initialValue: set ? "" + set.state + "" : "1", <div style={{ marginBottom: 16 }}>
})( <Search
<Radio.Group onChange={e => this.change(e)}> placeholder="请输入用户名或姓名进行搜索"
<Radio value="1">启用</Radio> onSearch={this.handleSearch}
<Radio value="0">不启用</Radio> style={{ width: 300 }}
</Radio.Group> enterButton
)} />
</FormItem> </div>
{/*<FormItem*/}
{/*{...formItemLayout}*/} <Table
{/*label="积分单位"*/} columns={columns}
{/*>*/} dataSource={exchangeList && exchangeList.records}
{/*{getFieldDecorator('unit', {*/} rowKey={record => record.userId}
{/*initialValue: set?set.unit:'积分',*/} pagination={pagination}
{/*rules: [{ required: true, message: '请输入单位名称!' }],*/} />
{/*})(*/} </div>
{/*<Input />*/}
{/*)}*/} {/* 兑换弹窗 */}
{/*<p>可设置积分单位</p>*/} <Modal
{/*</FormItem>*/} title="积分兑换"
{this.state.show ? ( visible={this.state.exchangeModalVisible}
<FormItem {...formItemLayout} label="积分导入"> onOk={this.handleExchange}
<div> onCancel={this.hideExchangeModal}
<Upload okText="确认兑换"
headers={{ "X-Requested-With": null }} cancelText="取消"
//accept="application/vnd.ms-excel"
fileList={this.state.fileList}
action={this.state.uploadAction}
data={this.state.uploadParams}
beforeUpload={this.beforeUpload}
onChange={this.handleUploadChange}
> >
<Button> {this.state.selectedUser && (
<Icon type="upload" /> 导入积分 <div>
</Button> <p>用户:{this.state.selectedUser.name}</p>
</Upload> <p>当前积分余额:<span style={{ color: '#1890ff', fontWeight: 'bold' }}>{this.state.selectedUser.totalPoint}</span></p>
<div style={{ marginTop: 16 }}>
<label style={{ display: 'block', marginBottom: 8 }}>扣除积分数量:</label>
<Input
type="number"
value={this.state.deductPoints}
onChange={(e) => this.setState({ deductPoints: parseInt(e.target.value) || 0 })}
placeholder="请输入要扣除的积分数量"
/>
</div> </div>
{this.state.fileList.length == 0 ? ( </div>
<div style={{ color: "#ccc" }}>您还未上传任何数据哦~</div> )}
) : null} </Modal>
<span>请上传资源附件(附件格式:xls)</span>不知道格式?
<a href="https://fulan-test.oss-cn-hangzhou.aliyuncs.com/test/积分导入模板.xlsx">
下载积分模版
</a>
</FormItem>
) : null}
<FormItem {...tailFormItemLayout}>
<Button type="primary" onClick={e => this.handleSubmit(e)}>
保存
</Button>
</FormItem>
</Form>
</div> </div>
); );
} }
} }
const CurrencyOptionForm = Form.create()(CurrencyOption);
function mapStateToProps(state, ownProps) { function mapStateToProps(state, ownProps) {
return { return {
set: state.point.set, exchangeList: state.point.exchangeList,
param: state.uploadParam.param, param: state.uploadParam.param,
}; };
} }
function mapDispatchToProps(dispatch) { function mapDispatchToProps(dispatch) {
return { return {
postPointSet: (obj, cb) => dispatch(postPointSet(obj, cb)), postUserList: obj => dispatch(postUserList(obj)),
postPointEdit: obj => dispatch(postPointEdit(obj)), postPointExchange: obj => dispatch(postPointExchange(obj)),
excl: obj => dispatch(excl(obj)),
gupfetch: () => dispatch(gupfetch()),
}; };
} }
export default connect(mapStateToProps, mapDispatchToProps)(CurrencyOptionForm); export default connect(mapStateToProps, mapDispatchToProps)(CurrencyOption);
\ No newline at end of file
import React from "react";
import { Form, DatePicker, Input, Button, Table, Spin } from "antd";
import moment from "moment";
import "moment/locale/zh-cn";
import { connect } from "react-redux";
import { getPointDetailed } from "./redux/action";
import Breadcrumb from "@/common/Breadcrumb";
const { RangePicker } = DatePicker;
const FormItem = Form.Item;
//时间格式化
const dateFormats = "YYYY-MM-DD HH:mm:ss";
class Detailed extends React.Component {
state = {
current: "1",
pageSize: "10",
};
componentDidMount() {
if (history.state.state) {
this.props.getPointDetailed({
activityId: history.state.state.record.id,
});
} else {
this.props.getPointDetailed();
}
}
//查询
handleSubmit = e => {
// debugger
e.preventDefault();
const {
// location,
getPointDetailed } = this.props;
this.props.form.validateFields((err, values) => {
if(err) console.log('11111111111', err)
//
if (!err) {
// if (location.state) {
if (history.state.state) {
getPointDetailed({
// activityId: location.state.record.id,
activityId: history.state.state.record.id,
accountName: values.accountName,
startTime: values.time
? new Date(
moment(values.time[0]._d).format(dateFormats)
).getTime()
: "",
endTime: values.time
? new Date(
moment(values.time[1]._d).format(dateFormats)
).getTime()
: "",
});
} else {
getPointDetailed({
accountName: values.accountName,
startTime: values.time
? new Date(
moment(values.time[0]._d).format(dateFormats)
).getTime()
: "",
endTime: values.time
? new Date(
moment(values.time[1]._d).format(dateFormats)
).getTime()
: "",
});
}
}
});
};
render() {
const that = this;
const { form, detailed, getPointDetailed,
// location
} = this.props;
const { getFieldDecorator } = form;
const columns = [
{
title: "时间",
dataIndex: "time",
key: "time",
render: text => {
return <span>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</span>;
},
},
{
title: "积分",
dataIndex: "point",
key: "point",
render: (text, record) => {
return (
<span>
{record.flag == "1" ? "+" : ""}
{text}
</span>
);
},
},
{
title: "用户名",
dataIndex: "accountName",
key: "accountName",
render: text => {
return (
<span title={text}>
{text.length > 10 ? text.substring(9, 0) + "..." : text}
</span>
);
},
},
{
title: "学习活动类型",
dataIndex: "learnType",
key: "learnType",
},
{
title: "学习活动名称",
dataIndex: "learnName",
key: "learnName",
render: text => {
return (
<span title={text}>
{text.length > 10 ? text.substring(9, 0) + "..." : text}
</span>
);
},
},
{
title: "学习活动来源",
dataIndex: "learnSource",
key: "learnSource",
},
];
const pagination = {
showQuickJumper: true,
showSizeChanger: true,
total: detailed && detailed.page.pageTotal,
pageSize: detailed && detailed.page.pageSize,
showTotal: function() {
//设置显示一共几条数据
return detailed && "共计 " + detailed.page.pageTotal + " 条";
},
// 分页
onShowSizeChange(current, pageSize) {
// if (location.state) {
if (history.state.state) {
getPointDetailed({
// activityId: location.state.record.id,
activityId: history.state.state.record.id,
pageNo: current,
pageSize: pageSize,
});
} else {
getPointDetailed({ pageNo: current, pageSize: pageSize });
}
that.setState({ current: current, pageSize: pageSize });
},
onChange(current, pageSize) {
// if (location.state) {
if (history.state.state) {
getPointDetailed({
activityId: history.state.state.record.id,
pageNo: current,
pageSize: pageSize,
});
} else {
getPointDetailed({ pageNo: current, pageSize: pageSize });
}
that.setState({ current: current, pageSize: pageSize });
},
};
return (
<div style={{ padding: "0 20px" }}>
<Breadcrumb title="积分流水明细"/>
<Form layout="inline" onSubmit={this.handleSubmit}>
<FormItem>
{getFieldDecorator("accountName")(
<Input placeholder="请输入用户名" />
)}
</FormItem>
<FormItem>
{getFieldDecorator("time")(
<RangePicker
placeholder={["开始时间", "结束时间"]}
ranges={{
// Today: [moment(), moment()],
"今天": [moment().startOf('day'), moment().endOf('day')],//当天零时到当天23时59分59秒 bug-12231-liyuan
// "This Month": [moment(), moment().endOf("month")],
"这个月": [moment().startOf("month"), moment().endOf("month")],
}}
showTime
format="YYYY-MM-DD"
onOk={this.onRangePicker}
/>
)}
</FormItem>
<FormItem>
<Button type="primary" htmlType="submit">
查询
</Button>
</FormItem>
</Form>
{detailed ? (
<Table
dataSource={detailed.data}
columns={columns}
pagination={pagination}
rowKey={record => record.id}
/>
) : (
<Spin className="cred-spin" />
)}
</div>
);
}
}
const DetailedForm = Form.create()(Detailed);
function mapStateToProps(state, ownProps) {
return {
detailed: state.point.detailed,
};
}
function mapDispatchToProps(dispatch) {
return {
getPointDetailed: obj => dispatch(getPointDetailed(obj)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(DetailedForm);
import React from "react";
import { Button, Form, Input, Radio, Switch, InputNumber, Select } from "antd";
import "./index.less";
const FormItem = Form.Item;
const { TextArea } = Input;
const Option = Select.Option;
const CollectionCreateForm = Form.create()(props => {
const { visible, onCancel, onCreate, form, editeData } = props;
const { getFieldDecorator } = form;
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 14 },
};
function handleChange(value) {
console.log(value); // { key: "lucy", label: "Lucy (101)" }
}
return (
<Form layout="horizontal">
<FormItem {...formItemLayout} label="积分池名称">
{getFieldDecorator("title", {
initialValue: props.editeData.name,
rules: [
{
required: true,
message: "Please input the title of collection!",
},
],
})(<Input />)}
</FormItem>
<FormItem {...formItemLayout} label="积分池描述">
{getFieldDecorator("description")(<TextArea rows={4} />)}
</FormItem>
<FormItem {...formItemLayout} label="商城模块开关">
{getFieldDecorator("switch", {
valuePropName: "checked",
initialValue: props.editeData.flag === "启用" ? true : false,
})(<Switch checkedChildren="开" unCheckedChildren="关" />)}
</FormItem>
<FormItem {...formItemLayout} label="积分单位">
{getFieldDecorator("input-number", { initialValue: 3 })(
<InputNumber min={1} max={10} />
)}
<span className="ant-form-text"> 积分</span>
</FormItem>
</Form>
);
});
class RegistrationForm extends React.Component {
constructor(props) {
super(props);
this.state = {
searchname: "",
};
// 搜索事件
this.onSearch = this.handleSearch.bind(this);
}
//componentWillUnmount(){
// this.props.form.setFieldsValue({
// title:'2'
// })
// }
// 搜索事件
handleSearch = event => {
data.splice(1, 1);
this.setState({
data: data,
});
};
render() {
const { editeData } = this.props;
return (
<div>
<CollectionCreateForm editeData={editeData} />
</div>
);
}
}
const EditPointPool = Form.create()(RegistrationForm);
export default EditPointPool;
...@@ -5,7 +5,29 @@ import moment from "moment"; ...@@ -5,7 +5,29 @@ import moment from "moment";
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const Option = Select.Option; const Option = Select.Option;
const FormItem = Form.Item; const FormItem = Form.Item;
// 引入图片裁剪上传组件
import UploadImageCover from "@/common/UploadImageCover";
class activModalForm extends React.Component { class activModalForm extends React.Component {
constructor(props) {
super(props);
this.state = {
productImg: props.record && props.record.productImg ? props.record.productImg : ""
};
}
// 获取图片URL的回调函数
getImgUrl = (imgUrl) => {
this.setState({
productImg: imgUrl
});
// 同时设置表单字段值
this.props.form.setFieldsValue({
productImg: imgUrl
});
}
render() { render() {
const { const {
visible, visible,
...@@ -38,79 +60,61 @@ class activModalForm extends React.Component { ...@@ -38,79 +60,61 @@ class activModalForm extends React.Component {
return ( return (
<Modal <Modal
visible={visible} visible={visible}
title="创建活动策略" title={type == "look" ? "查看商品" : type == "edit" ? "修改商品" : "新增商品"}
okText="确定" okText="确定"
onCancel={onCancel} onCancel={onCancel}
onOk={onCreate} onOk={onCreate}
destroyOnClose destroyOnClose
> >
<Form> <Form>
<FormItem {...formItemLayout} label="活动名称"> {/* 修改图片字段为支持裁剪的图片上传组件 */}
{getFieldDecorator("activityName", { <FormItem {...formItemLayout} label="图片">
initialValue: record && record.activityName, {getFieldDecorator("productImg", {
initialValue: record && record.productImg,
rules: [ rules: [
{ required: true, message: "请输入活动名称" }, { required: true, message: "请上传商品图片" },
{ max: 200, message: "活动名称不能超过200个字符!" },
], ],
})( })(
<Input <div>
placeholder="请输入活动名称" <UploadImageCover
details={record && record.productImg}
getImgUrl={this.getImgUrl}
disabled={type == "look" ? true : false} disabled={type == "look" ? true : false}
preRatio={["5/4"]} // 设置图片比例为1:1,适合商品展示
/> />
<div style={{ marginTop: 8, fontSize: 12, color: '#999' }}>
支持jpg、jpeg、png格式,建议尺寸1:1,大小不超过30MB
</div>
</div>
)} )}
</FormItem> </FormItem>
<FormItem {...formItemLayout} label="活动code"> <FormItem {...formItemLayout} label="商品名称">
{getFieldDecorator("code", { {getFieldDecorator("productName", {
initialValue: record && record.code, initialValue: record && record.productName,
rules: [{ required: true, message: "请选择活动code" }],
})(
<Select style={{ width: "200px" }} placeholder="请选择活动code">
{list}
</Select>
)}
</FormItem>
<FormItem {...formItemLayout} label="活动类型">
{getFieldDecorator("activityType", {
initialValue: record && record.activityType,
rules: [ rules: [
{ required: true, message: "请输入活动类型" }, { required: true, message: "请输入商品名称" },
{ max: 200, message: "活动类型不能超过200个字符!" }, { max: 50, message: "商品名称不能超过50个字符!" },
], ],
})( })(
<Input <Input
placeholder="请输入活动类型" placeholder="请输入商品名称"
disabled={type == "look" ? true : false} disabled={type == "look" ? true : false}
/> />
)} )}
</FormItem> </FormItem>
<FormItem {...formItemLayout} label="积分翻倍"> <FormItem {...formItemLayout} label="所需积分">
{getFieldDecorator("multiple", { {getFieldDecorator("point", {
initialValue: record && record.multiple, initialValue: record && record.point,
rules: [{ required: true, message: "请输入翻倍数" }],
})(
<InputNumber min={2} disabled={type == "look" ? true : false} />
)}
</FormItem>
<FormItem {...formItemLayout} label="活动时间">
{getFieldDecorator("time", {
initialValue: record && [
moment(record.startTime),
moment(record.endTime),
],
rules: [ rules: [
{ type: "array", required: true, message: "请输入活动时间!" }, { required: true, message: "请输入所需积分" },
{ type: 'number', min: 1, message: '积分必须大于0' },
], ],
})( })(
<RangePicker <InputNumber
placeholder={["开始时间", "结束时间"]} placeholder="请输入所需积分"
ranges={{
今天: [moment(), moment().endOf("month")],
这个月: [moment().startOf("month"), moment().endOf("month")],
}} //bug-11250-liyuan 积分管理 -积分活动策略 时间控件的问题
showTime
format="YYYY-MM-DD HH:mm:ss"
onOk={this.onRangePicker}
disabled={type == "look" ? true : false} disabled={type == "look" ? true : false}
min={1}
style={{ width: '100%' }}
/> />
)} )}
</FormItem> </FormItem>
......
import React from "react";
import {
Button,
Table,
Icon,
Select,
Input,
Divider,
Popconfirm,
Modal,
} from "antd";
import Styles from "./index.less";
import EditPointPool from "./EditPointPool.jsx";
const Option = Select.Option;
const data = [
{
key: "1",
name: "太保总公司积分商城",
start: "是",
flag: "启用",
},
{
key: "2",
name: "太保总公司积分商城",
start: "否",
flag: "停用",
},
{
key: "3",
name: "平安总公司积分商城",
start: "否",
flag: "启用",
},
];
for (var value of data) {
console.log(value.flag);
}
class PointPool extends React.Component {
constructor(props) {
super(props);
this.state = {
searchName: "",
editeData: [],
data: data,
};
this.columns = [
{
title: "积分池名称",
dataIndex: "name",
key: "name",
render: text => {
return (
<span title={text}>
{text.length > 10 ? text.substring(9, 0) + "..." : text}
</span>
);
},
},
{
title: "是否独立商城",
dataIndex: "start",
key: "start",
},
{
title: "是否独立商城",
dataIndex: "flag",
key: "flag",
},
{
title: "操作",
key: "action",
render: (text, record, index) => (
<span>
<a
href="#"
data-index={index}
onClick={() => this.handleEdit(record)}
>
编辑
</a>
<Divider type="vertical" />
{record.flag === "启用" ? (
<Popconfirm
title="确定要停用吗?"
okText="确定"
cancelText="取消"
onConfirm={() => this.handleStart(record.key)}
>
<a href="#">停用</a>
</Popconfirm>
) : (
<Popconfirm
title="确定要启用吗?"
okText="确定"
cancelText="取消"
onConfirm={() => this.handleStop(record.key)}
>
<a href="#">启用</a>
</Popconfirm>
)}
<Divider type="vertical" />
<a href="#" data-index={index}>
活动策略
</a>
<Divider type="vertical" />
<a href="#" data-index={index}>
发放积分配置
</a>
<Divider type="vertical" />
<a href="#" data-index={index}>
积分明细
</a>
</span>
),
},
];
// 搜索事件
this.onSearch = this.handleSearch.bind(this);
// 搜索框输入
this.onChange = this.handleChange.bind(this);
// 弹出对话框
this.onShowModal = this.showModal.bind(this);
// 关闭对话框
this.onHideModal = this.hideModal.bind(this);
// 编辑对话框
this.onEditModal = this.editModal.bind(this);
}
// 搜索事件
handleSearch = event => {
data.splice(1, 1);
this.setState({
data: data,
});
};
// 搜索框输入
handleChange = event => {
this.setState({ searchName: event.target.value });
};
// 搜索框输入
handleStop = key => {
console.log(key);
};
// 停用规则
handleStart = key => {
console.log(key);
};
// 编辑积分池
handleEdit = record => {
this.setState({ editeData: record });
this.onShowModal();
};
showModal = e => {
this.setState({
visible: true,
type: "edit",
title: "编辑积分池",
width: "30rem",
footer: "打*号必须填",
clear: "false",
key: "2222",
});
};
hideModal = e => {
this.setState({
visible: false,
});
};
editModal = e => {};
render() {
const columns = this.columns;
return (
<div className={Styles.list}>
<div className={Styles.listBtn}>
<div>
<Input
placeholder="请输入项目名称"
value={this.state.searchName}
onChange={this.onChange}
style={{ width: 200, marginRight: 10 }}
/>
<Button type="primary" onClick={this.onSearch}>
搜索
</Button>
</div>
</div>
<Table columns={columns} dataSource={this.state.data} />
<Modal
key={this.state.key}
title={this.state.title}
visible={this.state.visible}
onOk={this.onHideModal}
onCancel={this.onHideModal}
footer={[
<p className="comond" key="comond">
{this.state.footer}
</p>,
<Button key="back" size="large" onClick={this.onHideModal}>
取消
</Button>,
<Button
key="submit"
type="primary"
size="large"
onClick={this.onEditModal}
>
保存
</Button>,
]}
>
<div>
<EditPointPool editeData={this.state.editeData} />
</div>
</Modal>
</div>
);
}
}
export default PointPool;
import React, { Component } from 'react';
import { Icon, Switch, Tabs } from "antd";
import Styles from "./style.less";
import IntegralExchangeSetting from "./integralExchangeSetting";
import TradingLogs from "./tradingLogs";
import intl from "react-intl-universal";
import { connect } from "react-redux";
import { getExchangeSwitch, turnOnOrOffSwitch } from "../redux/action";
import Breadcrumb from "@/common/Breadcrumb";
const { TabPane } = Tabs;
class PointExchangeOption extends Component {
constructor(props) {
super(props)
this.state = {
integralChecked: false,
activeKey: "2",
refreshConfigCard: ""
}
}
componentDidMount() {
let _this = this;
this.props.getExchangeSwitch({ type: 10 }, () => {
const { switchList } = _this.props;
let result = false;
if (switchList.length && switchList.length > 0) {
let resultArr = switchList.filter(item => {
return parseInt(item.type) == 10;
});
if (resultArr.length > 0) {
result = resultArr[0].tokenSwitch || false;
}
}
_this.setState({
integralChecked: result,
activeKey:result?"1":"2",
refreshConfigCard: new Date().getTime()
});
});
}
getExchangeConfig = (type, checked) => {
switch (type) {
case "integral":
this.props.turnOnOrOffSwitch({ type: 10, tokenSwitchBol: checked });
this.setState({
integralChecked: checked,
activeKey:checked?"1":"2",
});
break;
}
}
tabChange = (activeKey) => {
this.setState({
activeKey
});
}
render() {
const { integralChecked, activeKey, refreshConfigCard } = this.state;
return <div className={Styles.exchangeContainer}>
<Breadcrumb title={intl.get("exchangeConfigText23")} />
<div className={Styles.exchangeConfigContainer}>
<div className={Styles.exchangeConfigArea}>
<ExchangeConfigItem
key={refreshConfigCard}
icon={<Icon type="pay-circle" />}
data={
{
type: "integral",
name: intl.get("exchangeConfigText1"),
desc: intl.get("exchangeConfigText2")
}
}
defaultChecked={integralChecked}
onChange={this.getExchangeConfig}
/>
</div>
</div>
<div className={Styles.exchangeTabsContainer}>
<Tabs activeKey={activeKey} onChange={this.tabChange} tabBarStyle={{ marginBottom: 0 }}>
{
integralChecked ?
<TabPane tab={intl.get("exchangeConfigText3")} key="1">
<div style={{ width: "100%", height: 15, backgroundColor: "#F0F2F5" }}></div>
<IntegralExchangeSetting />
</TabPane> : ""
}
<TabPane tab={intl.get("exchangeConfigText4")} key="2">
<div style={{ width: "100%", height: 15, backgroundColor: "#F0F2F5" }}></div>
<TradingLogs tabKey={activeKey} />
</TabPane>
</Tabs>
</div>
</div>;
}
}
function mapStateToProps(state, ownProps) {
return {
switchList: state.point.exchangeSwitchStatusList,
};
}
function mapDispatchToProps(dispatch) {
return {
getExchangeSwitch: (obj, callback) => dispatch(getExchangeSwitch(obj, callback)),
turnOnOrOffSwitch: (obj, callback) => dispatch(turnOnOrOffSwitch(obj, callback)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(PointExchangeOption);
const ExchangeConfigItem = ({ icon, data, defaultChecked, onChange }) => {
return <div className={Styles.exchangeConfigItem}>
<div className={Styles.exchangeConfigIcon}>
{icon}
</div>
<div className={Styles.exchangeConfigInfo}>
<div className={Styles.exchangeConfigName}>
{data.name}
</div>
<div className={Styles.exchangeConfigDesc}>
{data.desc}
</div>
</div>
<div className={Styles.exchangeConfigSwitch}>
<Switch
checkedChildren="ON"
unCheckedChildren="OFF"
checked={defaultChecked}
onChange={(checked) => onChange(data.type, checked)}
/>
</div>
</div>;
}
\ No newline at end of file
import React, { Component } from 'react';
import { Form, Input, Radio, Select, Button, message } from "antd";
import Styles from "./style.less";
import intl from "react-intl-universal";
import { connect } from "react-redux";
import { saveExchangeRule, getExchangeRule } from "../redux/action";
const exchangeLimitTypeCodeArr = ["", "ALLTIME", "DAY", "WEEK", "MONTH", "QUARTER", "HALFYEAR", "YEAR"];
class IntegralExchangeSetting extends Component {
constructor(props) {
super(props)
this.state = {
virtualCurrencyName: "",
proportionNumber: 1,
exchangeLimit: 1,
exchangeLimitType: "1",
exchangeLimitNumber: 1,
}
}
componentDidMount() {
let _this = this;
this.props.getExchangeRule(() => {
const { exchangeRule } = _this.props;
console.log(exchangeRule);
_this.setState({
virtualCurrencyName: exchangeRule.tokenName || "",
proportionNumber: exchangeRule.rate || 1,
exchangeLimit: exchangeRule.exchangeCondition ? 2 : 1,
exchangeLimitType: String(
exchangeLimitTypeCodeArr.indexOf(exchangeRule.ruleType || "ALLTIME")
),
exchangeLimitNumber: exchangeRule.ruleTokenCount || 1
})
});
}
handleSettingSubmit = (e) => {
e.preventDefault();
let _this = this;
this.props.form.validateFields((err, values) => {
if (!err) {
const { proportionNumber,exchangeLimitNumber, exchangeLimitType, exchangeLimit } = _this.state;
let param = {
exchangeCondition: exchangeLimit == 1 ? false : true,
rate: proportionNumber,
tokenName: values.virtualCurrencyName
}
if (exchangeLimit != 1) {
param.conditionRuleType = exchangeLimitTypeCodeArr[parseInt(exchangeLimitType)];
param.conditionRuleTokenCount = exchangeLimitNumber;
}
_this.props.saveExchangeRule(param, (res) => {
if (res.code == "1000") {
message.success("SavedSuccessfully!");
}
});
console.log(param)
}
})
}
getProportionNumber = (e) => {
let numberValue = parseInt(e.target.value);
if (isNaN(numberValue)) {
this.setState({
proportionNumber: 1
});
} else {
if(numberValue<=0){
numberValue = 1;
}
this.setState({
proportionNumber: Math.ceil(numberValue)
});
}
}
getExchangeLimitNumber = (e) => {
let numberValue = parseInt(e.target.value);
if (isNaN(numberValue)) {
this.setState({
exchangeLimitNumber: 1
});
} else {
if(numberValue<=0){
numberValue = 1;
}
this.setState({
exchangeLimitNumber: Math.ceil(numberValue)
});
}
}
getExchangeLimitMode = (e) => {
this.setState({
exchangeLimit: parseInt(e.target.value)
})
}
getExchangeLimitType = (value) => {
this.setState({
exchangeLimitType: value
})
}
render() {
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 19 },
},
};
const {
virtualCurrencyName,
proportionNumber,
exchangeLimitNumber,
exchangeLimit,
exchangeLimitType
} = this.state;
return <div className={Styles.exchangeTabsContentContainer}>
<div className={Styles.payByIntegralTitle}>
{intl.get("exchangeConfigText6")}
</div>
<Form {...formItemLayout} onSubmit={this.handleSettingSubmit} >
<Form.Item label={intl.get("exchangeConfigText5")} >
{getFieldDecorator('virtualCurrencyName', {
rules: [
{
required: true,
message: intl.get("exchangeConfigText7"),
}, {
max: 3,
message: intl.get("exchangeConfigText7")
}
],
initialValue: virtualCurrencyName
})(<Input style={{ width: 680 }} placeholder={intl.get("exchangeConfigText7")} />)}
</Form.Item>
<Form.Item label={intl.get("exchangeConfigText8")} >
{getFieldDecorator('proportion', {
rules: [
{
required: true,
message: intl.get("exchangeConfigText7"),
}
],
initialValue: proportionNumber
})(
<Input type="hidden" />
)}
<Input
type="number"
step={1}
style={{ width: 150 }}
min={1}
onChange={this.getProportionNumber}
value={proportionNumber}
addonAfter={intl.get("SystemAdmin42")}
/>
<span style={{ marginLeft: 15, marginRight: 15 }}>:</span>
<Input
type="number"
style={{ width: 150 }}
value={1}
disabled
addonAfter={intl.get("exchangeConfigText9")}
/>
<br />
<span>
{intl.get("exchangeConfigText10")}
</span>
</Form.Item>
<Form.Item label={intl.get("exchangeConfigText11")} >
{getFieldDecorator('range', {
rules: [
{
required: true,
message: "",
},
],
initialValue: 1
})(
<Radio checked disabled>{intl.get("exchangeConfigText12")}</Radio>
)}
</Form.Item>
<Form.Item label={intl.get("exchangeConfigText13")} >
{getFieldDecorator('exchangeConfig', {
rules: [
{
required: true,
message: "",
},
],
initialValue: exchangeLimit
})(
<Input type="hidden" />
)}
<Radio.Group onChange={this.getExchangeLimitMode} value={exchangeLimit}>
<Radio value={1}>{intl.get("exchangeConfigText14")}</Radio>
<Radio value={2}></Radio>
</Radio.Group>
<Select
value={exchangeLimitType}
style={{ width: 350 }}
onChange={this.getExchangeLimitType}
disabled={exchangeLimit == 1 ? true : false}
>
<Select.Option value="1">{intl.get("exchangeConfigText22")}</Select.Option>
<Select.Option value="2">{intl.get("exchangeConfigText16")}</Select.Option>
<Select.Option value="3">{intl.get("exchangeConfigText17")}</Select.Option>
<Select.Option value="4">{intl.get("exchangeConfigText18")}</Select.Option>
<Select.Option value="5">{intl.get("exchangeConfigText19")}</Select.Option>
<Select.Option value="6">{intl.get("exchangeConfigText20")}</Select.Option>
<Select.Option value="7">{intl.get("exchangeConfigText21")}</Select.Option>
</Select>
{
exchangeLimit != 1 ?
<Input
type="number"
step={1}
style={{ width: 150, marginLeft: 15 }}
min={1}
onChange={this.getExchangeLimitNumber}
value={exchangeLimitNumber}
addonAfter={intl.get("exchangeConfigText9")}
/> : ""
}
<br />
<Button style={{ marginTop: 30 }} type="primary" htmlType="submit" >{intl.get("Save")}</Button>
</Form.Item>
</Form>
</div>;
}
}
function mapStateToProps(state, ownProps) {
return {
exchangeSwitchStatus: state.point.exchangeSwitchStatus,
exchangeRule: state.point.exchangeRule,
};
}
function mapDispatchToProps(dispatch) {
return {
saveExchangeRule: (obj, callback) => dispatch(saveExchangeRule(obj, callback)),
getExchangeRule: (callback) => dispatch(getExchangeRule(callback)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Form.create()(IntegralExchangeSetting));
\ No newline at end of file
.exchangeContainer {
width: 100%;
.exchangeConfigContainer {
width: 100%;
height: 258px;
border-bottom: 1px solid #F0F0F0;
padding: 24px 16px 0 16px;
.exchangeConfigArea {
width: 100%;
height: 218px;
.exchangeConfigItem {
width: 32%;
height: 218px;
background-color: rgba(66, 133, 244, 0.05);
padding-top: 24px;
padding-right: 16px;
padding-left: 96px;
position: relative;
.exchangeConfigIcon {
width: 96px;
height: 218px;
position: absolute;
left: 0;
top: 0;
text-align: center;
font-size: 56px;
padding-top: 52px;
}
.exchangeConfigSwitch {
position: absolute;
right: 18px;
bottom: 26px;
}
.exchangeConfigInfo {
width: 100%;
.exchangeConfigName {
width: 100%;
height: 28px;
line-height: 28px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
font-size: 20px;
}
.exchangeConfigDesc {
width: 100%;
line-height: 20px;
color: rgba(0, 0, 0, 0.45);
font-weight: 500;
font-size: 14px;
margin-top: 16px;
text-align: justify;
}
}
}
}
}
.exchangeTabsContainer {
width: 100%;
.exchangeTabsContentContainer {
width: 100%;
.payByIntegralTitle {
width: 100%;
padding-left: 32px;
padding-top: 33px;
line-height: 24px;
font-size: 16px;
color: #000;
font-weight: 400;
}
}
}
.tradingLogsContainer {
width: 100%;
padding: 16px;
background-color: white;
.list_btn {
margin-bottom: 16px;
}
}
}
.tradingLogsFilter {
width: 470px;
height: 208px;
background-color: #fff;
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.2);
border-radius: 2px;
padding-top: 15px;
.tradingLogsFilterBtns {
width: 100%;
text-align: center;
}
}
import React, { Component } from 'react';
import Styles from "./style.less";
import { connect } from "react-redux";
import {
Button,
Table,
Input,
Icon,
message,
Dropdown
} from "antd";
import { getTradingLogs,exportTradingLogs } from "../redux/action";
import TradingLogsFilter from "./tradingLogsFilter";
import intl from "react-intl-universal";
import func from "../../../../util/commonFunc";
const tradingTypeArr = {
"100": intl.get("exchangeConfigText37"),
"110": intl.get("exchangeConfigText38"),
"120": intl.get("exchangeConfigText39"),
"180": intl.get("exchangeConfigText40"),
"181": intl.get("exchangeConfigText41"),
"182": intl.get("exchangeConfigText42"),
"200": intl.get("exchangeConfigText43"),
"210": intl.get("exchangeConfigText44"),
"280": intl.get("exchangeConfigText45"),
"281": intl.get("exchangeConfigText46"),
"282": intl.get("exchangeConfigText47"),
"300": intl.get("exchangeConfigText48"),
};
class TradingLogs extends Component {
constructor(props) {
super(props);
this.state = {
tradingLogsKeyword: "",
pageNo: 1,
pageSize: 10,
tradingType: "1",
startTime: "",
endTime: "",
tradingLogsTotal: 0,
selectedKeys: [],
dropDownVisible: false
};
// 列名
this.columns = [
{
title: intl.get("UserName"),
dataIndex: "username",
key: "username",
render: (text, record) => {
return <span >
{text.length > 14 ? text.slice(0, 14) + "..." : text}
</span>
}
},
{
title: intl.get("Name"),
dataIndex: "name",
key: "name",
render: (text, record) => {
return <span >
{text.length > 14 ? text.slice(0, 14) + "..." : text}
</span>
}
},
{
title: intl.get("exchangeConfigText26"),
dataIndex: "tradingTime",
key: "tradingTime",
},
{
title: intl.get("exchangeConfigText27"),
dataIndex: "tradingNo",
key: "tradingNo",
render: text => (
<span>{text}</span>
),
},
{
title: intl.get("exchangeConfigText28"),
dataIndex: "type",
key: "type",
render: text => (
<span>{tradingTypeArr[String(text)]}</span>
),
},
{
title: intl.get("Remark"),
dataIndex: "remark",
key: "remark",
render: text => text,
}, ,
{
title: intl.get("exchangeConfigText29"),
dataIndex: "costNumber",
key: "costNumber",
render: text => {
return parseInt(text) > 0 ? "+" + text : text;
},
},
];
}
componentDidMount() {
this.getTradingLogsList(1);
}
componentWillReceiveProps(nextProps) {
if(nextProps.tabKey != this.props.tabKey){
this.setState({
dropDownVisible: false
})
}
}
//TODO 根据页码获取消费充值列表
getTradingLogsList(page) {
const { getTradingLogs } = this.props;
const { pageSize, tradingLogsKeyword, startTime, endTime, tradingType } = this.state;
let _this = this;
let params = {
pageNo: page,
pageSize: pageSize,
kwd: tradingLogsKeyword.trim(),
};
if (tradingType != "1") {
params.type = parseInt(tradingType);
}
if (startTime) {
params.startAt = startTime;
}
if (endTime) {
params.endAt = endTime;
}
console.log(params);
getTradingLogs(params, () => {
const { tradingLogs, tradingLogsTotal } = _this.props;
let arr = [];
arr = tradingLogs && tradingLogs.map((item, index) => {
return {
key: item.orderId,
id: item.orderId,
username: item.name,
name: item.fullName,
tradingTime: item.createdAt,
tradingNo: item.orderId,
type: item.type,
remark: item.remark,
costNumber: item.count
}
});
this.setState({
tradingLogsLists: arr,
tradingLogsTotal: tradingLogsTotal,
pageNo: page
});
});
}
// TODO 获取关键词
handleGetValue = e => {
const { value } = e.target;
this.setState({
tradingLogsKeyword: value,
});
};
// TODO 根据相关数据进行搜索
handleSearch = () => {
this.getTradingLogsList(1);
};
//TODO 导出明细
exportTradingLogs = () => {
const { exportTradingLogs } = this.props;
const { tradingLogsKeyword, startTime, endTime, tradingType } = this.state;
let params = {
kwd: tradingLogsKeyword.trim(),
};
if (tradingType != "1") {
params.type = parseInt(tradingType);
}
if (startTime) {
params.startAt = startTime;
}
if (endTime) {
params.endAt = endTime;
}
exportTradingLogs(params, (data) => {
if(data.code=="1000"){
message.success("导出成功,"+data.data);
}
});
}
// TODO 页面大小切换
pageSizeChange = (page, size) => {
let _this = this;
this.setState({
pageSize: size
}, () => {
_this.getTradingLogsList(1);
});
}
// TODO 页码切换
pageChange = (page, size) => {
this.getTradingLogsList(page);
}
dropDownClick = (e) => {
e.preventDefault();
const { dropDownVisible } = this.state;
this.setState({
dropDownVisible: !dropDownVisible
})
}
dropDownClose = () => {
this.setState({
dropDownVisible: false
})
}
//TODO 获取高级检索相关数据进行搜索
advancedSearch = (data) => {
const { startTime, endTime, tradingType } = data;
let _this = this;
this.setState({
startTime,
endTime,
tradingType
}, () => {
_this.getTradingLogsList(1);
});
}
render() {
const { tradingLogsLists, tradingLogsTotal, pageSize, pageNo } = this.state;
let pagination = {
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
total: tradingLogsTotal,
showTotal: total => `共计 ${total} 条`,
PageSize: pageSize,
current: pageNo,
onShowSizeChange: this.pageSizeChange,
onChange: this.pageChange
};
// 默认栏目
const { columns } = this;
const searchBtnStyle = { marginRight: 10, marginBottom: 10 };
return (
<div className={Styles.tradingLogsContainer}>
{/* 展示头部 */}
<div className={Styles.list_btn}>
<div>
<Input.Search
placeholder={intl.get("exchangeConfigText24")}
style={{ width: 250, ...searchBtnStyle }}
onChange={this.handleGetValue}
onSearch={this.handleSearch}
/>
<Dropdown
trigger={["click"]}
placement={"bottomCenter"}
overlay={
<TradingLogsFilter
dropDownClose={this.dropDownClose}
advancedSearch={this.advancedSearch}
/>
}
visible={this.state.dropDownVisible}
>
<a className="ant-dropdown-link" style={{ lineHeight: "30px" }} onClick={this.dropDownClick}>
{intl.get("advancedSearch")}<Icon type="down" />
</a>
</Dropdown>
<Button
onClick={this.exportTradingLogs}
style={{ float: "right", ...searchBtnStyle }}
>
{intl.get("exchangeConfigText25")}
</Button>
</div>
</div>
{/* 消费充值列表 */}
<Table
style={{ marginLeft: 20, marginRight: 20, marginTop: 10 }}
columns={columns}
dataSource={tradingLogsLists}
pagination={pagination}
/>
</div>
);
}
}
function mapStateToProps(state, ownProps) {
return {
tradingLogs: state.point.tradingLogs,
tradingLogsTotal: state.point.tradingLogsTotal,
};
}
function mapDispatchToProps(dispatch) {
return {
getTradingLogs: (obj, callback) => dispatch(getTradingLogs(obj, callback)),
exportTradingLogs: (obj, callback) => dispatch(exportTradingLogs(obj, callback)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(TradingLogs);
import React, { Component } from 'react';
import styles from "./style.less";
import { Form, Select, DatePicker, Button } from "antd";
const Option = Select.Option;
const RangePicker = DatePicker.RangePicker;
import intl from "react-intl-universal";
class TradingLogsFilter extends Component {
constructor(props) {
super(props)
this.state = {
tradingType: "1",
startTime: "",
endTime: "",
refreshFilter: ""
}
}
//获取交易类型
handleTradingType = (value) => {
this.setState({
tradingType: value,
});
}
handleGetDateRange = (dates, dateStrings) => {
if (dates.length == 0) {
this.setState({
startTime: "",
endTime: ""
});
}
}
handleDateRangeOk = (dates) => {
if (dates.length >= 2) {
let startTime = dates[0].valueOf();
let endTime = dates[1].valueOf();
this.setState({
startTime,
endTime
});
}
}
searchByData = () => {
this.props.advancedSearch(this.state);
this.props.dropDownClose();
}
resetSearch = () => {
this.setState({
tradingType: "1",
startTime: "",
endTime: "",
siteProtectStatus: "0",
refreshFilter: new Date().getTime()
});
this.props.advancedSearch({
tradingType: "1",
startTime: "",
endTime: "",
siteProtectStatus: "0",
});
this.props.dropDownClose();
}
render() {
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 19 },
},
};
return (
<div className={styles.tradingLogsFilter}>
<Form {...formItemLayout} >
<Form.Item label={intl.get("exchangeConfigText28")} >
<Select
style={{ width: 350 }}
onChange={this.handleTradingType}
value={this.state.tradingType}
>
<Option value="1">{intl.get("all")}</Option>
<Option value="100">{intl.get("exchangeConfigText30")}</Option>
<Option value="200">{intl.get("exchangeConfigText31")}</Option>
</Select>
</Form.Item>
<Form.Item label={intl.get("Time")} >
<RangePicker
key={this.state.refreshFilter}
style={{}}
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
placeholder={[intl.get("StartTime"), intl.get("EndTime")]}
onChange={this.handleGetDateRange}
onOk={this.handleDateRangeOk}
/>
</Form.Item>
</Form>
<div className={styles.tradingLogsFilterBtns}>
<Button style={{ marginRight: 8 }} onClick={this.resetSearch}>
{intl.get("SystemAdmin16")}
</Button>
<Button type={"primary"} onClick={this.searchByData}>
{intl.get("Search")}
</Button>
</div>
</div >
)
}
}
export default TradingLogsFilter;
\ No newline at end of file
...@@ -3,6 +3,7 @@ import { message } from "antd"; ...@@ -3,6 +3,7 @@ import { message } from "antd";
//积分 //积分
export const POINT_SET = "POINT_SET"; export const POINT_SET = "POINT_SET";
export const POINT_TABLE = "POINT_TABLE"; export const POINT_TABLE = "POINT_TABLE";
export const POINT_EXCHANGE = "POINT_EXCHANGE";
export const POINT_DETAILED = "POINT_DETAILED"; export const POINT_DETAILED = "POINT_DETAILED";
// 兑换 // 兑换
...@@ -17,13 +18,14 @@ const { ...@@ -17,13 +18,14 @@ const {
postPointSetApi, postPointSetApi,
exclApi, exclApi,
postPointEditApi, postPointEditApi,
getPointTableApi, //商品列表
postPointTableApi,
postPointShelfApi, postPointShelfApi,
postPointShelvesApi, postPointShelvesApi,
postPointAddApi, postPointAddApi,
postPointModifyApi, postPointModifyApi,
getPointDetailedApi, getPointDetailedApi,
pointActivityDelApi, pointProductDelApi,
getExchangeSwitchApi, getExchangeSwitchApi,
getExchangeRuleApi, getExchangeRuleApi,
...@@ -32,6 +34,9 @@ const { ...@@ -32,6 +34,9 @@ const {
exportTradingLogsApi, exportTradingLogsApi,
turnOnOrOffSwitchApi, turnOnOrOffSwitchApi,
getCodeListApi, getCodeListApi,
//兑换列表
postUserListApi,
postPointExchangeApi,
} = api; } = api;
//积分通用设置 //积分通用设置
...@@ -87,16 +92,15 @@ export function postPointEdit(data) { ...@@ -87,16 +92,15 @@ export function postPointEdit(data) {
// Table // Table
export function getPointTable(data) { export function getPointTable(data) {
console.log(data);
return dispatch => { return dispatch => {
// return fetch(pointUrl+`/manage/activity/list`,{type:'GET',data:data}) // return fetch(pointUrl+`/manage/activity/list`,{type:'GET',data:data})
return request({ return request({
url: getPointTableApi, url: postPointTableApi,
data: data, data: data,
}).then(res => { }).then(res => {
dispatch({ dispatch({
type: POINT_TABLE, type: POINT_TABLE,
data: res, data: res.data,
}); });
}); });
}; };
...@@ -208,7 +212,7 @@ export function pointActivityDel(data, callback) { ...@@ -208,7 +212,7 @@ export function pointActivityDel(data, callback) {
return dispatch => { return dispatch => {
// return fetch(pointUrl+`/manage/point/details/list`,{type:'GET',data:data}) // return fetch(pointUrl+`/manage/point/details/list`,{type:'GET',data:data})
return request({ return request({
url: pointActivityDelApi, url: pointProductDelApi,
data: data, data: data,
}).then(res => { }).then(res => {
callback(res); callback(res);
...@@ -363,3 +367,31 @@ export function getCodeList(data, callback) { ...@@ -363,3 +367,31 @@ export function getCodeList(data, callback) {
}); });
}; };
} }
// 获取积分列表
export function postUserList(data, callback) {
return dispatch => {
return request({
url: postUserListApi,
data: data,
}).then(res => {
dispatch({
type: POINT_EXCHANGE,
data: res.data,
});
});
};
}
// 积分兑换
export function postPointExchange(data, callback) {
return dispatch => {
return request({
url: postPointExchangeApi,
data: data,
}).then(res => {
if (res.code == "1000") {
message.success("兑换成功");
}
});
};
}
\ No newline at end of file
...@@ -3,15 +3,31 @@ export default { ...@@ -3,15 +3,31 @@ export default {
postPointSetApi: `GET ${services.webManage}/point/strategy/view`, postPointSetApi: `GET ${services.webManage}/point/strategy/view`,
exclApi: `POST ${services.webManage}/point/import`, exclApi: `POST ${services.webManage}/point/import`,
postPointEditApi: `POST ${services.webManage}/point/strategy/update`, postPointEditApi: `POST ${services.webManage}/point/strategy/update`,
getPointTableApi: `GET ${services.webManage}/activity/list`,
postPointShelfApi: `POST ${services.webManage}/activity/enabled`, postPointShelfApi: `POST ${services.webManage}/activity/enabled`,
postPointShelvesApi: `POST ${services.webManage}/activity/disabled`, postPointShelvesApi: `POST ${services.webManage}/activity/disabled`,
postPointAddApi: `POST ${services.webManage}/activity/insert`, // 商品列表
postPointModifyApi: `POST ${services.webManage}/activity/update`, postPointTableApi: `POST ${services.webManage}/point/product/list`,
getPointDetailedApi: `GET ${services.webManage}/point/details/list`, //新增商品
pointActivityDelApi: `POST ${services.webManage}/activity/delete`, postPointAddApi: `POST ${services.webManage}/point/product/insert`,
//修改商品
postPointModifyApi: `POST ${services.webManage}/point/product/update`,
//删除商品
pointProductDelApi: `POST ${services.webManage}/point/product/delete`,
//上架
getPointDetailedApi: `POST ${services.webManage}/point/product/enabled`,
//下架
pointProductShelvesApi: `POST ${services.webManage}/point/product/disabled`,
//兑换管理 //兑换管理
//--积分列表
// /manage/point/user/list
// 入参:{"name":"xx", "pageNo":"1", "pageSize":10}
// --积分兑换
// /manage/point/user/exchange
// {"userId":1314, "point": 2}
postUserListApi: `POST ${services.webManage}/point/user/list`,
postPointExchangeApi: `POST ${services.webManage}/point/user/exchange`,
getExchangeSwitchApi: `GET ${services.webMall}/student/token/config/switch`, getExchangeSwitchApi: `GET ${services.webMall}/student/token/config/switch`,
getExchangeRuleApi: `GET ${services.webMall}/manage/tokenExchangeRule/get`, getExchangeRuleApi: `GET ${services.webMall}/manage/tokenExchangeRule/get`,
saveExchangeRuleApi: `POST ${services.webMall}/manage/tokenExchangeRule/save`, saveExchangeRuleApi: `POST ${services.webMall}/manage/tokenExchangeRule/save`,
......
...@@ -9,6 +9,7 @@ const initialState = { ...@@ -9,6 +9,7 @@ const initialState = {
set: null, set: null,
table: null, table: null,
detailed: null, detailed: null,
exchangeList: null,
codeList: [], codeList: [],
exchangeSwitchStatusList: [], exchangeSwitchStatusList: [],
exchangeRule: {}, exchangeRule: {},
...@@ -33,6 +34,11 @@ function point(state = initialState, action) { ...@@ -33,6 +34,11 @@ function point(state = initialState, action) {
return Object.assign({}, state, { return Object.assign({}, state, {
table: action.data, table: action.data,
}); });
//兑换列表
case "POINT_EXCHANGE":
return Object.assign({}, state, {
exchangeList: action.data,
});
//积分流水明细 //积分流水明细
case "POINT_DETAILED": case "POINT_DETAILED":
return Object.assign({}, state, { return Object.assign({}, state, {
......
...@@ -172,22 +172,6 @@ const ActiveOption = Loadable({ ...@@ -172,22 +172,6 @@ const ActiveOption = Loadable({
), ),
loading: SpinLoading, loading: SpinLoading,
}); });
//积分兑换设置
const ExchangeForOption = Loadable({
loader: () =>
import(
/* webpackChunkName: "ExchangeForOption" */ "@/pages/SystemManagement/Point/exchangeForOption/index"
),
loading: SpinLoading,
});
//积分流水明细
const Detailed = Loadable({
loader: () =>
import(
/* webpackChunkName: "Detailed" */ "@/pages/SystemManagement/Point/Detailed"
),
loading: SpinLoading,
});
// RulesEngine 规则引擎(推荐管理) // RulesEngine 规则引擎(推荐管理)
const RulesEngine = Loadable({ const RulesEngine = Loadable({
loader: () => loader: () =>
...@@ -358,11 +342,6 @@ class Online extends React.Component { ...@@ -358,11 +342,6 @@ class Online extends React.Component {
path={`${this.props.match.url}/message-management`} path={`${this.props.match.url}/message-management`}
component={() => <Message />} component={() => <Message />}
/> />
<Route
path={`${this.props.match.url}/underline/underlineclass`}
component={() => <div>积分管理</div>}
/>
<Route <Route
path={`${this.props.match.url}/system/sensitiveWords`} path={`${this.props.match.url}/system/sensitiveWords`}
component={() => <SensitiveWords />} component={() => <SensitiveWords />}
...@@ -410,16 +389,6 @@ class Online extends React.Component { ...@@ -410,16 +389,6 @@ class Online extends React.Component {
path={`${this.props.match.url}/point/active-option`} path={`${this.props.match.url}/point/active-option`}
component={() => <ActiveOption />} component={() => <ActiveOption />}
/> />
{/*积分兑换设置*/}
<Route
path={`${this.props.match.url}/point/exchange-for-option`}
component={() => <ExchangeForOption />}
/>
{/*积分流水明细*/}
<Route
path={`${this.props.match.url}/point/Detailed-option`}
component={() => <Detailed props={this.props} />}
/>
{/*规则引擎(推荐管理)*/} {/*规则引擎(推荐管理)*/}
<Route <Route
path={`${this.props.match.url}/rules-engine-management`} path={`${this.props.match.url}/rules-engine-management`}
......
...@@ -377,7 +377,7 @@ class Base extends Component { ...@@ -377,7 +377,7 @@ class Base extends Component {
style={{ display: "inline-block" }} style={{ display: "inline-block" }}
/> />
)} )}
{this.props.iscopy == true ? null : ( {/* {this.props.iscopy == true ? null : (
<Button <Button
type="primary" type="primary"
onClick={this.showModal} onClick={this.showModal}
...@@ -386,7 +386,7 @@ class Base extends Component { ...@@ -386,7 +386,7 @@ class Base extends Component {
> >
复制问卷 复制问卷
</Button> </Button>
)} )} */}
</FormItem> </FormItem>
<FormItem {...formItemLayout} label="业务类型:"> <FormItem {...formItemLayout} label="业务类型:">
{getFieldDecorator("bizType", { {getFieldDecorator("bizType", {
......
// let baseUrl = API_CONFIG.BASE_URL; // let baseUrl = API_CONFIG.BASE_URL;
const { IP } = require("../../build/Ip"); const { IP } = require("../../build/Ip");
let baseUrl = "http://10.10.12.94:8090"; let baseUrl = IP;
// let baseUrl = "";
if (location.host.includes("localhost")) {
// baseUrl = IP + '/admin';
baseUrl = "https://hqjddj.shanghaiairport.com";
// baseUrl = "http://192.168.1.107:8090"; //lang
// baseUrl = "https://192.168.1.106:8090";
}
const service = { const service = {
webManage: `${baseUrl}/web-manage/manage`, webManage: `${baseUrl}/web-manage/manage`,
webMall: `${baseUrl}/mall`, webMall: `${baseUrl}/mall`,
......
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