import{r as e,j as s}from"./app-61e75031.js";import{w as l,c as a,i as t,x as i}from"./local-95ab843f.js";import{P as c}from"./index-a7529dc7.js";import{C as d}from"./index-33422928.js";import{d as r,e as n}from"./trade-281a8bb7.js";import{s as o,o as h}from"./auth-db23b820.js";import{o as m}from"./multipleUse-8758e0f1.js";import{C as b}from"./index-d69519d2.js";import"./index-b09a3426.js";import"./index-bf885361.js";import"./index-e39dfa26.js";class p 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 s.jsxs("div",{className:"contract-real-table__mobile",children:[this.state.list.map(((e,t)=>s.jsxs("div",{className:"table-row",children:[s.jsxs("div",{className:"table-row-line",children:[s.jsx("div",{className:"table-pairs",children:e.symbol}),s.jsx("div",{className:"table-time",children:e.working_time})]}),s.jsxs("div",{className:"table-row-line",children:[s.jsxs("div",{className:["table-direction"].join(" "),style:{color:r(e.side)},children:[l("order_type",e.type),"/",n(e.side)]}),s.jsx(d,{onClick:this.tableContractRevoke.bind(this,e),children:"撤销"})]}),s.jsxs("div",{className:"table-row-line",children:[s.jsx(b,{checked:e.is_checked,onChange:s=>{e.is_checked=s}}),s.jsxs("div",{className:"table-col-left",children:[s.jsxs("div",{className:"table-col__line",children:[s.jsx("div",{className:"table-col-label",children:"用户"}),s.jsx("div",{className:"table-col-value",children:a(e.exchange_users_id)})]}),s.jsxs("div",{className:"table-col__line",children:[s.jsx("div",{className:"table-col-label",children:"开仓价格"}),s.jsx("div",{className:"table-col-value",children:e.price})]}),s.jsxs("div",{className:"table-col__line",children:[s.jsx("div",{className:"table-col-label",children:"订单id"}),s.jsx("div",{className:"table-col-value",children:e.order_id})]})]}),s.jsxs("div",{className:"table-col-left",children:[s.jsxs("div",{className:"table-col__line",children:[s.jsx("div",{className:"table-col-label",children:"交易所"}),s.jsx("div",{className:"table-col-value",children:e.exchange})]}),s.jsxs("div",{className:"table-col__line",children:[s.jsx("div",{className:"table-col-label",children:"数量"}),s.jsx("div",{className:"table-col-value",children:e.qty})]}),s.jsxs("div",{className:"table-col__line",children:[s.jsx("div",{className:"table-col-label",children:"状态"}),s.jsx("div",{className:["table-col-value","green"].join(" "),children:e.status})]})]})]})]},(new Date).valueOf()+t))),s.jsx(c,{onChange:this.pageChange,pageNum:this.state.pageNum,pageSize:this.state.pageSize,total:this.state.total})]})}async tableContractRevoke(e){let s={};if(e)s={ids:[e.id]};else{const e=this.state.list,l=[];if(e.forEach((e=>{e.is_checked&&l.push(e.id)})),!l.length)return void o("未选择行");s={ids:l}}await m(s)&&this.getTableList()}currentTable(){return s.jsx("div",{style:this.props.style??null,className:"c-table-height",children:t()?this.mobileTable():this.pcTable()})}async getTableList(e){let s=null;try{let l={page:this.state.pageNum,limit:this.state.pageSize};e&&(l={...l,...e}),s=h();const a=await i(l);0==a.code&&(a.data.data.forEach((e=>{e.is_checked=!1})),this.setState({list:JSON.parse(JSON.stringify(a.data.data)),total:a.data.total}),this.props.updateTotal&&this.props.updateTotal(a.data.total)),s&&s.hide()}catch(l){s&&s.hide()}}shouldComponentUpdate(e,s,l){return e["v-if"]&&s.isFirst&&(this.setState({isFirst:!1}),this.getTableList()),!0}render(){return this.props["v-if"]?this.currentTable():s.jsx(s.Fragment,{})}}export{p as default};
