Merge branch 'clickCopyv1.4' of https://codeup.aliyun.com/5f9118049cffa29cfdd3be1c/marketing/frontend into clickCopyv1.4
This commit is contained in:
commit
fa60290ba8
|
@ -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',
|
||||
|
|
|
@ -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 (
|
||||
<div className="mouseMenu" onMouseLeave={this.closeMenuMask.bind(this)} onMouseEnter={this.props.mouseEnter}>
|
||||
<div className="menuBody">
|
||||
|
|
|
@ -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") ||
|
||||
|
|
|
@ -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}>
|
||||
<RadioButton value={1}>串码</RadioButton>
|
||||
<RadioButton value={2}>链接</RadioButton>
|
||||
<RadioButton value={4}>二维码</RadioButton>
|
||||
|
@ -1059,7 +903,7 @@ export default class acclist extends React.Component {
|
|||
<Checkbox.Group
|
||||
value={this.state.checkedList}
|
||||
onChange={(arr) => this.setState({ checkedList: arr })}
|
||||
disabled={this.state.isEdit}>
|
||||
disabled={true}>
|
||||
<Checkbox value={1}>兑换码</Checkbox>
|
||||
<Checkbox value={2} disabled>
|
||||
优惠券
|
||||
|
@ -1124,7 +968,7 @@ export default class acclist extends React.Component {
|
|||
id='allow_repetition'
|
||||
prop='allow_repetition'>
|
||||
<RadioGroup
|
||||
disabled={this.state.isEdit}
|
||||
disabled={true}
|
||||
onChange={(e) => this.onRepetitionChange(e)}
|
||||
value={this.state.model.allow_repetition}>
|
||||
<RadioButton value={1}>是</RadioButton>
|
||||
|
@ -1137,7 +981,7 @@ export default class acclist extends React.Component {
|
|||
id='allow_loss'
|
||||
prop='allow_loss'>
|
||||
<RadioGroup
|
||||
disabled={this.state.isEdit}
|
||||
disabled={true}
|
||||
onChange={(e) => this.onLossChange(e)}
|
||||
value={this.state.model.allow_loss}>
|
||||
<RadioButton value={1}>是</RadioButton>
|
||||
|
|
|
@ -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]
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
//渲染范围列表数据以及数据转换
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -797,7 +797,7 @@ export default class orderlist extends React.Component {
|
|||
onClick={(e) => this.moreFn(e, rowData)}>
|
||||
详情
|
||||
</span>
|
||||
{rowData.status == 1 ? (
|
||||
{rowData.status == 1||rowData.status == 0 ? (
|
||||
<span
|
||||
className='grid-link'
|
||||
onClick={(e) => this.deleteFn(e, rowData)}>
|
||||
|
|
|
@ -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 (
|
||||
<div id="step1">
|
||||
<Form model={this.state.model} rules={rules} ref="form1">
|
||||
<FormItem labelname="营销计划名称" prop="title" id="title">
|
||||
<div id='step1'>
|
||||
<Form model={this.state.model} rules={rules} ref='form1'>
|
||||
<FormItem labelname='营销计划名称' prop='title' id='title'>
|
||||
<Ipt
|
||||
onChange={(e) => {
|
||||
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'}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem labelname="计划类型" prop="type" id="type">
|
||||
<FormItem labelname='计划类型' prop='type' id='type'>
|
||||
<RadioGroup
|
||||
onChange={(e) => {
|
||||
this.onTypeChange(e);
|
||||
this.onTypeChange(e)
|
||||
}}
|
||||
value={this.state.model.type}
|
||||
>
|
||||
value={this.state.model.type}>
|
||||
<RadioButton value={1} disabled={true}>
|
||||
活动
|
||||
</RadioButton>
|
||||
<RadioButton value={2}>仅兑换</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem labelname="分销商" prop="reseller" id="reseller">
|
||||
<FormItem labelname='分销商' prop='reseller' id='reseller'>
|
||||
<Select
|
||||
options={this.state.reseller_option}
|
||||
placeholder="选择一项"
|
||||
placeholder='选择一项'
|
||||
disabled={this.props.disabled}
|
||||
width={515}
|
||||
value={this.state.model.reseller}
|
||||
onChange={(e) => {
|
||||
this.onResellerChange(e);
|
||||
Bus.emit("change", "reseller", e);
|
||||
this.onResellerChange(e)
|
||||
Bus.emit('change', 'reseller', e)
|
||||
}}
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem labelname="开始~结束时间" prop="date_time" id="date_time">
|
||||
<FormItem labelname='开始~结束时间' prop='date_time' id='date_time'>
|
||||
<DateRangePicker
|
||||
className="zent-datepicker-plan"
|
||||
className='zent-datepicker-plan'
|
||||
showTime={{
|
||||
format: "HH:mm:ss",
|
||||
defaultTime: [moment().format("HH:mm:ss"), "23:59:59"],
|
||||
format: 'HH:mm:ss',
|
||||
defaultTime: [moment().format('HH:mm:ss'), '23:59:59']
|
||||
}}
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
format='YYYY-MM-DD HH:mm:ss'
|
||||
disabled={[this.props.disabled, false]}
|
||||
value={this.state.model.date_time}
|
||||
onChange={(e) => {
|
||||
Bus.emit("change", "date_time", e);
|
||||
this.onChangeCombinedDate(e);
|
||||
Bus.emit('change', 'date_time', e)
|
||||
this.onChangeCombinedDate(e)
|
||||
}}
|
||||
disabledDate={this.onDisabledRange}
|
||||
/>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,8 +177,8 @@ export default class acclist extends React.Component {
|
|||
getApprovalsInfo(approval_id).then((res) => {
|
||||
handelResponse(res, (req, msg) => {
|
||||
/*当为创建中和审核驳回时 转换数据结构 */
|
||||
const newProduct = []
|
||||
req.code_batch.map((item) => {
|
||||
const newProduct = []
|
||||
item.product.legal.map((item1) => {
|
||||
newProduct.push({
|
||||
type: 1,
|
||||
|
@ -809,10 +809,10 @@ export default class acclist extends React.Component {
|
|||
// handelResponse(
|
||||
// res,
|
||||
// (req, msg) => {
|
||||
Notify.success(res.message)
|
||||
setTimeout(() => {
|
||||
this.props.history.push('/home/key-list/')
|
||||
}, 2000)
|
||||
Notify.success(res.message)
|
||||
setTimeout(() => {
|
||||
this.props.history.push('/home/key-list/')
|
||||
}, 2000)
|
||||
// },
|
||||
// (err) => {
|
||||
// Notify.error(err)
|
||||
|
@ -869,10 +869,10 @@ export default class acclist extends React.Component {
|
|||
// handelResponse(
|
||||
// res,
|
||||
// (req, msg) => {
|
||||
Notify.success(res.message)
|
||||
setTimeout(() => {
|
||||
this.props.history.push('/home/key-list/')
|
||||
}, 2000)
|
||||
Notify.success(res.message)
|
||||
setTimeout(() => {
|
||||
this.props.history.push('/home/key-list/')
|
||||
}, 2000)
|
||||
// },
|
||||
// (err) => {
|
||||
// Notify.error(err)
|
||||
|
|
|
@ -190,6 +190,7 @@ export default class acclist extends React.Component {
|
|||
{ title: '审核中' },
|
||||
{ title: '未通过' },
|
||||
{ title: '进行中' },
|
||||
{ title: '生成中' },
|
||||
{ title: '暂停中' },
|
||||
{ title: '已完结' },
|
||||
{ title: '已作废' }
|
||||
|
@ -414,30 +415,34 @@ export default class acclist extends React.Component {
|
|||
}, 200)
|
||||
}
|
||||
tabFn(index) {
|
||||
console.log(index)
|
||||
this.setState({ activepage: index, key_word: '' })
|
||||
if (index == 1) {
|
||||
this.setState({ activepage: 1 })
|
||||
switch (index) {
|
||||
case 1:
|
||||
this.setState({ activepage: 1 })
|
||||
break
|
||||
case 2:
|
||||
this.setState({ activepage: 2 })
|
||||
break
|
||||
case 3:
|
||||
this.setState({ activepage: 8 })
|
||||
break
|
||||
case 4:
|
||||
this.setState({ activepage: 4 })
|
||||
break
|
||||
case 5:
|
||||
this.setState({ activepage: 3 })
|
||||
break
|
||||
case 6:
|
||||
this.setState({ activepage: 5 })
|
||||
break
|
||||
case 7:
|
||||
this.setState({ activepage: 6 })
|
||||
break
|
||||
case 8:
|
||||
this.setState({ activepage: 7 })
|
||||
break
|
||||
}
|
||||
if (index == 2) {
|
||||
this.setState({ activepage: 2 })
|
||||
}
|
||||
|
||||
if (index == 3) {
|
||||
this.setState({ activepage: 8 })
|
||||
}
|
||||
if (index == 4) {
|
||||
this.setState({ activepage: 4 })
|
||||
}
|
||||
if (index == 5) {
|
||||
this.setState({ activepage: 5 })
|
||||
}
|
||||
if (index == 6) {
|
||||
this.setState({ activepage: 6 })
|
||||
}
|
||||
if (index == 7) {
|
||||
this.setState({ activepage: 7 })
|
||||
}
|
||||
|
||||
this.setState({ page: 1, limit: 10 })
|
||||
|
||||
setTimeout(() => {
|
||||
|
@ -970,6 +975,27 @@ export default class acclist extends React.Component {
|
|||
</Dropdown>
|
||||
</span>
|
||||
)
|
||||
} else if (rowData.status === 3) {
|
||||
str = (
|
||||
<span>
|
||||
<a className='grid-link disabled'>编辑</a>
|
||||
<a className='grid-link disabled'>复制</a>
|
||||
<span className='grid-link disabled'>撤销审批</span>
|
||||
<Dropdown
|
||||
position={DropdownPosition.RightTop}
|
||||
visible={this.state.menuVisible}
|
||||
onVisibleChange={(v) =>
|
||||
this.setState({ visible: v })
|
||||
}>
|
||||
<DropdownClickTrigger>
|
||||
<div className='linkmore disabled'>
|
||||
更多 <Icon type={'down'} />{' '}
|
||||
</div>
|
||||
</DropdownClickTrigger>
|
||||
<DropdownContent></DropdownContent>
|
||||
</Dropdown>
|
||||
</span>
|
||||
)
|
||||
} else {
|
||||
str = (
|
||||
<span>
|
||||
|
|
63
src/utils.js
63
src/utils.js
|
@ -85,47 +85,28 @@ export function getNowTime() {
|
|||
export function sortWeeks(weeks) {
|
||||
var _weeks = [] //创建临时排序的数组
|
||||
for (var i = 0; i < weeks.length; i++) {
|
||||
if (weeks[i] == '周一') {
|
||||
var _week = {}
|
||||
_week['id'] = 1
|
||||
_week['name'] = '周一'
|
||||
_weeks.push(_week)
|
||||
}
|
||||
if (weeks[i] == '周二') {
|
||||
var _week = {}
|
||||
_week['id'] = 2
|
||||
_week['name'] = '周二'
|
||||
_weeks.push(_week)
|
||||
}
|
||||
if (weeks[i] == '周三') {
|
||||
var _week = {}
|
||||
_week['id'] = 3
|
||||
_week['name'] = '周三'
|
||||
_weeks.push(_week)
|
||||
}
|
||||
if (weeks[i] == '周四') {
|
||||
var _week = {}
|
||||
_week['id'] = 4
|
||||
_week['name'] = '周四'
|
||||
_weeks.push(_week)
|
||||
}
|
||||
if (weeks[i] == '周五') {
|
||||
var _week = {}
|
||||
_week['id'] = 5
|
||||
_week['name'] = '周五'
|
||||
_weeks.push(_week)
|
||||
}
|
||||
if (weeks[i] == '周六') {
|
||||
var _week = {}
|
||||
_week['id'] = 6
|
||||
_week['name'] = '周六'
|
||||
_weeks.push(_week)
|
||||
}
|
||||
if (weeks[i] == '周日') {
|
||||
var _week = {}
|
||||
_week['id'] = 7
|
||||
_week['name'] = '周日'
|
||||
_weeks.push(_week)
|
||||
switch (weeks[i]) {
|
||||
case '周一':
|
||||
_weeks.push({ id: 1, name: '周一' })
|
||||
break
|
||||
case '周二':
|
||||
_weeks.push({ id: 2, name: '周二' })
|
||||
break
|
||||
case '周三':
|
||||
_weeks.push({ id: 3, name: '周三' })
|
||||
break
|
||||
case '周四':
|
||||
_weeks.push({ id: 4, name: '周四' })
|
||||
break
|
||||
case '周五':
|
||||
_weeks.push({ id: 5, name: '周五' })
|
||||
break
|
||||
case '周六':
|
||||
_weeks.push({ id: 6, name: '周六' })
|
||||
break
|
||||
case '周日':
|
||||
_weeks.push({ id: 7, name: '周日' })
|
||||
break
|
||||
}
|
||||
}
|
||||
_weeks.sort(function (a, b) {
|
||||
|
|
Loading…
Reference in New Issue