完善充值流程

This commit is contained in:
yuyongdong 2024-08-07 19:43:37 +08:00
parent 44a7766427
commit da65418be2
4 changed files with 2046 additions and 26 deletions

File diff suppressed because it is too large Load Diff

View File

@ -351,7 +351,7 @@
</div> </div>
<div class="item-amount"> <div class="item-amount">
<img src="@/assets/img/marketplace/icon_diamond.png" alt=""> <img src="@/assets/img/marketplace/icon_diamond.png" alt="">
<span>499950</span> <span>{{ brickworkAmount * 50 }}</span>
</div> </div>
<div class="item-amount-input"> <div class="item-amount-input">
<div class="left"> <div class="left">
@ -365,8 +365,7 @@
</div> </div>
</div> </div>
<div class="conform-btn" @click="conformBtn"> <div class="conform-btn" @click="conformBtn">
<span v-if="confirmRecharge?.goods_id == 1006">{{ priceAmount ? confirmRecharge.price : 0 }}</span> <span>{{ brickworkAmount }}</span>
<span v-else>{{ confirmRecharge?.price }}</span>
<!-- <img src="@/assets/img/marketplace/icon_USDT.png" alt=""> --> <!-- <img src="@/assets/img/marketplace/icon_USDT.png" alt=""> -->
<img :src="icon_usdc" alt=""> <img :src="icon_usdc" alt="">
</div> </div>
@ -566,7 +565,7 @@ const activeIndex = ref(0)
const rechargeList = ref() const rechargeList = ref()
const rechargeHistoryList = ref() const rechargeHistoryList = ref()
const confirmRecharge = ref() const confirmRecharge = ref()
const brickworkAmount = ref(0) const brickworkAmount = ref(1)
const priceAmount = ref(0) const priceAmount = ref(0)
// //
@ -589,15 +588,14 @@ const getRechargeGoods = async () => {
} }
const handleInput = (e) => { const handleInput = (e) => {
// console.log(brickworkAmount.value, e)
if(Number(brickworkAmount.value) >9999) { if(Number(brickworkAmount.value) >9999) {
brickworkAmount.value = 9999 brickworkAmount.value = 9999
toRaw(confirmRecharge.value).price = 9999 toRaw(confirmRecharge.value).price = 9999
toRaw(confirmRecharge.value).diamond = brickworkAmount.value toRaw(confirmRecharge.value).diamond = brickworkAmount.value*50
} else { } else {
toRaw(confirmRecharge.value).price = brickworkAmount.value toRaw(confirmRecharge.value).price = brickworkAmount.value
toRaw(confirmRecharge.value).diamond = brickworkAmount.value toRaw(confirmRecharge.value).diamond = brickworkAmount.value*50
priceAmount.value = brickworkAmount.value // priceAmount.value = brickworkAmount.value
} }
} }
@ -605,24 +603,25 @@ const handleInput = (e) => {
const rechargeDecrease = async () => { const rechargeDecrease = async () => {
if(brickworkAmount.value == 0) return false if(brickworkAmount.value == 0) return false
brickworkAmount.value-- brickworkAmount.value--
priceAmount.value-- // priceAmount.value--
if(confirmRecharge.value.goods_id == 1006) { if(confirmRecharge.value.goods_id == 1001) {
toRaw(confirmRecharge.value).price = priceAmount.value toRaw(confirmRecharge.value).price = brickworkAmount.value
toRaw(confirmRecharge.value).diamond = brickworkAmount.value toRaw(confirmRecharge.value).diamond = brickworkAmount.value*50
} }
} }
const rechargeIncrease = async () => { const rechargeIncrease = async () => {
brickworkAmount.value++ brickworkAmount.value++
priceAmount.value++ // priceAmount.value++
if(confirmRecharge.value.goods_id == 1006) { if(confirmRecharge.value.goods_id == 1001) {
toRaw(confirmRecharge.value).price = priceAmount.value toRaw(confirmRecharge.value).price = brickworkAmount.value
toRaw(confirmRecharge.value).diamond = brickworkAmount.value toRaw(confirmRecharge.value).diamond = brickworkAmount.value*50
} }
} }
// //
const conformBtn = async () => { const conformBtn = async () => {
return console.log(toRaw(confirmRecharge.value))
// return
// if(localWalletStore.walletType == 3) { // if(localWalletStore.walletType == 3) {
let address = localWalletStore.address let address = localWalletStore.address
if(toRaw(confirmRecharge.value).price == 0) { if(toRaw(confirmRecharge.value).price == 0) {
@ -633,12 +632,11 @@ const conformBtn = async () => {
// return // return
try { try {
const bc = new BlockChain() const bc = new BlockChain()
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id), Number(toRaw(confirmRecharge.value).goods_id) == 1006 ? brickworkAmount.value : 0) let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id), Number(toRaw(confirmRecharge.value).diamond))
// console.log(res) // console.log(res)
if(res) { if(res) {
activeIndex.value = 0 brickworkAmount.value = 1
brickworkAmount.value = 0 // priceAmount.value = 0
priceAmount.value = 0
await dataInfo() await dataInfo()
loadingDialogVisible.value = false loadingDialogVisible.value = false
message.success('Top-Up Successful') message.success('Top-Up Successful')
@ -716,7 +714,6 @@ const dataInfo = async () => {
watch(localWalletStore,() => { watch(localWalletStore,() => {
// console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token) // console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token)
if(!localWalletStore.token) { if(!localWalletStore.token) {
nftList.value = []
cecInfo.value = { cecInfo.value = {
total: 0, total: 0,
available: '', available: '',

View File

@ -26,7 +26,7 @@ export class BitgetWallet{
} }
get installed() { get installed() {
console.log('bitget install: ', window.bitkeep, window.bitkeep.ethereum) // console.log('bitget install: ', window.bitkeep, window.bitkeep.ethereum)
return !!window.bitkeep && !!window.bitkeep.ethereum; return !!window.bitkeep && !!window.bitkeep.ethereum;
} }

View File

@ -320,9 +320,8 @@ const closeCartBox = () => {
watch(() => route.path,(newPath, oldPath) => { watch(() => route.path,(newPath, oldPath) => {
let routerPath = newPath.split('/') let routerPath = newPath.split('/')
if(routerPath[1] == 'marketplace' || routerPath[1] == 'detail') { // if(routerPath[1] == 'marketplace' || routerPath[1] == 'detail') {
// if(routerPath[1] == 'marketplace') { if(routerPath[1] == 'marketplace') {
console.log(toRaw(marketplaceStore.detailData))
isCart.value = true isCart.value = true
} else { } else {
isCart.value = false isCart.value = false