完善充值流程

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

View File

@ -26,7 +26,7 @@ export class BitgetWallet{
}
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;
}

View File

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