This commit is contained in:
zhangds 2022-08-10 17:27:25 +08:00
commit facec5e5b4
12 changed files with 740 additions and 695 deletions

View File

@ -888,8 +888,4 @@ export const batchSend = (data) => {
return req("post", baseurl + `/keys/batchSend`, data); return req("post", baseurl + `/keys/batchSend`, data);
}; };
export const exportKey = (data) => {
return req("get", baseurl + "/key/export", data);
};
export { req }; export { req };

File diff suppressed because it is too large Load Diff

View File

@ -2,21 +2,27 @@
* @Author: Wind * @Author: Wind
* @Date: 2022-07-25 10:53:41 * @Date: 2022-07-25 10:53:41
* @LastEditors: Wind * @LastEditors: Wind
* @LastEditTime: 2022-07-28 15:29:24 * @LastEditTime: 2022-08-10 15:52:01
* @Description:key列表查询组件 * @Description:key列表查询组件
* @FilePath: \frontend\src\components\keysFind\index.jsx * @FilePath: \frontend\src\components\keysFind\index.jsx
*/ */
import './index.less' import './index.less'
import { useState } from 'react' import { useState, useEffect } from 'react'
import { Button, Select, DateRangePicker } from 'zent' import { Button, Select, DateRangePicker, Notify } from 'zent'
import Ipt from '@/components/input/main' import Ipt from '@/components/input/main'
import Form from '@/components/form/main' import Form from '@/components/form/main'
import FormItem from '@/components/form-item/main' import FormItem from '@/components/form-item/main'
import _ from 'lodash' import _ from 'lodash'
import {
getReSellerOption,
handelResponse,
getPlanChoseOption
} from '../../assets/api'
import { FixedSizeList } from 'react-window'
const stateList = [ const stateList = [
{ key: 0, text: '全部' }, { key: 0, text: '全部' },
{ key: 1, text: '待使用' }, { key: 1, text: '使用' },
{ key: 2, text: '已使用' }, { key: 2, text: '已使用' },
{ key: 3, text: '已完结' }, { key: 3, text: '已完结' },
{ key: 4, text: '已作废' } { key: 4, text: '已作废' }
@ -26,20 +32,67 @@ function init() {
date: [], date: [],
reseller: '', reseller: '',
plan: '', plan: '',
state: '', state: { key: 0, text: '全部' },
key: '' key: ''
} }
} }
export default ({ onQuery }) => { export default ({ onQuery }) => {
const [models, setModels] = useState(init()) 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) { function onChange(data) {
return { return {
begin_time: data.date[0] || null, begin_time: data.date[0] || null,
end_time: data.date[1] || null, end_time: data.date[1] || null,
reseller_name: data.reseller || null, reseller_id: data.reseller?.key || null,
plan_name: data.plan || null, plan_id: data.plan?.key || null,
status: data.state?.key || null, status: data.state?.key || null,
key: data.key || null key: data.key || null
} }
@ -69,26 +122,26 @@ export default ({ onQuery }) => {
/> />
</FormItem> </FormItem>
<FormItem labelname='分销商:' required='' labelwidth='70px'> <FormItem labelname='分销商:' required='' labelwidth='70px'>
<Ipt <Select
value={models.reseller} value={models.reseller}
countShow={false} options={resellerOption}
labelWidth='0px' placeholder='请选择'
placeholder='请输入' renderOptionList={renderOptionList}
width={204} width={204}
onClearItem={() => setModels({ ...models, reseller: '' })} clearable
onChange={(va) => setModels({ ...models, reseller: va })} onChange={(va) => setModels({ ...models, reseller: va })}
/> />
</FormItem> </FormItem>
<FormItem labelname='计划名称:' required='' labelwidth='90px'> <FormItem labelname='计划名称:' required='' labelwidth='90px'>
<Ipt <Select
value={models.plan} value={models.plan}
countShow={false} options={planChoseOption}
labelWidth='0px' placeholder='请选择'
placeholder='请输入' renderOptionList={renderOptionList}
width={204} width={204}
clearable
onChange={(va) => setModels({ ...models, plan: va })} onChange={(va) => setModels({ ...models, plan: va })}
onClearItem={() => setModels({ ...models, plan: '' })}
/> />
</FormItem> </FormItem>
<FormItem labelname='KEY' required='' labelwidth='50px'> <FormItem labelname='KEY' required='' labelwidth='50px'>
@ -103,8 +156,20 @@ export default ({ onQuery }) => {
/> />
</FormItem> </FormItem>
<div> <div className='button_box'>
<Button type='primary' onClick={() => onQuery(onChange(models))}> <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>
<Button <Button

View File

@ -1,10 +1,16 @@
.keysFind { .keysFind {
width: 100%; width: 1200px;
display: flex; display: flex;
align-items: center; align-items: center;
.form-label {
height: 80% !important;
}
.form-compontent { .form-compontent {
padding-top: 0px !important; padding-top: 0px !important;
height: 65% !important;
.iptfillself:not(:last-child) { .iptfillself:not(:last-child) {
margin-bottom: 0 !important; margin-bottom: 0 !important;
@ -23,10 +29,13 @@
.form-Item { .form-Item {
width: auto; width: auto;
margin-right: 15px; margin-right: 15px;
margin-bottom: 15px; margin-bottom: 25px;
} }
} }
.button_box {
margin-top: 8px;
}
.zent-datepicker .zent-datepicker-trigger { .zent-datepicker .zent-datepicker-trigger {

View File

@ -52,13 +52,13 @@ const receiveTypeList = [
] ]
const week = [ const week = [
{ key: 'Mon', text: '星期一' }, { key: 'Mon', text: '一' },
{ key: 'Tue', text: '星期二' }, { key: 'Tue', text: '二' },
{ key: 'Wed', text: '星期三' }, { key: 'Wed', text: '三' },
{ key: 'Thu', text: '星期四' }, { key: 'Thu', text: '四' },
{ key: 'Fri', text: '星期五' }, { key: 'Fri', text: '五' },
{ key: 'Sat', text: '星期六' }, { key: 'Sat', text: '六' },
{ key: 'Sun', text: '星期天' } { key: 'Sun', text: '天' }
] ]
// //
const earlyPerList = ['70', '50', '30', '20'] const earlyPerList = ['70', '50', '30', '20']
@ -781,7 +781,7 @@ export default class addKnockGold extends Component {
/> />
</FormItem> </FormItem>
{this.state.model.channel == 1 ? ( {this.state.model.channel == 1 ? (
<FormItem labelname='模板编号' prop='temp_no' id='batch_number'> <FormItem labelname='模板编号' prop='temp_no' id='batch_number'>
<Ipt <Ipt
onChange={(value) => { onChange={(value) => {
this.onHandleChange(value, 'temp_no') this.onHandleChange(value, 'temp_no')
@ -1239,6 +1239,7 @@ export default class addKnockGold extends Component {
style={{ marginLeft: '25px' }}> style={{ marginLeft: '25px' }}>
{week.map((week) => ( {week.map((week) => (
<Checkbox <Checkbox
className='checkbox'
disabled={this.props?.data?.id ? true : false} disabled={this.props?.data?.id ? true : false}
value={week.text} value={week.text}
key={week.key}> key={week.key}>
@ -1261,7 +1262,7 @@ export default class addKnockGold extends Component {
model[index] = value model[index] = value
this.onHandleChange(model, 'ruleDate') this.onHandleChange(model, 'ruleDate')
}} }}
width={158} width={205}
disabledTime={this.onDisabledRange} disabledTime={this.onDisabledRange}
/> />
{this.addOrMoveFunction( {this.addOrMoveFunction(
@ -1291,7 +1292,7 @@ export default class addKnockGold extends Component {
}}> }}>
<Radio value='irregular'>有效期内不规则日期可用</Radio> <Radio value='irregular'>有效期内不规则日期可用</Radio>
</RadioGroup> </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,
this.props?.data?.id ? true : false this.props?.data?.id ? true : false
]} ]}
width={234} width={205}
value={this.state.model.irregularDate[index]} value={this.state.model.irregularDate[index]}
onChange={(value) => { onChange={(value) => {
const model = this.state.model.irregularDate const model = this.state.model.irregularDate
@ -1339,7 +1340,7 @@ export default class addKnockGold extends Component {
model[index] = value model[index] = value
this.onHandleChange(model, 'irregularTime') this.onHandleChange(model, 'irregularTime')
}} }}
width={158} width={205}
disabledTime={this.onDisabledRange} disabledTime={this.onDisabledRange}
/> />
{this.addOrMoveFunction( {this.addOrMoveFunction(

View File

@ -182,6 +182,12 @@
} }
#usable_time { #usable_time {
align-items: flex-start !important;
.form-label {
padding-top: 25px;
}
.form-compontent { .form-compontent {
.boxTime { .boxTime {
display: flex; display: flex;
@ -236,7 +242,7 @@
.move { .move {
margin-left: 25px; margin-left: 25px;
color: #ccc; color: red;
cursor: pointer; cursor: pointer;
} }
} }
@ -336,6 +342,10 @@
} }
} }
.checkbox {
margin-right: 22px !important;
}
.userSelect { .userSelect {
width: 520px; width: 520px;
min-height: 150px; min-height: 150px;

View File

@ -153,7 +153,9 @@ export default class acclist extends React.Component {
getReseller(req.reseller_id).then((res) => { getReseller(req.reseller_id).then((res) => {
handelResponse(res, (req, msg) => { handelResponse(res, (req, msg) => {
this.setState({ reseller: req }) this.setState({ reseller: req })
this.setState({
direct_reseller_id: req.direct_reseller_id
})
this.setState({ phone_list: req.contact_phone }) this.setState({ phone_list: req.contact_phone })
this.setState({ email_list: req.contact_email }) this.setState({ email_list: req.contact_email })
}) })

View File

@ -186,21 +186,19 @@ export default class acclist extends React.Component {
} }
/* 处理可复制数据逻辑 */ /* 处理可复制数据逻辑 */
copyElementFunction({ key_batch_id, status, end_time, keyBatch, id ,title}) { copyElementFunction({ key_batch_id, status, keyBatch, id, title }) {
const today = moment().format('yyyy-MM-DD HH:mm:ss')
let element = '' let element = ''
if ( if (
![-1, 6, 7].includes(status) && ![-1, 6, 7].includes(status) &&
![6, 7].includes(keyBatch?.status) && ![6, 7].includes(keyBatch?.status) &&
end_time > today &&
!keyBatch?.approval_status && !keyBatch?.approval_status &&
keyBatch?.discard === 0 keyBatch?.discard === 0
) { ) {
element = ( element = (
<span <span
className='grid-link' className='grid-link'
style={{ marginLeft: '10px' }} style={{}}
onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch,title)}> onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch, title)}>
复制 复制
</span> </span>
) )
@ -208,7 +206,6 @@ export default class acclist extends React.Component {
element = ( element = (
<span <span
style={{ style={{
marginLeft: '10px',
paddingRight: '10px', paddingRight: '10px',
color: '#d8dbdd' 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('keybatch_id', key_batch_id)
sessionStorage.setItem('copy_code_id', id) sessionStorage.setItem('copy_code_id', id)
sessionStorage.setItem('key_reseller_id', keyBatch.plan.reseller_id) sessionStorage.setItem('key_reseller_id', keyBatch.plan.reseller_id)
@ -585,6 +582,7 @@ export default class acclist extends React.Component {
编辑 编辑
</span> </span>
)} )}
{this.copyElementFunction(rowData)}
{rowData.status != 4 && rowData.status != 5 ? ( {rowData.status != 4 && rowData.status != 5 ? (
<span <span
className='grid-link' className='grid-link'
@ -609,7 +607,6 @@ export default class acclist extends React.Component {
) : ( ) : (
<span style={{ color: '#d8dbdd' }}>撤销审批</span> <span style={{ color: '#d8dbdd' }}>撤销审批</span>
)} )}
{this.copyElementFunction(rowData)}
</div> </div>
) )
} }

View File

@ -180,7 +180,7 @@ export default class acclist extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
planStatus:'',//计划状态 planStatus: '', //计划状态
dataCount: 0, dataCount: 0,
page: 1, page: 1,
limit: 10, limit: 10,
@ -305,8 +305,14 @@ export default class acclist extends React.Component {
handelResponse( handelResponse(
res, res,
(req, msg) => { (req, msg) => {
this.setState({ distdata: req.data }) const newData = req.data.map((item) => {
this.setState({ planStatus: req.plan.status })//计划状态 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 }) this.setState({ dataCount: req.total })
sessionStorage.setItem('key_plan_status', req.plan.status) sessionStorage.setItem('key_plan_status', req.plan.status)
}, },
@ -390,7 +396,7 @@ export default class acclist extends React.Component {
}, },
{ {
path: '/home/exchangecode-add', 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() { bulkSendFunction() {
if (!this.state.gridSelection[0]?.reseller_id) let isNotify = ''
return Notify.warn('请勾选需要批量发送的key批次') 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.getResellerInfoFunction(this.state.gridSelection[0].reseller_id)
this.setState({ isBulkSend: true }) this.setState({ isBulkSend: true })
} }
@ -771,7 +785,10 @@ export default class acclist extends React.Component {
disabled={this.state.disabled}> disabled={this.state.disabled}>
新建key 新建key
</Button> </Button>
<Button type='primary' onClick={() => this.bulkSendFunction()}> <Button
type='primary'
onClick={() => this.bulkSendFunction()}
disabled={!this.state.gridSelection[0]?.reseller_id}>
批量发送 批量发送
</Button> </Button>
</div> </div>
@ -871,11 +888,18 @@ export default class acclist extends React.Component {
str = ( str = (
<span> <span>
<a className='grid-link disabled'>编辑</a> <a className='grid-link disabled'>编辑</a>
{ {[1, 2, 8].includes(rowData.status) ||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):( [2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a> <a className='grid-link disabled'>复制</a>
) ) : (
} <a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span className='grid-link disabled'>撤销审批</span> <span className='grid-link disabled'>撤销审批</span>
@ -898,11 +922,18 @@ export default class acclist extends React.Component {
str = ( str = (
<span> <span>
<a className='grid-link disabled'>编辑</a> <a className='grid-link disabled'>编辑</a>
{ {[1, 2, 8].includes(rowData.status) ||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):( [2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a> <a className='grid-link disabled'>复制</a>
) ) : (
} <a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span <span
className='grid-link' className='grid-link'
onClick={(e) => this.onReCall(e, rowData)}> onClick={(e) => this.onReCall(e, rowData)}>
@ -950,11 +981,18 @@ export default class acclist extends React.Component {
}}> }}>
编辑 编辑
</a> </a>
{ {[1, 2, 8].includes(rowData.status) ||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):( [2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a> <a className='grid-link disabled'>复制</a>
) ) : (
} <a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span className='grid-link disabled'>撤销审批</span> <span className='grid-link disabled'>撤销审批</span>
<Dropdown <Dropdown

View File

@ -25,7 +25,6 @@ import {
keyBatchUsage, keyBatchUsage,
keyBatchCancel, keyBatchCancel,
handelResponse, handelResponse,
getkeyDetailList,
getKeysList, getKeysList,
batchUploadVoid, batchUploadVoid,
batchUploadUsed, batchUploadUsed,
@ -104,7 +103,7 @@ export default class acclist extends React.Component {
} }
componentDidMount(e) { componentDidMount(e) {
this.iptsureFn(); // this.iptsureFn();
} }
componentWillMount() { componentWillMount() {
this.setState({ tableHeight: window.innerHeight - 430 }); this.setState({ tableHeight: window.innerHeight - 430 });
@ -628,6 +627,7 @@ export default class acclist extends React.Component {
pageChange={(e) => { pageChange={(e) => {
this.onPageChange(e); this.onPageChange(e);
}} }}
emptyText="查询 请输入【分销商】或【计划名称】或【key】进行查询"
countChange={(e) => { countChange={(e) => {
this.onCountChange(e); this.onCountChange(e);
}} }}

View File

@ -311,7 +311,11 @@ export default class adduserinfo extends React.Component{
//获取角色 //获取角色
getRoleFn(){ getRoleFn(){
let _self=this; let _self=this;
getRole().then(res=>{ let data={
page:1,
limit:1000
}
getRole(data).then(res=>{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
let roleList=response.data.map(item=>{ let roleList=response.data.map(item=>{

Binary file not shown.