|
@@ -1,7 +1,8 @@
|
|
|
import React from 'react';
|
|
|
-import { Modal, Select, Descriptions, Button, Input } from 'antd';
|
|
|
+import { Modal, Select, Descriptions, Button, Input ,message} from 'antd';
|
|
|
import { BirdGrid } from 'components/Grid';
|
|
|
import { config, request, util } from 'utils'
|
|
|
+import { jrequest } from 'utils/request';
|
|
|
|
|
|
|
|
|
const { Option } = Select;
|
|
@@ -14,22 +15,73 @@ class MemberPoints extends React.Component {
|
|
|
this.state = {
|
|
|
value: '',
|
|
|
visible: false,
|
|
|
- visibleLogs: false
|
|
|
+ visibleLogs: false,
|
|
|
+ memPointsLog: [],
|
|
|
+ visibleEvidence: false,
|
|
|
+ evidenceData: {},
|
|
|
+ weixinUserInfo:{},
|
|
|
+ addPointLog:{},
|
|
|
+ increaseOrDecrease : "add",
|
|
|
+ pointIncrease: 0,
|
|
|
+ pointIncreaseDesc:'人为增加或者减少积分'
|
|
|
+
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
- showModal = () => {
|
|
|
+ showModal = (data) => {
|
|
|
this.setState({
|
|
|
visible: true,
|
|
|
+ weixinUserInfo: data
|
|
|
});
|
|
|
};
|
|
|
|
|
|
handleOk = (e) => {
|
|
|
+ let self = this;
|
|
|
console.log(e);
|
|
|
+ let addPointLog = this.state.addPointLog;
|
|
|
+ addPointLog.secretPhone = this.state.weixinUserInfo.secretPhone;
|
|
|
+ addPointLog.id = this.state.weixinUserInfo.id;
|
|
|
+ addPointLog.increase = this.state.increaseOrDecrease === "add" ? true:false;
|
|
|
+ addPointLog.action = this.state.increaseOrDecrease === "add" ? '人为增加积分': '人为减少积分';
|
|
|
+ addPointLog.remark = this.state.pointIncreaseDesc;
|
|
|
+ addPointLog.value = this.state.pointIncrease;
|
|
|
+ addPointLog.terminalName = "会员中心"
|
|
|
+ addPointLog.terminalAction = "人为增加或者减少积分"
|
|
|
+ if(this.state.pointIncrease <= 0){
|
|
|
+ message.error("增加或者减少的积分不能小于等于0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addPointLog.increase){
|
|
|
+ addPointLog.balance = parseInt(this.state.weixinUserInfo.point) + parseInt(this.state.pointIncrease);
|
|
|
+ }else{
|
|
|
+ addPointLog.balance = parseInt(this.state.weixinUserInfo.point) - parseInt(this.state.pointIncrease);
|
|
|
+ }
|
|
|
+ console.log(addPointLog);
|
|
|
+ if(addPointLog.balance < 0){
|
|
|
+ message.error("变更后的积分不能为负数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
this.setState({
|
|
|
visible: false,
|
|
|
});
|
|
|
+
|
|
|
+ jrequest({
|
|
|
+ url: "/wechatInfo/addPoint",
|
|
|
+ method: "post",
|
|
|
+ data:addPointLog
|
|
|
+ }).then(result => {
|
|
|
+ if (result.success) {
|
|
|
+ message.success("保存成功");
|
|
|
+ self.refs.grid.reload();
|
|
|
+ } else {
|
|
|
+ message.error("保存失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
};
|
|
|
|
|
|
handleCancel = (e) => {
|
|
@@ -39,12 +91,6 @@ class MemberPoints extends React.Component {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- showModalLogs = () => {
|
|
|
- this.setState({
|
|
|
- visibleLogs: true,
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
|
|
|
handleCancelLogs = (e) => {
|
|
|
console.log(e);
|
|
@@ -54,14 +100,53 @@ class MemberPoints extends React.Component {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ //弹出证据链查看模态框
|
|
|
+ showModalEvidence = (data) => {
|
|
|
+ this.setState({
|
|
|
+ evidenceData: data,
|
|
|
+ visibleEvidence: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //关闭证据链查看模态框
|
|
|
+ handleCancelEvidence = () => {
|
|
|
+ this.setState({
|
|
|
+ visibleEvidence: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 增加或者减少
|
|
|
+ increaseOrDecrease =(event) =>{
|
|
|
+ console.log(event);
|
|
|
+ this.setState({
|
|
|
+ increaseOrDecrease: event
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 增加或者减少的积分数
|
|
|
+ pointIncrease =(event) =>{
|
|
|
+ console.log(event.target.value);
|
|
|
+ this.setState({
|
|
|
+ pointIncrease: event.target.value
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 增加或者减少的积分数
|
|
|
+ pointIncreaseDesc =(event) =>{
|
|
|
+ console.log(event.target.value);
|
|
|
+ this.setState({
|
|
|
+ pointIncreaseDesc: event.target.value
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
render() {
|
|
|
|
|
|
+ let self = this;
|
|
|
+
|
|
|
let gridOption = {
|
|
|
title: "表格示例",
|
|
|
url: {
|
|
|
// read: APIV4 + "/userPointLog/logs",
|
|
|
- read: JAPIV + "/userPointLog/logsCondition",
|
|
|
+ read: JAPIV + "/wechatInfo/query",
|
|
|
// add: "/test/add",
|
|
|
// edit: "/test/edit",
|
|
|
// delete: "/test/delete"
|
|
@@ -72,18 +157,32 @@ class MemberPoints extends React.Component {
|
|
|
//actions: [{ name: '外部按钮', color: 'error', onClick: function () { } }],
|
|
|
columns: [
|
|
|
{ title: "会员ID", data: "id", type: "text", editor: {} },
|
|
|
- { title: "姓名(昵称)", data: "crtUser", type: "number" },
|
|
|
+ { title: "姓名(昵称)", data: "nickname", type: "number" },
|
|
|
{ title: "手机号", data: "secretPhone", type: "number", query: true },
|
|
|
- { title: "积分余额", data: "balance", type: "text", editor: {} },
|
|
|
+ { title: "积分余额", data: "point", type: "text", editor: {} },
|
|
|
{
|
|
|
title: "操作选项", type: "command", actions: [{
|
|
|
name: '更改',
|
|
|
color: '#1880FF',
|
|
|
- onClick: this.showModal
|
|
|
+ onClick: (data) => {
|
|
|
+ this.showModal(data)
|
|
|
+ }
|
|
|
}, {
|
|
|
name: '日志',
|
|
|
color: '#1880FF',
|
|
|
- onClick: this.showModalLogs
|
|
|
+ onClick: (data) => {
|
|
|
+ jrequest({
|
|
|
+ //url: APIV3+"/web/memProduct/getProductLog?staffId="+user.staffid,
|
|
|
+ url: JAPIV + "/userPointLog/logsConditionOneUser?secretPhone=" + data.secretPhone,
|
|
|
+ method: "get",
|
|
|
+ //data:{productCode:data.ProductCode}
|
|
|
+ }).then((result) => {
|
|
|
+ self.setState({
|
|
|
+ memPointsLog: result.content,
|
|
|
+ visibleLogs: true,
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
}]
|
|
|
}
|
|
|
]
|
|
@@ -91,31 +190,25 @@ class MemberPoints extends React.Component {
|
|
|
|
|
|
let gridOptionLogs = {
|
|
|
title: "表格示例",
|
|
|
- url: {
|
|
|
- // read: APIV4 + "/userPointLog/logs",
|
|
|
- read: "/api/v1/table",
|
|
|
- // add: "/test/add",
|
|
|
- // edit: "/test/edit",
|
|
|
- // delete: "/test/delete"
|
|
|
- },
|
|
|
+ dataSource: this.state.memPointsLog,
|
|
|
pageSize: 8,
|
|
|
- checkable: true,
|
|
|
+ checkable: false,
|
|
|
//actions: [{ name: '外部按钮', color: 'error', onClick: function () { } }],
|
|
|
columns: [
|
|
|
{ title: "会员ID", data: "id", type: "text", editor: {}, hide: true },
|
|
|
- { title: "时间", data: "field-datetime", type: "datetime", editor: {} },
|
|
|
- { title: "变更积分值", data: "crtUser", type: "number" },
|
|
|
- { title: "原始积分值", data: "secretPhone", type: "number" },
|
|
|
+ { title: "时间", data: "lastUpdate", type: "text", editor: {} },
|
|
|
+ { title: "变更积分值", data: "value", type: "number" },
|
|
|
+ { title: "原始积分值", data: "origin", type: "number" },
|
|
|
{ title: "变更后积分值", data: "balance", type: "text", editor: {} },
|
|
|
- { title: "用户行为终端", data: "balance", type: "text", editor: {} },
|
|
|
- { title: "用户行为", data: "balance", type: "text", editor: {} },
|
|
|
- { title: "备注", data: "balance", type: "text", editor: {} },
|
|
|
+ { title: "用户行为终端", data: "terminalName", type: "text", editor: {} },
|
|
|
+ { title: "用户行为", data: "terminalAction", type: "text", editor: {} },
|
|
|
+ { title: "备注", data: "remark", type: "text", editor: {} },
|
|
|
{
|
|
|
title: "证据链", type: "command", actions: [{
|
|
|
name: '查看',
|
|
|
color: '#1880FF',
|
|
|
onClick: (data) => {
|
|
|
- console.log(data)
|
|
|
+ this.showModalEvidence(data);
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
@@ -124,7 +217,7 @@ class MemberPoints extends React.Component {
|
|
|
};
|
|
|
|
|
|
const selectBefore = (
|
|
|
- <Select defaultValue="增加" style={{ width: 90 }}>
|
|
|
+ <Select value={this.state.increaseOrDecrease} style={{ width: 90 }} onChange={this.increaseOrDecrease}>
|
|
|
<Option value="add">增加</Option>
|
|
|
<Option value="delete">减少</Option>
|
|
|
</Select>
|
|
@@ -144,14 +237,14 @@ class MemberPoints extends React.Component {
|
|
|
</Button>,
|
|
|
]}
|
|
|
>
|
|
|
- <Descriptions column={1} style={{ margin: '25px 20px 0 0' }}>
|
|
|
- <Descriptions.Item label="原积分">100000</Descriptions.Item>
|
|
|
+ <Descriptions column={1} style={{ margin: '25px 20px 0 0', borderColor: "red" }}>
|
|
|
+ <Descriptions.Item label="原积分">{this.state.weixinUserInfo.point}</Descriptions.Item>
|
|
|
<Descriptions.Item label="变更积分">
|
|
|
<div style={{ marginBottom: 16 }}>
|
|
|
- <Input addonBefore={selectBefore} addonAfter="积分" />
|
|
|
+ <Input addonBefore={selectBefore} addonAfter="积分" onChange={this.pointIncrease} placeholder={this.state.pointIncrease}></Input>
|
|
|
</div>
|
|
|
</Descriptions.Item>
|
|
|
- <Descriptions.Item label="原因说明"><Input /></Descriptions.Item>
|
|
|
+ <Descriptions.Item label="原因说明"><Input onChange={this.pointIncreaseDesc} placeholder={this.state.pointIncreaseDesc}></Input></Descriptions.Item>
|
|
|
|
|
|
</Descriptions>
|
|
|
|
|
@@ -164,9 +257,45 @@ class MemberPoints extends React.Component {
|
|
|
footer={null}
|
|
|
width={1000}
|
|
|
>
|
|
|
- <BirdGrid gridOption={gridOptionLogs} ref="grid" />
|
|
|
+ <BirdGrid gridOption={gridOptionLogs} ref="grid1" />
|
|
|
|
|
|
</Modal>
|
|
|
+
|
|
|
+
|
|
|
+ <Modal
|
|
|
+ title="证据链"
|
|
|
+ visible={this.state.visibleEvidence}
|
|
|
+ onCancel={this.handleCancelEvidence}
|
|
|
+ footer={[
|
|
|
+ <Button key="submit" type="primary" onClick={this.handleCancelEvidence} >
|
|
|
+ 返回
|
|
|
+ </Button>,
|
|
|
+ ]}
|
|
|
+ width="80%"
|
|
|
+ >
|
|
|
+ <div style={{ width: '96%', margin: '30px 0 20px 2%', border: "none" }}>
|
|
|
+ <Descriptions title="基础信息" bordered column={2} style={{ border: "none" }}>
|
|
|
+ <Descriptions.Item label="数据来源平台">{this.state.evidenceData.terminalName}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="订单编号" span={2}>{this.state.evidenceData.dataCode}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="用户行为" span={2}>{this.state.evidenceData.terminalAction}</Descriptions.Item>
|
|
|
+ </Descriptions>
|
|
|
+ <Descriptions title="变量字段" bordered column={2} style={{ margin: '25px 20px 0 0' }}>
|
|
|
+ <Descriptions.Item label="订单金额">{this.state.evidenceData.orderAmount}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="优惠金额">{this.state.evidenceData.discountedPrice}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="物流运费">{this.state.evidenceData.transportCost}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="实付金额">{this.state.evidenceData.payment}</Descriptions.Item>
|
|
|
+ </Descriptions>
|
|
|
+ {/* <Descriptions title="成长值计算" column={1} style={{ margin: '25px 20px 0 0' }}>
|
|
|
+ <Descriptions.Item label="计算公式">{this.state.evidenceData.remark}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="成长值变动">500.00 * 5% = 25</Descriptions.Item>
|
|
|
+ </Descriptions> */}
|
|
|
+ <Descriptions title="积分值计算" column={1} style={{ margin: '25px 20px 0 0' }}>
|
|
|
+ <Descriptions.Item label="计算公式">{this.state.evidenceData.remark}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="积分值变动">{this.state.evidenceData.payment}*{this.state.evidenceData.remark ? this.state.evidenceData.remark.split("*")[1] : ""}={this.state.evidenceData.value}</Descriptions.Item>
|
|
|
+ </Descriptions>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
);
|