Commit 30a6618b authored by wxk's avatar wxk

接口基本连接完喽

parent ca4221cf
......@@ -11,7 +11,7 @@ const Api = {
GetWalletInfo: "/walletInfo ", //查询某个账号的当前资产信息
Transfer: "/transfer", //充币提币
Transaction: "/transaction", //交易记录
Records: "/records", //历史记录
Records: "/records", //充提记录
}
export default Api;
......@@ -75,15 +75,15 @@
</div>
<p class="item">
<span class="type-name">可用</span>
<span>1234.123456BTC</span>
<span>{{coinInfo.active}}</span>
</p>
<p class="item">
<span class="type-name">冻结</span>
<span>1234.123456BTC</span>
<span>{{coinInfo.frozen}}</span>
</p>
<p class="item">
<span class="type-name">总量</span>
<span>1234.123456BTC</span>
<span>{{coinInfo.amount}}</span>
</p>
</div>
<div class="handle-content">
......@@ -94,15 +94,15 @@
</div>
<p class="item">
<span class="type-name">可用</span>
<span>1234.123456YCC</span>
<span>{{baseInfo.active}}</span>
</p>
<p class="item">
<span class="type-name">冻结</span>
<span>1234.123456YCC</span>
<span>{{baseInfo.frozen}}</span>
</p>
<p class="item">
<span class="type-name">总量</span>
<span>1234.123456YCC</span>
<span>{{baseInfo.amount}}</span>
</p>
</div>
<!-- 充币弹框 -->
......@@ -131,7 +131,7 @@
<p class="tips">操作前请确认信息</p>
<div slot="footer" class="dialog-footer">
<el-button @click="innerVisible = false">取 消</el-button>
<el-button type="primary" @click="sure_recharge('recharge')" :disabled="transferok">确认充值</el-button>
<el-button type="primary" @click="sure_recharge('0')" :disabled="transferok">确认充值</el-button>
</div>
</el-dialog>
<el-form>
......@@ -193,7 +193,7 @@
<p class="tips">操作前请确认信息</p>
<div slot="footer" class="dialog-footer">
<el-button @click="innerVisible1 = false">取 消</el-button>
<el-button type="primary" @click="sure_recharge('withdraw')" :disabled="transferok">确认提币</el-button>
<el-button type="primary" @click="sure_recharge('1')" :disabled="transferok">确认提币</el-button>
</div>
</el-dialog>
<el-form>
......@@ -241,20 +241,20 @@
<span class="title">类型</span>
<el-checkbox-button :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全部</el-checkbox-button>
<el-checkbox-group v-model="checkedOptions" @change="handleCheckedChange">
<el-checkbox-button v-for="option in options" :label="option" :key="option">{{option}}</el-checkbox-button>
<el-checkbox-button v-for="(option, index) in options" :label="index+''" :key="option">{{option}}</el-checkbox-button>
</el-checkbox-group>
</div>
<div class="select-bar-content status-select fl">
<span class="title">状态</span>
<el-checkbox-button :indeterminate="isIndeterminate1" v-model="checkAll1" @change="handleCheckAllChange1">全部</el-checkbox-button>
<el-checkbox-group v-model="checkedStates" @change="handleCheckedChange1">
<el-checkbox-button v-for="state in states" :label="state" :key="state">{{state}}</el-checkbox-button>
<el-checkbox-button v-for="(state,index) in states" :label="index+''" :key="state">{{state}}</el-checkbox-button>
</el-checkbox-group>
</div>
</div>
<el-date-picker
class="fr"
v-model="value6"
v-model="transactionTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="至"
......@@ -317,11 +317,11 @@
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage4"
:current-page="currentPage"
:page-sizes="[10, 20, 30]"
:page-size="10"
layout="total, prev, pager, next, sizes"
:total="400">
:total="total">
</el-pagination>
</div>
<!--充提记录-->
......@@ -333,20 +333,20 @@
<span class="title">类型</span>
<el-checkbox-button :indeterminate="isIndeterminate2" v-model="checkAll2" @change="handleCheckAllChange2">全部</el-checkbox-button>
<el-checkbox-group v-model="checkedOptions1" @change="handleCheckedChange2">
<el-checkbox-button v-for="option in options1" :label="option" :key="option">{{option}}</el-checkbox-button>
<el-checkbox-button v-for="(option,index) in options1" :label="index+''" :key="option">{{option}}</el-checkbox-button>
</el-checkbox-group>
</div>
<div class="select-bar-content status-select fl small">
<span class="title">状态</span>
<el-checkbox-button :indeterminate="isIndeterminate3" v-model="checkAll3" @change="handleCheckAllChange3">全部</el-checkbox-button>
<el-checkbox-group v-model="checkedStates1" @change="handleCheckedChange3">
<el-checkbox-button v-for="(state,index) in states1" :label="index" :key="state">{{state}}</el-checkbox-button>
<el-checkbox-button v-for="(state,index) in states1" :label="index+''" :key="state">{{state}}</el-checkbox-button>
</el-checkbox-group>
</div>
</div>
<el-date-picker
class="fr"
v-model="value6"
v-model="transactionTime1"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="至"
......@@ -417,13 +417,13 @@
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage4"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"
:current-page="currentPage1"
:page-sizes="[10, 20, 30]"
:page-size="10"
:page-size="pageSize1"
layout="total, prev, pager, next, sizes"
:total="400">
:total="total1">
</el-pagination>
</div>
</div>
......@@ -438,6 +438,8 @@
return{
username: localStorage.getItem('username'),
value1: true,
coinInfo: {},//目标币账户信息
baseInfo: {},//基础币账户信息
amount_num:'',//充值数量
dialogFormVisible:false,//充值弹框
transferok:false,
......@@ -445,9 +447,13 @@
dialogFormVisible1:false,//提现弹框
innerVisible1: false,//提现确认弹框
recharge_list_value: '',//充值时候选择的账户
account_symbol: '',//币种
value6: '', //时间筛选值
account_symbol: '',//充提币种
/*交易记录参数*/
transactionTime: ['', ''],// 时间筛选
pageSize: '10', //表格每页的条数
currentPage: 1, //分页(当前页数)
total: 0, //记录总条数
list: [],//表格数据
isIndeterminate: true,
checkAll: false,
checkedOptions: [],
......@@ -456,7 +462,7 @@
checkAll1: false,
checkedStates: [],
states: ["挂单中", "完全成交", "已撤单", "部分成交"],
list: [{
/* list: [{
id: "123", //单号
platform: "zhaobi", //交易所
account: "b15a4f6c5c1163b5f80715c9bd87d5118ec4b5668cb29f148eeceec61ddeadc2",
......@@ -508,8 +514,8 @@
sum: 124.00000000, //总价
status: "3", //状态0挂单中 1完全成交2撤单3部分成交
time: "2018-06-28 14:12:59"
}],
list1: [{
}],*/
/*list1: [{
user: "wkf@33.cn",
coin: "BTC",
transfer_amount: 11.00000123,
......@@ -539,8 +545,13 @@
status: "1",
fee: 0.10000000,
fromUid: "9c885ce7664ed3c3675df8e49590c141665d94add5bf72a816a8d8a78bd8fbe5",
opt: "0"}],
opt: "0"}],*/
/*充提记录参数*/
transactionTime1: ['', ''],// 时间筛选
pageSize1: '10', //表格每页的条数
currentPage1: 1, //分页(当前页数)
total1: 0, //记录总条数
list1: [],//表格数据
isIndeterminate2: true,
checkAll2: false,
checkedOptions1: [],
......@@ -549,31 +560,19 @@
checkAll3: false,
checkedStates1: [],
states1: ["失败", "成功"],
currentPage4: 1, //分页
}
},
props: ['robotDetailInfo','robotBankList'],
created() {
this.list.map( item => {
const unit = item.opt === "0" ? item.base : item.coin;
item.price = item.price + unit;
item.sum = item.sum + unit;
item.fee = item.fee + unit;
item.opt = item.opt==="0" ? "买入" : "卖出";
item.status = item.status==="0" ? "挂单中" :
(item.status==="1" ? "完全成交" :
(item.status==="2" ? "已撤单" : "部分成交"));
return item;
});
this.list1.map( item => {
item.fee = item.fee + item.coin;
item.opt = item.opt==="0" ? "充币" : "提币";
item.status = item.status==="0" ? "失败" : "成功";
return item;
})
},
methods: {
//页面初始化
init() {
this.getWalletInfo();
this.getTransaction();
this.getRecords();
},
//返回上一页(关闭详情)
closeDetails() {
Bus.$emit('hideDetails')
......@@ -582,10 +581,17 @@
getWalletInfo() {
const params = {
account: this.robotDetailInfo.account,
coin: [this.robotDetailInfo.coin, this.robotDetailInfo.base]
coin: this.robotDetailInfo.coin,
base: this.robotDetailInfo.base,
}
axios.post(ApiConfig.GetWalletInfo,params).then( res=> {
// console.log(res)
if (res.data.code === 200) {
const Data = res.data.data;
for (let item of Data) {
this.coinInfo = item.coin === this.robotDetailInfo.coin ? item : this.coinInfo;
this.baseInfo = item.coin === this.robotDetailInfo.base ? item : this.baseInfo;
}
}
})
},
handleClose(done) {
......@@ -613,8 +619,8 @@
sure_recharge(key){
const params = {
user: this.username,
fromuid: this.recharge_list_value,
uid: this.robotDetailInfo.account,
from_account: this.recharge_list_value,
account: this.robotDetailInfo.account,
coin: this.account_symbol,
amount: this.amount_num,
opt: key
......@@ -630,17 +636,18 @@
}else{
this.transferok = true;
axios.post(ApiConfig.Transfer,params).then(res=>{
if(res.status == 200 && res.data == "transfer success"){
if(res.data.code === 200){
this.init();
this.$notify({
title: '提示',
message: key=="recharge"?'充值: '+ this.amount_num +" "+ row.symbol + ' 成功' : '提现: ' + this.amount_num +" "+ row.symbol + ' 成功',
message: key === "0" ? '充值 : '+ this.amount_num +" "+ this.account_symbol + ' 成功' : '提现: ' + this.amount_num +" "+ this.account_symbol + '成功',
type: 'success',
duration:'2000',
});
}else{
this.$notify({
title: '提示',
message: res.data,
message: res.data.msg,
type: 'error',
duration:'2000',
});
......@@ -652,8 +659,8 @@
this.amount_num = '';
this.recharge_list_value = '';
this.transferok = false;
})
.catch(err=>{
}).catch(err=>{
console.log(err)
this.$notify({
title: '提示',
message: "操作失败,请稍后重试!",
......@@ -668,54 +675,130 @@
this.account_symbol = symbol;
this.dialogFormVisible1 = true;
},
//查询交易记录
getTransaction(params) {
const baseParams = {
account: this.robotDetailInfo.account,
coin: this.robotDetailInfo.coin,
base: this.robotDetailInfo.base,
page: "1",
size: this.pageSize,
opt: this.checkedOptions,
status: this.checkedStates,
min_time: this.transactionTime[0],
max_time: this.transactionTime[1],
};
params = Object.assign({},baseParams,params);
axios.post(ApiConfig.Transaction, params).then( res => {
if (res.data.code === 200){
let result = res.data.data;
this.total = result.count;
if (result.list) {
this.list = result.list.map(item => {
const unit = item.opt === "0" ? item.base : item.coin;
item.price = item.price + unit;
item.sum = item.sum + unit;
item.fee = item.fee + unit;
item.opt = item.opt==="0" ? "买入" : "卖出";
item.status = item.status==="0" ? "挂单中" :
(item.status==="1" ? "完全成交" :
(item.status==="2" ? "已撤单" : "部分成交"));
return item;
})
}
}
})
},
//查询充提记录
getRecords(params) {
const baseParams = {
account: this.robotDetailInfo.account,
coin: [this.robotDetailInfo.coin, this.robotDetailInfo.base],
page: "1",
size: this.pageSize1,
opt: this.checkedOptions1,
status: this.checkedStates1,
min_time: this.transactionTime1[0],
max_time: this.transactionTime1[1],
};
params = Object.assign({},baseParams,params);
axios.post(ApiConfig.Records, params).then( res => {
if (res.data.code === 200){
let result = res.data.data;
this.total1 = result.count;
if (result.list) {
this.list1 = result.list.map(item => {
item.fee = item.fee + item.coin;
item.opt = item.opt==="0" ? "充币" : "提币";
item.status = item.status==="0" ? "失败" : "成功";
return item;
})
}
}
})
},
//交易记录筛选
handleCheckAllChange(val) {
this.checkedOptions = val ? this.options : [];
this.checkedOptions = val ? ['0','1'] : [];
this.isIndeterminate = false;
this.getTransaction();
},
handleCheckedChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.options.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.options.length;
this.getTransaction();
},
handleCheckAllChange1(val) {
this.checkedStates = val ? this.states : [];
this.checkedStates = val ? ['0','1','2','3'] : [];
this.isIndeterminate1 = false;
this.getTransaction();
},
handleCheckedChange1(value) {
let checkedCount = value.length;
this.checkAll1 = checkedCount === this.states.length;
this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.states.length;
this.getTransaction();
},
//交易记录分页
handleSizeChange(val) {
this.pageSize = val+'';
this.getTransaction();
},
handleCurrentChange(val) {
this.getTransaction({page: val+''});
},
//充提记录筛选
handleCheckAllChange2(val) {
this.checkedOptions1 = val ? this.options1 : [];
this.isIndeterminate2 = false;
this.getRecords();
},
handleCheckedChange2(value) {
let checkedCount = value.length;
this.checkAll2 = checkedCount === this.options1.length;
this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.options1.length;
this.getRecords();
},
handleCheckAllChange3(val) {
this.checkedStates1 = val ? [0,1] : [];
this.isIndeterminate3 = false;
this.getRecords();
},
handleCheckedChange3(value) {
let checkedCount = value.length;
this.checkAll3 = checkedCount === [0,1].length;
this.checkAll3 = checkedCount === this.states1.length;
this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.states1.length;
console.log(value.map( item => {
return item+'';
}))
this.getRecords();
},
//交易记录分页
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
//分页
handleSizeChange1(val) {
this.pageSize1 = val+'';
this.getRecords();
},
handleCurrentChange1(val) {
this.getRecords({page: val+''});
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
}
},
watch: {
robotBankList(val) {
......@@ -723,11 +806,16 @@
// console.log(this.robotBankList);
},
robotDetailInfo() {
this.getWalletInfo();
this.init();
},
//交易记录时间筛选
transactionTime(val) {
this.getTransaction();
},
//充提记录时间筛选
transactionTime1(val) {
this.getRecords();
},
value6(val) {
console.log(val[0])
}
}
}
</script>
......
......@@ -59,8 +59,10 @@
methods: {
getPlatInfo() {
axios.post(ApiConfig.GetPlatformInfo).then( res =>{
if (res.data.code === 200) {
this.platInfo = res.data.data;
// console.log(this.platInfo)
}
})
},
getRobotBank() {
......@@ -73,8 +75,10 @@
"platform":[] //交易所种类 可选参数
}
axios.post(ApiConfig.GetRobotBank,params).then( res => {
if (res.data.code === 200) {
// console.log(res.data.data);
this.robotBankList = res.data.data
}
})
},
}
......
......@@ -242,15 +242,19 @@
//机器人预警状态查询
getRobotStatus(params) {
axios.post(ApiConfig.GetRobotStatus,params).then( res => {
if (res.data.code === 200) {
// console.log(res.data)
this.robotStatusList = res.data;
this.robotStatusList = res.data.data;
}
})
},
//获取符合筛选条件的机器人列表
getRobotList(params) {
axios.post(ApiConfig.GetMatchRobots,params).then( res => {
if (res.data.code === 200) {
// console.log(res.data.data);
this.robotList = res.data.data;
}
})
},
//交易所过滤
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment