Merge branch 'master' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend
This commit is contained in:
commit
395676167e
|
@ -11,7 +11,29 @@ const upload = (method, url, params, responseType) => {
|
||||||
return res.json()
|
return res.json()
|
||||||
} );
|
} );
|
||||||
return http.then(response => response).catch(error => console.error('Error:', error));
|
return http.then(response => response).catch(error => console.error('Error:', error));
|
||||||
|
}
|
||||||
|
|
||||||
|
const derive = (method, url, params, responseType) => {
|
||||||
|
var obj = {
|
||||||
|
responseType: 'blob'
|
||||||
|
};
|
||||||
|
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('&')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let http = fetch(url, obj).then(res =>{
|
||||||
|
window.timeshow=res.headers.get('Date-Time');
|
||||||
|
return res.json()
|
||||||
|
} );
|
||||||
|
return http.then(response => response).catch(error => console.error('Error:', error));
|
||||||
}
|
}
|
||||||
|
|
||||||
const req = (method, url, params, responseType) => {
|
const req = (method, url, params, responseType) => {
|
||||||
|
@ -226,13 +248,16 @@ export const getOrderDetails = (id) => {
|
||||||
}
|
}
|
||||||
//订单导出
|
//订单导出
|
||||||
export const getOrderExport = (params) => {
|
export const getOrderExport = (params) => {
|
||||||
return req('get', baseurl + "/order/export",params)
|
return derive('get', baseurl + "/order/export",params)
|
||||||
}
|
}
|
||||||
//订单改为成功
|
//订单改为成功
|
||||||
export const putOrderSuccess = (id) => {
|
export const putOrderSuccess = (id) => {
|
||||||
return req('put', baseurl + "/order/success/"+id)
|
return req('put', baseurl + "/order/success/"+id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//订单作废
|
//订单作废
|
||||||
export const putOrderCancel = (id) => {
|
export const putOrderCancel = (id) => {
|
||||||
return req('put', baseurl + "/order/cancel/"+id)
|
return req('put', baseurl + "/order/cancel/"+id)
|
||||||
|
|
|
@ -3,4 +3,30 @@ export const getQueryString=(name)=>{
|
||||||
var r = window.location.search.substr(1).match(reg);
|
var r = window.location.search.substr(1).match(reg);
|
||||||
if (r != null) return unescape(r[2]);
|
if (r != null) return unescape(r[2]);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 前30天的时间段
|
||||||
|
export const nowMonth = () => {
|
||||||
|
const end = new Date();
|
||||||
|
const start = new Date();
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||||
|
return start
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前的时间段
|
||||||
|
export const nowDay = () => {
|
||||||
|
const end = new Date();
|
||||||
|
return end
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 补0操作
|
||||||
|
function buling (num) {
|
||||||
|
if (num < 10) {
|
||||||
|
return '0' + num
|
||||||
|
} else {
|
||||||
|
return num
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ import Grid from "../../../components/gird/main.js"
|
||||||
import TabPage from "../../../components/tabPage/main.js"
|
import TabPage from "../../../components/tabPage/main.js"
|
||||||
import Filterbar from "../../../components/filterbar/main.js"
|
import Filterbar from "../../../components/filterbar/main.js"
|
||||||
import menu from "../../../assets/enum.js"
|
import menu from "../../../assets/enum.js"
|
||||||
import {getOrderList,handelResponse,getOrderExport,putOrderSuccess,putOrderCancel} from "../../../assets/api.js"
|
import { nowMonth, nowDay } from "../../../assets/comm.js";
|
||||||
|
import {getOrderList,handelResponse,putOrderSuccess,putOrderCancel} from "../../../assets/api.js"
|
||||||
|
// var moment = require("moment");
|
||||||
|
// let day = moment(nowDay()).format("YYYY-MM-DD");
|
||||||
|
// let tomonth = moment(nowMonth()).format("YYYY-MM-DD");
|
||||||
const Column = [
|
const Column = [
|
||||||
{
|
{
|
||||||
title: '订单号',
|
title: '订单号',
|
||||||
|
@ -205,15 +209,11 @@ export default class orderlist extends React.Component{
|
||||||
title:'确认操作',
|
title:'确认操作',
|
||||||
content: <p>是否导出订单?</p>,
|
content: <p>是否导出订单?</p>,
|
||||||
onConfirm(){
|
onConfirm(){
|
||||||
getOrderExport(data).then(res=>{
|
if(data.key_word){
|
||||||
handelResponse(res,(response,msg)=>{
|
window.location.href=window.baseurl+'/order/export?page='+data.page+'&limit='+data.limit+'&key_word='+data.key_word;
|
||||||
Notify.clear();
|
}else{
|
||||||
Notify.success(msg);
|
window.location.href=window.baseurl+'/order/export?page='+data.page+'&limit='+data.limit;
|
||||||
},(err)=>{
|
}
|
||||||
|
|
||||||
})
|
|
||||||
}).catch(err=>{
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onCancel(){
|
onCancel(){
|
||||||
console.log('点击了取消按钮');
|
console.log('点击了取消按钮');
|
||||||
|
@ -308,6 +308,23 @@ export default class orderlist extends React.Component{
|
||||||
this.setState({allcheck:false})
|
this.setState({allcheck:false})
|
||||||
this.setState({itemcheck:false})
|
this.setState({itemcheck:false})
|
||||||
}
|
}
|
||||||
|
//获取当前时间
|
||||||
|
getnow() {
|
||||||
|
var now = new Date();
|
||||||
|
var year = now.getFullYear();
|
||||||
|
var month =
|
||||||
|
now.getMonth() + 1 <= 9
|
||||||
|
? "0" + (now.getMonth() + 1)
|
||||||
|
: now.getMonth() + 1;
|
||||||
|
var day = now.getDate() <= 9 ? "0" + now.getDate() : now.getDate();
|
||||||
|
var tt = now.getHours() <= 9 ? "0" + now.getHours() : now.getHours();
|
||||||
|
var mm =
|
||||||
|
now.getMinutes() <= 9 ? "0" + now.getMinutes() : now.getMinutes();
|
||||||
|
var ss =
|
||||||
|
now.getSeconds() <= 9 ? "0" + now.getSeconds() : now.getSeconds();
|
||||||
|
let datelist = [year, month, day, tt, mm, ss];
|
||||||
|
return datelist.join("");
|
||||||
|
}
|
||||||
//选择时间
|
//选择时间
|
||||||
onChangeCombinedDate(e){
|
onChangeCombinedDate(e){
|
||||||
this.setState({combinedValue:e});
|
this.setState({combinedValue:e});
|
||||||
|
@ -369,6 +386,11 @@ export default class orderlist extends React.Component{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
componentWillMount(){
|
componentWillMount(){
|
||||||
|
// let datetime = [
|
||||||
|
// tomonth + " " + "00:00:00",
|
||||||
|
// day + " " + "23:59:59"
|
||||||
|
// ];
|
||||||
|
// this.setState({combinedValue:datetime});
|
||||||
this.getOrderFn();
|
this.getOrderFn();
|
||||||
}
|
}
|
||||||
// 监听组件内部状态的变化:
|
// 监听组件内部状态的变化:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Card,Button,Notify,Sweetalert} from 'zent';
|
import { Card,Button,Notify,Sweetalert,RadioGroup,RadioButton} from 'zent';
|
||||||
import "./add.less"
|
import "./add.less"
|
||||||
import "../../../../assets/comm.css"
|
import "../../../../assets/comm.css"
|
||||||
import Ipt from "../../../../components/input/main"
|
import Ipt from "../../../../components/input/main"
|
||||||
|
@ -14,6 +14,7 @@ export default class addrole extends React.Component{
|
||||||
this.state={
|
this.state={
|
||||||
model:{
|
model:{
|
||||||
role:'',
|
role:'',
|
||||||
|
account_type:5,
|
||||||
setrole:[],
|
setrole:[],
|
||||||
pagetitle:'新建角色',
|
pagetitle:'新建角色',
|
||||||
},
|
},
|
||||||
|
@ -28,7 +29,6 @@ export default class addrole extends React.Component{
|
||||||
title:'确认操作',
|
title:'确认操作',
|
||||||
content: <p>是否取消本次操作?</p>,
|
content: <p>是否取消本次操作?</p>,
|
||||||
onConfirm:()=>{
|
onConfirm:()=>{
|
||||||
console.log(window);
|
|
||||||
window.history.go(-1)
|
window.history.go(-1)
|
||||||
sessionStorage.setItem('pathname2','/home/system/role-list')
|
sessionStorage.setItem('pathname2','/home/system/role-list')
|
||||||
},
|
},
|
||||||
|
@ -38,11 +38,18 @@ export default class addrole extends React.Component{
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
authchange=e=>{
|
||||||
|
let model1=this.state.model;
|
||||||
|
model1.account_type=e.target.value;
|
||||||
|
this.setState({ model: model1 });
|
||||||
|
}
|
||||||
|
|
||||||
submit(){
|
submit(){
|
||||||
let roleFlag=this.refs.roleform.validator();
|
let roleFlag=this.refs.roleform.validator();
|
||||||
let self=this;
|
let self=this;
|
||||||
|
console.log(this.refs.roletree.state);
|
||||||
if(this.refs.roletree.state.checkedKeys.length<1){
|
if(!this.refs.roletree.state.checkedKeys){
|
||||||
|
Notify.clear();
|
||||||
Notify.error('请至少选中一个模块权限')
|
Notify.error('请至少选中一个模块权限')
|
||||||
}else{
|
}else{
|
||||||
if(roleFlag){
|
if(roleFlag){
|
||||||
|
@ -53,7 +60,8 @@ export default class addrole extends React.Component{
|
||||||
content: self.state.enumer==0?(<p>是否新增<b>[{self.state.model.role}]</b>角色?</p>):(<p>是否修改当前角色信息?</p>),
|
content: self.state.enumer==0?(<p>是否新增<b>[{self.state.model.role}]</b>角色?</p>):(<p>是否修改当前角色信息?</p>),
|
||||||
onConfirm:()=>{
|
onConfirm:()=>{
|
||||||
let data={role_name:self.state.model.role,
|
let data={role_name:self.state.model.role,
|
||||||
menu_id:this.refs.roletree.state.checkedKeys
|
menu_id:this.refs.roletree.state.checkedKeys,
|
||||||
|
account_type:self.state.model.account_type
|
||||||
}
|
}
|
||||||
if(self.state.enumer==0){
|
if(self.state.enumer==0){
|
||||||
postRole(data).then(res=>{
|
postRole(data).then(res=>{
|
||||||
|
@ -99,6 +107,7 @@ export default class addrole extends React.Component{
|
||||||
let menuList=JSON.parse(sessionStorage.getItem('dataInfo'));
|
let menuList=JSON.parse(sessionStorage.getItem('dataInfo'));
|
||||||
let model={};
|
let model={};
|
||||||
model.role=menuList.role_name;
|
model.role=menuList.role_name;
|
||||||
|
model.account_type=menuList.account_type;
|
||||||
this.setState({menuList,model});
|
this.setState({menuList,model});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +115,7 @@ export default class addrole extends React.Component{
|
||||||
const rules = {
|
const rules = {
|
||||||
role: [
|
role: [
|
||||||
{ type: "required", message: "请输入角色名"}
|
{ type: "required", message: "请输入角色名"}
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
return(
|
return(
|
||||||
<div id="addrole" className="maincenter">
|
<div id="addrole" className="maincenter">
|
||||||
|
@ -127,6 +136,12 @@ export default class addrole extends React.Component{
|
||||||
}}
|
}}
|
||||||
value={this.state.model.role} placeholder={"请输入角色"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'520px'} alignment={'left'}/>
|
value={this.state.model.role} placeholder={"请输入角色"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'520px'} alignment={'left'}/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem labelname="数据权限分组" >
|
||||||
|
<RadioGroup onChange={this.authchange} value={this.state.model.account_type}>
|
||||||
|
<RadioButton value={1} >管理员</RadioButton>
|
||||||
|
<RadioButton value={5} >普通账号</RadioButton>
|
||||||
|
</RadioGroup>
|
||||||
|
</FormItem>
|
||||||
<FormItem labelname="设置权限" prop="setrole" id="setrole">
|
<FormItem labelname="设置权限" prop="setrole" id="setrole">
|
||||||
<Tree ref="roletree" rules={this.state.menuList.rule_id}/>
|
<Tree ref="roletree" rules={this.state.menuList.rule_id}/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
Loading…
Reference in New Issue