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} ) : null}
{rowData.status == 3 && rowData.pay_status == 2 ? ( {rowData.status == 3 && rowData.pay_status == 2 ? (
<> <>
<span
className='grid-link'
onClick={(e) => this.changeSuccessFn(e, rowData)}>
改为成功
</span>
<span <span
className='grid-link' className='grid-link'
onClick={() => onClick={() =>

View File

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