# Conflicts:
#	src/assets/api.js
This commit is contained in:
red-deng-deng 2021-11-17 14:02:30 +08:00
commit a7b21d4d06
6 changed files with 90 additions and 74 deletions

View File

@ -1,80 +1,94 @@
export const baseurl = 'http://market.api.system.com'
// 通用公用方法get和post
const req = (method, url, params, responseType) => {
if(method == "get")
{
var obj = {
method: method,
params: params,
var obj=null;
if (method == "get") {
if (params) {
let paramsArray = [];
//拼接参数
Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key]))
if (url.search(/\?/) === -1) {
url += '?' + paramsArray.join('&')
} else {
url += '&' + paramsArray.join('&')
}
}
}
if(method == "post")
{
var obj = {
if (method == "post") {
obj = {
method: method,
body: params,
body: JSON.stringify(params),
headers: new Headers({
'Content-Type': 'application/json'
'Content-Type': 'application/json'
})
}
}
return fetch(url).then(res => res.json()).catch(error => console.error('Error:', error)).then(response => console.log('Success:', response));
let http = fetch(url,obj).then(res => res.json());
return http.then(response => response.data).catch(error => console.error('Error:', error));
}
//营销计划列表
export const getPlanList = (params) => {
return req('get', baseurl + "/plan", params)
}
//获取分销商下拉菜单
export const getReSellerOption = (params) => {
return req('get', baseurl + "/reseller/choice", params)
}
//新建营销计划
export const getPlanStep = (id,params) => {
return req('get', baseurl + "/plan/step/:"+id, params)
export const getPlanStep = (id, params) => {
return req('get', baseurl + "/plan/step/:" + id, params)
}
//获取营销计划草稿信息
export const getDraftInfo = (id,params) => {
return req('get', baseurl + "/plan/draft/:"+id, params)
export const getDraftInfo = (id, params) => {
return req('get', baseurl + "/plan/draft/:" + id, params)
}
//启用停用 营销计划
export const startOrStopPlan = (id,params) => {
return req('put', baseurl + "/plan/status/:"+id, params)
export const startOrStopPlan = (id, params) => {
return req('put', baseurl + "/plan/status/:" + id, params)
}
//创建key批次信息
export const addKeysBatchInfo = (id,params) => {
return req('post', baseurl + "/plan/:"+id+"/keys", params)
export const addKeysBatchInfo = (id, params) => {
return req('post', baseurl + "/plan/:" + id + "/keys", params)
}
//获取key批次信息
export const getKeysBatchInfo = (id,params) => {
export const getKeysBatchInfo = (id, params) => {
return req('get', baseurl + "/keys", params)
}
//启用停用key批次信息
export const startOrStopKeybatch = (id,params) => {
return req('put', baseurl + "/keys/status/:"+id, params)
export const startOrStopKeybatch = (id, params) => {
return req('put', baseurl + "/keys/status/:" + id, params)
}
//获取key批次详细信息
export const getKeyBatchDetail = (id,params) => {
return req('get', baseurl + "/keys/:"+id, params)
export const getKeyBatchDetail = (id, params) => {
return req('get', baseurl + "/keys/:" + id, params)
}
//更新key批次详细信息
export const putKeyBatchDetail = (id,params) => {
return req('put', baseurl + "/keys/:"+id, params)
export const putKeyBatchDetail = (id, params) => {
return req('put', baseurl + "/keys/:" + id, params)
}
//发送密钥邮件
export const postKeyEmail = (id,params) => {
return req('post', baseurl + "/keys/send/:"+id, params)
export const postKeyEmail = (id, params) => {
return req('post', baseurl + "/keys/send/:" + id, params)
}
//修改密钥邮件
export const putKeyEmail = (id,params) => {
return req('put', baseurl + "/keys/receive/:"+id, params)
export const putKeyEmail = (id, params) => {
return req('put', baseurl + "/keys/receive/:" + id, params)
}

View File

@ -18,6 +18,10 @@
display: flex;
justify-content:flex-start;
}
.dflexajce{
display: flex;
justify-content:flex-end;
}
.dflexac{
display: flex;
align-items: center;

View File

@ -199,7 +199,7 @@ export default class acclist extends React.Component{
}
//获取兑换码列表
getCodeListFn(){
let data={}
let data={key_batch_id:1}
getCodesList(data).then(res=>{
console.log(res);
}).catch(err=>{
@ -222,7 +222,7 @@ componentWillMount(){
return(
<div id="exchangecodelist">
<TabPage slot={date} tabs={this.state.tabList} tabChange={this.tabFn.bind(this)}>
<p className="codetable dflexjs">
<p className="codetable dflexajce">
{/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}>新建兑换码</Button> */}
{/* <Button type="info">批量操作</Button> */}
<Ipt icon="search" placeholder={"请输入关键字进行匹配查询"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>

View File

@ -6,6 +6,7 @@ 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 {getVerify,getReSellerOption} from "../../../assets/api.js"
const TabPanel = Tabs.TabPanel;
export default class acclist extends React.Component{
@ -18,13 +19,23 @@ export default class acclist extends React.Component{
reseller:null,
return_id:"1",
date_time:""
}
},
reseller_option:[]
}
}
componentDidMount(e){
}
getReSellerOption()
{
}
submit(){
if(this.refs.form1.validator())
@ -38,7 +49,6 @@ export default class acclist extends React.Component{
}
onTypeChange(e){
console.log(e.target.value)
let model = this.state.model;
model.type = e.target.value;
this.setState({model:model})
@ -114,13 +124,6 @@ export default class acclist extends React.Component{
} } />
</FormItem>
<FormItem labelname=" 计划充值返回" prop="return_id" id="return_id">
<RadioGroup onChange={this.onChange} value={this.state.model.return_id}>
<RadioButton value="1">直接返回</RadioButton>
<RadioButton value="2">卡单</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="开始~结束时间" prop="date_time" id="date_time">
<CombinedDateRangePicker canClear={false}
className="zent-datepicker-plan"

View File

@ -45,7 +45,15 @@ export default class acclist extends React.Component{
return false;
}
onStyleChange(e){
let model2 = this.state.model;
model2.type = e.target.value;
this.setState({model:model2})
// let model2 = this.state.model
// model2.style = e;
// this.setState({model:model2})
}
render(){
const Column = [
{
@ -116,34 +124,25 @@ export default class acclist extends React.Component{
return(
<div id="step2">
<Form model={this.state.model} rules={rules} ref="form1">
<FormItem labelname=" key样式" prop="style">
<RadioGroup onChange={this.onChange} value={this.state.return_id}>
<FormItem labelname=" key样式" prop="style" id="style">
<RadioGroup onChange={(e)=>{ this.onStyleChange(e)} } value={this.state.model.style}>
<RadioButton value="1">串码</RadioButton>
<RadioButton value="2">链接</RadioButton>
<RadioButton value="3">二维码</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="分销商" prop="reseller">
<Select options={options} placeholder="选择一项" width={515} value={this.state.model.reseller} />
</FormItem>
<FormItem labelname=" key方式" prop="return_id">
<RadioGroup onChange={this.onChange} value={this.state.return_id}>
<RadioButton value="1">指定数量</RadioButton>
<RadioButton value="2">不限</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="key数量" prop="date_time" >
<FormItem labelname="key数量" prop="quantity" id="quantity" >
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.name = e;
model2.quantity = e;
this.setState({model:model2})
}} value={this.state.model.name} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'400px'} alignment={'left'}/>
}} value={this.state.model.quantity} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'400px'} alignment={'left'}/>
<Button className="import-btn" >导入白名单</Button>
</FormItem>
<FormItem labelname="绑定类型" prop="checkedList" >
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object" >
<Checkbox.Group value={this.state.checkedList} onChange={this.onCheckChange}>
<Checkbox value="1">兑换码</Checkbox>
<Checkbox value="2">优惠券</Checkbox>
@ -155,7 +154,7 @@ export default class acclist extends React.Component{
<Button>新建优惠券</Button>
<Button>新建立减金</Button>
</FormItem>
<FormItem labelname="绑定对象">
<FormItem labelname="绑定对象" >
<Grid
headBackgroud="#f9fafc"
isShowPageBar={false}
@ -169,26 +168,21 @@ export default class acclist extends React.Component{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
}}
/>
</FormItem>
<FormItem labelname="重复选择商品">
<FormItem labelname="重复选择商品" id="allow_repetition" prop="allow_repetition">
<RadioGroup onChange={this.onChange} value={this.state.value}>
<RadioButton value="1"></RadioButton>
<RadioButton value="2"></RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="是否合并库存">
<RadioGroup onChange={this.onChange} value={this.state.value}>
<RadioButton value="1"></RadioButton>
<RadioButton value="2"></RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="是否允许亏损">
<FormItem labelname="是否允许亏损" id="allow_loss" prop="allow_loss">
<RadioGroup onChange={this.onChange} value={this.state.value}>
<RadioButton value="1" ></RadioButton>
<RadioButton value="2" ></RadioButton>

View File

@ -33,12 +33,13 @@ export default class acclist extends React.Component{
}
//分页
onPageChange(e){
this.setState({distdata:[]})
}
componentDidMount(e){
getPlanList((res)=>{
console.log(res)
})
getPlanList().then((res)=>{
console.log(res)
}).catch(()=>{})
}
//切换siwtch
onSwitchChange(status,row){