import{r as e,j as l,s,o as a}from"./app-eaa32a4a.js";import{x as t,c as i,i as c,y as d}from"./local-bd07797b.js";import{P as r}from"./index-de07cc7b.js";import{C as o}from"./index-fbd6c2c0.js";import{d as n,e as h}from"./trade-281a8bb7.js";import{o as m}from"./multipleUse-ddae912e.js";import{C as b}from"./index-8c1c9a76.js";import{i as p}from"./dom-ce105537.js";import"./auth-e5508dcf.js";import"./index-58480b55.js";import"./index-4abfb1b1.js";import"./index-f0b471ce.js";class j extends e.Component{constructor(e){super(e),this.pageChange=e=>{this.setState({pageNum:e}),this.getTableList()},this.state={list:[{}],pageNum:1,pageSize:10,total:0,isFirst:!0},this.columns=[{colKey:"ddd",title:"用户名"},{colKey:"d2",title:"交易所"},{colKey:"d3",title:"交易对"},{colKey:"d4",title:"交易类型",align:"center"},{colKey:"d5",title:"持仓方向",align:"center"},{colKey:"d6",title:"开仓价格",align:"center"},{colKey:"d7",title:"数量",align:"center"},{colKey:"d8",title:"成交数量USDT",align:"center"},{colKey:"d9",title:"时间",align:"center"},{colKey:"d10",title:"操作",align:"center"}]}pcTable(){return""}mobileTable(){return l.jsxs("div",{className:"contract-real-table__mobile",children:[this.state.list.map(((e,s)=>l.jsxs("div",{className:"table-row",children:[l.jsxs("div",{className:"table-row-line",children:[l.jsx("div",{className:"table-pairs",children:e.symbol}),l.jsx("div",{className:"table-time",children:e.working_time})]}),l.jsxs("div",{className:"table-row-line",children:[l.jsxs("div",{className:["table-direction"].join(" "),style:{color:n(e.side)},children:[t("order_type",e.type),"/",h(e.side)]}),l.jsx("div",{style:{display:p("NEW"===e.status)},children:l.jsx(o,{onClick:this.tableContractRevoke.bind(this,e),children:"撤销"})})]}),l.jsxs("div",{className:"table-row-line",children:[l.jsx(b,{checked:e.is_checked,onChange:l=>{e.is_checked=l}}),l.jsxs("div",{className:"table-col-left",children:[l.jsxs("div",{className:"table-col__line",children:[l.jsx("div",{className:"table-col-label",children:"用户"}),l.jsx("div",{className:"table-col-value",children:i(e.exchange_users_id)})]}),l.jsxs("div",{className:"table-col__line",children:[l.jsx("div",{className:"table-col-label",children:"开仓价格"}),l.jsx("div",{className:"table-col-value",children:e.price})]}),l.jsxs("div",{className:"table-col__line",children:[l.jsx("div",{className:"table-col-label",children:"订单id"}),l.jsx("div",{className:"table-col-value",children:e.order_id})]})]}),l.jsxs("div",{className:"table-col-left",children:[l.jsxs("div",{className:"table-col__line",children:[l.jsx("div",{className:"table-col-label",children:"交易所"}),l.jsx("div",{className:"table-col-value",children:e.exchange})]}),l.jsxs("div",{className:"table-col__line",children:[l.jsx("div",{className:"table-col-label",children:"数量"}),l.jsx("div",{className:"table-col-value",children:e.qty})]}),l.jsxs("div",{className:"table-col__line",children:[l.jsx("div",{className:"table-col-label",children:"状态"}),l.jsx("div",{className:["table-col-value","green"].join(" "),children:e.status})]})]})]})]},(new Date).valueOf()+s))),l.jsx(r,{onChange:this.pageChange,pageNum:this.state.pageNum,pageSize:this.state.pageSize,total:this.state.total})]})}async tableContractRevoke(e){let l={};if(e)l={ids:[e.id]};else{const e=this.state.list,a=[];if(e.forEach((e=>{e.is_checked&&a.push(e.id)})),!a.length)return void s("未选择行");l={ids:a}}await m(l)&&this.getTableList()}currentTable(){return l.jsx("div",{style:this.props.style??null,className:"c-table-height",children:c()?this.mobileTable():this.pcTable()})}async getTableList(e){let l=null;try{let s={page:this.state.pageNum,limit:this.state.pageSize};e&&(s={...s,...e}),l=a();const t=await d(s);0==t.code&&(t.data.data.forEach((e=>{e.is_checked=!1})),this.setState({list:JSON.parse(JSON.stringify(t.data.data)),total:t.data.total}),this.props.updateTotal&&this.props.updateTotal(t.data.total)),l&&l.hide()}catch(s){l&&l.hide()}}render(){return this.props["v-if"]?this.currentTable():l.jsx(l.Fragment,{})}}export{j as default};
