888 lines
31 KiB
JavaScript
888 lines
31 KiB
JavaScript
|
|
|||
|
import { getCheck,getAddBalace, getAddMinerAccount, getAccountList, getDelMinerAccount, getMinerAccountBalance, getCheckAccount,getCheckBalance,getIfBind } from "../../../api/personalCenter"
|
|||
|
import {getAccountGradeList } from "../../../api/login"
|
|||
|
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
activeName: "mining",
|
|||
|
dialogVisible: false,
|
|||
|
labelPosition: "top",
|
|||
|
formLabelAlign: {
|
|||
|
|
|||
|
},
|
|||
|
currencyList: [
|
|||
|
// {
|
|||
|
// value: "nexa",
|
|||
|
// label: "nexa",
|
|||
|
// img: require("../../../assets/img/currency-nexa.png"),
|
|||
|
// imgUrl: `${this.$baseApi}img/nexa.png`,
|
|||
|
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "grs",
|
|||
|
// label: "grs",
|
|||
|
// // img: require("../assets/images/grs.png"),
|
|||
|
// imgUrl: `${this.$baseApi}img/grs.svg`,
|
|||
|
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "mona",
|
|||
|
// label: "mona",
|
|||
|
// imgUrl: `${this.$baseApi}img/mona.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb_skein",
|
|||
|
// label: "dgb-skein-pool1",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb_qubit",
|
|||
|
// label: "dgb-qubit-pool1",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb_odo",
|
|||
|
// label: "dgb-odocrypt-pool1",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb2_odo",
|
|||
|
// label: "dgb-odocrypt-pool2",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb_qubit_a10",
|
|||
|
// label: "dgb-qubit-pool2",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb_skein_a10",
|
|||
|
// label: "dgb-skein-pool2",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
// {
|
|||
|
// value: "dgb_odo_b20",
|
|||
|
// label: "dgb-odoscrypt-pool3",
|
|||
|
// imgUrl: `${this.$baseApi}img/dgb.svg`,
|
|||
|
// },
|
|||
|
|
|||
|
],
|
|||
|
walletDialogVisible: false,
|
|||
|
accountList: [
|
|||
|
|
|||
|
// {
|
|||
|
// addr: "sdijfsjdfdiougujidododododododododod44444444444444444444444dodododododododododoufsohifsfhifhsidi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remark: "备注信息jiojgddddddddddddddddddddddddddddddddddddd测试",
|
|||
|
// },
|
|||
|
// {
|
|||
|
// addr: "sdijfsdsiofjsiofjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remark: "备注信息测试",
|
|||
|
// },
|
|||
|
// {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// },
|
|||
|
// {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remarks: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remark: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remark: "备注信息测试",
|
|||
|
// }, {
|
|||
|
// account: "sdijf6656fjsdifi",
|
|||
|
// miningPool: "dgb-skein-pool1",
|
|||
|
// currency: "dgb",
|
|||
|
// remark: "备注信息测试",
|
|||
|
// },
|
|||
|
],
|
|||
|
params: {
|
|||
|
account: "",
|
|||
|
miningPool: "",
|
|||
|
currency: "",
|
|||
|
remarks: "",
|
|||
|
},
|
|||
|
checked: "",
|
|||
|
checkAll: false,
|
|||
|
checkedItems: [],
|
|||
|
isIndeterminate: true,
|
|||
|
selectedIndices: [],
|
|||
|
WalletAddressParams: {
|
|||
|
ma: "",
|
|||
|
balance: "",
|
|||
|
coin: "",
|
|||
|
active: "0",
|
|||
|
amount: "0",
|
|||
|
remarks:"",
|
|||
|
gCode:""
|
|||
|
},
|
|||
|
AccountParams: {
|
|||
|
coin: "",
|
|||
|
ma: "",
|
|||
|
remarks: "",
|
|||
|
balance:"",
|
|||
|
code:"",
|
|||
|
|
|||
|
},
|
|||
|
options: [
|
|||
|
|
|||
|
{
|
|||
|
value: "1",
|
|||
|
label: "personal.no"
|
|||
|
},
|
|||
|
{
|
|||
|
value: "0",
|
|||
|
label: "personal.yes"
|
|||
|
},
|
|||
|
],
|
|||
|
MiningLoading: false,
|
|||
|
paymentSettingsData: {
|
|||
|
ma: "",
|
|||
|
balance: "",
|
|||
|
active: "",
|
|||
|
amount: "",
|
|||
|
},
|
|||
|
deleteAccountDialog: false,
|
|||
|
deleteAccount: "",
|
|||
|
confirmBindingLoading:false,
|
|||
|
amountDisabled:false,
|
|||
|
isItBound:false,
|
|||
|
securityLoading:false,
|
|||
|
deleteGCode:"",
|
|||
|
dialogVerification:false,
|
|||
|
addMinerLoading:false,
|
|||
|
screenCurrency:"",
|
|||
|
newAccountList:[],
|
|||
|
quotaList:[
|
|||
|
|
|||
|
{
|
|||
|
value:"nexa",
|
|||
|
amount:10000,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"grs",
|
|||
|
amount:1,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"mona",
|
|||
|
amount:1,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"dgbs",
|
|||
|
amount:1,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"dgbq",
|
|||
|
amount:1,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"dgbo",
|
|||
|
amount:1,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"rxd",
|
|||
|
amount:100,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"enx",
|
|||
|
amount:5000,
|
|||
|
|
|||
|
},
|
|||
|
{
|
|||
|
value:"alph",
|
|||
|
amount:1,
|
|||
|
|
|||
|
},
|
|||
|
|
|||
|
],
|
|||
|
amount:1,
|
|||
|
lang: this.$i18n.locale,
|
|||
|
}
|
|||
|
},
|
|||
|
|
|||
|
mounted() {
|
|||
|
|
|||
|
|
|||
|
|
|||
|
this.fetchIfBind()
|
|||
|
|
|||
|
this.fetchAccountList()
|
|||
|
|
|||
|
this.currencyList = JSON.parse(localStorage.getItem("currencyList"))
|
|||
|
window.addEventListener("setItem", () => {
|
|||
|
this.currencyList = JSON.parse(localStorage.getItem("currencyList"))
|
|||
|
});
|
|||
|
if (this.dialogVisible) {
|
|||
|
this.$refs.select.$el.children[0].children[0].setAttribute('style', "background:#ffff;background-size: 20PX 20PX;color:#333;padding-left: 30PX;");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
},
|
|||
|
methods: {
|
|||
|
async fetchIfBind(params){
|
|||
|
this.securityLoading = true
|
|||
|
const data = await getIfBind(params)
|
|||
|
if (data && data.code === 200) {
|
|||
|
if (data.data) {
|
|||
|
this.isItBound =true
|
|||
|
}else if(!data.data){
|
|||
|
this.isItBound =false
|
|||
|
}
|
|||
|
|
|||
|
if (this.$route.query.id && this.$route.query.coin && this.isItBound) {
|
|||
|
this.fetchMinerAccountBalance({ id: this.$route.query.id })
|
|||
|
this.WalletAddressParams.coin =this.$route.query.coin
|
|||
|
this.WalletAddressParams.ma =this.$route.query.ma
|
|||
|
|
|||
|
}else if(this.$route.query.id && this.$route.query.coin && !this.isItBound){
|
|||
|
this.dialogVerification=true
|
|||
|
}
|
|||
|
}
|
|||
|
this.securityLoading = false
|
|||
|
},
|
|||
|
async fetchCheck(params){
|
|||
|
this.addMinerLoading =true
|
|||
|
const data = await getCheck(params)
|
|||
|
if (!data) {
|
|||
|
this.addMinerLoading =false
|
|||
|
|
|||
|
}
|
|||
|
if (data && data.code === 200) {
|
|||
|
this.fetchAddMinerAccount(this.AccountParams)
|
|||
|
}else if(data.code === 801){//账号不可用
|
|||
|
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.duplicateAccount`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
this.addMinerLoading =false
|
|||
|
}else if(data.code === 802){//钱包不可用
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.invalidAddress`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
this.addMinerLoading =false
|
|||
|
}
|
|||
|
|
|||
|
},
|
|||
|
|
|||
|
async fetchCheckBalance(params){
|
|||
|
this.confirmBindingLoading =true
|
|||
|
const data = await getCheckBalance(params)
|
|||
|
if (data && data.data) {
|
|||
|
this.fetchWalletAddress(this.WalletAddressParams)
|
|||
|
}else{
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.invalidAddress`),
|
|||
|
showClose: true,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
}
|
|||
|
this.confirmBindingLoading =false
|
|||
|
},
|
|||
|
async fetchAccountGradeList(){
|
|||
|
const data = await getAccountGradeList()
|
|||
|
this.$addStorageEvent(1,`miningAccountList`,JSON.stringify(data.data))
|
|||
|
},
|
|||
|
|
|||
|
|
|||
|
async fetchCheckAccount(params) {
|
|||
|
const data = await getCheckAccount(params)
|
|||
|
if (data && data.code == 200) {
|
|||
|
if (data.data) {
|
|||
|
this.fetchAddMinerAccount(this.AccountParams)
|
|||
|
|
|||
|
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.duplicateAccount`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
async fetchMinerAccountBalance(params) {
|
|||
|
this.MiningLoading = true
|
|||
|
const data = await getMinerAccountBalance(params)
|
|||
|
if (data && data.code == 200) {
|
|||
|
this.walletDialogVisible = true
|
|||
|
this.paymentSettingsData = data.data
|
|||
|
}
|
|||
|
|
|||
|
if ( this.paymentSettingsData.active == `1` || this.paymentSettingsData.active == `否`|| this.paymentSettingsData.active == `No`) {
|
|||
|
this.amountDisabled=true
|
|||
|
|
|||
|
}else{
|
|||
|
this.amountDisabled=false
|
|||
|
}
|
|||
|
// this.paymentSettingsData.active = this.paymentSettingsData.active ? this.paymentSettingsData.active : `0`
|
|||
|
this.paymentSettingsData.active = this.paymentSettingsData.active==`1` ? this.$t(`personal.no`) :this.$t(`personal.yes`)
|
|||
|
|
|||
|
this.paymentSettingsData.amount = this.paymentSettingsData.amount ? this.paymentSettingsData.amount : `0`
|
|||
|
this.MiningLoading = false
|
|||
|
},
|
|||
|
async fetchDelMinerAccount(params) {
|
|||
|
this.MiningLoading = true
|
|||
|
const data = await getDelMinerAccount(params)
|
|||
|
|
|||
|
if (data && data.code == 200) {
|
|||
|
this.fetchAccountGradeList()
|
|||
|
this.fetchAccountList()
|
|||
|
this.checkedItems = []
|
|||
|
this.deleteAccountDialog = false
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
this.MiningLoading = false
|
|||
|
},
|
|||
|
async fetchAccountList(params) {
|
|||
|
this.MiningLoading = true
|
|||
|
const data = await getAccountList(params)
|
|||
|
this.accountList = data.data
|
|||
|
console.log("请求成功,",data);
|
|||
|
this.newAccountList = this.accountList
|
|||
|
this.$addStorageEvent(1, `accountList`, JSON.stringify(this.accountList))
|
|||
|
|
|||
|
this.MiningLoading = false
|
|||
|
|
|||
|
},
|
|||
|
|
|||
|
async fetchWalletAddress(params) {
|
|||
|
const data = await getAddBalace(params)
|
|||
|
if (data && data.code == 200) {
|
|||
|
this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: "success",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
this.walletDialogVisible = false
|
|||
|
for (const key in this.WalletAddressParams) {
|
|||
|
this.WalletAddressParams[key]=""
|
|||
|
}
|
|||
|
}
|
|||
|
this.fetchAccountList()
|
|||
|
},
|
|||
|
//添加挖矿账户
|
|||
|
async fetchAddMinerAccount(params) {
|
|||
|
this.addMinerLoading =true
|
|||
|
const data = await getAddMinerAccount(params)
|
|||
|
if (data && data.code == 200) {
|
|||
|
this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: "success",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
this.dialogVisible = false
|
|||
|
this.AccountParams.ma=""
|
|||
|
this.AccountParams.coin=""
|
|||
|
this.AccountParams.remarks =""
|
|||
|
this.AccountParams.balance =""
|
|||
|
// this.fetchAccountList()
|
|||
|
// this.fetchAccountGradeList()
|
|||
|
}
|
|||
|
|
|||
|
this.fetchAccountList()
|
|||
|
this.fetchAccountGradeList()
|
|||
|
|
|||
|
this.addMinerLoading =false
|
|||
|
},
|
|||
|
handleCheckAllChange(val) {
|
|||
|
|
|||
|
if (val) {
|
|||
|
this.checkedItems = this.accountList.map(item => item.id);
|
|||
|
}else{
|
|||
|
this.checkedItems=[]
|
|||
|
|
|||
|
}
|
|||
|
this.isIndeterminate = false;
|
|||
|
// if (val) {
|
|||
|
// this.checkedItems = this.accountList.map(() => true);
|
|||
|
// this.selectedIndices = this.accountList.map((_, index) => index);
|
|||
|
// } else {
|
|||
|
// this.checkedItems = this.accountList.map(() => false);
|
|||
|
// this.selectedIndices = [];
|
|||
|
// }
|
|||
|
|
|||
|
// this.isIndeterminate = false;
|
|||
|
// -------------------------------------
|
|||
|
|
|||
|
|
|||
|
// if (val) {
|
|||
|
// this.checkedItems = this.accountList.map((_, index) => index !== 0);
|
|||
|
// this.selectedIndices = this.accountList.map((_, index) => index !== 0 ? index : null).filter(Boolean);
|
|||
|
// } else {
|
|||
|
// this.checkedItems = this.accountList.map(() => false);
|
|||
|
// this.selectedIndices = [];
|
|||
|
// }
|
|||
|
// this.isIndeterminate = false;
|
|||
|
},
|
|||
|
handleSingleCheckChange(index) {
|
|||
|
if ((this.checkedItems.every((item) => item)) && (this.checkedItems.length == this.accountList.length)) {
|
|||
|
this.checkAll = true
|
|||
|
} else {
|
|||
|
this.checkAll = false
|
|||
|
}
|
|||
|
if (this.checkedItems[index]) {
|
|||
|
this.selectedIndices.push(index);
|
|||
|
} else {
|
|||
|
this.selectedIndices = this.selectedIndices.filter(i => i !== index);
|
|||
|
}
|
|||
|
// ---------------------------
|
|||
|
// if (index === 0) {
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// if (this.checkedItems.every((item, i) => i !== 0 && item) && this.checkedItems.filter((item, i) => i !== 0).length === this.accountList.filter((_, i) => i !== 0).length) {
|
|||
|
// this.checkAll = true;
|
|||
|
// } else {
|
|||
|
// this.checkAll = false;
|
|||
|
// }
|
|||
|
// if (index !== 0 && this.checkedItems[index]) {
|
|||
|
// this.selectedIndices.push(index);
|
|||
|
// } else if (index !== 0) {
|
|||
|
// this.selectedIndices = this.selectedIndices.filter(i => i !== index);
|
|||
|
// }
|
|||
|
// console.log(!this.selectedIndices[0],5656);
|
|||
|
|
|||
|
},
|
|||
|
handelActive(){
|
|||
|
|
|||
|
if (this.paymentSettingsData.active ==0) {
|
|||
|
this.amountDisabled = false
|
|||
|
}else if(this.paymentSettingsData.active ==1){
|
|||
|
this.amountDisabled = true
|
|||
|
}
|
|||
|
},
|
|||
|
|
|||
|
closeDialog(){
|
|||
|
this.walletDialogVisible =false
|
|||
|
this.WalletAddressParams.gCode =""
|
|||
|
},
|
|||
|
addTo() {
|
|||
|
if (this.isItBound) {
|
|||
|
this.dialogVisible = true
|
|||
|
}else{
|
|||
|
this.dialogVerification=true
|
|||
|
}
|
|||
|
|
|||
|
},
|
|||
|
confirmAdd() {
|
|||
|
// this.accountList.push({
|
|||
|
// account: this.params.account,
|
|||
|
// miningPool: this.params.miningPool,
|
|||
|
// currency: this.params.miningPool,
|
|||
|
// remarks: this.params.remarks,
|
|||
|
// })
|
|||
|
if (!this.AccountParams.ma) {
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.accountNumber`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
return
|
|||
|
}
|
|||
|
if (!this.AccountParams.balance) {
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.inputWalletAddress`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
return
|
|||
|
}
|
|||
|
if (!this.AccountParams.coin) {
|
|||
|
this.$message({
|
|||
|
message:this.$t(`personal.selectCurrency`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
if (!this.AccountParams.code && this.isItBound) {
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`personal.gCode`),
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// 账户只能输入字母、数字、下划线,且不能以数字开头,长度不小于4位,不大于24位
|
|||
|
const regexAccount=/^[a-zA-Z_][a-zA-Z0-9_]{3,23}$/
|
|||
|
|
|||
|
const PasswordIsValid = regexAccount.test(this.AccountParams.ma);
|
|||
|
if (!PasswordIsValid) {
|
|||
|
// 如果输入不符合要求,可以根据具体需求给出错误提示或进行其他处理
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.accountFormat`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
this.fetchCheck({ coin: this.AccountParams.coin, ma: this.AccountParams.ma,balance: this.AccountParams.balance})
|
|||
|
// this.fetchCheckAccount({ coin: this.AccountParams.coin, ma: this.AccountParams.ma })
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
},
|
|||
|
handelAddClose(){
|
|||
|
for (let key in this.AccountParams) {
|
|||
|
this.AccountParams[key] = "";
|
|||
|
}
|
|||
|
this.$refs.select.$el.children[0].children[0].setAttribute('style', "background:#ffff;background-size: 20PX 20PX;color:#333;padding-left: 30PX;");
|
|||
|
|
|||
|
},
|
|||
|
deleteSelected() {
|
|||
|
let id = this.checkedItems.join(`,`)
|
|||
|
this.deleteAccount = this.accountList.filter(item => this.checkedItems.includes(item.id)).map(item => item.ma);
|
|||
|
this.deleteAccount = this.deleteAccount.join(`、`)
|
|||
|
|
|||
|
if (this.isItBound) {
|
|||
|
this.deleteAccountDialog = true
|
|||
|
}else{
|
|||
|
this.dialogVerification=true
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//删除选中项
|
|||
|
// this.selectedIndices.sort((a, b) => b - a);
|
|||
|
// this.selectedIndices.forEach(index => {
|
|||
|
// this.accountList.splice(index, 1);
|
|||
|
// });
|
|||
|
// // 清空选中索引数组
|
|||
|
// this.selectedIndices = [];
|
|||
|
// this.checkedItems = []
|
|||
|
// -----------
|
|||
|
//删除选中项 默认第一项不能删除
|
|||
|
// const validSelectedIndices = this.selectedIndices.filter(index => index !== 0);
|
|||
|
// validSelectedIndices.sort((a, b) => b - a);
|
|||
|
// validSelectedIndices.forEach(index => {
|
|||
|
// this.accountList.splice(index, 1);
|
|||
|
// });
|
|||
|
// this.selectedIndices = [];
|
|||
|
// this.checkedItems = this.accountList.map(() => false);
|
|||
|
},
|
|||
|
confirmDelete() {
|
|||
|
if (!this.deleteGCode && this.isItBound) {
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`personal.gCode`),
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
this.fetchDelMinerAccount({ id: this.checkedItems.join(`,`), gCode:this.deleteGCode})
|
|||
|
},
|
|||
|
handleCheckedCitiesChange(value) {
|
|||
|
let checkedCount = value.length;
|
|||
|
this.checkAll = checkedCount === this.accountList.length;
|
|||
|
this.isIndeterminate = checkedCount > 0 && checkedCount < this.accountList.length;
|
|||
|
},
|
|||
|
|
|||
|
bindWallet(item) {
|
|||
|
|
|||
|
|
|||
|
this.handelQuotaList(item.coin)
|
|||
|
this.WalletAddressParams.ma = item.ma
|
|||
|
this.WalletAddressParams.coin = item.coin
|
|||
|
|
|||
|
if (this.isItBound) {
|
|||
|
this.fetchMinerAccountBalance({ id: item.id })
|
|||
|
}else{
|
|||
|
this.dialogVerification=true
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
},
|
|||
|
confirmBinding() {
|
|||
|
if (!this.paymentSettingsData.balance) {
|
|||
|
this.$message({
|
|||
|
message: this.$t(`personal.walletTips`),
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
if ( this.WalletAddressParams.coin.includes(`dgb`) &&this.paymentSettingsData.amount < 1) {
|
|||
|
this.$message({
|
|||
|
message: `${this.$t(`personal.PaymentAmountTips`)} 1`,
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
return
|
|||
|
}
|
|||
|
if (this.isItBound && !this.WalletAddressParams.gCode) {
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`personal.gCode`),
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
const currentQuota = this.quotaList.find(item => item.value === this.WalletAddressParams.coin);
|
|||
|
if (currentQuota) {
|
|||
|
// 比较用户设置的支付额度是否小于最小支付额度
|
|||
|
if (Number(this.paymentSettingsData.amount) < currentQuota.amount) {
|
|||
|
// 如果小于最小支付额度,显示错误提示
|
|||
|
this.$message({
|
|||
|
message: `${this.$t(`personal.PaymentAmountTips`)} ${currentQuota.amount} `,
|
|||
|
type: "error",
|
|||
|
showClose: true
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
this.WalletAddressParams.balance = this.paymentSettingsData.balance
|
|||
|
this.WalletAddressParams.amount = this.paymentSettingsData.amount
|
|||
|
this.WalletAddressParams.active = this.paymentSettingsData.active
|
|||
|
this.WalletAddressParams.remarks = this.paymentSettingsData.remark
|
|||
|
|
|||
|
if (this.WalletAddressParams.active == "是" ||this.WalletAddressParams.active == "Yes" ) {
|
|||
|
this.WalletAddressParams.active=0
|
|||
|
}else if(this.WalletAddressParams.active == "否" ||this.WalletAddressParams.active == "No"){
|
|||
|
this.WalletAddressParams.active=1
|
|||
|
}
|
|||
|
this.fetchCheckBalance({coin:this.WalletAddressParams.coin,balance:this.WalletAddressParams.balance})
|
|||
|
|
|||
|
// this.fetchWalletAddress(this.WalletAddressParams)
|
|||
|
},
|
|||
|
jumpVerification(){
|
|||
|
// this.$router.push( { name: 'SecuritySetting', params: { active: true} })
|
|||
|
|
|||
|
this.$router.push({
|
|||
|
path: `/${this.lang}/personalCenter/securitySetting`,
|
|||
|
params: { active: true }
|
|||
|
}).catch(err => {
|
|||
|
if(err.name !== 'NavigationDuplicated') {
|
|||
|
console.error('路由跳转失败:', err);
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
},
|
|||
|
closeDeleteDialog(){
|
|||
|
this.deleteGCode =""
|
|||
|
},
|
|||
|
changeSelection(scope) {
|
|||
|
let brand = scope
|
|||
|
for (let index in this.currencyList) {
|
|||
|
let aa = this.currencyList[index];
|
|||
|
let value = aa.value;
|
|||
|
if (brand === value) {
|
|||
|
this.$refs.select.$el.children[0].children[0].setAttribute('style', "background:url(" + aa.imgUrl + ") no-repeat 10PX;background-size: 20PX 20PX;color:#333;padding-left: 33PX;");
|
|||
|
}
|
|||
|
}
|
|||
|
// this.fetchParam({ coin: this.value })
|
|||
|
|
|||
|
},
|
|||
|
changeScreen(scope) {
|
|||
|
let brand = scope
|
|||
|
for (let index in this.currencyList) {
|
|||
|
let aa = this.currencyList[index];
|
|||
|
let value = aa.value;
|
|||
|
if (brand === value) {
|
|||
|
this.$refs.screen.$el.children[0].children[0].setAttribute('style', "background:url(" + aa.imgUrl + ") no-repeat 10PX;background-size: 20PX 20PX;color:#333;padding-left: 33PX;");
|
|||
|
}
|
|||
|
}
|
|||
|
if (!scope) {
|
|||
|
this.newAccountList =this.accountList
|
|||
|
|
|||
|
this.$refs.screen.$el.children[0].children[0].setAttribute('style', "background:url(``) no-repeat 10PX;background-size: 20PX 20PX;color:#333;padding-left: 8PX;");
|
|||
|
|
|||
|
}else{
|
|||
|
this.newAccountList = this.accountList.filter(item=>item.coin == scope)
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// this.fetchParam({ coin: this.value })
|
|||
|
|
|||
|
},
|
|||
|
clickCopy(item){
|
|||
|
|
|||
|
|
|||
|
// 创建临时输入框
|
|||
|
var tempInput = document.createElement('input');
|
|||
|
tempInput.value = item.addr;
|
|||
|
document.body.appendChild(tempInput);
|
|||
|
|
|||
|
try {
|
|||
|
tempInput.select();
|
|||
|
const isCopySuccessful = document.execCommand('copy');
|
|||
|
if (isCopySuccessful) {
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`personal.copySuccessful`),
|
|||
|
type: 'success',
|
|||
|
|
|||
|
|
|||
|
});
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`personal.copyFailed`),
|
|||
|
type: 'success',
|
|||
|
|
|||
|
|
|||
|
});
|
|||
|
}
|
|||
|
} catch (error) {
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`personal.copyFailed`),
|
|||
|
type: 'success',
|
|||
|
|
|||
|
|
|||
|
});
|
|||
|
} finally {
|
|||
|
if (document.body.contains(tempInput)) {
|
|||
|
document.body.removeChild(tempInput);
|
|||
|
} else {
|
|||
|
console.log('临时输入框不是 body 的子节点,无法移除。');
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// navigator.clipboard.writeText(value).then(() => {
|
|||
|
// this.$message({
|
|||
|
// showClose: true,
|
|||
|
// message: this.$t(`personal.copySuccessful`),
|
|||
|
// type: 'success',
|
|||
|
|
|||
|
// });
|
|||
|
// }).catch(err => {
|
|||
|
// this.$message({
|
|||
|
// showClose: true,
|
|||
|
// message: this.$t(`personal.copyFailed`),
|
|||
|
// type: 'error',
|
|||
|
|
|||
|
// });
|
|||
|
// });
|
|||
|
},
|
|||
|
jumpAlerts(item){
|
|||
|
|
|||
|
|
|||
|
this.$message({
|
|||
|
showClose: true,
|
|||
|
message: this.$t(`alerts.turnOffReminder`),
|
|||
|
type: 'error',
|
|||
|
|
|||
|
});
|
|||
|
// const lang = this.lang;
|
|||
|
// this.$router.push({
|
|||
|
// path: `/${lang}/alerts`,
|
|||
|
// query: {
|
|||
|
// ma: item.ma,
|
|||
|
// img: item.img,
|
|||
|
// id: item.id,
|
|||
|
// coin: item.coin
|
|||
|
// }
|
|||
|
// });
|
|||
|
|
|||
|
// this.$router.push({
|
|||
|
// path: "/alerts",
|
|||
|
// query: { ma:item.ma,img:item.img, id:item.id,coin:item.coin },
|
|||
|
// });
|
|||
|
},
|
|||
|
handelQuotaList(coin){
|
|||
|
try {
|
|||
|
let obj = this.quotaList.find(item=>item.value == coin)
|
|||
|
|
|||
|
|
|||
|
if (obj) {
|
|||
|
this.amount = obj.amount
|
|||
|
}else{
|
|||
|
return 0
|
|||
|
}
|
|||
|
} catch (error) {
|
|||
|
console.log(error);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|