完善充值流程
This commit is contained in:
parent
bc3a0af938
commit
ac4b287bdd
@ -9,10 +9,10 @@
|
||||
<div class="assets-user-name">
|
||||
<div class="adderss">{{ localWalletStore.showAddress ? localWalletStore.showAddress : 'User Address' }}</div>
|
||||
<div class="email">
|
||||
<p>Email: {{ userInfoData.email }}</p>
|
||||
<p>Email: {{ userInfoData.email ? userInfoData.email : '-' }}</p>
|
||||
</div>
|
||||
<div class="name">
|
||||
<p>Player name: <span>{{ userInfoData.nickname }}</span></p>
|
||||
<p>Player name: <span>{{ userInfoData.nickname ? userInfoData.nickname : '-' }}</span></p>
|
||||
</div>
|
||||
<div class="recharge">
|
||||
<div class="recharge-left">
|
||||
@ -591,7 +591,7 @@ const selectItem = (data, index) => {
|
||||
if(data.goods_id == 1006) {
|
||||
confirmRecharge.value = {
|
||||
currency: data.currency,
|
||||
diamond: '',
|
||||
diamond: brickworkAmount.value,
|
||||
goods_id: data.goods_id,
|
||||
price: priceAmount.value
|
||||
}
|
||||
@ -605,8 +605,10 @@ const handleInput = (e) => {
|
||||
if(Number(brickworkAmount.value) >9999) {
|
||||
brickworkAmount.value = 9999
|
||||
toRaw(confirmRecharge.value).price = 9999
|
||||
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||
} else {
|
||||
toRaw(confirmRecharge.value).price = brickworkAmount.value
|
||||
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||
priceAmount.value = brickworkAmount.value
|
||||
}
|
||||
|
||||
@ -618,6 +620,7 @@ const rechargeDecrease = async () => {
|
||||
priceAmount.value--
|
||||
if(confirmRecharge.value.goods_id == 1006) {
|
||||
toRaw(confirmRecharge.value).price = priceAmount.value
|
||||
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||
}
|
||||
}
|
||||
const rechargeIncrease = async () => {
|
||||
@ -625,12 +628,13 @@ const rechargeIncrease = async () => {
|
||||
priceAmount.value++
|
||||
if(confirmRecharge.value.goods_id == 1006) {
|
||||
toRaw(confirmRecharge.value).price = priceAmount.value
|
||||
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||
}
|
||||
console.log(brickworkAmount.value)
|
||||
}
|
||||
|
||||
// 充值
|
||||
const conformBtn = async () => {
|
||||
// debugger
|
||||
// if(localWalletStore.walletType == 3) {
|
||||
let address = localWalletStore.address
|
||||
if(toRaw(confirmRecharge.value).price == 0) {
|
||||
@ -641,9 +645,12 @@ const conformBtn = async () => {
|
||||
// return
|
||||
try {
|
||||
const bc = new BlockChain()
|
||||
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id))
|
||||
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id), Number(toRaw(confirmRecharge.value).goods_id) == 1006 ? brickworkAmount.value : 0)
|
||||
// console.log(res)
|
||||
if(res) {
|
||||
activeIndex.value = 0
|
||||
brickworkAmount.value = 0
|
||||
priceAmount.value = 0
|
||||
await dataInfo()
|
||||
loadingDialogVisible.value = false
|
||||
message.success('Top-Up Successful')
|
||||
@ -1649,6 +1656,7 @@ onMounted(() => {
|
||||
padding: 0 99px;
|
||||
color: #FFF;
|
||||
background: #1A1821;
|
||||
box-shadow: none;
|
||||
border-radius: 100px;
|
||||
.ant-modal-body {
|
||||
.log-title {
|
||||
@ -1696,6 +1704,8 @@ onMounted(() => {
|
||||
}
|
||||
.log-body {
|
||||
width: 100%;
|
||||
height: 540px;
|
||||
overflow-y: auto;
|
||||
.pages {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
@ -1742,6 +1752,21 @@ onMounted(() => {
|
||||
color: #8587B2;
|
||||
}
|
||||
}
|
||||
&::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #171220;
|
||||
border-radius: 2px;
|
||||
}
|
||||
&::-webkit-scrollbar-corner {
|
||||
display: block;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
height: 15px;
|
||||
background: #9950fd;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pagination {
|
||||
|
@ -22,7 +22,7 @@ export class GameItemMall {
|
||||
return txHash
|
||||
}
|
||||
|
||||
async execBuyItem(itemId) {
|
||||
async execBuyItem(itemId, itemNum) {
|
||||
// await this.bc.checkPassportLogin();
|
||||
// const chainId = parseInt(import.meta.env.VUE_APP_NET_ID);
|
||||
// const provider = this.bc.passportProvider
|
||||
@ -30,16 +30,17 @@ export class GameItemMall {
|
||||
// return
|
||||
|
||||
await this.bc.checkPassportLogin();
|
||||
const token = await this.bc.passportToken()
|
||||
const chainId = parseInt(import.meta.env.VUE_APP_NET_ID);
|
||||
const { provider, address } = await this.bc.selectAddress({targetChainId: chainId})
|
||||
const preDatas = {
|
||||
net_id: chainId,
|
||||
goods_id: itemId,
|
||||
account_address: address,
|
||||
// passport: '',
|
||||
|
||||
goods_num: itemNum,
|
||||
}
|
||||
const { errocode, errmsg, calls } = await apiPreRecharge(preDatas)
|
||||
// const token = this.bc.store.refreshToken
|
||||
const { errocode, errmsg, calls } = await apiPreRecharge(preDatas, token)
|
||||
if (errocode) {
|
||||
throw new Error(errmsg)
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, computed, onUnmounted, watchEffect, getCurrentInstance, watch, inject } from "vue";
|
||||
import { ref, toRaw, reactive, onMounted, computed, onUnmounted, watchEffect, getCurrentInstance, watch, inject } from "vue";
|
||||
const message = inject('$message')
|
||||
const { proxy } = getCurrentInstance();
|
||||
import { useAppStore } from "@/store/app";
|
||||
@ -320,7 +320,9 @@ const closeCartBox = () => {
|
||||
|
||||
watch(() => route.path,(newPath, oldPath) => {
|
||||
let routerPath = newPath.split('/')
|
||||
if(routerPath[1] == 'marketplace') {
|
||||
if(routerPath[1] == 'marketplace' || routerPath[1] == 'detail') {
|
||||
// if(routerPath[1] == 'marketplace') {
|
||||
console.log(toRaw(marketplaceStore.detailData))
|
||||
isCart.value = true
|
||||
} else {
|
||||
isCart.value = false
|
||||
|
@ -185,9 +185,9 @@ export const apiDiamondHistory = async (account_address) => {
|
||||
}
|
||||
|
||||
// 充值-购买
|
||||
export const apiPreRecharge = async (data) => {
|
||||
export const apiPreRecharge = async (data, token) => {
|
||||
const url = `${API_BASE}/api/recharge/buy`
|
||||
return httpPost(url, data)
|
||||
return httpPost(url, data, token)
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user