parent
83bfd18ed8
commit
06f7b4493a
7 changed files with 975 additions and 3537 deletions
@ -1,249 +0,0 @@ |
||||
<!doctype html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>訂單</title> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> |
||||
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> |
||||
<!--引入公共样式--> |
||||
<link rel="stylesheet" type="text/css" href="../../../lib/css/icons-extra2.css" /> |
||||
<link href="../../../lib/css/mui.pullToRefresh.css" rel="stylesheet" /> |
||||
<link href="../../../lib/css/basic.css" rel="stylesheet" /> |
||||
<link href="../css/order.css" rel="stylesheet" /> |
||||
<!--下拉刷新上拉加载css--> |
||||
<script src="../../../lib/js/rem-layout.js"></script> |
||||
<script src="../../../lib/js/mui.min.js"></script> |
||||
<script src="../../../lib/js/vue.js"></script> |
||||
<script src="../../../lib/js/app.js"></script> |
||||
<!--下拉刷新上拉加载js--> |
||||
<script src="../../../lib/js/mui.pullToRefresh.js"></script> |
||||
<script src="../../../lib/js/mui.pullToRefresh.material.js"></script> |
||||
<!--baseJs--> |
||||
<script src="../js/ajax/coin_ajax.js"></script> |
||||
<script src="../js/ajax/ad_ajax.js"></script> |
||||
</head> |
||||
|
||||
<body> |
||||
<header class="mui-bar mui-bar-nav" id="header"> |
||||
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="font-size: .34rem;">广告管理</a> |
||||
</header> |
||||
<div class="mui-content" id='data-info'> |
||||
<div class="select-box"> |
||||
<div class="select"> |
||||
<select name="slct1" v-model="coin_index" @change="coinChange"> |
||||
<option value="0">全部</option> |
||||
<option v-for="(item,index) in coins" :value="index + 1">{{item.coinName}}</option> |
||||
</select> |
||||
</div> |
||||
<div class="select" v-model="ad_statsu" @change="statusChange"> |
||||
<select name="slct2"> |
||||
<option value="">全部</option> |
||||
<option value="UNDERWAY">进行中</option> |
||||
<option value="FINISH">已完成</option> |
||||
<option value="CANCEL">已撤销</option> |
||||
</select> |
||||
</div> |
||||
<div class="select" v-model="ad_type" @change="typeChange"> |
||||
<select name="slct3"> |
||||
<option value="">全部</option> |
||||
<option value="BUY">购买</option> |
||||
<option value="SELL">出售</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
<div class="order-info"> |
||||
<ul> |
||||
<li class="item-list" v-for="item in ads"> |
||||
<div class="order-info-left sales" v-if='item.adType == "SELL"'> |
||||
卖 |
||||
</div> |
||||
<div class="order-info-left buys" v-if='item.adType == "BUY"'> |
||||
买 |
||||
</div> |
||||
<div class="order-info-right"> |
||||
<div class="order-info-top"> |
||||
<span class="order-coin">{{item.coinName}}<label >{{item.modifyTime}}</label></span> |
||||
<span class="order-status" :class="{'sure' : sureClass(item.adStatus),'remove':removeClass(item.adStatus)}"> |
||||
<img src="../img/countdown.png" v-if="item.adStatus == 'UNDERWAY'"/> |
||||
<img src="../img/sure.png" v-if="item.adStatus == 'FINISH'"/> |
||||
<img src="../img/remove.png" v-if="item.adStatus == 'CANCEL'"/> |
||||
{{item.adStatus | adStautsF}} |
||||
</span> |
||||
<span class="order-status" v-if="item.adStatus == 'UNDERWAY'">撤销</span> |
||||
</div> |
||||
<div class="order-info-bottom"> |
||||
<h4>流水号:{{item.adNumber}}</h4> |
||||
<div class="order-info-txt"> |
||||
<span>单价({{item.unitName}})</span> |
||||
<span>剩余({{item.coinName}})</span> |
||||
<span>总量({{item.coinName}})</span> |
||||
</div> |
||||
<div class="order-info-num"> |
||||
<span>{{item.price | toFixNum(coin.unitDecimal)}}</span> |
||||
<span>{{item.lastNum | toFixNum(coin.coinDecimal)}}</span> |
||||
<span>{{item.totalNum | toFixNum(coin.coinDecimal)}}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
|
||||
<script type="text/javascript"> |
||||
/**vue**/ |
||||
|
||||
//全局过滤器-保留小数点 |
||||
Vue.filter('toFixNum', function(value, fix_num) { |
||||
//出现NaN的情况 |
||||
if(isNaN(value)) { |
||||
return Number(0).toFixed(fix_num); |
||||
} |
||||
//需要保留的小数位 + 1,用于不四舍五入 |
||||
var floatNum = parseFloat(value).toFixed(fix_num + 1); |
||||
//截取数据,保留小数并不用四舍五入 |
||||
var realNum = floatNum.substring(0, floatNum.length - 1); |
||||
return realNum; |
||||
}); |
||||
|
||||
var dataInfo = new Vue({ |
||||
el: '#data-info', |
||||
data: { |
||||
coins: [], //代币列表 |
||||
coin_index: 0, //代币下拉控件索引 |
||||
coin: { //当前选择的代币 |
||||
coinName: '', //当前选择的代币 |
||||
unitName: '', //当前代币的交易单位 |
||||
coinDecimal: 6, //代币小数长度 |
||||
unitDecimal: 2, //代币交易单位小数长度 |
||||
}, |
||||
|
||||
ads: [], //广告列表 |
||||
ad_status: '', //广告状态 |
||||
ad_type: '', //广告类型 |
||||
}, |
||||
methods: { |
||||
//币种切换时触发方法 |
||||
coinChange: function(e) { |
||||
//当前下拉框选择索引 |
||||
var index = this.coin_index; |
||||
//索引为0的时候,币种是选择全部 |
||||
if(index == 0) { |
||||
this.coin.coinName = ''; |
||||
this.coin.unitName = ''; |
||||
this.coin.coinDecimal = 6; |
||||
this.coin.unitDecimal = 2; |
||||
//查询用户广告 |
||||
listUserAds(); |
||||
return; |
||||
} |
||||
//更换当前币种 |
||||
this.coin = JSON.parse(JSON.stringify(this.coins[index - 1])); |
||||
//查询用户广告 |
||||
listUserAds(); |
||||
}, |
||||
//查询广告状态改变 |
||||
statusChange: function() { |
||||
listUserAds(); |
||||
}, |
||||
//查询广告类型改变 |
||||
typeChange: function() { |
||||
listUserAds(); |
||||
}, |
||||
//是否显示 sure 样式 |
||||
sureClass: function(status) { |
||||
if(status == 'UNDERWAY' || status == 'FINISH') { |
||||
return true; |
||||
} |
||||
return false; |
||||
}, |
||||
//是否显示 remove 样式 |
||||
removeClass: function(status) { |
||||
if(status == 'CANCEL') { |
||||
return true; |
||||
} |
||||
return false; |
||||
}, |
||||
}, |
||||
filters: { |
||||
//根据广告状态返回广告中文标识 |
||||
adStautsF: function(val) { |
||||
if(val == 'UNDERWAY') { |
||||
return '进行中'; |
||||
} |
||||
if(val == 'FINISH') { |
||||
return '已完成'; |
||||
} |
||||
if(val == 'CANCEL') { |
||||
return '已取消'; |
||||
} |
||||
}, |
||||
} |
||||
}); |
||||
</script> |
||||
|
||||
<script type="text/javascript"> |
||||
/**mui.plusReady**/ |
||||
mui.plusReady(function() { |
||||
getCoins(); |
||||
listUserAds(); |
||||
}); |
||||
</script> |
||||
|
||||
<script type="text/javascript"> |
||||
/**事件绑定**/ |
||||
</script> |
||||
|
||||
<script type="text/javascript"> |
||||
/**function**/ |
||||
|
||||
//查询法币币种列表 |
||||
function getCoins() { |
||||
mui.ajax(coinAjax.GET_COINS.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: {}, |
||||
dataType: 'json', |
||||
type: coinAjax.GET_COINS.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
//渲染数据 |
||||
dataInfo.coins = data.data; |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//查询用户广告列表 |
||||
function listUserAds() { |
||||
mui.ajax(adAjax.LIST_USER_AD.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
coinName: dataInfo.coin.coinName, |
||||
unitName: dataInfo.coin.unitName, |
||||
adType: dataInfo.ad_type, |
||||
adStatus: dataInfo.ad_status, |
||||
userId: '18925792125' |
||||
}, |
||||
dataType: 'json', |
||||
type: adAjax.LIST_USER_AD.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
//渲染数据 |
||||
dataInfo.ads = data.data; |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
</script> |
||||
|
||||
</html> |
@ -1,789 +0,0 @@ |
||||
<!doctype html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>付款页面</title> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> |
||||
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> |
||||
<!--引入公共样式--> |
||||
<link href="../../../lib/css/mui.pullToRefresh.css" rel="stylesheet" /> |
||||
<link rel="stylesheet" type="text/css" href="../../../lib/css/icons-extra2.css" /> |
||||
<link href="../../../lib/css/basic.css" rel="stylesheet" /> |
||||
<link href="../css/payment.css" rel="stylesheet" /> |
||||
<!--下拉刷新上拉加载css--> |
||||
<script src="../../../lib/js/rem-layout.js"></script> |
||||
<script src="../../../lib/js/mui.min.js"></script> |
||||
<script src="../../../lib/js/vue.js"></script> |
||||
<script src="../../../lib/js/app.js"></script> |
||||
<!--下拉刷新上拉加载js--> |
||||
<script src="../../../lib/js/mui.pullToRefresh.js"></script> |
||||
<script src="../../../lib/js/mui.pullToRefresh.material.js"></script> |
||||
<!--baseJs--> |
||||
<script src="../js/ajax/appeal_ajax.js"></script> |
||||
<script src="../js/ajax/order_ajax.js"></script> |
||||
<script src="../js/ajax/userpay_ajax.js"></script> |
||||
<script src="../js/ajax/ad_ajax.js"></script> |
||||
<script src="../js/ajax/config_ajax.js"></script> |
||||
<script src="../js/base/requestUrl.js"></script> |
||||
<script src="../../../lib/js/jsencrypt.min.js"></script> |
||||
<script src="../../wallet/js/wallet.inner.js"></script> |
||||
</head> |
||||
|
||||
<body> |
||||
<div id="data-info"> |
||||
<header class="mui-bar mui-bar-nav" id="header"> |
||||
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="font-size: .34rem;">{{order.role | roleAlertF}} {{order.turnover}}<label>{{order.unitName}}</label></a> |
||||
<!--订单状态等于“新建”并且“用户角色”等于“买方”:显示待付款--> |
||||
<a class=" mui-icon-right-nav" v-if='orderNew && roleBuy'><img src="../img/countdown.png" /><label>待付款</label></a> |
||||
<!--订单状态等于“进行中”并且“用户角色”等于“买方”:显示已付款--> |
||||
<a class=" mui-icon-right-nav" v-if='orderUnderway && roleBuy'><img src="../img/countdown.png" /><label>已付款</label></a> |
||||
<!--订单状态等于“新建”并且“用户角色”等于“卖方”:显示等待买家付款--> |
||||
<a class=" mui-icon-right-nav" v-if='orderNew && roleSell'><img src="../img/countdown.png" /><label>等待买家付款</label></a> |
||||
<!--订单状态等于“进行中”并且“用户角色”等于“卖方”:显示买家已付款--> |
||||
<a class=" mui-icon-right-nav" v-if='orderUnderway && roleSell'><img src="../img/countdown.png" /><label>买家已付款</label></a> |
||||
<!--订单状态等于“已完成”:显示已完成--> |
||||
<a class=" mui-icon-right-nav" v-if='orderFinish'><img src="../img/sure.png" /><label>已完成</label></a> |
||||
<!--订单状态等于“已取消”:显示已取消--> |
||||
<a class=" mui-icon-right-nav" v-if='orderCancel'><img src="../img/remove.png" /><label style="color: #78C4DF">已取消</label></a> |
||||
<!--订单状态等于“申诉”:显示申诉中--> |
||||
<a class=" mui-icon-right-nav" v-if='orderAppeal'><img src="../img/shensu.png" /><label style="color: #9D71EA">申诉中</label></a> |
||||
</header> |
||||
<div class="mui-content"> |
||||
<div class="top-info"> |
||||
<span>{{order.role | roleF}}<label class="person-name">{{roleUserName}}</label></span> |
||||
<span>单价<label>{{order.price}} {{order.unitName}}</label></span> |
||||
<span>数量<label>{{order.amount}} {{order.coinName}}</label></span> |
||||
<em class="countdown" v-if="orderNew">{{count_down}}</em> |
||||
<em class="mui-icon fold" :class="{'mui-icon-arrowup' : !arrowStatus,'mui-icon-arrowdown' : arrowStatus}" id="fold" v-show='paymentStatus'></em> |
||||
</div> |
||||
<div class="payment" id="payment" v-show='arrowStatus && paymentStatus'> |
||||
<ul class="mui-table-view"> |
||||
<li class="mui-table-view-cell"> |
||||
<a :class="{'mui-navigate-right' : orderNew && roleBuy}"> |
||||
<!--根据卖家支付类型渲染可选支付方式--> |
||||
<span class="mui-icon iconfont icon-zhifubap" style="color: #0062CC;" v-show='payZFB'><label>支付宝</label></span> |
||||
<span class="mui-icon iconfont icon-weixin-copy" style="color: #007849;" v-show='payWX'><label>微信</label></span> |
||||
<span class="mui-icon iconfont icon-yinhangka" style="color: #F4A41F;" v-show='payBANK'><label>银行卡</label></span> |
||||
<label class="switth" id="switch" v-show="orderNew && roleBuy">切换支付方式</label> |
||||
</a> |
||||
</li> |
||||
<!--卖家支付类型等于“银行卡”:持卡人--> |
||||
<li class="mui-table-view-cell" v-show='payBANK'> |
||||
<a class="payment-txt">持卡人</a> |
||||
<label>{{payInfo.bankUserName}}</label> |
||||
</li> |
||||
<!--卖家支付类型等于“银行卡”:开户银行--> |
||||
<li class="mui-table-view-cell" v-show='payBANK'> |
||||
<a class="payment-txt">开户银行</a> |
||||
<label>{{payInfo.bankType}}</label> |
||||
</li> |
||||
<!--卖家支付类型等于“银行卡”:显示卡号--> |
||||
<li class="mui-table-view-cell" v-show='payBANK'> |
||||
<a class="payment-txt">卡号</a> |
||||
<label>{{payInfo.bankNumber}}<img src="../img/fuzhi.png"/></label> |
||||
</li> |
||||
<!--卖家支付类型等于“微信”和“支付宝”:显示收款账户--> |
||||
<li class="mui-table-view-cell" v-show='payWX || payZFB'> |
||||
<a class="payment-txt">账号</a> |
||||
<label>{{payInfo.accountInfo}}</label> |
||||
</li> |
||||
<!--卖家支付类型等于“微信”和“支付宝”:显示二维码按钮--> |
||||
<li class="mui-table-view-cell" v-show='payWX || payZFB'> |
||||
<a class="payment-txt">二维码</a> |
||||
<label id="codeimg"><img src="../img/code.png"/></label> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
<div> |
||||
<!--订单状态等于“进行中”或者等于“申诉”并且“用户角色”等于“卖方”:显示对方从何处付款提示--> |
||||
<ul class="mui-table-view" v-show="(orderUnderway || orderAppeal) && roleSell"> |
||||
<li class="mui-table-view-cell"> |
||||
<a class="payment-txt">对方已从 “{{order.orderPayType | payTypeF}}” 付款</a> |
||||
</li> |
||||
</ul> |
||||
<!--订单状态 等于“新建”并且 “用户角色”等于“买方”:显示选择支付方式提示--> |
||||
<ul class="mui-table-view" v-show="orderNew && roleBuy"> |
||||
<li class="mui-table-view-cell"> |
||||
<a class="payment-txt">请选择其中一种支付方式进行付款!</a> |
||||
</li> |
||||
</ul> |
||||
<!--订单状态等于“取消”:显示订单取消提示--> |
||||
<ul class="mui-table-view" v-show="orderCancel"> |
||||
<li class="mui-table-view-cell"> |
||||
<a class="payment-txt">订单已取消,无法查看支付信息</a> |
||||
</li> |
||||
</ul> |
||||
<!--订单状态不等于“取消”或者不等于“完成”并且“申诉信息”不等于空:显示申诉结果--> |
||||
<ul class="mui-table-view" v-if="(orderCancel || orderFinish) && appealInfo != null"> |
||||
<li class="mui-table-view-cell"> |
||||
<a class="payment-txt">申诉结果:{{appealInfo.remark}}</a> |
||||
</li> |
||||
</ul> |
||||
<!--订单状态 不等于'取消' 并且 不等于'完成':显示广告备注--> |
||||
<ul class="mui-table-view" v-if="!orderCancel && !orderFinish"> |
||||
<li class="mui-table-view-cell"> |
||||
<p style="color: #333333" v-if="ad_remark != null && ad_remark != '' ">广告备注:{{ad_remark}}</p> |
||||
<p style="color: #333333;" v-else>广告备注:暂无</p> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
<div class="btn-group"> |
||||
<div class="cancel-btn" id="cancel-btn" v-show="cancelBtn"> |
||||
取消订单 |
||||
</div> |
||||
<div class="yes-btn" id="pay-btn" v-show="payBtn"> |
||||
我已付款 |
||||
</div> |
||||
<div class="yes-btn" id="receipt-btn" v-show="receiptBtn"> |
||||
确认收款 |
||||
</div> |
||||
<div class="yes-btn" id="appeal-btn" v-show="appealBtn"> |
||||
申诉 |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<!--支付方式弹出框--> |
||||
<div id="switch-popover" class="mui-popover mui-popover-action"> |
||||
<div class="mui-scroll-wrapper"> |
||||
<div class="mui-scroll"> |
||||
<ul class="mui-table-view"> |
||||
<li class="mui-table-view-cell" v-for='(item,index) in sellPays' :data-pay-index='index'>{{item.payType | payTypeF}}</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<!--灰色背景图蒙版--> |
||||
<div id="bg" class="bg" v-show='bgStatus' style="display: block;"></div> |
||||
<!--买入卖出交易密码确认--> |
||||
<div class="confirm animated bounceInUp" v-show="pass_status"> |
||||
<form class="input-group"> |
||||
<div class="title-top"> |
||||
<span class="mui-icon mui-icon-closeempty icon js-tap-pass-close"></span> |
||||
<span id="title" class="title">确认收款</span> |
||||
</div> |
||||
<div class="mui-input-row"> |
||||
<label for="cosnfirm-password">密码</label> |
||||
<input type="password" class="mui-input-password" placeholder="请输入密码" v-model="pass"> |
||||
</div> |
||||
<div class="mui-button-row"> |
||||
<button id="confirmBtn" type="button" class="mui-btn mui-btn-primary">确认</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
|
||||
<!--取消订单的弹出框--> |
||||
<div class="cancelOrder" id="cancelOrder" v-show="btnConfirmStatus" style="display: block;"> |
||||
<div v-show='btnConfirmType == "PAY"'> |
||||
<div class="orderCont"> |
||||
<p class="popTitle">确认付款</p> |
||||
<p class="popText popText_1">未付款点击“我已付款”将被冻结账户</p> |
||||
<p class="popText popText_2">请确认已向卖方付款</p> |
||||
</div> |
||||
<div class="orderHandle"> |
||||
<div class="btn thinkBtn"><span>取消</span></div> |
||||
<div class="btn cancelBtn" id="payBtn"><span>我已付款</span></div> |
||||
</div> |
||||
</div> |
||||
<div v-show='btnConfirmType == "CANCEL"'> |
||||
<div class="orderCont"> |
||||
<p class="popTitle">取消订单</p> |
||||
<p class="popText popText_1">如您已向卖家付款,取消订单您将会损失付款资金!</p> |
||||
<p class="popText popText_2"></p> |
||||
</div> |
||||
<div class="orderHandle"> |
||||
<div class="btn thinkBtn"><span>取消</span></div> |
||||
<div class="btn cancelBtn" id="cancelBtn"><span>确认取消</span></div> |
||||
</div> |
||||
</div> |
||||
<div v-show='btnConfirmType == "RECEIPT"'> |
||||
<div class="orderCont"> |
||||
<p class="popTitle">确认收款</p> |
||||
<p class="popText popText_1">请确认已收到买家付款</p> |
||||
<p class="popText popText_2">点击“确认收款”放币给买家</p> |
||||
</div> |
||||
<div class="orderHandle"> |
||||
<div class="btn thinkBtn"><span>取消</span></div> |
||||
<div class="btn cancelBtn" id="receiptBtn"><span>确认收款</span></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<!--二维码弹出框--> |
||||
<div class="code" id="code" v-show="codeStatus" style="display: block;"> |
||||
<img :src="base_file_url + payInfo.collectionCodeUrl" /> |
||||
<span class="mui-icon mui-icon-download"></span> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
<script type="text/javascript"> |
||||
var dataInfo = new Vue({ |
||||
el: '#data-info', |
||||
data: { |
||||
btnConfirmStatus: false, //二次确认框是否显示 |
||||
btnConfirmType: '', //二次确认框显示的内容 |
||||
codeStatus: false, //二维码是否显示 |
||||
bgStatus: false, //蒙版是否显示 |
||||
arrowStatus: true, //折叠面板状态 |
||||
payIsShow: true, //折叠面板是否显示 |
||||
pass_status: false, //密码框是否显示 |
||||
sellPays: [], //卖家支付信息 |
||||
payInfo: {}, //买家选中的支付信息 |
||||
order: {}, //订单数据 |
||||
appealInfo: {}, //申诉结果信息 |
||||
ad_remark: '', //广告方备注信息 |
||||
pass: '', //支付密码 |
||||
public_pass: '', //公钥加密的资金密码 |
||||
base_file_url: app.walletFileUrl, //访问服务器图片路径前缀 |
||||
count_down: '00:00', //倒计时剩余时间 |
||||
}, |
||||
computed: { |
||||
//角色:买方 |
||||
roleBuy: function() { |
||||
return this.order.role == 'BUY'; |
||||
}, |
||||
//角色:卖方 |
||||
roleSell: function() { |
||||
return this.order.role == 'SELL'; |
||||
}, |
||||
//订单状态:新建 |
||||
orderNew: function() { |
||||
return this.order.orderStatus == 'NEW'; |
||||
}, |
||||
//订单状态:进行中 |
||||
orderUnderway: function() { |
||||
return this.order.orderStatus == 'UNDERWAY'; |
||||
}, |
||||
//订单状态:取消 |
||||
orderCancel: function() { |
||||
return this.order.orderStatus == 'CANCEL'; |
||||
}, |
||||
//订单状态:申诉 |
||||
orderAppeal: function() { |
||||
return this.order.orderStatus == 'APPEAL'; |
||||
}, |
||||
//订单状态:已完成 |
||||
orderFinish: function() { |
||||
return this.order.orderStatus == 'FINISH'; |
||||
}, |
||||
//订单类型:买入 |
||||
orderBuy: function() { |
||||
return this.order.orderType == 'BUY' |
||||
}, |
||||
//订单类型:卖出 |
||||
orderSell: function() { |
||||
return this.order.otderType == 'SELL' |
||||
}, |
||||
//支付类型:微信 |
||||
payWX: function() { |
||||
return this.payInfo.payType == 'WX'; |
||||
}, |
||||
//支付类型:支付宝 |
||||
payZFB: function() { |
||||
return this.payInfo.payType == 'ZFB'; |
||||
}, |
||||
//支付类型:银行卡 |
||||
payBANK: function() { |
||||
return this.payInfo.payType == 'BANK'; |
||||
}, |
||||
//支付信息是否显示 |
||||
paymentStatus: function() { |
||||
if(this.order.orderStatus == 'FINISH' || this.order.orderStatus == 'CANCEL' || this.order.role == 'SELL') { |
||||
return false; |
||||
} |
||||
return true; |
||||
}, |
||||
//申诉按钮显示规则 |
||||
appealBtn: function() { |
||||
//订单状态进行中或者申诉中 |
||||
return this.orderUnderway || this.orderAppeal; |
||||
}, |
||||
//确认付款按钮显示规则 |
||||
payBtn: function() { |
||||
//订单状态新建并且角色是买方 |
||||
return this.orderNew && this.roleBuy; |
||||
}, |
||||
//确认收款按钮显示规则 |
||||
receiptBtn: function() { |
||||
//订单状态新建或者申诉中并且角色是卖方 |
||||
return(this.orderUnderway || this.orderAppeal) && this.roleSell; |
||||
}, |
||||
//取消按钮显示规则 |
||||
cancelBtn: function() { |
||||
//订单状态是新建或者进行中,并且角色是买方并且订单类型是买入 |
||||
return(this.orderNew || this.orderUnderway) && this.roleBuy && this.orderBuy; |
||||
}, |
||||
//根据身份显示对方的账户 |
||||
roleUserName: function() { |
||||
if(this.order.role == 'BUY') { |
||||
return this.order.sellUserName; |
||||
} |
||||
if(this.order.role == 'SELL') { |
||||
return this.order.buyUserName; |
||||
} |
||||
}, |
||||
}, |
||||
methods: { |
||||
//倒计时逻辑 |
||||
countDown: function(interval) { |
||||
var data = this.order.createTime.replace(new RegExp(/-/gm), "/"); |
||||
//结束时间戳 |
||||
var lastTime = Date.parse(new Date(data)) + interval * 60 * 1000; |
||||
//当前时间戳 |
||||
var now = Date.parse(new Date()); |
||||
//剩余时间戳 |
||||
var msec = lastTime - now; |
||||
//分钟 |
||||
var min = parseInt(msec / 1000 / 60 % 60); |
||||
//秒 |
||||
var sec = parseInt(msec / 1000 % 60); |
||||
//分钟判断 |
||||
var minStr = min > 9 ? min : '0' + min; |
||||
//秒数判断 |
||||
var secStr = sec > 9 ? sec : '0' + sec; |
||||
//时间已结束 |
||||
if(msec <= 0) { |
||||
this.count_down = ''; |
||||
//倒计时结束,查询订单 |
||||
selectByOrderId(this.order.id); |
||||
return; |
||||
} |
||||
//渲染倒计时时间 |
||||
this.count_down = minStr + ':' + secStr; |
||||
//递归 |
||||
var that = this; |
||||
setTimeout(function() { |
||||
that.countDown(interval); |
||||
}, 1000); |
||||
} |
||||
}, |
||||
filters: { |
||||
payTypeF: function(val) { |
||||
if(val == 'WX') { |
||||
return '微信' |
||||
} |
||||
if(val == 'ZFB') { |
||||
return '支付宝' |
||||
} |
||||
if(val == 'BANK') { |
||||
return '银行卡' |
||||
} |
||||
}, |
||||
//根据身份显示对方账户 |
||||
roleF: function(val) { |
||||
if(val == 'BUY') { |
||||
return '卖家' |
||||
} |
||||
if(val == 'SELL') { |
||||
return '买家' |
||||
} |
||||
}, |
||||
//根据身份显示提示 |
||||
roleAlertF: function(val) { |
||||
if(val == 'BUY') { |
||||
return '请付款'; |
||||
} |
||||
if(val == 'SELL') { |
||||
return '请收款'; |
||||
} |
||||
}, |
||||
} |
||||
}); |
||||
</script> |
||||
|
||||
<script type="text/javascript"> |
||||
/**mui.plusReady**/ |
||||
mui.plusReady(function() { |
||||
var self = plus.webview.currentWebview(); |
||||
selectByOrderId(self.orderId); |
||||
}); |
||||
</script> |
||||
|
||||
<script type="text/javascript"> |
||||
/**事件绑定**/ |
||||
//折叠面板的监听 |
||||
document.getElementById('fold').addEventListener('tap', function() { |
||||
if(dataInfo.arrowStatus) { |
||||
dataInfo.arrowStatus = false; |
||||
} else { |
||||
dataInfo.arrowStatus = true; |
||||
} |
||||
}); |
||||
//点击切换方式的显示选择框 |
||||
document.getElementById('switch').addEventListener('tap', function() { |
||||
mui('#switch-popover').popover('toggle'); |
||||
}); |
||||
// 点击蒙版调用关闭方法 |
||||
document.getElementById('bg').addEventListener("tap", function() { |
||||
dataInfo.codeStatus = false; |
||||
dataInfo.bgStatus = false; |
||||
dataInfo.btnConfirmStatus = false; |
||||
dataInfo.pass_status = false; |
||||
}); |
||||
//密码框取消按钮监听 |
||||
mui(".confirm").on('tap', '.input-group .js-tap-pass-close', function() { |
||||
dataInfo.bgStatus = false; |
||||
dataInfo.pass_status = false; |
||||
}); |
||||
// 点击二级确认框的取消 |
||||
mui('.orderHandle').on('tap', '.thinkBtn', function() { |
||||
dataInfo.bgStatus = false; |
||||
dataInfo.btnConfirmStatus = false; |
||||
}); |
||||
// 点击取消订单 |
||||
document.getElementById("cancel-btn").addEventListener("tap", function() { |
||||
dataInfo.btnConfirmStatus = true; |
||||
dataInfo.bgStatus = true; |
||||
dataInfo.btnConfirmType = 'CANCEL'; |
||||
}); |
||||
// 点击我已付款 |
||||
document.getElementById("pay-btn").addEventListener("tap", function() { |
||||
dataInfo.btnConfirmStatus = true; |
||||
dataInfo.bgStatus = true; |
||||
dataInfo.btnConfirmType = 'PAY'; |
||||
}); |
||||
// 点击确认收款 |
||||
document.getElementById("receipt-btn").addEventListener("tap", function() { |
||||
dataInfo.btnConfirmStatus = true; |
||||
dataInfo.bgStatus = true; |
||||
dataInfo.btnConfirmType = 'RECEIPT'; |
||||
}); |
||||
// 点击申诉 |
||||
document.getElementById("appeal-btn").addEventListener("tap", function() { |
||||
//跳转申诉页 |
||||
app.openWin('appeal.html', 'appeal.html', {}, { |
||||
orderId: dataInfo.order.id |
||||
}); |
||||
}); |
||||
// 点击二级确认收款 |
||||
document.getElementById("payBtn").addEventListener("tap", function() { |
||||
pay(); |
||||
}); |
||||
// 点击二级取消订单 |
||||
document.getElementById("cancelBtn").addEventListener("tap", function() { |
||||
cancelBuyOrder(); |
||||
}); |
||||
// 点击二级确认付款 |
||||
document.getElementById("receiptBtn").addEventListener("tap", function() { |
||||
//显示密码框,隐藏二级确认框 |
||||
dataInfo.bgStatus = true; |
||||
dataInfo.pass_status = true; |
||||
dataInfo.btnConfirmStatus = false; |
||||
}); |
||||
// 点击二级确认付款的密码输入确认 |
||||
document.getElementById("confirmBtn").addEventListener("tap", function() { |
||||
if(dataInfo.pass == '') { |
||||
mui.toast("请输入密码!"); |
||||
return; |
||||
} |
||||
//获取非对称加密的公钥 |
||||
walletApi.getPublicKey(dataInfo.pass, function(data) { |
||||
dataInfo.public_pass = data; |
||||
//确认收款 |
||||
receipt(); |
||||
}); |
||||
}); |
||||
// 二維碼监听事件 |
||||
document.getElementById('codeimg').addEventListener("tap", function() { |
||||
dataInfo.codeStatus = true; |
||||
dataInfo.bgStatus = true; |
||||
}); |
||||
//支付宝,微信,银行卡切换事件 |
||||
mui("#switch-popover").on("tap", "li", function() { |
||||
//当前选择的所引 |
||||
var index = this.getAttribute('data-pay-index'); |
||||
//切换支付信息对象 |
||||
dataInfo.payInfo = dataInfo.sellPays[index]; |
||||
mui('#switch-popover').popover("hide"); |
||||
}); |
||||
</script> |
||||
|
||||
<script type="text/javascript"> |
||||
/**funtion**/ |
||||
|
||||
//根据订单id查询订单 |
||||
function selectByOrderId(orderId) { |
||||
mui.ajax(orderAjax.SELECT_BY_ORDER_ID.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
orderId: orderId, |
||||
}, |
||||
dataType: 'json', |
||||
type: orderAjax.SELECT_BY_ORDER_ID.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
dataInfo.order = data.data; |
||||
//订单状态新建,并且角色是买方,开始倒计时 |
||||
if(dataInfo.orderNew && dataInfo.roleBuy) { |
||||
//查询撤单时间间隔,开始倒计时 |
||||
selectAutoCancelInterval(); |
||||
} |
||||
//订单状态不是已完成和撤销并,查询广告备注信息 |
||||
if(!dataInfo.orderFinish && !dataInfo.orderCancel) { |
||||
//角色是买家,查询卖家支付信息 |
||||
if(dataInfo.roleBuy) { |
||||
//查询卖家支付信息 |
||||
selectSellPayType(orderId); |
||||
} |
||||
//查询广告信息 |
||||
selectAdById(); |
||||
} |
||||
//订单已完成或者撤销状态,查询申诉结果 |
||||
if(dataInfo.orderFinish || dataInfo.orderCancel) { |
||||
selectAppealHandleLog(); |
||||
} |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//刷新订单信息,用于申诉完之后回调 |
||||
function reloadOrder() { |
||||
selectByOrderId(dataInfo.order.id); |
||||
} |
||||
|
||||
//查询卖家支付信息 |
||||
function selectSellPayType(orderId) { |
||||
mui.ajax(userpayAjax.SELECT_SELL_PAY_TYPE.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
orderId: orderId, |
||||
}, |
||||
dataType: 'json', |
||||
type: userpayAjax.SELECT_SELL_PAY_TYPE.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
//选项支付方式选择框 |
||||
dataInfo.sellPays = data.data; |
||||
//默认选中第一个支付方式 |
||||
dataInfo.payType = data.data[0].payType; |
||||
//默认选中第一个支付信息 |
||||
dataInfo.payInfo = data.data[0]; |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//取消买单 |
||||
function cancelBuyOrder() { |
||||
plus.nativeUI.showWaiting("等待中..."); |
||||
mui.ajax(orderAjax.CANCEL_BUY_ORDER.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
orderId: dataInfo.order.id, |
||||
}, |
||||
dataType: 'json', |
||||
type: orderAjax.CANCEL_BUY_ORDER.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
plus.nativeUI.closeWaiting(); |
||||
if(data.code == 200) { |
||||
mui.toast("操作成功!"); |
||||
//重新查询订单 |
||||
selectByOrderId(dataInfo.order.id); |
||||
//关闭蒙版、二级确认框 |
||||
dataInfo.bgStatus = false; |
||||
dataInfo.btnConfirmStatus = false; |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else { |
||||
mui.toast(data.msg); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//确认付款 |
||||
function pay() { |
||||
plus.nativeUI.showWaiting("等待中..."); |
||||
mui.ajax(orderAjax.PAY.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
orderId: dataInfo.order.id, |
||||
payType: dataInfo.payInfo.payType, |
||||
}, |
||||
dataType: 'json', |
||||
type: orderAjax.PAY.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
plus.nativeUI.closeWaiting(); |
||||
if(data.code == 200) { |
||||
mui.toast("操作成功!"); |
||||
//重新查询订单 |
||||
selectByOrderId(dataInfo.order.id); |
||||
//关闭蒙版、二级确认框 |
||||
dataInfo.bgStatus = false; |
||||
dataInfo.btnConfirmStatus = false; |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else { |
||||
mui.toast(data.msg); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//确认付款 |
||||
function receipt() { |
||||
plus.nativeUI.showWaiting("等待中..."); |
||||
mui.ajax(orderAjax.RECEIPT.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
orderId: dataInfo.order.id, |
||||
pass: dataInfo.public_pass, |
||||
}, |
||||
dataType: 'json', |
||||
type: orderAjax.RECEIPT.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
plus.nativeUI.closeWaiting(); |
||||
if(data.code == 200) { |
||||
mui.toast("操作成功!"); |
||||
//重新查询订单 |
||||
selectByOrderId(dataInfo.order.id); |
||||
//关闭蒙版、二级确认框 |
||||
dataInfo.bgStatus = false; |
||||
dataInfo.btnConfirmStatus = false; |
||||
dataInfo.pass_status = false; |
||||
dataInfo.pass = ''; |
||||
dataInfo.public_pass = ''; |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else { |
||||
mui.toast(data.msg); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//查询申诉结果 |
||||
function selectAppealHandleLog() { |
||||
mui.ajax(appealAjax.SELECT_APPEAL_HANDLE_LOG.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
orderNumber: dataInfo.order.orderNumber, |
||||
}, |
||||
dataType: 'json', |
||||
type: appealAjax.SELECT_APPEAL_HANDLE_LOG.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
dataInfo.appealInfo = data.data; |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//查询广告信息 |
||||
function selectAdById() { |
||||
mui.ajax(adAjax.SELECT_BY_ID.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
data: { |
||||
adId: dataInfo.order.adId, |
||||
}, |
||||
dataType: 'json', |
||||
type: adAjax.SELECT_BY_ID.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
//设置广告方备注信息 |
||||
dataInfo.ad_remark = data.data.adRemark; |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
//查询定时撤单间隔时间 |
||||
function selectAutoCancelInterval() { |
||||
mui.ajax(configAjax.SELECT_AUTO_CANCEL_INTERVAL.getUrl, { |
||||
headers: { |
||||
"X-Requested-Token": app.getTokenStorage(), // token头部 |
||||
"locale": app.getLanguageLocalStorage() // 语种头部 |
||||
}, |
||||
dataType: 'json', |
||||
type: configAjax.SELECT_AUTO_CANCEL_INTERVAL.getType, |
||||
timeout: 10000, //超时时间设置为10秒 |
||||
success: function(data) { |
||||
if(data.code == 200) { |
||||
//传入时间间隔,开始倒计时 |
||||
dataInfo.countDown(data.data); |
||||
} else if(data.code == 201) { |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} else if(data.code == 202) { |
||||
mui.toast("您的账号在别处登录!"); |
||||
//未登录,跳转登录页面 |
||||
app.openWin(requestUrl.LOGIN.getUrl, requestUrl.LOGIN.getId); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
</script> |
||||
|
||||
</html> |
@ -1,338 +0,0 @@ |
||||
<!doctype html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>资产</title> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> |
||||
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> |
||||
<!--引入公共样式--> |
||||
<link href="../../../lib/css/basic.css" rel="stylesheet" /> |
||||
<link href="../css/assets.css" rel="stylesheet" /> |
||||
<script src="../../../lib/js/rem-layout.js"></script> |
||||
<script src="../../../lib/js/require2.1.11.js"></script> |
||||
<script type="text/javascript" src="../js/base.config.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body> |
||||
<div id="js-data-info"> |
||||
<header class="mui-bar mui-bar-nav"> |
||||
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> |
||||
<h1 class="mui-title">{{coin.walletType | filetWalletType}} — {{coin.tokenSymbol}}{{langue.capital}}</h1> |
||||
</header> |
||||
<div class="mui-content"> |
||||
|
||||
<!--代币信息--> |
||||
<div class="coin"> |
||||
<div class="coin-kind"> |
||||
<div class="coin-kind-img"><img :src="coin.src" /></div> |
||||
<span class="coin-kind-txt">{{coin.tokenSymbol}}</span> |
||||
</div> |
||||
<div class="coin-item"> |
||||
<ul> |
||||
<li class="coin-item-list"> |
||||
<span class="coin-item-list-txt">{{langue.amount}}</span> |
||||
<span class="coin-item-list-num">{{coin.balance}}</span> |
||||
</li> |
||||
<li class="coin-item-list"> |
||||
<span class="coin-item-list-txt">{{langue.freeBalance}}</span> |
||||
<span class="coin-item-list-num">{{coin.freeBalance}}</span> |
||||
</li> |
||||
<li class="coin-item-list"> |
||||
<span class="coin-item-list-txt">{{langue.freezeBalance}}</span> |
||||
<span class="coin-item-list-num">{{coin.freezeBalance}}</span> |
||||
</li> |
||||
<!--<li class="coin-item-list"> |
||||
<span class="coin-item-list-txt">{{langue.valuation}}({{marketData ? marketData.basecoin : 'USDT'}})</span> |
||||
<span class="coin-item-list-num">{{valuation.countCoin}}</span> |
||||
</li> |
||||
<li class="coin-item-list"> |
||||
<span class="coin-item-list-txt">{{langue.valuation}}({{valuation.moneyKey}})</span> |
||||
<span class="coin-item-list-num">{{valuation.countAmount}}</span> |
||||
</li>--> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
|
||||
<!--去交易--> |
||||
<div class="transaction"> |
||||
<h3>{{langue.record}}</h3> |
||||
<div class="transaction-data"> |
||||
<div class="mui-row transaction-data-title"> |
||||
<div class="mui-col-sm-4 mui-col-xs-4">{{langue.amount}}</div> |
||||
<div class="mui-col-sm-4 mui-col-xs-4">{{langue.state}}</div> |
||||
<div class="mui-col-sm-4 mui-col-xs-4 mui-text-right">{{langue.dateTime}}</div> |
||||
</div> |
||||
<div class="record-contorol"> |
||||
<div class="mui-scroll-wrapper"> |
||||
<div id="js-scroll" class=" mui-scroll"> |
||||
<ul class="mui-table-view transaction-data-record"> |
||||
<li class="mui-table-view-cell mui-row js-coin-record" v-for="(row,index) in coinRecord" :data-index="index"> |
||||
<div class="mui-row"> |
||||
<div class="mui-col-sm-4 mui-col-xs-4 mui-ellipsis">{{row.amount | filtAmount}}</div> |
||||
<div class="mui-col-sm-4 mui-col-xs-4">{{row.status | filtStatus}}</div> |
||||
<div class="mui-col-sm-4 mui-col-xs-4 mui-text-right">{{row.createTime || row.timestamp | filtDate}}</div> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div class="btn mui-row" v-if="coin.tokenSymbol != 'DIA' && coin.tokenSymbol != 'TIN'"> |
||||
<div class="mui-col-sm-6 mui-col-xs-6"> |
||||
<div class="btn-recharge" id="btn-recharge">{{langue.addCredit}}</div> |
||||
</div> |
||||
<div class="mui-col-sm-6 mui-col-xs-6"> |
||||
<div class="btn-withdraw" id="btn-withdraw">{{langue.withdrawCoin}}</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
<script type="text/javascript"> |
||||
define('langues', { |
||||
zh_CN: { |
||||
capital: "资产", |
||||
title: "钱包", |
||||
totalBalance: "总额", |
||||
valuation: "估值", |
||||
addCredit: "充值", |
||||
withdrawCoin: "提现", |
||||
freeBalance: "可用余额", |
||||
freezeBalance: "冻结余额", |
||||
succeed: "成功", |
||||
error: "失败", |
||||
dateTime: "时间", |
||||
amount: "数量", |
||||
state: "状态", |
||||
await: "打包中", |
||||
pendingon: "待处理", |
||||
record: "财务记录", |
||||
statusObj: { |
||||
0: "失败", |
||||
1: "成功", |
||||
2: "待处理", |
||||
3: "待处理", |
||||
4: "待处理", |
||||
5: "打包中", |
||||
6: "失败", |
||||
7: "失败", |
||||
} |
||||
}, |
||||
zh_HK: { |
||||
capital: "資產", |
||||
title: "錢包", |
||||
totalBalance: "總額", |
||||
valuation: "估值", |
||||
addCredit: "充值", |
||||
withdrawCoin: "提現", |
||||
freeBalance: "可用余額", |
||||
freezeBalance: "凍結余額", |
||||
succeed: "成功", |
||||
error: "失敗", |
||||
dateTime: "時間", |
||||
amount: "數量", |
||||
state: "狀態", |
||||
await: "打包中", |
||||
pendingon: "待處理", |
||||
record: "財務記錄", |
||||
statusObj: { |
||||
0: "失敗", |
||||
1: "成功", |
||||
2: "待處理", |
||||
3: "待處理", |
||||
4: "待處理", |
||||
5: "打包中", |
||||
6: "失敗", |
||||
7: "失敗", |
||||
} |
||||
}, |
||||
en_US: { |
||||
capital: "Capital", |
||||
title: "Wallet", |
||||
totalBalance: "Total Balance", |
||||
valuation: "Valuation", |
||||
addCredit: "Recharge", |
||||
withdrawCoin: "Withdraw", |
||||
freeBalance: "Free Balance", |
||||
freezeBalance: "Freeze Balance", |
||||
succeed: "Success", |
||||
error: "ERROR", |
||||
dateTime: "Date", |
||||
amount: "Amount", |
||||
state: "State", |
||||
await: "Await", |
||||
pendingon: "Pendingon", |
||||
record: "Financial record", |
||||
statusObj: { |
||||
0: "ERROR", |
||||
1: "Success", |
||||
2: "Pendingon", |
||||
3: "Pendingon", |
||||
4: "Pendingon", |
||||
5: "Await", |
||||
6: "ERROR", |
||||
7: "ERROR", |
||||
} |
||||
} |
||||
}) |
||||
</script> |
||||
<script type="text/javascript"> |
||||
require(['mui', 'app', 'Vue', 'walletApi', 'langues', 'muiPullToRefresh', 'muiPullToRefreshMaterial'], function(mui, app, Vue, walletApi, langues) { |
||||
var langue = langues[app.getLanguageLocalStorage()]; |
||||
var dataInfo = new Vue({ |
||||
el: "#js-data-info", |
||||
data: { |
||||
langue: langue, |
||||
coin: {}, // 币种信息 |
||||
coinRecord: [], // 币种记录 |
||||
marketData: {}, // 行情数据 |
||||
valuation: { |
||||
countCoin: "0.000000", // 估值 |
||||
countAmount: "0.000000", //估值多少币种 |
||||
moneyKey: app.getExchangeRateLocalStorage() |
||||
} |
||||
}, |
||||
filters: { |
||||
filtAmount: function(amount) { |
||||
return app.formatValue(amount); |
||||
}, |
||||
filtDate: function(date) { |
||||
return date.substring(0, 10); |
||||
}, |
||||
filtStatus: function(val) { |
||||
return dataInfo.langue.statusObj[val]; |
||||
}, |
||||
filetWalletType: function(val) { |
||||
if(Object.is("CCT", val)) { |
||||
return "币币钱包"; |
||||
} |
||||
if(Object.is("C2C", val)) { |
||||
return "法币钱包"; |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
dataInfo.$nextTick(function() { |
||||
mui.plusReady(function() { |
||||
var currentWin = plus.webview.currentWebview() |
||||
dataInfo.coin = currentWin.coin; // 获取币种信息 |
||||
dataInfo.marketData = currentWin.marketData; // 获取行情数据 |
||||
valuationFun(dataInfo.marketData); |
||||
let deceleration = mui.os.ios ? 0.003 : 0.0009; // 阻尼系数 |
||||
mui('.mui-scroll-wrapper').scroll({ |
||||
bounce: false, |
||||
indicators: false, //是否显示滚动条 |
||||
deceleration: deceleration |
||||
}); |
||||
mui('.mui-content').pullToRefresh({ |
||||
down: { |
||||
callback: function() { |
||||
var self = this; |
||||
record(); |
||||
walletApi.getWallet({ |
||||
walletType: dataInfo.coin.walletType, |
||||
moduleType: dataInfo.coin.moduleType, |
||||
tokenAddr: dataInfo.coin.tokenAddr |
||||
}, |
||||
function(data) { |
||||
dataInfo.coin = data; |
||||
valuationFun(dataInfo.marketData); |
||||
}) |
||||
setTimeout(function() { |
||||
// 关闭下拉加载圈 |
||||
self.endPullDownToRefresh(); |
||||
}, 2000); |
||||
} |
||||
} |
||||
}); |
||||
record(); |
||||
|
||||
function record() { |
||||
walletApi.getWalletRecord({ |
||||
walletType: dataInfo.coin.walletType, |
||||
moduleType: dataInfo.coin.moduleType, |
||||
tokenAddr: dataInfo.coin.tokenAddr, |
||||
pageNum: 0, |
||||
pageSize: 9999 |
||||
}, |
||||
function(data) { |
||||
|
||||
dataInfo.coinRecord = data; |
||||
}); |
||||
|
||||
} |
||||
|
||||
// 记录页面监听 |
||||
mui(".transaction-data-record").on("tap", "li", function() { |
||||
var index = this.getAttribute('data-index'); |
||||
app.openWin('recharge_record.html', 'recharge_record.html', {}, { |
||||
coinRecord: dataInfo.coinRecord[index], |
||||
addr: dataInfo.coin.addr || "" |
||||
}); |
||||
}); |
||||
|
||||
// 提币点击事件 |
||||
document.getElementById('btn-withdraw').addEventListener('tap', function() { |
||||
app.openWin('withdraw.html', 'withdraw.html', '', { |
||||
index: dataInfo.coin.coinIndex, |
||||
coin: dataInfo.coin |
||||
}); |
||||
|
||||
}); |
||||
// 充值点击事件 |
||||
document.getElementById('btn-recharge').addEventListener('tap', function() { |
||||
app.openWin('recharge.html', 'recharge.html', '', { |
||||
index: dataInfo.coin.coinIndex, |
||||
coin: dataInfo.coin |
||||
}); |
||||
}); |
||||
// 国际化统一方法 |
||||
window.addEventListener('switchLangueData', function(e) { |
||||
dataInfo.langue = langues[e.detail]; |
||||
}); |
||||
|
||||
// 钱包数据更新的监听 |
||||
window.addEventListener('walletSaveEvent', function(e) { |
||||
record(); |
||||
walletApi.getCCTWallet({ |
||||
walletType: dataInfo.coin.walletType, |
||||
moduleType: dataInfo.coin.moduleType, |
||||
tokenAddr: dataInfo.coin.tokenAddr |
||||
}, |
||||
function(data) { |
||||
dataInfo.coin = data; |
||||
}); |
||||
}); |
||||
}) |
||||
|
||||
/** |
||||
* 估值方法 |
||||
* @param {Object} data 行情数据 |
||||
*/ |
||||
function valuationFun(data) { |
||||
if(data == null) return; |
||||
var coinKey = data.baseCoin; // 当前兑换币种 |
||||
var money = app.getExchangeRateLocalStorage(); |
||||
var moneyKey = app.getExchangeRateLocalStorage().toLowerCase() + "Amount"; // 获取系统币种Key值; |
||||
var coinName = dataInfo.coin.tokenSymbol; |
||||
var countCoin = 0; |
||||
var countAmount = 0; |
||||
var moneyExchange = 0; // 汇率 |
||||
moneyExchange = parseFloat(data.marketObj[moneyKey]); |
||||
countCoin += parseFloat(dataInfo.coin.balance) * parseFloat(data.marketObj.amount); |
||||
countAmount = app.formatValue(parseFloat(countCoin) * moneyExchange); |
||||
dataInfo.valuation.countAmount = app.formatValue(countAmount); |
||||
dataInfo.valuation.countCoin = app.formatValue(countCoin); |
||||
dataInfo.valuation.moneyKey = app.getExchangeRateLocalStorage(); |
||||
} |
||||
}) |
||||
|
||||
}) |
||||
</script> |
||||
|
||||
</html> |
@ -1,213 +0,0 @@ |
||||
<!doctype html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title></title> |
||||
<meta name="apple-mobile-web-app-capable" content="yes"> |
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> |
||||
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> |
||||
<link href="../../../lib/css/basic.css" rel="stylesheet" /> |
||||
<link href="../css/transfer.css" rel="stylesheet" /> |
||||
<script src="../../../lib/js/rem-layout.js"></script> |
||||
<script src="../../../lib/js/rem-layout.js"></script> |
||||
<script src="../../../lib/js/require2.1.11.js"></script> |
||||
<script type="text/javascript" src="../js/base.config.js"></script> |
||||
</head> |
||||
<style> |
||||
[v-cloak] { |
||||
display: none; |
||||
} |
||||
|
||||
.mui-badge1 { |
||||
padding: 0px; |
||||
width: 65%; |
||||
float: right; |
||||
line-height: 42px; |
||||
font-size: 14px; |
||||
} |
||||
|
||||
.mui-input-group:before, |
||||
.mui-input-group:after { |
||||
height: 0px; |
||||
} |
||||
|
||||
.mui-input-group .mui-input-row { |
||||
height: 50px; |
||||
padding-top: 10px; |
||||
} |
||||
|
||||
.mui-navigate-right:after, |
||||
.mui-push-right:after { |
||||
top: 30px; |
||||
} |
||||
|
||||
.mui-input-row .mui-input-clear~.mui-icon-clear { |
||||
top: 20px; |
||||
} |
||||
</style> |
||||
|
||||
<body> |
||||
<header class="mui-bar mui-bar-nav"> |
||||
<a class="mui-icon mui-icon-back mui-action-back mui-icon-left-nav"></a> |
||||
<h1 class="mui-title" data-text="extract">划转</h1> |
||||
</header> |
||||
<div class="mui-content" id="js-data-info" style="margin-top: 20px;" v-cloak> |
||||
<div class="transfer-money" style="border-radius: 10px;padding-top: .4rem;"> |
||||
<div class="account-left"><label data-text="from">从</label> |
||||
<span class="account1">{{txData.fromType | filetWalletType}}</span><br /> |
||||
<span id="money1" class="money1">{{coins,txData.fromType,txData.coin.coinName | getFreeBalance}} {{txData.coin.coinName}}</span> |
||||
</div> |
||||
<div class="icon-transfer" id="js-tx-btn"><img src="../img/huazhuan.png" /></div> |
||||
<div class="account-right"><label data-text="to">到</label> |
||||
<span class="account2" data-text="escrow_account">{{txData.toAddr | filetWalletType}}</span><br /> |
||||
<span id="money2" class="money2">{{coins,txData.toAddr,txData.coin.coinName | getFreeBalance}} {{txData.coin.coinName}}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<form class="mui-input-group" style="padding: 0.1rem;margin-top: 40px;"> |
||||
<div class="mui-input-row"> |
||||
<label class="mui-text-center">币种</label> |
||||
<a class="mui-navigate-right"> |
||||
<span class="mui-badge1"> |
||||
<select class="mui-h5" style="margin:auto; color:#000;" v-model="txData.coin.coinName"> |
||||
<option v-for="coin in coinMap" :value="coin.coinName">{{coin.coinName}}</option> |
||||
</select> |
||||
</span> |
||||
</a> |
||||
</div> |
||||
<div class="mui-input-row"> |
||||
<label class="mui-text-center">数量</label> |
||||
<input type="number" class="mui-input-clear" id="js-amount" placeholder="请输入划转数量" :data-free="coins,txData.fromType,txData.coin.coinName | getFreeBalance"> |
||||
</div> |
||||
</form> |
||||
|
||||
<div style="margin-top: 50px; padding: 0 20px;"> |
||||
<button id="js-submit" type="button" class="mui-btn mui-btn-primary mui-btn-block" data-text="confirm">确定</button> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
</body> |
||||
<script> |
||||
var coinMap = { |
||||
USDT: { |
||||
coinName: "USDT", |
||||
moduleType: "btc" |
||||
}, |
||||
DIA: { |
||||
coinName: "DIA", |
||||
moduleType: "eth" |
||||
}, |
||||
ETH: { |
||||
coinName: "ETH", |
||||
moduleType: "eth" |
||||
}, |
||||
TIN: { |
||||
coinName: "TIN", |
||||
moduleType: "eth" |
||||
} |
||||
} |
||||
require(['Vue', 'app', 'mui', 'walletApi'], function(Vue, app, mui, walletApi) { |
||||
var dataInfo = new Vue({ |
||||
el: "#js-data-info", |
||||
data: { |
||||
coins: { |
||||
CCT: app.getCoinWalletInfoLocalStorage(), |
||||
C2C: app.getC2CCoinWalletInfoLocalStorage() |
||||
}, |
||||
coinMap: coinMap, |
||||
txData: { |
||||
fromType: "CCT", //币币钱包 |
||||
toAddr: "C2C", //法币钱包 |
||||
coin: coinMap.USDT, //币种名称 |
||||
amount: "", |
||||
} |
||||
}, |
||||
filters: { |
||||
getFreeBalance: function(data, type, coinName) { |
||||
if(data == null) return 0; |
||||
var coin = data[type]; |
||||
if(coin == null) return 0; |
||||
for(var i = 0; i < coin.length; i++) { |
||||
if(Object.is(coin[i].tokenSymbol, coinName)) { |
||||
return coin[i].freeBalance; |
||||
} |
||||
} |
||||
return 0; |
||||
}, |
||||
filetWalletType(val) { |
||||
if(Object.is("CCT", val)) { |
||||
return "币币钱包"; |
||||
} |
||||
if(Object.is("C2C", val)) { |
||||
return "法币钱包"; |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
|
||||
Vue.nextTick(function() { |
||||
document.getElementById('js-tx-btn').addEventListener('tap', function() { |
||||
var type; |
||||
type = dataInfo.txData.toAddr; |
||||
dataInfo.txData.toAddr = dataInfo.txData.fromType; |
||||
dataInfo.txData.fromType = type; |
||||
}) |
||||
// 提现input框的监听事件 |
||||
document.getElementById('js-amount').addEventListener('input', function() { |
||||
var inputDom = this; |
||||
var _decimals = 6; |
||||
var value = walletApi.formatValue(inputDom.value,_decimals) ; |
||||
var freeBalance = inputDom.getAttribute('data-free'); |
||||
if(value != '' && parseFloat(value) > parseFloat(freeBalance)) { |
||||
value = freeBalance; |
||||
} |
||||
if(value+"".indexOf(".")>=0){ |
||||
inputDom.value = ""; |
||||
} |
||||
inputDom.value = value; |
||||
dataInfo.txData.amount = value; |
||||
}) |
||||
|
||||
document.getElementById('js-submit').addEventListener('tap', function() { |
||||
if(dataInfo.txData.amount <= 0 || dataInfo.txData.amount == '') { |
||||
mui.toast("请输入划转金额!"); |
||||
return; |
||||
} |
||||
mui.confirm("是否确定执行此操作?", "操作提示", ["取消", "确认"], function(e) { |
||||
if(e.index == 1) { |
||||
var data = dataInfo.txData; |
||||
data.coinName = data.coin.coinName; |
||||
data.moduleType = dataInfo.coinMap[data.coin.coinName].moduleType; |
||||
walletApi.handleTransfer(data, function(res) { |
||||
saveWallet(); |
||||
if(res.code == 200) { |
||||
mui.back(); |
||||
} |
||||
mui.toast(res.msg); |
||||
}) |
||||
} else {} |
||||
|
||||
}) |
||||
}) |
||||
}) |
||||
|
||||
saveWallet(); // 更新钱包余额 |
||||
|
||||
/** |
||||
* 更新钱包余额 |
||||
*/ |
||||
function saveWallet() { |
||||
walletApi.getCCTWallets(function(data) { |
||||
dataInfo.coins.CCT = data || {}; |
||||
}) |
||||
walletApi.getC2CWallets(function(data) { |
||||
dataInfo.coins.C2C = data || {}; |
||||
}) |
||||
} |
||||
}) |
||||
</script> |
||||
|
||||
</html> |
@ -1,280 +0,0 @@ |
||||
<!doctype html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>钱包</title> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> |
||||
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> |
||||
<!--引入公共样式--> |
||||
<link href="../../../lib/css/basic.css" rel="stylesheet" /> |
||||
<link href="../css/wallet.css" rel="stylesheet" /> |
||||
<script type="text/javascript" src="../../../lib/js/vue.min.js"></script> |
||||
<script src="../../../lib/js/rem-layout.js"></script> |
||||
<script type="text/javascript" src="../../../lib/js/mui.min.js"></script> |
||||
<script type="text/javascript" src="../../../lib/js/app.js"></script> |
||||
<script src="../../../lib/js/require2.1.11.js"></script> |
||||
<script type="text/javascript" src="../js/base.config.js"></script> |
||||
</head> |
||||
<style> |
||||
[v-cloak] { |
||||
display: none; |
||||
} |
||||
|
||||
.mui-bar-nav~.mui-content .mui-slider.mui-fullscreen { |
||||
top: 1.1rem; |
||||
} |
||||
</style> |
||||
|
||||
<body> |
||||
<div id="js-data-info" v-cloak> |
||||
<header class="mui-bar mui-bar-nav"> |
||||
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> |
||||
<h1 class="mui-title">{{langue.title}}</h1> |
||||
</header> |
||||
<div class="mui-content"> |
||||
<div id="slider" class="mui-slider mui-fullscreen"> |
||||
<div class="mui-slider-group"> |
||||
<!--全部订单--> |
||||
<div class="mui-slider-item mui-control-content" v-for="row in wallets"> |
||||
<div class="top-bg" style="height: 2.2rem;"> |
||||
<div class="valuation"> |
||||
<div class="account">{{row | filetWalletType}}</div> |
||||
<span class="valuation-txt">{{langue.valuation}}({{valuation.baseCoin}})</span> |
||||
<span class="valuation-price">{{valuation.countCoin}}</span> |
||||
<span class="valuation-rate">≈{{valuation.countAmount}} {{valuation.moneyKey}}</span> |
||||
</div> |
||||
<!--<div class="btn"> |
||||
<div class="btn-recharge" id="btn-recharge">{{langue.addCredit}}</div> |
||||
<div class="btn-withdraw" id="btn-withdraw">{{langue.withdrawCoin}}</div> |
||||
</div>--> |
||||
</div> |
||||
<!--币种选择--> |
||||
<div class="coin"> |
||||
<ul class="coin-ul" > |
||||
<li class="coin-item-list" v-for="(coin,index) in coins[row]" :data-index="index" :data-type="row"> |
||||
<div class="coin-kind"> |
||||
<div class="coin-kind-img"><img :src="coin.src" /></div> |
||||
<span class="coin-kind-txt">{{coin.tokenSymbol}}</span> |
||||
</div> |
||||
<div class="coin-situation"> |
||||
<span class="coin-remain">{{langue.free}}:{{coin.freeBalance}}</span> |
||||
<span class="coin-reeze">{{langue.freeze}}:{{coin.freezeBalance}}</span> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
<script type="text/javascript"> |
||||
define('langues', { |
||||
zh_CN: { |
||||
title: "钱包", |
||||
valuation: "估值", |
||||
addCredit: "充值", |
||||
withdrawCoin: "提现", |
||||
free: "可用", |
||||
freeze: "冻结", |
||||
walletTypeC2C: "法币交易", |
||||
walletTypeCCT: "币币交易", |
||||
}, |
||||
zh_HK: { |
||||
title: "錢包", |
||||
valuation: "估值", |
||||
addCredit: "充值", |
||||
withdrawCoin: "提現", |
||||
free: "可用", |
||||
freeze: "凍結" |
||||
}, |
||||
en_US: { |
||||
title: "Wallet", |
||||
valuation: "Valuation", |
||||
addCredit: "Recharge", |
||||
withdrawCoin: "Withdraw", |
||||
free: "Free", |
||||
freeze: "Freeze" |
||||
} |
||||
|
||||
}) |
||||
</script> |
||||
<script type="text/javascript"> |
||||
mui.init({ |
||||
swipeBack: false |
||||
}); |
||||
|
||||
var dataInfo = new Vue({ |
||||
el: "#js-data-info", |
||||
data: { |
||||
langue: {}, |
||||
wallets: ["CCT" , "C2C"], |
||||
coins: { |
||||
CCT: app.getCoinWalletInfoLocalStorage(), |
||||
C2C: app.getC2CCoinWalletInfoLocalStorage() |
||||
}, |
||||
valuation: { |
||||
countCoin: "0.00000000", // 估值 |
||||
countAmount: "0.00", //估值多少币种 |
||||
moneyKey: app.getExchangeRateLocalStorage(), |
||||
baseCoin: "USDT" |
||||
}, |
||||
marketData: {}, |
||||
marketList: {} |
||||
}, |
||||
filters:{ |
||||
filetWalletType(val){ |
||||
if(Object.is("CCT",val)){ |
||||
return "法币钱包"; |
||||
} |
||||
if(Object.is("C2C",val)){ |
||||
return "币币钱包"; |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
require(['walletApi', 'langues', 'muiPullToRefresh', 'muiPullToRefreshMaterial'], function(walletApi, langues) { |
||||
dataInfo.langue = langues[app.getLanguageLocalStorage()]; |
||||
dataInfo.$nextTick(function() { |
||||
mui.init(); |
||||
let deceleration = mui.os.ios ? 0.003 : 0.0009; // 阻尼系数 |
||||
mui('.mui-scroll-wrapper').scroll({ |
||||
bounce: false, |
||||
indicators: true, //是否显示滚动条 |
||||
deceleration: deceleration |
||||
}); |
||||
mui('.mui-content').pullToRefresh({ |
||||
down: { |
||||
callback: function() { |
||||
var self = this; |
||||
walletApi.voidServieWalletPass(); |
||||
// 发送用户信息查询请求 |
||||
walletApi.getCCTWallets(function(data) { |
||||
dataInfo.coins.CCT = data; |
||||
coinsEvenPush(data); |
||||
valuationFun(dataInfo.marketList, walletApi.walletType.CCT); |
||||
}) |
||||
walletApi.getC2CWallets(function(data) { |
||||
dataInfo.coins.C2C = data; |
||||
coinsEvenPush(data); |
||||
valuationFun(dataInfo.marketList, walletApi.walletType.C2C); |
||||
}) |
||||
setTimeout(function() { |
||||
// 关闭下拉加载圈 |
||||
self.endPullDownToRefresh(); |
||||
}, 3000); |
||||
} |
||||
} |
||||
}); |
||||
//代币资产页面监听 |
||||
mui(".coin-ul").on("tap", "li", function() { |
||||
var index = this.getAttribute('data-index'); |
||||
var type = this.getAttribute('data-type'); |
||||
app.openWin('assets.html', 'assets.html', {}, { |
||||
coin: dataInfo.coins[type][index], |
||||
marketData: dataInfo.marketData[dataInfo.coins[type][index].tokenSymbol] |
||||
}); |
||||
}); |
||||
// // 提币点击事件 |
||||
// document.getElementById('btn-withdraw').addEventListener('tap', function() { |
||||
// app.openWin('withdraw.html', 'withdraw.html'); |
||||
// }); |
||||
// // 充值点击事件 |
||||
// document.getElementById('btn-recharge').addEventListener('tap', function() { |
||||
// app.openWin('recharge.html', 'recharge.html'); |
||||
// }); |
||||
walletApi.getCCTWallets(function(data) { |
||||
dataInfo.coins.CCT = data; |
||||
coinsEvenPush(data); |
||||
valuationFun(dataInfo.marketList, walletApi.walletType.CCT); |
||||
}) |
||||
walletApi.getC2CWallets(function(data) { |
||||
dataInfo.coins.C2C = data; |
||||
coinsEvenPush(data); |
||||
valuationFun(dataInfo.marketList, walletApi.walletType.C2C); |
||||
}) |
||||
|
||||
walletApi.voidServieWalletPass(); |
||||
// 国际化统一方法 |
||||
window.addEventListener('switchLangueData', function(e) { |
||||
dataInfo.langue = langues[e.detail]; |
||||
}); |
||||
/** |
||||
* 监听获取行情列表 |
||||
*/ |
||||
window.addEventListener("marketList", function(event) { |
||||
var marketList = event.detail; |
||||
valuationFun(marketList, "CCT"); |
||||
}); |
||||
|
||||
// 钱包数据更新的监听 |
||||
window.addEventListener('walletSaveEvent', function(e) { |
||||
walletApi.voidServieWalletPass(); |
||||
walletApi.getCCTWallets(function(data) { |
||||
dataInfo.coins.CCT = data; |
||||
coinsEvenPush(data); |
||||
valuationFun(dataInfo.marketList, walletApi.walletType.CCT); |
||||
}) |
||||
walletApi.getC2CWallets(function(data) { |
||||
dataInfo.coins.C2C = data; |
||||
coinsEvenPush(data); |
||||
valuationFun(dataInfo.marketList, walletApi.walletType.C2C); |
||||
}) |
||||
|
||||
}); |
||||
|
||||
function valuationFun(data, type) { |
||||
if(data == null) return; |
||||
var coinKey = dataInfo.valuation.baseCoin; // 当前兑换币种 |
||||
var money = app.getExchangeRateLocalStorage(); |
||||
var moneyKey = app.getExchangeRateLocalStorage().toLowerCase() + "Amount"; // 获取系统币种Key值; |
||||
var marketData = data[coinKey]; // 获取行情数据 |
||||
if(marketData == null) return; |
||||
var coins = dataInfo.coins[type]; |
||||
var countCoin = 0; |
||||
var countAmount = 0; |
||||
var moneyExchange = 0; // 汇率 |
||||
var isMoneyV = true; |
||||
for(var i = 0; i < coins.length; i++) { |
||||
var coinName = coins[i].tokenSymbol; |
||||
if(coinName in marketData) { |
||||
if(isMoneyV) { |
||||
marketData[coinKey] = {}; |
||||
marketData[coinKey].basecoin = marketData[coinName].basecoin; |
||||
marketData[coinKey].marketObj = JSON.parse(JSON.stringify(marketData[coinName].marketObj)); |
||||
marketData[coinKey].marketObj.amount = 1; |
||||
moneyExchange = parseFloat(marketData[coinName].marketObj[moneyKey]); |
||||
isMoneyV = false; |
||||
} |
||||
countCoin += parseFloat(coins[i].balance) * parseFloat(marketData[coinName].marketObj.amount); |
||||
} else if(coinKey == coinName) { |
||||
countCoin += parseFloat(coins[i].balance); |
||||
} |
||||
} |
||||
countAmount = app.formatValue(parseFloat(countCoin) * moneyExchange); |
||||
dataInfo.valuation.countAmount = countAmount; |
||||
dataInfo.valuation.countCoin = app.formatValue(countCoin); |
||||
dataInfo.valuation.moneyKey = app.getExchangeRateLocalStorage(); |
||||
dataInfo.marketData = marketData; |
||||
dataInfo.marketList = data; |
||||
} |
||||
/** |
||||
* 币种信息推送 |
||||
* @param {Array} coins |
||||
*/ |
||||
function coinsEvenPush(coins) { |
||||
if(coins == null || coins.length == 0) return; |
||||
var coinMap = {}; |
||||
for(var i = 0; i < coins.length; i++) { |
||||
coinMap[coins[i].tokenSymbol] = coins[i]; |
||||
} |
||||
mui.fire(plus.webview.getWebviewById("html/cct/html/cct_index.html"), "saveCoinsEven", coinMap); |
||||
} |
||||
}) |
||||
}) |
||||
</script> |
||||
|
||||
</html> |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue