Merge branch 'clickCopyv1.4' of https://codeup.aliyun.com/5f9118049cffa29cfdd3be1c/marketing/frontend into clickCopyv1.4
This commit is contained in:
commit
facec5e5b4
|
@ -888,8 +888,4 @@ export const batchSend = (data) => {
|
|||
return req("post", baseurl + `/keys/batchSend`, data);
|
||||
};
|
||||
|
||||
export const exportKey = (data) => {
|
||||
return req("get", baseurl + "/key/export", data);
|
||||
};
|
||||
|
||||
export { req };
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,21 +2,27 @@
|
|||
* @Author: Wind
|
||||
* @Date: 2022-07-25 10:53:41
|
||||
* @LastEditors: Wind
|
||||
* @LastEditTime: 2022-07-28 15:29:24
|
||||
* @LastEditTime: 2022-08-10 15:52:01
|
||||
* @Description:key列表查询组件
|
||||
* @FilePath: \frontend\src\components\keysFind\index.jsx
|
||||
*/
|
||||
import './index.less'
|
||||
import { useState } from 'react'
|
||||
import { Button, Select, DateRangePicker } from 'zent'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Button, Select, DateRangePicker, Notify } from 'zent'
|
||||
import Ipt from '@/components/input/main'
|
||||
import Form from '@/components/form/main'
|
||||
import FormItem from '@/components/form-item/main'
|
||||
import _ from 'lodash'
|
||||
import {
|
||||
getReSellerOption,
|
||||
handelResponse,
|
||||
getPlanChoseOption
|
||||
} from '../../assets/api'
|
||||
import { FixedSizeList } from 'react-window'
|
||||
|
||||
const stateList = [
|
||||
{ key: 0, text: '全部' },
|
||||
{ key: 1, text: '待使用' },
|
||||
{ key: 1, text: '可使用' },
|
||||
{ key: 2, text: '已使用' },
|
||||
{ key: 3, text: '已完结' },
|
||||
{ key: 4, text: '已作废' }
|
||||
|
@ -26,20 +32,67 @@ function init() {
|
|||
date: [],
|
||||
reseller: '',
|
||||
plan: '',
|
||||
state: '',
|
||||
state: { key: 0, text: '全部' },
|
||||
key: ''
|
||||
}
|
||||
}
|
||||
|
||||
export default ({ onQuery }) => {
|
||||
const [models, setModels] = useState(init())
|
||||
const [resellerOption, setResellerOption] = useState([]) /* 分销商 */
|
||||
const [planChoseOption, setPlanChoseOption] = useState([]) /* 营销计划 */
|
||||
|
||||
useEffect(() => {
|
||||
/* 获取分销商 */
|
||||
getReSellerOption().then((res) =>
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
const data = req.map((item) => ({
|
||||
key: item.direct_reseller_id,
|
||||
text: item.name
|
||||
}))
|
||||
setResellerOption(data)
|
||||
},
|
||||
(err) => {}
|
||||
)
|
||||
)
|
||||
/* 获取营销计划 */
|
||||
getPlanChoseOption().then((res) =>
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
const data = req.map((item) => ({
|
||||
key: item.id,
|
||||
text: item.title
|
||||
}))
|
||||
setPlanChoseOption(data)
|
||||
},
|
||||
(err) => {}
|
||||
)
|
||||
)
|
||||
}, [])
|
||||
|
||||
function renderOptionList(options, renderOption) {
|
||||
return (
|
||||
<FixedSizeList
|
||||
height={256}
|
||||
itemCount={options.length}
|
||||
itemSize={32}
|
||||
width={200}>
|
||||
{({ index, style }) => (
|
||||
<div style={style}>{renderOption(options[index], index)}</div>
|
||||
)}
|
||||
</FixedSizeList>
|
||||
)
|
||||
}
|
||||
|
||||
function onChange(data) {
|
||||
return {
|
||||
begin_time: data.date[0] || null,
|
||||
end_time: data.date[1] || null,
|
||||
reseller_name: data.reseller || null,
|
||||
plan_name: data.plan || null,
|
||||
reseller_id: data.reseller?.key || null,
|
||||
plan_id: data.plan?.key || null,
|
||||
status: data.state?.key || null,
|
||||
key: data.key || null
|
||||
}
|
||||
|
@ -69,26 +122,26 @@ export default ({ onQuery }) => {
|
|||
/>
|
||||
</FormItem>
|
||||
<FormItem labelname='分销商:' required='' labelwidth='70px'>
|
||||
<Ipt
|
||||
<Select
|
||||
value={models.reseller}
|
||||
countShow={false}
|
||||
labelWidth='0px'
|
||||
placeholder='请输入'
|
||||
options={resellerOption}
|
||||
placeholder='请选择'
|
||||
renderOptionList={renderOptionList}
|
||||
width={204}
|
||||
onClearItem={() => setModels({ ...models, reseller: '' })}
|
||||
clearable
|
||||
onChange={(va) => setModels({ ...models, reseller: va })}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem labelname='计划名称:' required='' labelwidth='90px'>
|
||||
<Ipt
|
||||
<Select
|
||||
value={models.plan}
|
||||
countShow={false}
|
||||
labelWidth='0px'
|
||||
placeholder='请输入'
|
||||
options={planChoseOption}
|
||||
placeholder='请选择'
|
||||
renderOptionList={renderOptionList}
|
||||
width={204}
|
||||
clearable
|
||||
onChange={(va) => setModels({ ...models, plan: va })}
|
||||
onClearItem={() => setModels({ ...models, plan: '' })}
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem labelname='KEY:' required='' labelwidth='50px'>
|
||||
|
@ -103,8 +156,20 @@ export default ({ onQuery }) => {
|
|||
/>
|
||||
</FormItem>
|
||||
|
||||
<div>
|
||||
<Button type='primary' onClick={() => onQuery(onChange(models))}>
|
||||
<div className='button_box'>
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={() => {
|
||||
if (
|
||||
onChange(models).plan_id ||
|
||||
onChange(models).reseller_id ||
|
||||
onChange(models).key
|
||||
) {
|
||||
onQuery(onChange(models))
|
||||
} else {
|
||||
Notify.warn('请输入【分销商】或【计划名称】或【key】进行查询')
|
||||
}
|
||||
}}>
|
||||
查询
|
||||
</Button>
|
||||
<Button
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
.keysFind {
|
||||
width: 100%;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.form-label {
|
||||
height: 80% !important;
|
||||
}
|
||||
|
||||
.form-compontent {
|
||||
padding-top: 0px !important;
|
||||
height: 65% !important;
|
||||
|
||||
|
||||
.iptfillself:not(:last-child) {
|
||||
margin-bottom: 0 !important;
|
||||
|
@ -23,10 +29,13 @@
|
|||
.form-Item {
|
||||
width: auto;
|
||||
margin-right: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
.button_box {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
|
||||
.zent-datepicker .zent-datepicker-trigger {
|
||||
|
|
|
@ -52,13 +52,13 @@ const receiveTypeList = [
|
|||
]
|
||||
|
||||
const week = [
|
||||
{ key: 'Mon', text: '星期一' },
|
||||
{ key: 'Tue', text: '星期二' },
|
||||
{ key: 'Wed', text: '星期三' },
|
||||
{ key: 'Thu', text: '星期四' },
|
||||
{ key: 'Fri', text: '星期五' },
|
||||
{ key: 'Sat', text: '星期六' },
|
||||
{ key: 'Sun', text: '星期天' }
|
||||
{ key: 'Mon', text: '周一' },
|
||||
{ key: 'Tue', text: '周二' },
|
||||
{ key: 'Wed', text: '周三' },
|
||||
{ key: 'Thu', text: '周四' },
|
||||
{ key: 'Fri', text: '周五' },
|
||||
{ key: 'Sat', text: '周六' },
|
||||
{ key: 'Sun', text: '周天' }
|
||||
]
|
||||
//预警百分比
|
||||
const earlyPerList = ['70', '50', '30', '20']
|
||||
|
@ -781,7 +781,7 @@ export default class addKnockGold extends Component {
|
|||
/>
|
||||
</FormItem>
|
||||
{this.state.model.channel == 1 ? (
|
||||
<FormItem labelname='卷模板编号' prop='temp_no' id='batch_number'>
|
||||
<FormItem labelname='券模板编号' prop='temp_no' id='batch_number'>
|
||||
<Ipt
|
||||
onChange={(value) => {
|
||||
this.onHandleChange(value, 'temp_no')
|
||||
|
@ -1239,6 +1239,7 @@ export default class addKnockGold extends Component {
|
|||
style={{ marginLeft: '25px' }}>
|
||||
{week.map((week) => (
|
||||
<Checkbox
|
||||
className='checkbox'
|
||||
disabled={this.props?.data?.id ? true : false}
|
||||
value={week.text}
|
||||
key={week.key}>
|
||||
|
@ -1261,7 +1262,7 @@ export default class addKnockGold extends Component {
|
|||
model[index] = value
|
||||
this.onHandleChange(model, 'ruleDate')
|
||||
}}
|
||||
width={158}
|
||||
width={205}
|
||||
disabledTime={this.onDisabledRange}
|
||||
/>
|
||||
{this.addOrMoveFunction(
|
||||
|
@ -1291,7 +1292,7 @@ export default class addKnockGold extends Component {
|
|||
}}>
|
||||
<Radio value='irregular'>有效期内,不规则日期可用</Radio>
|
||||
</RadioGroup>
|
||||
<p className='notice' style={{ width: '600px' }}>
|
||||
<p className='notice' style={{ width: '500px' }}>
|
||||
可在有效期内任意选择时间天数,以及可用时段。
|
||||
因当前微信支持问题,如选择不规则时间,微信卡包内当前仅会展示有效期,建议
|
||||
将具体可用日期以及时间段填写在使用说明内。
|
||||
|
@ -1305,7 +1306,7 @@ export default class addKnockGold extends Component {
|
|||
this.props?.data?.id ? true : false,
|
||||
this.props?.data?.id ? true : false
|
||||
]}
|
||||
width={234}
|
||||
width={205}
|
||||
value={this.state.model.irregularDate[index]}
|
||||
onChange={(value) => {
|
||||
const model = this.state.model.irregularDate
|
||||
|
@ -1339,7 +1340,7 @@ export default class addKnockGold extends Component {
|
|||
model[index] = value
|
||||
this.onHandleChange(model, 'irregularTime')
|
||||
}}
|
||||
width={158}
|
||||
width={205}
|
||||
disabledTime={this.onDisabledRange}
|
||||
/>
|
||||
{this.addOrMoveFunction(
|
||||
|
|
|
@ -182,6 +182,12 @@
|
|||
}
|
||||
|
||||
#usable_time {
|
||||
align-items: flex-start !important;
|
||||
|
||||
.form-label {
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.form-compontent {
|
||||
.boxTime {
|
||||
display: flex;
|
||||
|
@ -236,7 +242,7 @@
|
|||
|
||||
.move {
|
||||
margin-left: 25px;
|
||||
color: #ccc;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
@ -336,6 +342,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 22px !important;
|
||||
}
|
||||
|
||||
.userSelect {
|
||||
width: 520px;
|
||||
min-height: 150px;
|
||||
|
|
|
@ -153,7 +153,9 @@ export default class acclist extends React.Component {
|
|||
getReseller(req.reseller_id).then((res) => {
|
||||
handelResponse(res, (req, msg) => {
|
||||
this.setState({ reseller: req })
|
||||
|
||||
this.setState({
|
||||
direct_reseller_id: req.direct_reseller_id
|
||||
})
|
||||
this.setState({ phone_list: req.contact_phone })
|
||||
this.setState({ email_list: req.contact_email })
|
||||
})
|
||||
|
|
|
@ -186,21 +186,19 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
/* 处理可复制数据逻辑 */
|
||||
copyElementFunction({ key_batch_id, status, end_time, keyBatch, id ,title}) {
|
||||
const today = moment().format('yyyy-MM-DD HH:mm:ss')
|
||||
copyElementFunction({ key_batch_id, status, keyBatch, id, title }) {
|
||||
let element = ''
|
||||
if (
|
||||
![-1, 6, 7].includes(status) &&
|
||||
![6, 7].includes(keyBatch?.status) &&
|
||||
end_time > today &&
|
||||
!keyBatch?.approval_status &&
|
||||
keyBatch?.discard === 0
|
||||
) {
|
||||
element = (
|
||||
<span
|
||||
className='grid-link'
|
||||
style={{ marginLeft: '10px' }}
|
||||
onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch,title)}>
|
||||
style={{}}
|
||||
onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch, title)}>
|
||||
复制
|
||||
</span>
|
||||
)
|
||||
|
@ -208,7 +206,6 @@ export default class acclist extends React.Component {
|
|||
element = (
|
||||
<span
|
||||
style={{
|
||||
marginLeft: '10px',
|
||||
paddingRight: '10px',
|
||||
color: '#d8dbdd'
|
||||
}}>
|
||||
|
@ -247,7 +244,7 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
/* 复制 */
|
||||
copyFunction(key_batch_id, id, keyBatch,title) {
|
||||
copyFunction(key_batch_id, id, keyBatch, title) {
|
||||
sessionStorage.setItem('keybatch_id', key_batch_id)
|
||||
sessionStorage.setItem('copy_code_id', id)
|
||||
sessionStorage.setItem('key_reseller_id', keyBatch.plan.reseller_id)
|
||||
|
@ -585,6 +582,7 @@ export default class acclist extends React.Component {
|
|||
编辑
|
||||
</span>
|
||||
)}
|
||||
{this.copyElementFunction(rowData)}
|
||||
{rowData.status != 4 && rowData.status != 5 ? (
|
||||
<span
|
||||
className='grid-link'
|
||||
|
@ -609,7 +607,6 @@ export default class acclist extends React.Component {
|
|||
) : (
|
||||
<span style={{ color: '#d8dbdd' }}>撤销审批</span>
|
||||
)}
|
||||
{this.copyElementFunction(rowData)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ export default class acclist extends React.Component {
|
|||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
planStatus:'',//计划状态
|
||||
planStatus: '', //计划状态
|
||||
dataCount: 0,
|
||||
page: 1,
|
||||
limit: 10,
|
||||
|
@ -305,8 +305,14 @@ export default class acclist extends React.Component {
|
|||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
this.setState({ distdata: req.data })
|
||||
this.setState({ planStatus: req.plan.status })//计划状态
|
||||
const newData = req.data.map((item) => {
|
||||
if ([1, 2, 8, 7].includes(item.status)) {
|
||||
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)
|
||||
},
|
||||
|
@ -390,7 +396,7 @@ export default class acclist extends React.Component {
|
|||
},
|
||||
{
|
||||
path: '/home/exchangecode-add',
|
||||
name: '复制key:'+row.batch_name
|
||||
name: '复制key:' + row.batch_name
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -584,8 +590,16 @@ export default class acclist extends React.Component {
|
|||
|
||||
/* 批量发送按钮 */
|
||||
bulkSendFunction() {
|
||||
if (!this.state.gridSelection[0]?.reseller_id)
|
||||
return Notify.warn('请勾选需要批量发送的key批次')
|
||||
let isNotify = ''
|
||||
this.state.gridSelection.filter((item) => {
|
||||
if (![4, 5, 6].includes(item.status)) {
|
||||
return (isNotify = true)
|
||||
}
|
||||
})
|
||||
|
||||
if (isNotify) {
|
||||
return Notify.warn('只有状态为进行中、暂停中、已完结的允许发送')
|
||||
}
|
||||
this.getResellerInfoFunction(this.state.gridSelection[0].reseller_id)
|
||||
this.setState({ isBulkSend: true })
|
||||
}
|
||||
|
@ -771,7 +785,10 @@ export default class acclist extends React.Component {
|
|||
disabled={this.state.disabled}>
|
||||
新建key
|
||||
</Button>
|
||||
<Button type='primary' onClick={() => this.bulkSendFunction()}>
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={() => this.bulkSendFunction()}
|
||||
disabled={!this.state.gridSelection[0]?.reseller_id}>
|
||||
批量发送
|
||||
</Button>
|
||||
</div>
|
||||
|
@ -871,12 +888,19 @@ export default class acclist extends React.Component {
|
|||
str = (
|
||||
<span>
|
||||
<a className='grid-link disabled'>编辑</a>
|
||||
{
|
||||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):(
|
||||
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a>
|
||||
)
|
||||
}
|
||||
|
||||
{[1, 2, 8].includes(rowData.status) ||
|
||||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
|
||||
<a className='grid-link disabled'>复制</a>
|
||||
) : (
|
||||
<a
|
||||
className='grid-link'
|
||||
onClick={(e) => {
|
||||
this.onCopyRow(e, rowData)
|
||||
}}>
|
||||
复制
|
||||
</a>
|
||||
)}
|
||||
|
||||
<span className='grid-link disabled'>撤销审批</span>
|
||||
|
||||
<Dropdown
|
||||
|
@ -898,11 +922,18 @@ export default class acclist extends React.Component {
|
|||
str = (
|
||||
<span>
|
||||
<a className='grid-link disabled'>编辑</a>
|
||||
{
|
||||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):(
|
||||
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a>
|
||||
)
|
||||
}
|
||||
{[1, 2, 8].includes(rowData.status) ||
|
||||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
|
||||
<a className='grid-link disabled'>复制</a>
|
||||
) : (
|
||||
<a
|
||||
className='grid-link'
|
||||
onClick={(e) => {
|
||||
this.onCopyRow(e, rowData)
|
||||
}}>
|
||||
复制
|
||||
</a>
|
||||
)}
|
||||
<span
|
||||
className='grid-link'
|
||||
onClick={(e) => this.onReCall(e, rowData)}>
|
||||
|
@ -950,11 +981,18 @@ export default class acclist extends React.Component {
|
|||
}}>
|
||||
编辑
|
||||
</a>
|
||||
{
|
||||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):(
|
||||
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a>
|
||||
)
|
||||
}
|
||||
{[1, 2, 8].includes(rowData.status) ||
|
||||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
|
||||
<a className='grid-link disabled'>复制</a>
|
||||
) : (
|
||||
<a
|
||||
className='grid-link'
|
||||
onClick={(e) => {
|
||||
this.onCopyRow(e, rowData)
|
||||
}}>
|
||||
复制
|
||||
</a>
|
||||
)}
|
||||
<span className='grid-link disabled'>撤销审批</span>
|
||||
|
||||
<Dropdown
|
||||
|
|
|
@ -25,7 +25,6 @@ import {
|
|||
keyBatchUsage,
|
||||
keyBatchCancel,
|
||||
handelResponse,
|
||||
getkeyDetailList,
|
||||
getKeysList,
|
||||
batchUploadVoid,
|
||||
batchUploadUsed,
|
||||
|
@ -104,7 +103,7 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
componentDidMount(e) {
|
||||
this.iptsureFn();
|
||||
// this.iptsureFn();
|
||||
}
|
||||
componentWillMount() {
|
||||
this.setState({ tableHeight: window.innerHeight - 430 });
|
||||
|
@ -628,6 +627,7 @@ export default class acclist extends React.Component {
|
|||
pageChange={(e) => {
|
||||
this.onPageChange(e);
|
||||
}}
|
||||
emptyText="查询 请输入【分销商】或【计划名称】或【key】进行查询"
|
||||
countChange={(e) => {
|
||||
this.onCountChange(e);
|
||||
}}
|
||||
|
|
|
@ -311,7 +311,11 @@ export default class adduserinfo extends React.Component{
|
|||
//获取角色
|
||||
getRoleFn(){
|
||||
let _self=this;
|
||||
getRole().then(res=>{
|
||||
let data={
|
||||
page:1,
|
||||
limit:1000
|
||||
}
|
||||
getRole(data).then(res=>{
|
||||
handelResponse(res,(response,msg)=>{
|
||||
let roleList=response.data.map(item=>{
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue