This commit is contained in:
zhangds 2022-11-01 17:24:19 +08:00
commit d58dd8e6a8
2 changed files with 235 additions and 213 deletions

View File

@ -765,11 +765,6 @@ export default class orderlist extends React.Component {
) : null}
{rowData.status == 3 && rowData.pay_status == 2 ? (
<>
<span
className='grid-link'
onClick={(e) => this.changeSuccessFn(e, rowData)}>
改为成功
</span>
<span
className='grid-link'
onClick={() =>

View File

@ -1,151 +1,167 @@
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import ReactDOM from "react-dom"
import React, { Component } from "react"
import { HashRouter as Router, Route, Link } from "react-router-dom"
import "../../../assets/comm.css"
import {getQueryString} from "../../../assets/comm.js"
import { getQueryString } from "../../../assets/comm.js"
import "./more.less"
import {Notify,Pop} from "zent"
import { Notify, Pop } from "zent"
import TabPage from "../../../components/tabPage/main.js"
import Grid from "../../../components/gird/main.js"
import {getOrderDetails,handelResponse,getOrderLog} from "../../../assets/api.js"
import ReactJson from 'react-json-view'
import {
getOrderDetails,
handelResponse,
getOrderLog
} from "../../../assets/api.js"
import ReactJson from "react-json-view"
import moment from "moment"
const Column = [
{
title: '创建时间',
name: 'time',
prop:'time',
title: "创建时间",
name: "time",
prop: "time",
type: "slot",
width:'20%'
},{
title: '操作描述',
name: 'message',
prop:'message',
width: "20%"
},
{
title: "操作描述",
name: "message",
prop: "message",
type: "normal",
width:'20%'
width: "20%"
},
{
title: '详情',
name: 'opearo',
title: "详情",
name: "opearo",
type: "slot",
prop:'opearo',
width:'50%'
prop: "opearo",
width: "50%"
}
];
]
export default class order extends React.Component{
constructor(props){
export default class order extends React.Component {
constructor(props) {
super(props)
this.state={
tabList:[{title:"详情"},{title:"日志"}],
tabactive:0,
orderDetailLog_data:[],
orderDetail_data:{},
tableHeight:500,
page:1,
orderNo:'',
limit:10,
total:0,
this.state = {
tabList: [{ title: "详情" }, { title: "日志" }],
tabactive: 0,
orderDetailLog_data: [],
orderDetail_data: {},
tableHeight: 500,
page: 1,
orderNo: "",
limit: 10,
total: 0
}
}
tabFn(index){
this.setState({tabactive:index});
let activerou=[];
if(index==0){
activerou=[{items:[
tabFn(index) {
this.setState({ tabactive: index })
let activerou = []
if (index == 0) {
activerou = [
{
"path": "/order-list",
"name": "订单管理"
items: [
{
path: "/order-list",
name: "订单管理"
},
{
"path": "/order-addetails",
"name": "订单详情"
path: "/order-addetails",
name: "订单详情"
}
]}]
}else{
activerou=[{items:[
]
}
]
} else {
activerou = [
{
"path": "/order-list",
"name": "订单管理"
items: [
{
path: "/order-list",
name: "订单管理"
},
{
"path": "/order-addetails",
"name": "订单日志"
path: "/order-addetails",
name: "订单日志"
}
]}]
]
}
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
this.getOrderLogFn();
]
}
selection(){
sessionStorage.setItem("breaknav", JSON.stringify(activerou))
this.getOrderLogFn()
}
selection() {}
//获取订单日志
getOrderLogFn(){
let _self=this;
let {page,limit,orderNo}=this.state;
let data={
getOrderLogFn() {
let _self = this
let { page, limit, orderNo } = this.state
let data = {
page,
limit
}
getOrderLog(orderNo,data).then(res=>{
handelResponse(res,(response,msg)=>{
const orderDetailLog_data=response.data;
_self.setState({orderDetailLog_data,total:response.total});
},(err)=>{
getOrderLog(orderNo, data)
.then((res) => {
handelResponse(
res,
(response, msg) => {
const orderDetailLog_data = response.data
_self.setState({ orderDetailLog_data, total: response.total })
},
(err) => {
Notify.error(err)
}
)
})
}).catch(err=>{
});
.catch((err) => {})
}
//获取详情信息
getDetails(data){
let _self=this;
getOrderDetails(data).then(res=>{
handelResponse(res,(response,msg)=>{
const orderDetail_data=response;
_self.setState({orderDetail_data});
},(err)=>{
getDetails(data) {
let _self = this
getOrderDetails(data)
.then((res) => {
handelResponse(
res,
(response, msg) => {
console.log(response)
_self.setState({ orderDetail_data: response })
},
(err) => {
Notify.error(err)
}
)
})
}).catch(err=>{
});
.catch((err) => {})
}
//page
pageChange(e){
this.setState({page:e});
pageChange(e) {
this.setState({ page: e })
setTimeout(() => {
this.getOrderLogFn();
}, 0);
this.getOrderLogFn()
}, 0)
}
//limit
countChange(e){
this.setState({page:1,limit:e});
countChange(e) {
this.setState({ page: 1, limit: e })
setTimeout(() => {
this.getOrderLogFn();
}, 0);
this.getOrderLogFn()
}, 0)
}
componentWillMount(){
let href=window.location.href;
let strindex = href.lastIndexOf("\=");
let orderNo = href.substr(strindex + 1, href.length);
this.setState({orderNo});
this.getDetails(orderNo);
this.setState({tableHeight:window.innerHeight-430});
componentWillMount() {
let href = window.location.href
let strindex = href.lastIndexOf("=")
let orderNo = href.substr(strindex + 1, href.length)
this.setState({ orderNo })
this.getDetails(orderNo)
this.setState({ tableHeight: window.innerHeight - 430 })
}
render(){
let orderDetail_data=this.state.orderDetail_data;
return(
<div id="more" className="maincenter">
render() {
let orderDetail_data = this.state.orderDetail_data
return (
<div id='more' className='maincenter'>
<TabPage tabs={this.state.tabList} tabChange={this.tabFn.bind(this)}>
{
this.state.tabactive==0?( <ul className="main-body">
{this.state.tabactive == 0 ? (
<ul className='main-body'>
<li>
<span>订单号</span>
<font>{orderDetail_data.order_number}</font>
@ -180,61 +196,72 @@ export default class order extends React.Component{
</li>
<li>
<span>总计</span>
<font>{(orderDetail_data.num*orderDetail_data.contract_price).toFixed(4)}</font>
<font>
{(
orderDetail_data.num * orderDetail_data.contract_price
).toFixed(4)}
</font>
</li>
{orderDetail_data.product?.product_type === 1 ? (
<li>
<span>充值账号</span>
<font>{orderDetail_data.account}</font>
</li>
) : null}
<li>
<span>状态</span>
<font>{orderDetail_data.status_text}</font>
</li>
</ul>):(
<div className="main-body">
</ul>
) : (
<div className='main-body'>
<Grid
spliteColor={'#fff'}
spliteColor={"#fff"}
tableData={this.state.orderDetailLog_data}
Column={Column}
isMultiple={false}
maxheight={this.state.tableHeight}
dataCount={this.state.total}
countChange={
(e)=>{
countChange={(e) => {
this.countChange(e)
}
}
}}
countbarVisible={false}
isSwitch={false}
pageChange={(e)=>{
pageChange={(e) => {
this.pageChange(e)
}}
checkChange ={this.selection.bind(this)}
ComponentHandler={(com,rowData)=>{
if(com == "time")
{
return <div>{moment.unix(rowData.time).format("YYYY-MM-DD HH:mm:ss")}</div>
}
if(com == "opearo")
{
return <div>
{
rowData.data? <ReactJson collapsed={true} name={false} src={rowData.data} displayDataTypes={false}/>:<span>-</span>
}
</div>
}
}}
/>
checkChange={this.selection.bind(this)}
ComponentHandler={(com, rowData) => {
if (com == "time") {
return (
<div>
{moment
.unix(rowData.time)
.format("YYYY-MM-DD HH:mm:ss")}
</div>
)
}
if (com == "opearo") {
return (
<div>
{rowData.data ? (
<ReactJson
collapsed={true}
name={false}
src={rowData.data}
displayDataTypes={false}
/>
) : (
<span>-</span>
)}
</div>
)
}
}}
/>
</div>
)}
</TabPage>
</div>
)