diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index ba87fa96..546f9af4 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -225,6 +225,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { sessionStorage.setItem("keyType", 2); // 1.1 获取归属计划下拉框数据 await getPlanList().then((arr) => { + console.log("arr =>1", arr); // 1.2 优惠券管理判断是新增还是编辑 if (editData && editData !== "") { setState({ isEdit: true }); @@ -232,7 +233,11 @@ const UseCouponAddEdit = forwardRef((props, ref) => { let plan_row = arr.find( (item) => item.text === editData.plan_title ); - if (plan_row) { + if ( + plan_row && + plan_row !== undefined && + plan_row !== "undefined" + ) { setForm_info_data({ plan_id: plan_row, }); @@ -240,16 +245,17 @@ const UseCouponAddEdit = forwardRef((props, ref) => { setState({ direct_reseller_id: plan_row.key.reseller_id, }); + // 1.5 设置归属计划key + getKey(plan_row.key.key).then((arr_key) => { + let el_key = arr_key.find( + (item) => editData.key_batch_id === item.key + ); + if (el_key) { + setForm_info_data({ key_batch_id: el_key }); + } + }); } - // 1.5 设置归属计划key - getKey(plan_row.key.key).then((arr_key) => { - let el_key = arr_key.find( - (item) => editData.key_batch_id === item.key - ); - if (el_key) { - setForm_info_data({ key_batch_id: el_key }); - } - }); + // 1.6 设置其它数据 editFun(); @@ -559,7 +565,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { (item) => !item.checked && (item.goods_id || item.only.goods_id) ) .map((item) => { - console.log("item =>", item); if (item.type === 1) { return item.goods_id; } else { @@ -799,7 +804,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { table_index: index, }); } else { - console.log("rowData =>", rowData); setState({ product_title: "编辑商品", productData: rowData, diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index 4566adda..2d03f834 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -127,7 +127,9 @@ export default class acclist extends React.Component { product_title: "新建商品", addIsType: "", keyCodeId: "", //key批次ID - keyType: 1, + keyType: sessionStorage.getItem("isKeyAdd") + ? Number(sessionStorage.getItem("isKeyAdd")) + : 1, couponData: [], Column: [ { @@ -1554,7 +1556,11 @@ export default class acclist extends React.Component { { this.onCheckChange(e); }} diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js index 3171025b..7406efac 100644 --- a/src/pages/plan/key/list.js +++ b/src/pages/plan/key/list.js @@ -1,5 +1,5 @@ /* key列表 */ -import React from 'react' +import React from "react"; import { Input, Notify, @@ -14,15 +14,15 @@ import { DropdownPosition, DropdownClickTrigger, Icon, - DropdownContent -} from 'zent' -import './list.less' -import { Switch, Pop } from 'zent' -import '../../../assets/comm.css' -import Ipt from '../../../components/input/main' -import Grid from '../../../components/gird/main.js' -import TabPage from '../../../components/tabPage/main.js' -import menu from '../../../assets/enum.js' + DropdownContent, +} from "zent"; +import "./list.less"; +import { Switch, Pop } from "zent"; +import "../../../assets/comm.css"; +import Ipt from "../../../components/input/main"; +import Grid from "../../../components/gird/main.js"; +import TabPage from "../../../components/tabPage/main.js"; +import menu from "../../../assets/enum.js"; import { terminateApprovals, getKeyList, @@ -30,116 +30,116 @@ import { startOrStopKeybatch, cancelKey, getReseller, - batchSend -} from '../../../assets/api.js' -import _ from 'lodash' + batchSend, +} from "../../../assets/api.js"; +import _ from "lodash"; const Column = [ { - title: 'key-批次ID', - name: 'id', - prop: 'id', - className: 'name', - type: 'normal', - width: '100px' + title: "key-批次ID", + name: "id", + prop: "id", + className: "name", + type: "normal", + width: "100px", }, { - title: '批次名称', - name: 'link', - prop: 'link', - type: 'slot', - width: '180px' + title: "批次名称", + name: "link", + prop: "link", + type: "slot", + width: "180px", }, { - title: '启用', - prop: 'switch', - name: 'switch', - width: '80px', - type: 'solt' + title: "启用", + prop: "switch", + name: "switch", + width: "80px", + type: "solt", }, { - title: '归属营销计划', - name: 'plan_title', - prop: 'plan_title', - type: 'normal', - width: '200px' + title: "归属营销计划", + name: "plan_title", + prop: "plan_title", + type: "normal", + width: "200px", }, { - title: '操作', - name: 'plan', - type: 'slot', - prop: 'edit', - width: '170px' + title: "操作", + name: "plan", + type: "slot", + prop: "edit", + width: "170px", }, { - title: '状态', - name: 'status', - type: 'slot', - prop: 'status', - width: '60px' + title: "状态", + name: "status", + type: "slot", + prop: "status", + width: "60px", }, { - title: '创建人', - name: 'creator_name', - prop: 'creator_name', - type: 'normal', - width: '100px' + title: "创建人", + name: "creator_name", + prop: "creator_name", + type: "normal", + width: "100px", }, { - title: '发放key码总数', - name: 'grant', - type: 'normal', - prop: 'grant', - width: '110px' + title: "发放key码总数", + name: "grant", + type: "normal", + prop: "grant", + width: "110px", }, { - title: '领取key总数', - name: 'receive', - type: 'normal', - prop: 'receive', - width: '120px' + title: "领取key总数", + name: "receive", + type: "normal", + prop: "receive", + width: "120px", }, { - title: '已消耗key总数', - name: 'usage', - type: 'slot', - prop: 'usage', - width: '120px' + title: "已消耗key总数", + name: "usage", + type: "slot", + prop: "usage", + width: "120px", }, { - title: '作废key码总数', - name: 'invalid', - type: 'normal', - prop: 'invalid', - width: '120px' + title: "作废key码总数", + name: "invalid", + type: "normal", + prop: "invalid", + width: "120px", }, { - title: '可用key码总数', - name: 'silent', - type: 'normal', - prop: 'silent', - width: '140px' + title: "可用key码总数", + name: "silent", + type: "normal", + prop: "silent", + width: "140px", }, { - title: '失效key码总数', - name: 'overdue', - type: 'normal', - prop: 'overdue', - width: '140px' + title: "失效key码总数", + name: "overdue", + type: "normal", + prop: "overdue", + width: "140px", }, { - title: '完结key码总数', - name: 'end', - type: 'normal', - prop: 'end', - width: '140px' + title: "完结key码总数", + name: "end", + type: "normal", + prop: "end", + width: "140px", }, { - title: '更新时间', - name: 'update_time', - type: 'normal', - prop: 'update_time', - width: '140px' - } + title: "更新时间", + name: "update_time", + type: "normal", + prop: "update_time", + width: "140px", + }, // { // title: "发放总价(预估)", // name: "grant_total", @@ -174,26 +174,26 @@ const Column = [ // prop: "silent_total", // width: "140px", // }, -] +]; export default class acclist extends React.Component { constructor(props) { - super(props) + super(props); this.state = { - planStatus: '', //计划状态 + planStatus: "", //计划状态 dataCount: 0, page: 1, limit: 10, tabList: [ - { title: '全部' }, - { title: '创建中' }, - { title: '审核中' }, - { title: '未通过' }, - { title: '进行中' }, - { title: '生成中' }, - { title: '暂停中' }, - { title: '已完结' }, - { title: '已作废' } + { title: "全部" }, + { title: "创建中" }, + { title: "审核中" }, + { title: "未通过" }, + { title: "进行中" }, + { title: "生成中" }, + { title: "暂停中" }, + { title: "已完结" }, + { title: "已作废" }, ], gridSelection: [], distdata: [], @@ -201,17 +201,17 @@ export default class acclist extends React.Component { distdata2: [ { id: 12313123213123, - name: '爱奇艺月卡兑换券', - time: '2021-11-08 14:21:06至2021-11-08 15:06:04', - plan: '营销计划2', + name: "爱奇艺月卡兑换券", + time: "2021-11-08 14:21:06至2021-11-08 15:06:04", + plan: "营销计划2", belongid: 3123213, send: 100, record: 58, used: 41, dead: 11, fail: 12, - status: '1' - } + status: "1", + }, ], activepage: 0, distdata4: [], @@ -219,29 +219,29 @@ export default class acclist extends React.Component { distdata11: [], tableHeight: 600, disabled: false, - email: '', - key_word: '', - phone: '', + email: "", + key_word: "", + phone: "", phone_list: [], email_list: [], - phone: '', - email: '', + phone: "", + email: "", email_radio: -1, phone_radio: -1, menuVisible: false, - isBulkSend: false - } + isBulkSend: false, + }; } cancel(e) { - this.setState({ audit_visible: false }) + this.setState({ audit_visible: false }); } send(e) { - let phoneReg = new RegExp('^[1][3,4,5,6,7,8,9][0-9]{9}$') + let phoneReg = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$"); let emailReg = new RegExp( - '^[A-Za-z0-9\u4e00-\u9fa5.]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$' - ) - let ids = [JSON.parse(sessionStorage.getItem('key_batch_id'))] + "^[A-Za-z0-9\u4e00-\u9fa5.]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$" + ); + let ids = [JSON.parse(sessionStorage.getItem("key_batch_id"))]; let data = { phone: this.state.phone_radio > -1 @@ -250,327 +250,330 @@ export default class acclist extends React.Component { email: this.state.email_radio > -1 ? this.state.email_list[this.state.email_radio] - : this.state.email - } + : this.state.email, + }; if (!phoneReg.test(data.phone)) { - Notify.error('手机号格式不正确') - return + Notify.error("手机号格式不正确"); + return; } /* 批量发送 */ if (this.state.isBulkSend) { - ids = this.state.gridSelection.map((item) => item.id) + ids = this.state.gridSelection.map((item) => item.id); } batchSend({ ids, ...data }).then((res) => { handelResponse( res, (req, msg) => { - this.setState({ audit_visible: false }) - Notify.success('发送成功') + this.setState({ audit_visible: false }); + Notify.success("发送成功"); }, (err) => { - Notify.error(err) + Notify.error(err); } - ) - }) + ); + }); } getKeyList(time = {}) { - let _self = this - let { page, limit, key_word, activepage } = _self.state - let data = { page, limit } - data.plan_id = sessionStorage.getItem('key_plan_id') + let _self = this; + let { page, limit, key_word, activepage } = _self.state; + let data = { page, limit }; + data.plan_id = sessionStorage.getItem("key_plan_id"); if (this.state.combinedValue && this.state.combinedValue[0]) { - data.begin_time = this.state.combinedValue[0] - data.end_time = this.state.combinedValue[1] + data.begin_time = this.state.combinedValue[0]; + data.end_time = this.state.combinedValue[1]; } if (activepage) { - data.status = activepage + data.status = activepage; } if (key_word) { - data.key_word = key_word + data.key_word = key_word; } if (time && time[0]) { - data.begin_time = time[0] - data.end_time = time[1] + data.begin_time = time[0]; + data.end_time = time[1]; } if (time && time[0] == null && time.length > 1) { - delete data.begin_time - delete data.end_time + delete data.begin_time; + delete data.end_time; } if (this.state.activepage == 0) { - delete data.status + delete data.status; } getKeyList(data).then((res) => { handelResponse( res, (req, msg) => { + console.log("req =>", req); + sessionStorage.setItem("isKeyAdd", req.data[0].bind_object[0]); + const newData = req.data.map((item) => { if (![4, 5].includes(item.status)) { - item.disabled = true + item.disabled = true; } - return item - }) - this.setState({ distdata: newData }) - this.setState({ planStatus: req.plan.status }) //计划状态 - this.setState({ dataCount: req.total }) - sessionStorage.setItem('key_plan_status', req.plan.status) + return item; + }); + this.setState({ distdata: newData }); + this.setState({ planStatus: req.plan.status }); //计划状态 + this.setState({ dataCount: req.total }); + sessionStorage.setItem("key_plan_status", req.plan.status); }, (err) => {} - ) - }) + ); + }); } //分页 onPageChange(e) { - this.setState({ page: e }) + this.setState({ page: e }); setTimeout(() => { - this.getKeyList() - }, 0) + this.getKeyList(); + }, 0); } componentDidMount() { // this.getKeyList(); } clickFn() { - this.props.history.push('/home/exchangecode-add') - sessionStorage.setItem('pathname2', '/home/exchangecode-add') + this.props.history.push("/home/exchangecode-add"); + sessionStorage.setItem("pathname2", "/home/exchangecode-add"); let activerou = [ { - pagetitle: '新建', + pagetitle: "新建", items: [ { - path: '/home/exchangecode-list', - name: 'key列表管理' + path: "/home/exchangecode-list", + name: "key列表管理", }, { - path: '/home/exchangecode-add', - name: '新建key' - } - ] - } - ] - sessionStorage.setItem('keybatch_id', '') - sessionStorage.setItem('copyOpearo', 0) + path: "/home/exchangecode-add", + name: "新建key", + }, + ], + }, + ]; + sessionStorage.setItem("keybatch_id", ""); + sessionStorage.setItem("copyOpearo", 0); //白名单状态为6 if (this.state.distdata.length > 0 && this.state.distdata[0].style == 6) { - sessionStorage.setItem('keyStyle', 1) + sessionStorage.setItem("keyStyle", 1); } else { - sessionStorage.setItem('keyStyle', 0) + sessionStorage.setItem("keyStyle", 0); } - sessionStorage.setItem('breakchangenav', JSON.stringify(activerou)) + sessionStorage.setItem("breakchangenav", JSON.stringify(activerou)); } aboutFn(e, row) { - this.props.history.push('/home/addkeyorder') - sessionStorage.setItem('pathname2', '/home/addkeyorder') + this.props.history.push("/home/addkeyorder"); + sessionStorage.setItem("pathname2", "/home/addkeyorder"); let activerou = [ { - pagetitle: '编辑', + pagetitle: "编辑", items: [ { - path: '/home/keyorder', - name: '兑换码管理' + path: "/home/keyorder", + name: "兑换码管理", }, { - path: '/home/addkeyorder', - name: row.name + '列表管理' - } - ] - } - ] - sessionStorage.setItem('breaknav', JSON.stringify(activerou)) + path: "/home/addkeyorder", + name: row.name + "列表管理", + }, + ], + }, + ]; + sessionStorage.setItem("breaknav", JSON.stringify(activerou)); } //复制 onCopyRow(status, row) { - this.props.history.push('/home/exchangecode-add') - sessionStorage.setItem('pathname2', '/home/exchangecode-add') + this.props.history.push("/home/exchangecode-add"); + sessionStorage.setItem("pathname2", "/home/exchangecode-add"); let activerou = [ { - pagetitle: '复制', + pagetitle: "复制", items: [ { - path: '/home/exchangecode-list', - name: 'key列表管理' + path: "/home/exchangecode-list", + name: "key列表管理", }, { - path: '/home/exchangecode-add', - name: '复制key:' + row.batch_name - } - ] - } - ] - sessionStorage.setItem('keybatch_id', row.id) - sessionStorage.setItem('copyOpearo', 1) - sessionStorage.setItem('key_reseller_id', row.reseller_id) - sessionStorage.setItem('breakchangenav', JSON.stringify(activerou)) + path: "/home/exchangecode-add", + name: "复制key:" + row.batch_name, + }, + ], + }, + ]; + sessionStorage.setItem("keybatch_id", row.id); + sessionStorage.setItem("copyOpearo", 1); + sessionStorage.setItem("key_reseller_id", row.reseller_id); + sessionStorage.setItem("breakchangenav", JSON.stringify(activerou)); } //page pageChange(e) { - this.setState({ page: e }) + this.setState({ page: e }); setTimeout(() => { - this.getKeyList() - }, 200) + this.getKeyList(); + }, 200); } tabFn(index) { - console.log(index) - this.setState({ activepage: index, key_word: '' }) + console.log(index); + this.setState({ activepage: index, key_word: "" }); switch (index) { case 1: - this.setState({ activepage: 1 }) - break + this.setState({ activepage: 1 }); + break; case 2: - this.setState({ activepage: 2 }) - break + this.setState({ activepage: 2 }); + break; case 3: - this.setState({ activepage: 8 }) - break + this.setState({ activepage: 8 }); + break; case 4: - this.setState({ activepage: 4 }) - break + this.setState({ activepage: 4 }); + break; case 5: - this.setState({ activepage: 3 }) - break + this.setState({ activepage: 3 }); + break; case 6: - this.setState({ activepage: 5 }) - break + this.setState({ activepage: 5 }); + break; case 7: - this.setState({ activepage: 6 }) - break + this.setState({ activepage: 6 }); + break; case 8: - this.setState({ activepage: 7 }) - break + this.setState({ activepage: 7 }); + break; } - this.setState({ page: 1, limit: 10 }) + this.setState({ page: 1, limit: 10 }); setTimeout(() => { - this.getKeyList() - }, 10) + this.getKeyList(); + }, 10); } //作废 delFn() { Sweetalert.confirm({ - type: 'warning', + type: "warning", closeBtn: true, - title: '确认操作', + title: "确认操作", content:

是否作废【渲染订单号】订单?

, onConfirm() { - alert('开始调用作废接口') + alert("开始调用作废接口"); }, onCancel() {}, - className: 'questModal', - parentComponent: this - }) + className: "questModal", + parentComponent: this, + }); } //选择时间 onChangeCombinedDate(e) { - this.setState({ combinedValue: e }) + this.setState({ combinedValue: e }); } onSwitchChange(status, row) { - let self = this + let self = this; Sweetalert.confirm({ - type: 'warning', + type: "warning", closeBtn: true, - title: '确认操作', + title: "确认操作", content: (

是否将[key-批次id{row.id}] - {row.status == 4 ? '暂停' : '开启'}? + {row.status == 4 ? "暂停" : "开启"}?

), onConfirm: () => { - this.changeState(status, row) + this.changeState(status, row); }, onCancel: this.onCancel, - className: 'questModal', - parentComponent: this - }) + className: "questModal", + parentComponent: this, + }); } //修改状态 changeState(status, row) { - let self = this + let self = this; let data = { - operation: status ? 4 : 5 - } + operation: status ? 4 : 5, + }; startOrStopKeybatch(row.id, data).then((res) => { handelResponse( res, (req, msg) => { let id = _.findIndex(this.state.distdata, (o) => { - return o.id == row.id - }) - this.state.distdata[id].status = status - this.setState({ distdata: this.state.distdata }) - Notify.success(msg) + return o.id == row.id; + }); + this.state.distdata[id].status = status; + this.setState({ distdata: this.state.distdata }); + Notify.success(msg); let data = { page: 1, limit: 10, - plan_id: sessionStorage.getItem('key_plan_id') - } - self.getKeyList(data) + plan_id: sessionStorage.getItem("key_plan_id"), + }; + self.getKeyList(data); }, (err) => { - Notify.error(err) + Notify.error(err); } - ) - }) + ); + }); } onEditRow(status, row) { - this.props.history.push('/home/key-edit') - sessionStorage.setItem('pathname2', '/home/key-edit') + this.props.history.push("/home/key-edit"); + sessionStorage.setItem("pathname2", "/home/key-edit"); let activerou = [ { - pagetitle: '编辑', + pagetitle: "编辑", items: [ { - path: '/home/exchangecode-list', - name: row.plan_title + 'key列表管理' + path: "/home/exchangecode-list", + name: row.plan_title + "key列表管理", }, { - path: '/home/exchangecode-lists', - name: 'key-批次ID:' + row.id + path: "/home/exchangecode-lists", + name: "key-批次ID:" + row.id, }, { - path: '/home/key-edit', - name: '编辑key' - } - ] - } - ] - sessionStorage.setItem('breakchangenav', JSON.stringify(activerou)) - sessionStorage.setItem('keybatch_id', row.id) - sessionStorage.setItem('key_reseller_id', row.reseller_id) - sessionStorage.setItem('approval_id', row.approval_id) + path: "/home/key-edit", + name: "编辑key", + }, + ], + }, + ]; + sessionStorage.setItem("breakchangenav", JSON.stringify(activerou)); + sessionStorage.setItem("keybatch_id", row.id); + sessionStorage.setItem("key_reseller_id", row.reseller_id); + sessionStorage.setItem("approval_id", row.approval_id); } //敲回车查询 iptsureFn() { - this.setState({ page: 1 }) + this.setState({ page: 1 }); setTimeout(() => { - this.getKeyList() - }, 200) + this.getKeyList(); + }, 200); } componentWillMount() { - this.setState({ tableHeight: window.innerHeight - 390 }) + this.setState({ tableHeight: window.innerHeight - 390 }); - let disabledArr = ['6', '0', '2', '5', '8'] - if (disabledArr.indexOf(sessionStorage.getItem('key_plan_status')) > -1) { - this.setState({ disabled: true }) + let disabledArr = ["6", "0", "2", "5", "8"]; + if (disabledArr.indexOf(sessionStorage.getItem("key_plan_status")) > -1) { + this.setState({ disabled: true }); } } phoneChange = (e) => { - this.setState({ phone: e.target.value }) - } + this.setState({ phone: e.target.value }); + }; emailChange = (e) => { - this.setState({ email: e.target.value }) - } + this.setState({ email: e.target.value }); + }; /* 获取经销商信息 */ getResellerInfoFunction(reseller_id) { @@ -583,53 +586,53 @@ export default class acclist extends React.Component { email_list: req.contact_email, audit_visible: true, phone_radio: -1, - email_radio: -1 - }) + email_radio: -1, + }); }, (err) => { - Notify.error(err) + Notify.error(err); } - ) - }) + ); + }); } /* 批量发送按钮 */ bulkSendFunction() { - let isNotify = '' + let isNotify = ""; this.state.gridSelection.filter((item) => { if (![4, 5].includes(item.status)) { - return (isNotify = true) + return (isNotify = true); } - }) + }); if (isNotify) { - return Notify.warn('只有状态为进行中、暂停中的允许发送') + return Notify.warn("只有状态为进行中、暂停中的允许发送"); } - this.getResellerInfoFunction(this.state.gridSelection[0].reseller_id) - this.setState({ isBulkSend: true }) + this.getResellerInfoFunction(this.state.gridSelection[0].reseller_id); + this.setState({ isBulkSend: true }); } menuItemClick(key, row) { /* isMany 是否是批量发送 */ - let self = this + let self = this; if (key == 1) { - this.setState({ isBulkSend: false }) - this.getResellerInfoFunction(row.reseller_id) - sessionStorage.setItem('key_batch_id', row.id) + this.setState({ isBulkSend: false }); + this.getResellerInfoFunction(row.reseller_id); + sessionStorage.setItem("key_batch_id", row.id); } if (key == 5) { - let plan_id = row.id + let plan_id = row.id; if (row.status == 2) { - Notify.error('审核中的数据不允许作废') - this.setState({ menuVisible: false }) - return + Notify.error("审核中的数据不允许作废"); + this.setState({ menuVisible: false }); + return; } Sweetalert.confirm({ - type: 'warning', + type: "warning", closeBtn: true, - title: '确认操作', + title: "确认操作", content: (

是否作废key批次ID[{row.id}]? @@ -641,127 +644,127 @@ export default class acclist extends React.Component { handelResponse( res, (response, msg) => { - Notify.clear() - Notify.success(msg) + Notify.clear(); + Notify.success(msg); let data = { page: 1, limit: 10, - plan_id: sessionStorage.getItem('key_plan_id') - } + plan_id: sessionStorage.getItem("key_plan_id"), + }; - self.getKeyList(data) + self.getKeyList(data); }, (err) => { - Notify.error(err) + Notify.error(err); } - ) + ); }) - .catch((err) => {}) + .catch((err) => {}); }, onCancel: this.onCancel, - className: 'questModal', - parentComponent: this - }) + className: "questModal", + parentComponent: this, + }); } } //limit countChange(e) { - this.setState({ page: 1, limit: e }) + this.setState({ page: 1, limit: e }); setTimeout(() => { - this.getKeyList() - }, 0) + this.getKeyList(); + }, 0); } //选择时间 onChangeCombinedDate(e) { - this.setState({ combinedValue: e }) - this.getKeyList(e) + this.setState({ combinedValue: e }); + this.getKeyList(e); } linkTo(row) { // sessionStorage.setItem('showflag',true); let arr = [ { - pagetitle: '编辑', + pagetitle: "编辑", items: [ - { path: '/home/key-list', name: '营销计划管理' }, - { path: '/home/key-list', name: row.plan_title + 'key列表' }, - { path: '/home/key-detail', name: row.batch_name + 'key码列表' } - ] - } - ] + { path: "/home/key-list", name: "营销计划管理" }, + { path: "/home/key-list", name: row.plan_title + "key列表" }, + { path: "/home/key-detail", name: row.batch_name + "key码列表" }, + ], + }, + ]; // sessionStorage.setItem("plan_item",JSON.stringify(row)) - sessionStorage.setItem('breakchangenav', JSON.stringify(arr)) - sessionStorage.setItem('linkshowname', '营销计划管理') - sessionStorage.setItem('key_batch_id', row.id) - this.props.history.push('/home/key-detail') + sessionStorage.setItem("breakchangenav", JSON.stringify(arr)); + sessionStorage.setItem("linkshowname", "营销计划管理"); + sessionStorage.setItem("key_batch_id", row.id); + this.props.history.push("/home/key-detail"); } // 监听组件内部状态的变化: componentDidUpdate(prevProps, prevState) { // 参数分别为改变之前的数据状态对象 if (prevState.key_word != this.state.key_word && !this.state.key_word) { - this.getKeyList() + this.getKeyList(); } } onPhoneChange(e) { - this.setState({ phone_radio: e.target.value }) + this.setState({ phone_radio: e.target.value }); } onEmailChange(e) { - this.setState({ email_radio: e.target.value }) + this.setState({ email_radio: e.target.value }); } onReCall(e, rowData) { - let self = this - let approval_id = rowData.approval_id + let self = this; + let approval_id = rowData.approval_id; Sweetalert.confirm({ - type: 'warning', + type: "warning", closeBtn: true, - title: '确认操作', + title: "确认操作", content:

该数据正在审批中,是否确认撤销审批?

, onConfirm: () => { terminateApprovals(approval_id).then((res) => { handelResponse( res, (req, msg) => { - Notify.success('撤销审批成功') + Notify.success("撤销审批成功"); setTimeout(() => { - this.getKeyList() - }, 3000) + this.getKeyList(); + }, 3000); }, (err) => { - Notify.error(err) + Notify.error(err); } - ) - }) + ); + }); }, onCancel: this.onCancel, - className: 'questModal', - parentComponent: this - }) + className: "questModal", + parentComponent: this, + }); } render() { const date = ( - ) + ); const popDom = (row) => { return (
兑换码统计 -
    -
  • +
      +
    • 已作废数 {row.invalid_total}
    • -
    • +
    • 已使用数 {row.usage_total}
    • @@ -769,55 +772,57 @@ export default class acclist extends React.Component { 已完结数 {row.end_total} */} -
    • +
    • 已失效数 {row.overdue_total}
- ) - } - const { current, pageSize } = this.state + ); + }; + const { current, pageSize } = this.state; return ( -
+
-
+
this.setState({ key_word: e })} value={this.state.key_word} wordSearch={this.iptsureFn.bind(this)} countShow={false} - height={'36px'} - width={'260px'} + height={"36px"} + width={"260px"} onClearItem={(e) => { - this.setState({ key_word: '' }) + this.setState({ key_word: "" }); }} - alignment={'left'} + alignment={"left"} />
-
+
{ - this.countChange(e) + this.countChange(e); }} - spliteColor={'#fff'} + spliteColor={"#fff"} tableData={this.state.distdata} Column={Column} maxheight={this.state.tableHeight} @@ -826,199 +831,205 @@ export default class acclist extends React.Component { page={this.state.page} dataCount={this.state.dataCount} pageChange={(e) => { - this.pageChange(e) + this.pageChange(e); }} checkChange={(selection) => { - this.setState({ gridSelection: selection }) + this.setState({ gridSelection: selection }); }} ComponentHandler={(com, rowData) => { - if (com == 'link') { + if (com == "link") { let str = ( { - this.linkTo(rowData) - }}> + this.linkTo(rowData); + }} + > {rowData.batch_name} - ) + ); if (rowData.style == 4) { str = ( - + {rowData.batch_name} - ) + ); } - return str + return str; } - if (com == 'usage') { + if (com == "usage") { return ( - - {rowData.usage} + + {rowData.usage} - ) + ); } - if (com == 'switch') { + if (com == "switch") { return ( = 6 ? true : false} onChange={(e) => { - this.onSwitchChange(e, rowData) - }}> - ) + this.onSwitchChange(e, rowData); + }} + > + ); } - if (com == 'status') { + if (com == "status") { return ( -

+

+ background: menu.keysStatusBg(rowData.status), + }} + > {rowData.status_text}

- ) + ); } - if (com == 'edit') { - let str = '' + if (com == "edit") { + let str = ""; /*计划已完结6,未通过2,已作废8 不可复制 key创建中1,未通过2 不可复制 */ if ([6, 7].includes(rowData.status)) { str = ( - 编辑 + 编辑 {[1, 2, 8].includes(rowData.status) || [2, 6, 8, 7].includes(this.state.planStatus) ? ( - 复制 + 复制 ) : ( { - this.onCopyRow(e, rowData) - }}> + this.onCopyRow(e, rowData); + }} + > 复制 )} - 撤销审批 + 撤销审批 - this.setState({ visible: v }) - }> + onVisibleChange={(v) => this.setState({ visible: v })} + > -
- 更多 {' '} +
+ 更多 {" "}
- ) + ); } else if (rowData.approval_status == 1) { str = ( - 编辑 + 编辑 {[1, 2, 8].includes(rowData.status) || [2, 6, 8, 7].includes(this.state.planStatus) ? ( - 复制 + 复制 ) : ( { - this.onCopyRow(e, rowData) - }}> + this.onCopyRow(e, rowData); + }} + > 复制 )} this.onReCall(e, rowData)}> + className="grid-link" + onClick={(e) => this.onReCall(e, rowData)} + > 撤销审批 - this.setState({ visible: v }) - }> + onVisibleChange={(v) => this.setState({ visible: v })} + > -
- 更多 +
+ 更多
this.menuItemClick(key, rowData) - }> - + } + > + 发送密码及压缩包 - + 日志 - + 作废 - ) + ); } else if (rowData.status === 3) { str = ( - 编辑 - 复制 - 撤销审批 + 编辑 + 复制 + 撤销审批 - this.setState({ visible: v }) - }> + onVisibleChange={(v) => this.setState({ visible: v })} + > -
- 更多 {' '} +
+ 更多 {" "}
- ) + ); } else { str = ( { - this.onEditRow(e, rowData) - }}> + this.onEditRow(e, rowData); + }} + > 编辑 {[1, 2, 8].includes(rowData.status) || [2, 6, 8, 7].includes(this.state.planStatus) ? ( - 复制 + 复制 ) : ( { - this.onCopyRow(e, rowData) - }}> + this.onCopyRow(e, rowData); + }} + > 复制 )} - 撤销审批 + 撤销审批 {/* 创建中 置灰更多按钮 */} {rowData.status === 1 ? ( this.setState({ visible: v }) - }> + } + > -
- 更多 {' '} +
+ 更多 {" "}
@@ -1040,30 +1052,32 @@ export default class acclist extends React.Component { visible={this.state.menuVisible} onVisibleChange={(v) => this.setState({ visible: v }) - }> + } + > -
- 更多 +
+ 更多
this.menuItemClick(key, rowData) - }> - 发送密码及压缩包 - + } + > + 发送密码及压缩包 + 日志 - 作废 + 作废 )} - ) + ); } - return str + return str; } }} /> @@ -1071,28 +1085,29 @@ export default class acclist extends React.Component { {this.state.audit_visible ? (
-
-
+
+
{ - this.cancel(e) + this.cancel(e); }} /> -
发送
-
+
发送
+
是否立即发送key以及解压密码?
-
+
接收手机号
-
+
{ - this.onPhoneChange(e) - }}> + this.onPhoneChange(e); + }} + > {this.state.phone_list.map((item, index) => { return ( + }} + > {item} - ) + ); })}
-
+
接收邮箱
-
+
{ - this.onEmailChange(e) - }}> + this.onEmailChange(e); + }} + > {this.state.email_list.map((item, index) => { return ( + }} + > {item} - ) + ); })}
-
+
-1}> + disabled={this.state.phone_radio > -1} + >
-
+
-1}> + disabled={this.state.email_radio > -1} + >
-
+
@@ -1175,6 +1197,6 @@ export default class acclist extends React.Component { ) : null}
- ) + ); } }