feat: 订单列表新增持久化

This commit is contained in:
wangsongsole 2024-04-08 11:45:22 +08:00
parent 01806e0aa4
commit 7cce4aae69
2 changed files with 25 additions and 1 deletions

View File

@ -23,6 +23,7 @@ export default class topNav extends React.Component {
} }
//点击一级菜单 //点击一级菜单
showlinkmenu(e, item) { showlinkmenu(e, item) {
sessionStorage.setItem("previousPath", window.location.hash.replace("#", "").split("?")[0])
let self = this let self = this
try { try {
item.children.forEach((it) => { item.children.forEach((it) => {
@ -53,6 +54,7 @@ export default class topNav extends React.Component {
Bus.emit("closeMask", false) //中介传参,关闭弹出框 Bus.emit("closeMask", false) //中介传参,关闭弹出框
} }
btnfn(item2) { btnfn(item2) {
sessionStorage.setItem("previousPath", window.location.hash.replace("#", "").split("?")[0])
this.setState({ pathname2: item2.router }) this.setState({ pathname2: item2.router })
this.setState({ showflag: true }) this.setState({ showflag: true })
sessionStorage.setItem("showflag", true) sessionStorage.setItem("showflag", true)
@ -60,6 +62,7 @@ export default class topNav extends React.Component {
} }
//返回 //返回
backFn(items) { backFn(items) {
sessionStorage.setItem("previousPath", window.location.hash.replace("#", "").split("?")[0])
this.setState({ pathname2: items.router }) this.setState({ pathname2: items.router })
sessionStorage.setItem("showflag", true) sessionStorage.setItem("showflag", true)
sessionStorage.setItem("pathname2", items.router) sessionStorage.setItem("pathname2", items.router)

View File

@ -432,6 +432,20 @@ export default class orderList extends React.Component {
product_id: product_id ? product_id.key : "", product_id: product_id ? product_id.key : "",
reseller_id: reseller_id ? reseller_id.key : "" reseller_id: reseller_id ? reseller_id.key : ""
} }
sessionStorage.setItem(
"state",
JSON.stringify({
page,
limit,
status,
option,
key_word,
orderType,
pay_status,
voucher_status,
search
})
)
if (orderType) { if (orderType) {
//区分立减金和商品 //区分立减金和商品
data.type = orderType data.type = orderType
@ -479,7 +493,14 @@ export default class orderList extends React.Component {
componentWillMount() { componentWillMount() {
let datetime = [tomonth + " " + "00:00:00", day + " " + "23:59:59"] let datetime = [tomonth + " " + "00:00:00", day + " " + "23:59:59"]
if (sessionStorage.getItem("previousPath") === "/home/order-addetails") {
const state = JSON.parse(sessionStorage.getItem("state"))
this.setState({ ...state }, () => {
this.getOrderFn(datetime) this.getOrderFn(datetime)
})
} else {
this.getOrderFn(datetime)
}
this.getPlan() this.getPlan()
this.setState({ tableHeight: window.innerHeight - 490, combinedValue: datetime }) this.setState({ tableHeight: window.innerHeight - 490, combinedValue: datetime })
} }