import{r as e,j as s,b as l,o as a}from"./app-a12cf07d.js";import{c as t,g as i,i as c,d}from"./local-6367da78.js";import{P as r}from"./index-3e8617f2.js";import{C as o}from"./index-34595b79.js";import{g as n,a as h}from"./trade-281a8bb7.js";import{a as m}from"./multipleUse-a63bb38b.js";import{C as p}from"./index-49b11c8b.js";import{i as b}from"./dom-ce105537.js";import"./auth-d668f6b9.js";import"./index-6dbbb2c5.js";import"./index-85d1a89a.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 s.jsxs("div",{className:"contract-real-table__mobile",children:[this.state.list.map(((e,l)=>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:n(e.position_side)},children:[t("order_type",e.type),"/",h(e.position_side)]}),s.jsx("div",{style:{display:b("NEW"===e.status)},children:s.jsx(o,{onClick:this.tableContractRevoke.bind(this,e),children:"撤销"})})]}),s.jsxs("div",{className:"table-row-line",children:[s.jsx(p,{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:i(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:"交易方向"}),s.jsx("div",{className:"table-col-value",children:e.side})]})]}),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()+l))),s.jsx(r,{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,a=[];if(e.forEach((e=>{e.is_checked&&a.push(e.id)})),!a.length)return void l("未选择行");s={ids:a}}await m(s)&&this.getTableList(this.props.filterParams)}currentTable(){return s.jsx("div",{style:this.props.style??null,className:"c-table-height",children:c()?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=a();const t=await d(l);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)),s&&s.hide()}catch(l){s&&s.hide()}}render(){return this.props["v-if"]?this.currentTable():s.jsx(s.Fragment,{})}}export{j as default};
