This commit is contained in:
zhangds 2022-07-28 16:12:18 +08:00
commit ceee9c8235
4 changed files with 41 additions and 83 deletions

View File

@ -866,19 +866,9 @@ export const addFund = (data, id) => {
return req("post", baseurl + `/codes/voucher/fund/${id}`, data); return req("post", baseurl + `/codes/voucher/fund/${id}`, data);
}; };
// 批量上传查询 // key列表
export const bachUploadQuery = (file) => { export const getKeysList = (data) => {
return upload("post", baseurl + "/key/import?type=1", file); return req("post", baseurl + "/key", data);
};
// 批量上传作废
export const bachUploadVoid = (file) => {
return upload("post", baseurl + "/key/batchUploadVoid", file);
};
// 批量上传使用
export const bachUploadUse = (file) => {
return upload("post", baseurl + "/key/batchUploadUsed", file);
}; };
export const bachUploadAll = (url, file) => { export const bachUploadAll = (url, file) => {

View File

@ -94,13 +94,9 @@ const UseUploadExcel = (props) => {
return; return;
} }
} else { } else {
handelResponse( console.log("res =>", res);
res, Notify.error(res.message);
(req, msg) => { setFilesTip(0);
Notify.error(msg);
},
(err) => {}
);
} }
}); });
}; };

View File

@ -2,18 +2,17 @@
* @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 11:26:12 * @LastEditTime: 2022-07-28 14:43:42
* @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 { useEffect, useState } from 'react' import { useState } from 'react'
import { Button, Notify, Select, DateRangePicker } from 'zent' import { Button, Select, DateRangePicker } 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 } from '../../assets/api'
const stateList = [ const stateList = [
{ key: 1, text: '全部' }, { key: 1, text: '全部' },
@ -33,36 +32,15 @@ function init() {
} }
export default ({ onQuery }) => { export default ({ onQuery }) => {
const [reseller_option, setReseller_option] = useState([])
const [models, setModels] = useState(init()) 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) { function onChange(data) {
return { return {
date: data.date.length || null, begin_time: data.date[0] || null,
reseller: data.reseller?.key, end_time: data.date[1] || null,
plan: data.plan?.key, reseller_name: data.reseller?.text,
state: data.state?.key, plan_name: data.plan?.text,
status: data.state?.key,
key: data.key || null key: data.key || null
} }
} }
@ -79,30 +57,6 @@ export default ({ onQuery }) => {
onChange={(va) => setModels({ ...models, date: va })} onChange={(va) => setModels({ ...models, date: va })}
/> />
</FormItem> </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'> <FormItem labelname='状态:' required='' labelwidth='50px'>
<Select <Select
name='state' name='state'
@ -114,6 +68,27 @@ export default ({ onQuery }) => {
onChange={(va) => setModels({ ...models, state: va })} onChange={(va) => setModels({ ...models, state: va })}
/> />
</FormItem> </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'> <FormItem labelname='KEY' required='' labelwidth='50px'>
<Ipt <Ipt
value={models.key} value={models.key}

View File

@ -26,6 +26,7 @@ import {
keyBatchCancel, keyBatchCancel,
handelResponse, handelResponse,
getkeyDetailList, getkeyDetailList,
getKeysList,
} from "@/assets/api.js"; } from "@/assets/api.js";
import _ from "lodash"; import _ from "lodash";
import menu from "@/assets/enum.js"; import menu from "@/assets/enum.js";
@ -96,22 +97,22 @@ export default class acclist extends React.Component {
}, 0); }, 0);
} }
componentDidMount(e) {} componentDidMount(e) {
this.iptsureFn();
}
componentWillMount() { componentWillMount() {
this.setState({ tableHeight: window.innerHeight - 430 }); this.setState({ tableHeight: window.innerHeight - 430 });
} }
getKeyCodeList(data) { getKeyCodeList(data) {
let queryParams = _.omitBy( let queryParams = _.omitBy(
{ ...data, ...this.state.conditionalQuery }, { ...data, ...this.state.conditionalQuery, ...this.state.sha1 },
(value) => { (value) => {
return _.isNaN(value) || _.isNil(value); 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( handelResponse(
res, res,
(req, msg) => { (req, msg) => {
@ -132,9 +133,7 @@ export default class acclist extends React.Component {
let data = { let data = {
page: this.state.page, page: this.state.page,
limit: this.state.limit, limit: this.state.limit,
key: this.state.key,
}; };
console.log(155, this.state.status);
let status = this.state.status > 0 ? this.state.status : null; let status = this.state.status > 0 ? this.state.status : null;
if (status) { if (status) {
data.status = status; data.status = status;
@ -198,7 +197,6 @@ export default class acclist extends React.Component {
let data = { let data = {
page: 1, page: 1,
limit: 10, limit: 10,
key: this.state.search,
}; };
if (status) { if (status) {
data.status = status; data.status = status;
@ -218,7 +216,6 @@ export default class acclist extends React.Component {
let params = { let params = {
page: 1, page: 1,
limit: 10, limit: 10,
key: this.state.search,
}; };
this.getKeyCodeList(params); this.getKeyCodeList(params);
} }