diff --git a/src/components/knockGold/wangEditor.jsx b/src/components/knockGold/wangEditor.jsx index 0ff8cfb4..9e105af5 100644 --- a/src/components/knockGold/wangEditor.jsx +++ b/src/components/knockGold/wangEditor.jsx @@ -17,6 +17,7 @@ export default class wangeditor extends React.Component { editor.config.pasteText = true // 设置编辑区域高度为 500px editor.config.height = 200 + editor.config.showFullScreen = false editor.config.menus = [ 'bold', 'foreColor', diff --git a/src/components/mouseMenu/main.js b/src/components/mouseMenu/main.js index e64124cb..296dadd3 100644 --- a/src/components/mouseMenu/main.js +++ b/src/components/mouseMenu/main.js @@ -41,8 +41,10 @@ export default class MouseMenu extends React.Component { } render() { let menuList = this.state.activeMenuList;//路由表 - const pathname = window.location.href.lastIndexOf('\/'); - const pathnamestr = window.location.href.substr(pathname); + let urlHref=(window.location.href).replace(/^\/|\/$/g, ''); + const pathname = urlHref.lastIndexOf("/"); + const pathnamestr = urlHref.substr(pathname); + return (
diff --git a/src/components/subnav/main.js b/src/components/subnav/main.js index 6f6d0b36..2070c54d 100644 --- a/src/components/subnav/main.js +++ b/src/components/subnav/main.js @@ -83,9 +83,9 @@ export default class topNav extends React.Component { let history0 = window.history.length <= 1; let routeflag = sessionStorage.getItem("showflag"); let breaknav = JSON.parse(sessionStorage.getItem("breaknav")); - let pathnameBreak = sessionStorage.getItem("pathname2"); - const pathname = window.location.href.lastIndexOf("/"); - const pathnamestr = window.location.href.substr(pathname); + let urlHref=(window.location.href).replace(/^\/|\/$/g, ''); + const pathname = urlHref.lastIndexOf("/"); + const pathnamestr = urlHref.substr(pathname); let breakflag = pathnamestr.includes("add") || pathnamestr.includes("aid") || diff --git a/src/pages/exchangecode/copyCode/index.jsx b/src/pages/exchangecode/copyCode/index.jsx index 31fb324c..bd6eccba 100644 --- a/src/pages/exchangecode/copyCode/index.jsx +++ b/src/pages/exchangecode/copyCode/index.jsx @@ -1,7 +1,7 @@ /*此页面 创建中 进行中 审核驳回可编辑 */ import React from 'react' -import { deWeightThree } from '../../../utils' +import { deWeightThree } from '@/utils' import { Radio, Card, @@ -17,13 +17,12 @@ import { RadioGroup, RadioButton } from 'zent' -import Ipt from '../../../components/input/main' -import Form from '../../../components/form/main' -import FormItem from '../../../components/form-item/main' -import Grid from '../../../components/gird/main.js' +import Ipt from '@/components/input/main' +import Form from '@/components/form/main' +import FormItem from '@/components/form-item/main' +import Grid from '@/components/gird/main.js' import { addPlanStep, - getApprovalsInfo, handelResponse, getKeyBatchDetail, getReseller, @@ -33,9 +32,9 @@ import { terminateApprovals, getApprovalsStatus, getProductInfoSelect -} from '../../../assets/api.js' +} from '@/assets/api.js' import Productform from '../product/add' -import Bus from '../../../assets/eventBus.js' +import Bus from '@/assets/eventBus.js' import _ from 'lodash' import './index.less' import moment from 'moment' @@ -91,7 +90,6 @@ export default class acclist extends React.Component { tempdata: [], distdata: [], pagetitle: '编辑key', - isEdit: false, begintime: '', endtime: '', isCancel: false, @@ -119,7 +117,6 @@ export default class acclist extends React.Component { /* key批次分销商id */ let reseller_id = sessionStorage.getItem('key_reseller_id') /* 审核id */ - let approval_id = sessionStorage.getItem('approval_id') /* 被复制得兑换码id */ let copy_code_id = ~~sessionStorage.getItem('copy_code_id') @@ -145,13 +142,6 @@ export default class acclist extends React.Component { if (req.status == 7) { this.setState({ isCancel: true }) } - - if (req.status == 1) { - this.setState({ isEdit: false }) - } else { - this.setState({ isEdit: true }) - } - req.code_batch = req.code_batch || [] this.setState({ pagetitle: '复制兑换码', @@ -232,68 +222,6 @@ export default class acclist extends React.Component { }) let temp = [...list] - //获取审批单信息 - if (approval_id > 0) { - getApprovalsInfo(approval_id).then((res) => { - handelResponse(res, (req, msg) => { - /*当为创建中和审核驳回时 转换数据结构 */ - const newProduct = [] - req.code_batch.map((item) => { - item.product.legal.map((item1) => { - newProduct.push({ - type: 1, - only: item1.product_id, - upstream: '直连天下', - ...item1 - }) - }) - - item.product.reduce.map((item1) => { - newProduct.push({ - type: 2, - only: item1.channel_activity_id, - upstream: - String(item.channel) === '1' ? '支付宝' : '微信', - origin: item1, - product_name: item1.batch_goods_name, - effectDate: - item1.time_limit?.effect_time.start_time + - ' 至 ' + - item1.time_limit?.effect_time.end_time, //有效时间 - contract_price: item1.price, //单价 - official_price: item1.reduce_amount, //官方价 - quantity: Math.trunc( - item1.all_budget / item1.reduce_amount - ), //总库 - ...item1 - }) - }) - - item.product = [...newProduct] - }) - - for (let i = 0; i < req.code_batch.length; i++) { - let code_batch = req.code_batch[i] - let range = [] - for (let j = 0; j < code_batch.product.length; j++) { - let product = code_batch.product[j] - range.push(product.product_name) - } - req.code_batch[i].disabled = true - req.code_batch[i].checked = true - req.code_batch[i].range = range.toString() - temp.push(req.code_batch[i]) - } - if (req.payment_direction) { - let index = this.state.payment_direction.indexOf( - req.payment_direction - ) - this.setState({ paytype: index + 1 }) - } - }) - }) - } - let model = { style: req.style, batch_name: req.batch_name, @@ -696,202 +624,118 @@ export default class acclist extends React.Component { delete item.products }) - //除了创建中 编辑key - if (this.state.isEdit) { - this.setState({ audit_visible: false }) - let approval_id = sessionStorage.getItem('approval_id') - if (approval_id > 0) { - getApprovalsStatus(approval_id).then((res) => { - handelResponse( - res, - (req, msg) => { - if (req.status == 0) { - this.setState({ recall_visible: true }) - } - if (req.status == 1) { - this.setState({ audit_visible: true }) - } - if (req.status == 2 || req.status == 3) { - let id = sessionStorage.getItem('keybatch_id') - let data = { - code_batch: dataCopy, - reseller_id: this.state.reseller.id, - reseller_name: this.state.reseller.name, - company_name: this.state.reseller.company_name, - receive_email: this.state.reseller.contact_email[0], - payment_direction: - this.state.payment_direction[this.state.paytype - 1] - } - - keyEditApproval(id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success('成功发起审批') - setTimeout(() => { - window.history.back() - }, 1000) - }, - (err) => { - Notify.error(err) - } - ) - }) - } - }, - (err) => { - Notify.error(err) + this.setState({ audit_visible: false }) + let approval_id = sessionStorage.getItem('approval_id') + if (approval_id > 0) { + getApprovalsStatus(approval_id).then((res) => { + handelResponse( + res, + (req, msg) => { + if (req.status == 0) { + this.setState({ recall_visible: true }) } - ) - }) - } else { - if (this.state.key_status != 1) { - let id = sessionStorage.getItem('keybatch_id') - let data = { - code_batch: dataCopy, - reseller_id: this.state.reseller?.id, - reseller_name: this.state.reseller?.name, - company_name: this.state.reseller?.company_name, - receive_email: this.state.reseller?.contact_email[0], - payment_direction: - this.state.payment_direction[this.state.paytype - 1] - } - - keyEditApproval(id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success('成功发起审批') - setTimeout(() => { - window.history.back() - }, 1000) - }, - (err) => { - Notify.error(err) + if (req.status == 1) { + this.setState({ audit_visible: true }) + } + if (req.status == 2 || req.status == 3) { + let id = sessionStorage.getItem('keybatch_id') + let data = { + code_batch: dataCopy, + reseller_id: this.state.reseller.id, + reseller_name: this.state.reseller.name, + company_name: this.state.reseller.company_name, + receive_email: this.state.reseller.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1] } - ) - }) - } else { - let data = { - batch_name: this.state.model.batch_name, - style: this.state.model.style, - quantity: this.state.model.quantity, - bind_object: this.state.checkedList, - allow_repetition: this.state.model.allow_repetition, - allow_loss: this.state.model.allow_loss, - merge_stock: this.state.model.merge_stock, - mobile_excel: this.state.mobile_excel, - mobile_repeat: this.state.mobile_repeat, - code_batch: dataCopy, - reseller_id: this.state.reseller.id, - reseller_name: this.state.reseller.name, - company_name: this.state.reseller.company_name, - receive_email: this.state.reseller.contact_email[0], - payment_direction: - this.state.payment_direction[this.state.paytype - 1] - } - let id = sessionStorage.getItem('keybatch_id') - putKeyBatchDetail(id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - keyApproval(this.state.plan_id, id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success('成功发起审批') - setTimeout(() => { - this.props.history.push('/home/key-list/') - }, 2000) - }, - (err) => { - Notify.error(err) - } - ) - }) - }, - (err) => { - Notify.error(err) - } - ) - }) - } - } + keyEditApproval(id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success('成功发起审批') + setTimeout(() => { + window.history.back() + }, 1000) + }, + (err) => { + Notify.error(err) + } + ) + }) + } + }, + (err) => { + Notify.error(err) + } + ) + }) } else { - //创建中 编辑key - let data = { - batch_name: this.state.model.batch_name, - style: this.state.model.style, - quantity: this.state.model.quantity, - bind_object: this.state.checkedList, - allow_repetition: this.state.model.allow_repetition, - allow_loss: this.state.model.allow_loss, - merge_stock: this.state.model.merge_stock, - mobile_excel: this.state.mobile_excel, - mobile_repeat: this.state.mobile_repeat, - code_batch: dataCopy, - reseller_id: this.state.reseller.id, - reseller_name: this.state.reseller.name, - company_name: this.state.reseller.company_name, - receive_email: this.state.reseller.contact_email[0], - payment_direction: this.state.payment_direction[this.state.paytype - 1] - } + if (this.state.key_status != 1) { + let id = sessionStorage.getItem('keybatch_id') + let data = { + code_batch: dataCopy, + reseller_id: this.state.reseller?.id, + reseller_name: this.state.reseller?.name, + company_name: this.state.reseller?.company_name, + receive_email: this.state.reseller?.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1] + } - let id = sessionStorage.getItem('keybatch_id') - let approval_id = sessionStorage.getItem('approval_id') - if (approval_id > 0) { - getApprovalsStatus(approval_id).then((res) => { - handelResponse( - res, - (req, msg) => { - if (req.status == 0) { - this.setState({ recall_visible: true }) - } - if (req.status == 1) { - this.setState({ audit_visible: true }) - } - if (req.status == 2 || req.status == 3) { - putKeyBatchDetail(id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - keyApproval(this.state.plan_id, id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success('成功发起审批') - setTimeout(() => { - this.props.history.push('/home/key-list/') - }, 2000) - }, - (err) => { - Notify.error(err) - } - ) - }) - }, - (err) => { - Notify.error(err) - } - ) - }) - } - }, - (err) => { - Notify.error(err) - } - ) - }) - } else { - keyApproval(this.state.plan_id, id, data).then((res) => { + keyEditApproval(id, data).then((res) => { handelResponse( res, (req, msg) => { Notify.success('成功发起审批') setTimeout(() => { - this.props.history.push('/home/key-list/') - }, 2000) + window.history.back() + }, 1000) + }, + (err) => { + Notify.error(err) + } + ) + }) + } else { + let data = { + batch_name: this.state.model.batch_name, + style: this.state.model.style, + quantity: this.state.model.quantity, + bind_object: this.state.checkedList, + allow_repetition: this.state.model.allow_repetition, + allow_loss: this.state.model.allow_loss, + merge_stock: this.state.model.merge_stock, + mobile_excel: this.state.mobile_excel, + mobile_repeat: this.state.mobile_repeat, + code_batch: dataCopy, + reseller_id: this.state.reseller.id, + reseller_name: this.state.reseller.name, + company_name: this.state.reseller.company_name, + receive_email: this.state.reseller.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1] + } + + let id = sessionStorage.getItem('keybatch_id') + putKeyBatchDetail(id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + keyApproval(this.state.plan_id, id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success('成功发起审批') + setTimeout(() => { + this.props.history.push('/home/key-list/') + }, 2000) + }, + (err) => { + Notify.error(err) + } + ) + }) }, (err) => { Notify.error(err) @@ -1039,7 +883,7 @@ export default class acclist extends React.Component { this.onStyleChange(e) }} value={this.state.model.style} - disabled={this.state.isEdit}> + disabled={true}> 串码 链接 二维码 @@ -1059,7 +903,7 @@ export default class acclist extends React.Component { this.setState({ checkedList: arr })} - disabled={this.state.isEdit}> + disabled={true}> 兑换码 优惠券 @@ -1124,7 +968,7 @@ export default class acclist extends React.Component { id='allow_repetition' prop='allow_repetition'> this.onRepetitionChange(e)} value={this.state.model.allow_repetition}> @@ -1137,7 +981,7 @@ export default class acclist extends React.Component { id='allow_loss' prop='allow_loss'> this.onLossChange(e)} value={this.state.model.allow_loss}> diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index bf313664..1e72d880 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -537,13 +537,6 @@ export default class exchangedit extends React.Component { addProduct.map((item) => { if (item.type === 2) { if (item.origin) { - const is = this.compareDate( - this.state.codeInfo.date_time[1], - item.origin.time_limit.effect_time.end_time - ) - if (!is) - item.origin.time_limit.effect_time.end_time = - this.state.codeInfo.date_time[1] addProductCopy.reduce.push(item.origin) } } else { @@ -555,13 +548,6 @@ export default class exchangedit extends React.Component { const updateProductCopy = { legal: [], reduce: [] } updateProduct.map((item) => { if (item.type === 2) { - const is = this.compareDate( - this.state.codeInfo.date_time[1], - item.time_limit.effect_time.end_time - ) - if (!is) - item.time_limit.effect_time.end_time = - this.state.codeInfo.date_time[1] updateProductCopy.reduce.push(item) } else { updateProductCopy.legal.push(item) @@ -588,11 +574,6 @@ export default class exchangedit extends React.Component { return { data, addProduct, updateProduct } } - //比较时间 - compareDate(d1, d2) { - return new Date(d1.replace(/-/g, '/')) > new Date(d2.replace(/-/g, '/')) - } - submitCodeData() { if (!this.state.reseller) { Notify.error('该兑换码对应分销商不存在') @@ -771,14 +752,6 @@ export default class exchangedit extends React.Component { let model2 = this.state.codeInfo model2.date_time = e this.setState({ codeInfo: model2 }) - - sessionStorage.setItem( - 'knockGold_effectDate', - JSON.stringify({ - begin_time: model2.date_time[0], - end_time: model2.date_time[1] - }) - ) } //渲染范围列表数据以及数据转换 diff --git a/src/pages/exchangecode/list/list.js b/src/pages/exchangecode/list/list.js index adb136e4..7f84b043 100644 --- a/src/pages/exchangecode/list/list.js +++ b/src/pages/exchangecode/list/list.js @@ -233,8 +233,10 @@ export default class acclist extends React.Component { ] } ] - - sessionStorage.setItem('knockGold_effectDate', JSON.stringify(rowData)) + sessionStorage.setItem( + 'knockGold_effectDate', + JSON.stringify(rowData.keyBatch.plan) + ) sessionStorage.setItem('code_id', rowData.id) sessionStorage.setItem('breaknav', JSON.stringify(activerou)) sessionStorage.setItem('approval_id', rowData.approval_id) diff --git a/src/pages/order/list/list.js b/src/pages/order/list/list.js index aec1da02..fe82cf00 100644 --- a/src/pages/order/list/list.js +++ b/src/pages/order/list/list.js @@ -797,7 +797,7 @@ export default class orderlist extends React.Component { onClick={(e) => this.moreFn(e, rowData)}> 详情 - {rowData.status == 1 ? ( + {rowData.status == 1||rowData.status == 0 ? ( this.deleteFn(e, rowData)}> diff --git a/src/pages/plan/add/step1.js b/src/pages/plan/add/step1.js index c26b5b83..1593378b 100644 --- a/src/pages/plan/add/step1.js +++ b/src/pages/plan/add/step1.js @@ -1,7 +1,7 @@ /* 新建计划 step1 */ -import ReactDOM from "react-dom"; -import React, { Component } from "react"; -import { HashRouter as Router, Route, Link } from "react-router-dom"; +import ReactDOM from 'react-dom' +import React, { Component } from 'react' +import { HashRouter as Router, Route, Link } from 'react-router-dom' import { Button, Tabs, @@ -10,59 +10,59 @@ import { Input, RadioButton, RadioGroup, - Notify, -} from "zent"; -import Ipt from "../../../components/input/main"; -import Form from "../../../components/form/main"; -import FormItem from "../../../components/form-item/main"; -import Bus from "../../../assets/eventBus.js"; -import _ from "lodash"; -import moment from "moment"; + Notify +} from 'zent' +import Ipt from '../../../components/input/main' +import Form from '../../../components/form/main' +import FormItem from '../../../components/form-item/main' +import Bus from '../../../assets/eventBus.js' +import _ from 'lodash' +import moment from 'moment' import { addPlanStep, handelResponse, getPlanList, getReSellerOption, - putPlanStep, -} from "../../../assets/api.js"; + putPlanStep +} from '../../../assets/api.js' export default class acclist extends React.Component { constructor(props) { - super(props); + super(props) this.state = { model: { //数据模型不可少 - title: "", + title: '', type: 2, reseller: null, - return_id: "1", - date_time: ["", ""], + return_id: '1', + date_time: ['', ''] }, reseller_option: [], - lodshow: false, - }; + lodshow: false + } } edit(data) { - let model = {}; - model.title = data.title; - model.type = parseInt(data.type); - model.return_id = data.return_type; + let model = {} + model.title = data.title + model.type = parseInt(data.type) + model.return_id = data.return_type model.reseller = { key: data.reseller_id, - text: data.reseller_name, - }; + text: data.reseller_name + } - model.date_time = [data.begin_time, data.end_time]; - sessionStorage.setItem("datetime", JSON.stringify(model.date_time)); + model.date_time = [data.begin_time, data.end_time] + sessionStorage.setItem('datetime', JSON.stringify(model.date_time)) sessionStorage.setItem( - "knockGold_effectDate", + 'knockGold_effectDate', JSON.stringify({ begin_time: model.date_time[0], - end_time: model.date_time[1], + end_time: model.date_time[1] }) - ); - this.setState({ model: model, lodshow: true }); + ) + this.setState({ model: model, lodshow: true }) } componentWillMount(e) {} @@ -73,231 +73,229 @@ export default class acclist extends React.Component { res, (req, msg) => { let arr = _.map(req, (o) => { - let obj = {}; - obj.key = o.id; - obj.text = o.name; - obj.direct_reseller_id = o.direct_reseller_id; - return obj; - }); - this.setState({ reseller_option: arr }); + let obj = {} + obj.key = o.id + obj.text = o.name + obj.direct_reseller_id = o.direct_reseller_id + return obj + }) + this.setState({ reseller_option: arr }) }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); + ) + }) } async submit(id) { - let valide = false; + let valide = false if (this.refs.form1.validator()) { - if (this.state.model.date_time[1] == "") { - Notify.error("结束日期不能为空"); - return; + if (this.state.model.date_time[1] == '') { + Notify.error('结束日期不能为空') + return } - let data = {}; - data.title = this.state.model.title; - data.type = parseInt(this.state.model.type); - data.return_type = 1; - data.reseller_id = this.state.model.reseller.key; - data.reseller_name = this.state.model.reseller.text; - data.begin_time = this.state.model.date_time[0]; - data.end_time = this.state.model.date_time[1]; + let data = {} + data.title = this.state.model.title + data.type = parseInt(this.state.model.type) + data.return_type = 1 + data.reseller_id = this.state.model.reseller.key + data.reseller_name = this.state.model.reseller.text + data.begin_time = this.state.model.date_time[0] + data.end_time = this.state.model.date_time[1] if (id) { let form = { title: data.title, begin_time: data.begin_time, - end_time: data.end_time, - }; + end_time: data.end_time + } await putPlanStep(id, form).then((res) => { handelResponse( res, (req, msg) => { - Notify.success("保存成功"); - valide = true; - return; + Notify.success('保存成功') + valide = true + return }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); + ) + }) } else { - let formdata = {}; - formdata.info = data; + let formdata = {} + formdata.info = data //第一次的时候不需要planID - let plan_id = sessionStorage.getItem("plan_id"); - formdata.info.copy_plan_id = sessionStorage.getItem("plan_id_copy"); - if (plan_id == "") { - await addPlanStep("", formdata).then((res) => { - console.log("res step1=>", res); + let plan_id = sessionStorage.getItem('plan_id') + formdata.info.copy_plan_id = sessionStorage.getItem('plan_id_copy') + if (plan_id == '') { + await addPlanStep('', formdata).then((res) => { + console.log('res step1=>', res) handelResponse( res, (req, msg) => { - sessionStorage.setItem("plan_id", req.id); - delete data.copy_plan_id; - console.log("step 1-2 =>", data); - sessionStorage.setItem("step1", JSON.stringify(data)); + sessionStorage.setItem('plan_id', req.id) + delete data.copy_plan_id + console.log('step 1-2 =>', data) + sessionStorage.setItem('step1', JSON.stringify(data)) sessionStorage.setItem( - "knockGold_effectDate", + 'knockGold_effectDate', JSON.stringify(data) - ); - valide = true; - return; + ) + valide = true + return }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); + ) + }) } else { - delete data.copy_plan_id; - sessionStorage.setItem("step1", JSON.stringify(data)); - sessionStorage.setItem("knockGold_effectDate", JSON.stringify(data)); - return true; + delete data.copy_plan_id + sessionStorage.setItem('step1', JSON.stringify(data)) + sessionStorage.setItem('knockGold_effectDate', JSON.stringify(data)) + return true } } } - return valide; + return valide } onCancel() { - this.refs.form1.cancel(); + this.refs.form1.cancel() } updateData(key, value) { - if (sessionStorage.getItem("step1")) { - let data = JSON.parse(sessionStorage.getItem("step1")); - data[key] = value; - sessionStorage.setItem("knockGold_effectDate", JSON.stringify(data)); - sessionStorage.setItem("step1", data); + if (sessionStorage.getItem('step1')) { + let data = JSON.parse(sessionStorage.getItem('step1')) + data[key] = value + sessionStorage.setItem('knockGold_effectDate', JSON.stringify(data)) + sessionStorage.setItem('step1', data) } } onTypeChange(e) { - let model = this.state.model; + let model = this.state.model - model.type = e.target.value; - this.setState({ model: model }); + model.type = e.target.value + this.setState({ model: model }) } onResellerChange(e) { - this.props.onGetDirectResellerId(e); - let model2 = this.state.model; - model2.reseller = e; + this.props.onGetDirectResellerId(e) + let model2 = this.state.model + model2.reseller = e this.setState({ - model: model2, - }); + model: model2 + }) } onChangeCombinedDate(e) { - let model2 = this.state.model; - model2.date_time = e; + let model2 = this.state.model + model2.date_time = e this.setState({ - model: model2, - }); + model: model2 + }) - sessionStorage.setItem("datetime", JSON.stringify(model2.date_time)); + sessionStorage.setItem('datetime', JSON.stringify(model2.date_time)) sessionStorage.setItem( - "knockGold_effectDate", + 'knockGold_effectDate', JSON.stringify({ begin_time: model2.date_time[0], - end_time: model2.date_time[1], + end_time: model2.date_time[1] }) - ); + ) } onDisabledRange = (date, type) => { - console.log(type); - let disabled = false; - if (type == "end") { - disabled = moment(date.getTime()).add(1, "days") <= new Date().getTime(); + let disabled = false + if (type == 'end') { + disabled = moment(date.getTime()).add(1, 'days') <= new Date().getTime() } - if (type == "start") { - disabled = date.getTime() <= new Date().getTime(); + if (type == 'start') { + disabled = date.getTime() <= new Date().getTime() } - return disabled; - }; + return disabled + } render() { //校验规则 const rules = { - title: [{ type: "required", message: "请输入营销计划名称" }], - reseller: [{ type: "required", message: "请选择分销商" }], - date_time: [{ type: "required", message: "请选择时间段" }], - }; + title: [{ type: 'required', message: '请输入营销计划名称' }], + reseller: [{ type: 'required', message: '请选择分销商' }], + date_time: [{ type: 'required', message: '请选择时间段' }] + } return ( -
-
- +
+ + { - let model2 = this.state.model; - model2.title = e; + let model2 = this.state.model + model2.title = e - this.setState({ model: model2 }); + this.setState({ model: model2 }) }} onClearItem={(e) => { - let model2 = this.state.model; - model2.title = ""; - this.setState({ model: model2 }); + let model2 = this.state.model + model2.title = '' + this.setState({ model: model2 }) }} value={this.state.model.title} countShow={false} - placeholder={"请输入"} - labelWidth={"0px"} + placeholder={'请输入'} + labelWidth={'0px'} maxLength={12} - height={"36px"} - width={"520px"} - alignment={"left"} + height={'36px'} + width={'520px'} + alignment={'left'} /> - + { - this.onTypeChange(e); + this.onTypeChange(e) }} - value={this.state.model.type} - > + value={this.state.model.type}> 活动 仅兑换 - +