对接字段

This commit is contained in:
wangsongsole 2022-07-28 14:50:02 +08:00
parent ef95bf21fc
commit 6f5defa911
3 changed files with 42 additions and 66 deletions

View File

@ -866,4 +866,9 @@ export const addFund = (data, id) => {
return req('post', baseurl + `/codes/voucher/fund/${id}`, data)
}
// key列表
export const getKeysList = (data) => {
return req('post', baseurl + '/key', data)
}
export { req }

View File

@ -2,18 +2,17 @@
* @Author: Wind
* @Date: 2022-07-25 10:53:41
* @LastEditors: Wind
* @LastEditTime: 2022-07-28 11:26:12
* @LastEditTime: 2022-07-28 14:43:42
* @Description:key列表查询组件
* @FilePath: \frontend\src\components\keysFind\index.jsx
*/
import './index.less'
import { useEffect, useState } from 'react'
import { Button, Notify, Select, DateRangePicker } from 'zent'
import { useState } from 'react'
import { Button, Select, DateRangePicker } 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 } from '../../assets/api'
const stateList = [
{ key: 1, text: '全部' },
@ -33,36 +32,15 @@ function init() {
}
export default ({ onQuery }) => {
const [reseller_option, setReseller_option] = useState([])
const [models, setModels] = useState(init())
useEffect(() => {
getReSellerOption().then((res) => {
handelResponse(
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
})
setReseller_option(arr)
},
(err) => {
Notify.error(err)
}
)
})
}, [])
function onChange(data) {
return {
date: data.date.length || null,
reseller: data.reseller?.key,
plan: data.plan?.key,
state: data.state?.key,
begin_time: data.date[0] || null,
end_time: data.date[1] || null,
reseller_name: data.reseller?.text,
plan_name: data.plan?.text,
status: data.state?.key,
key: data.key || null
}
}
@ -79,30 +57,6 @@ export default ({ onQuery }) => {
onChange={(va) => setModels({ ...models, date: va })}
/>
</FormItem>
<FormItem labelname='分销商:' required='' labelwidth='70px'>
<Select
options={reseller_option}
value={models.reseller}
placeholder='请选择'
width={204}
clearable
onChange={(va) => setModels({ ...models, reseller: va })}
/>
</FormItem>
<FormItem labelname='计划名称:' required='' labelwidth='90px'>
<Select
options={[
{ key: 1, text: '普通用户' },
{ key: 2, text: '高级用户' }
]}
value={models.plan}
placeholder='请选择'
clearable
width={204}
onChange={(va) => setModels({ ...models, plan: va })}
/>
</FormItem>
<FormItem labelname='状态:' required='' labelwidth='50px'>
<Select
name='state'
@ -114,6 +68,27 @@ export default ({ onQuery }) => {
onChange={(va) => setModels({ ...models, state: va })}
/>
</FormItem>
<FormItem labelname='分销商:' required='' labelwidth='70px'>
<Ipt
value={models.reseller}
countShow={false}
labelWidth='0px'
placeholder='请输入'
width={204}
onChange={(va) => setModels({ ...models, key: va })}
/>
</FormItem>
<FormItem labelname='计划名称:' required='' labelwidth='90px'>
<Ipt
value={models.plan}
countShow={false}
labelWidth='0px'
placeholder='请输入'
width={204}
onChange={(va) => setModels({ ...models, key: va })}
/>
</FormItem>
<FormItem labelname='KEY' required='' labelwidth='50px'>
<Ipt
value={models.key}

View File

@ -25,7 +25,7 @@ import {
keyBatchUsage,
keyBatchCancel,
handelResponse,
getkeyDetailList
getKeysList
} from '@/assets/api.js'
import _ from 'lodash'
import menu from '@/assets/enum.js'
@ -95,7 +95,9 @@ export default class acclist extends React.Component {
}, 0)
}
componentDidMount(e) {}
componentDidMount(e) {
this.iptsureFn()
}
componentWillMount() {
this.setState({ tableHeight: window.innerHeight - 430 })
}
@ -107,10 +109,8 @@ export default class acclist extends React.Component {
return _.isNaN(value) || _.isNil(value)
}
)
console.log(queryParams)
let id = sessionStorage.getItem('key_batch_id')
getkeyDetailList(id, queryParams).then((res) => {
getKeysList(queryParams).then((res) => {
handelResponse(
res,
(req, msg) => {
@ -130,10 +130,8 @@ export default class acclist extends React.Component {
getpageFn() {
let data = {
page: this.state.page,
limit: this.state.limit,
key: this.state.key
limit: this.state.limit
}
console.log(155, this.state.status)
let status = this.state.status > 0 ? this.state.status : null
if (status) {
data.status = status
@ -196,8 +194,7 @@ export default class acclist extends React.Component {
this.setState({ limit: 10 })
let data = {
page: 1,
limit: 10,
key: this.state.search
limit: 10
}
if (status) {
data.status = status
@ -216,8 +213,7 @@ export default class acclist extends React.Component {
let params = {
page: 1,
limit: 10,
key: this.state.search
limit: 10
}
this.getKeyCodeList(params)
}