💪 optimize: 优化订单列表代码

This commit is contained in:
wangsongsole 2024-01-26 16:55:16 +08:00
parent 4701409bc9
commit a92f045408
1 changed files with 13 additions and 24 deletions

View File

@ -5,9 +5,9 @@ import {
handlerRefund, handlerRefund,
putOrderCancel, putOrderCancel,
putOrderSuccess, putOrderSuccess,
receiveRetry,
refund, refund,
resendCardCode, resendCardCode
receiveRetry
} from "@/assets/api.js" } from "@/assets/api.js"
import "@/assets/comm.css" import "@/assets/comm.css"
import { nowDay, nowMonth } from "@/assets/comm.js" import { nowDay, nowMonth } from "@/assets/comm.js"
@ -35,7 +35,6 @@ export default class orderList extends React.Component {
tabList: [{ title: "订单列表" }], tabList: [{ title: "订单列表" }],
orderList: [], orderList: [],
filterList: filterList, filterList: filterList,
selectiondata: [], selectiondata: [],
menuList: [ menuList: [
{ id: 0, name: "订单状态", check: false }, { id: 0, name: "订单状态", check: false },
@ -110,7 +109,6 @@ export default class orderList extends React.Component {
handelResponse( handelResponse(
res, res,
(response, msg) => { (response, msg) => {
console.log(msg)
Notify.clear() Notify.clear()
Notify.success(msg) Notify.success(msg)
}, },
@ -277,43 +275,36 @@ export default class orderList extends React.Component {
//清空 //清空
clearFn() { clearFn() {
this.setState({ selectiondata: [] }) this.setState({ allcheck: false, selectiondata: [], itemcheck: false })
this.setState({ allcheck: false })
this.setState({ itemcheck: false })
} }
//选择时间 //选择时间
onChangeCombinedDate(e) { onChangeCombinedDate(e) {
this.setState({ combinedValue: e, page: 1, limit: 10, selectiondata: [] }) this.setState({ combinedValue: e, page: 1, limit: 10, selectiondata: [] }, () => {
setTimeout(() => {
this.getOrderFn() this.getOrderFn()
}, 0) })
} }
//page //page
pageChange(e) { pageChange(e) {
this.setState({ page: e }) this.setState({ selectiondata: [], page: e }, () => {
this.setState({ selectiondata: [] })
setTimeout(() => {
this.getOrderFn() this.getOrderFn()
}, 0) })
} }
//limit //limit
countChange(e) { countChange(e) {
this.setState({ page: 1, limit: e }) this.setState({})
this.setState({ selectiondata: [] }) this.setState({ selectiondata: [], page: 1, limit: e }, () => {
setTimeout(() => {
this.getOrderFn() this.getOrderFn()
}, 0) })
} }
//敲回车查询 //敲回车查询
sureFn() { sureFn() {
this.setState({ page: 1 }) this.setState({ page: 1 }, () => {
setTimeout(() => {
this.getOrderFn() this.getOrderFn()
}, 300) })
} }
//!提取动态删除核销状态条件 //!提取动态删除核销状态条件
@ -396,9 +387,8 @@ 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"]
this.setState({ combinedValue: datetime })
this.getOrderFn(datetime) this.getOrderFn(datetime)
this.setState({ tableHeight: window.innerHeight - 430 }) this.setState({ tableHeight: window.innerHeight - 430, combinedValue: datetime })
} }
//!状态筛选 //!状态筛选
@ -427,7 +417,6 @@ export default class orderList extends React.Component {
//! 1:直冲 2:立减金 3:红包 //! 1:直冲 2:立减金 3:红包
if (e.length && prop === "status") { if (e.length && prop === "status") {
console.log(e)
e.map((item, index) => { e.map((item, index) => {
if ([6, 7, 8, 9].includes(item)) { if ([6, 7, 8, 9].includes(item)) {
orderType.push(3) orderType.push(3)