fix
This commit is contained in:
parent
5caf5ae996
commit
12848453da
@ -454,8 +454,9 @@ export class Blockchain {
|
|||||||
.send({ gas: 1000000 })
|
.send({ gas: 1000000 })
|
||||||
}
|
}
|
||||||
|
|
||||||
public async beginNftSell(nftToken: string, currency: string, tokenId: string, amount: number, price: number,marketAddress:string ) {
|
public async beginNftSell(nftToken: string, currency: string, tokenId: string, amount: number, price: number,marketAddress:string ,nftType:boolean) {
|
||||||
const nftInstance = await this.getContractInstance(nftToken, ERC721ABI)
|
const nftInstance = await this.getContractInstance(nftToken, ERC721ABI)
|
||||||
|
nftType == true? await nftInstance.methods.setApprovalForAll(marketAddress, true).send({ gas: 1000000}):
|
||||||
await nftInstance.methods.approve(marketAddress, tokenId).send({ gas: 1000000})
|
await nftInstance.methods.approve(marketAddress, tokenId).send({ gas: 1000000})
|
||||||
console.log('11')
|
console.log('11')
|
||||||
const priceBN = this.web3.utils.toBN(this.web3.utils.toWei(price + ''))
|
const priceBN = this.web3.utils.toBN(this.web3.utils.toWei(price + ''))
|
||||||
|
@ -73,13 +73,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="buy-price">
|
<div class="buy-price">
|
||||||
<div class="mynft" v-if="isType === 'mynft'">
|
<div class="mynft" v-if="isType === 'mynft'">
|
||||||
<div class="for-rent-btn" v-if="piece.selling > 0">
|
<!-- <div class="for-rent-btn" v-if="piece.selling > 0">
|
||||||
<div class="adjust" @click="handPutShow"></div>
|
<div class="adjust" @click="handPutShow"></div>
|
||||||
<div class="remove"></div>
|
<div class="remove"></div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="rent"></div>
|
<div class="rent"></div>
|
||||||
<div class="sell" @click="handPutShow">Sell</div>
|
<div class="sell" @click="handPutShow">Sell</div>
|
||||||
|
</div> -->
|
||||||
|
<div >
|
||||||
|
<div class="rent"></div>
|
||||||
|
<div class="sell" @click="handPutShow">Sell</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="maeket" v-else>
|
<div class="maeket" v-else>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="piece-bottom-top">
|
<div class="piece-bottom-top">
|
||||||
<div class="price-input">
|
<div class="price-input">
|
||||||
<el-form :rules="rules">
|
<el-form :rules="rules">
|
||||||
<el-form-item label="" >
|
<el-form-item label="">
|
||||||
<el-input
|
<el-input
|
||||||
placeholder="Input your price"
|
placeholder="Input your price"
|
||||||
v-model="price"
|
v-model="price"
|
||||||
@ -67,7 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="pending">
|
<div class="pending">
|
||||||
<div class="pending-order" @click="handMessage">PEBDING ORDER</div>
|
<div class="pending-order" @click="handMessage">PEBDING ORDER</div>
|
||||||
<div class="confirm">CONFIRM</div>
|
<div class="confirm" @click="handClick">CONFIRM</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -78,6 +78,7 @@
|
|||||||
height="51px"
|
height="51px"
|
||||||
alt=""
|
alt=""
|
||||||
/></span>
|
/></span>
|
||||||
|
<MessageBox ref="message"></MessageBox>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ import WeaponSellTop from "./WeaponSellTop.vue";
|
|||||||
import PieceSellTop from "./PieceSellTop.vue";
|
import PieceSellTop from "./PieceSellTop.vue";
|
||||||
import HeroSellTop from "./HeroSellTop.vue";
|
import HeroSellTop from "./HeroSellTop.vue";
|
||||||
import ChipSellTop from "./ChipSellTop.vue";
|
import ChipSellTop from "./ChipSellTop.vue";
|
||||||
|
import MessageBox from "./MessageBox.vue";
|
||||||
import { AppModule } from "@/store/modules/app";
|
import { AppModule } from "@/store/modules/app";
|
||||||
import { sellMyNft } from "@/api/Market";
|
import { sellMyNft } from "@/api/Market";
|
||||||
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
|
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
|
||||||
@ -98,6 +100,7 @@ export default {
|
|||||||
HeroSellTop,
|
HeroSellTop,
|
||||||
ChipSellTop,
|
ChipSellTop,
|
||||||
PieceSellTop,
|
PieceSellTop,
|
||||||
|
MessageBox,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -105,8 +108,9 @@ export default {
|
|||||||
price: "",
|
price: "",
|
||||||
nft_Token: "",
|
nft_Token: "",
|
||||||
chainManager: new ChainManager(),
|
chainManager: new ChainManager(),
|
||||||
|
loadingInstance: "",
|
||||||
cunout: 1,
|
cunout: 1,
|
||||||
orderId:9,
|
orderId: 9,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
isWeapon: false,
|
isWeapon: false,
|
||||||
options: [],
|
options: [],
|
||||||
@ -130,7 +134,8 @@ export default {
|
|||||||
this.$emit("handPutHide");
|
this.$emit("handPutHide");
|
||||||
},
|
},
|
||||||
async handMessage() {
|
async handMessage() {
|
||||||
if (this.data.selling ? this.data.selling > 0 : this.price.selling > 0) {
|
|
||||||
|
if (this.data.selling ? this.data.selling > 0 : this.piece.selling > 0) {
|
||||||
try {
|
try {
|
||||||
const nftres = await this.chainManager.bc.beginUpdatePrice(
|
const nftres = await this.chainManager.bc.beginUpdatePrice(
|
||||||
this.orderId,
|
this.orderId,
|
||||||
@ -166,7 +171,10 @@ export default {
|
|||||||
amount: this.piece ? this.cunout : 1,
|
amount: this.piece ? this.cunout : 1,
|
||||||
price: this.price,
|
price: this.price,
|
||||||
marketAddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
marketAddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||||
|
nfttype:
|
||||||
|
this.type == "hero" || this.type == "weapon" ? false : true,
|
||||||
};
|
};
|
||||||
|
this.showLoading();
|
||||||
console.log(shellData, "shellData");
|
console.log(shellData, "shellData");
|
||||||
const nftres = await this.chainManager.bc.beginNftSell(
|
const nftres = await this.chainManager.bc.beginNftSell(
|
||||||
this.nft_Token,
|
this.nft_Token,
|
||||||
@ -174,10 +182,22 @@ export default {
|
|||||||
this.piece ? this.piece.detail.token_id : this.data.detail.token_id,
|
this.piece ? this.piece.detail.token_id : this.data.detail.token_id,
|
||||||
this.piece ? this.cunout : 1,
|
this.piece ? this.cunout : 1,
|
||||||
this.price,
|
this.price,
|
||||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||||
|
this.type == "hero" || this.type == "weapon" ? false : true
|
||||||
);
|
);
|
||||||
|
if (nftres.status == true) {
|
||||||
|
this.hideLoading();
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.message.open(1);
|
||||||
|
});
|
||||||
|
console.log("handMessage");
|
||||||
|
}
|
||||||
console.log(nftres, "beginSell");
|
console.log(nftres, "beginSell");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
this.hideLoading();
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.message.open(0);
|
||||||
|
});
|
||||||
console.log("query order status error", err);
|
console.log("query order status error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,11 +213,24 @@ export default {
|
|||||||
this.cunout--;
|
this.cunout--;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handClick() {
|
||||||
|
// console.log(this.data.selling, "-==-=-=-=p1");
|
||||||
|
console.log(this.piece, "-==-=-=-=p2");
|
||||||
|
},
|
||||||
handPlus() {
|
handPlus() {
|
||||||
if (this.cunout < this.piece.balance) {
|
if (this.cunout <= this.piece.balance) {
|
||||||
this.cunout++;
|
this.cunout++;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
showLoading() {
|
||||||
|
this.loadingInstance = this.$loading({
|
||||||
|
background: "rgba(0, 0, 0, 0.8)",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
hideLoading() {
|
||||||
|
this.loadingInstance?.close();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -112,6 +112,7 @@
|
|||||||
:currencyTypeList="currencyTypeList"
|
:currencyTypeList="currencyTypeList"
|
||||||
@handPutShow="handPutShow"
|
@handPutShow="handPutShow"
|
||||||
@handPutHide="handPutHide"
|
@handPutHide="handPutHide"
|
||||||
|
@handMessage="handMessage"
|
||||||
></TheSellDialog>
|
></TheSellDialog>
|
||||||
<HeroBuyDialog
|
<HeroBuyDialog
|
||||||
:type="type"
|
:type="type"
|
||||||
@ -120,6 +121,7 @@
|
|||||||
@handBuyShow="handBuyShow"
|
@handBuyShow="handBuyShow"
|
||||||
@handBuyHide="handBuyHide"
|
@handBuyHide="handBuyHide"
|
||||||
></HeroBuyDialog>
|
></HeroBuyDialog>
|
||||||
|
<MessageBox ref="message"></MessageBox>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@ -127,6 +129,7 @@ import { Component, Vue, Watch } from "vue-property-decorator";
|
|||||||
import Herodialog from "../HeroDialog.vue";
|
import Herodialog from "../HeroDialog.vue";
|
||||||
import HeroBuyDialog from "../HeroBuyDialog.vue";
|
import HeroBuyDialog from "../HeroBuyDialog.vue";
|
||||||
import TheSellDialog from "../TheSellDialog.vue";
|
import TheSellDialog from "../TheSellDialog.vue";
|
||||||
|
import MessageBox from "../MessageBox.vue";
|
||||||
import { AppModule } from "@/store/modules/app";
|
import { AppModule } from "@/store/modules/app";
|
||||||
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
|
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
|
||||||
import ChainManager from "@/chain/ChainManager";
|
import ChainManager from "@/chain/ChainManager";
|
||||||
@ -134,6 +137,7 @@ import ChainManager from "@/chain/ChainManager";
|
|||||||
name: "HeroNft",
|
name: "HeroNft",
|
||||||
components: {
|
components: {
|
||||||
Herodialog,
|
Herodialog,
|
||||||
|
MessageBox,
|
||||||
TheSellDialog,
|
TheSellDialog,
|
||||||
HeroBuyDialog,
|
HeroBuyDialog,
|
||||||
},
|
},
|
||||||
@ -146,7 +150,6 @@ export default class HeroNft extends Vue {
|
|||||||
isPiecePut: boolean = false;
|
isPiecePut: boolean = false;
|
||||||
isBuy: boolean = false;
|
isBuy: boolean = false;
|
||||||
type: string = "hero";
|
type: string = "hero";
|
||||||
|
|
||||||
starType = [
|
starType = [
|
||||||
{ Image: require("@/assets/market/hero/star01.png") },
|
{ Image: require("@/assets/market/hero/star01.png") },
|
||||||
{ Image: require("@/assets/market/hero/star03.png") },
|
{ Image: require("@/assets/market/hero/star03.png") },
|
||||||
@ -229,6 +232,14 @@ export default class HeroNft extends Vue {
|
|||||||
handBuyHide() {
|
handBuyHide() {
|
||||||
this.isBuy = false;
|
this.isBuy = false;
|
||||||
}
|
}
|
||||||
|
handMessage() {
|
||||||
|
console.log('msg');
|
||||||
|
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// this.$refs.message.open(1);
|
||||||
|
// console.log('msg2023');
|
||||||
|
// });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
ref="selldialog"
|
ref="selldialog"
|
||||||
:type="type"
|
:type="type"
|
||||||
:isPiecePut="isPiecePut"
|
:isPiecePut="isPiecePut"
|
||||||
v-if="currencyTypeList"
|
v-if="currencyTypeList.length > 0"
|
||||||
:currencyTypeList="currencyTypeList"
|
:currencyTypeList="currencyTypeList"
|
||||||
@handMessage="handMessage"
|
@handMessage="handMessage"
|
||||||
@handPutShow="handPutShow"
|
@handPutShow="handPutShow"
|
||||||
@ -105,7 +105,7 @@ import ChipBuyDialog from "../ChipBuyDialog.vue";
|
|||||||
import MessageBox from "../MessageBox.vue";
|
import MessageBox from "../MessageBox.vue";
|
||||||
import WeaponBuyDialog from "../WeaponBuyDialog.vue";
|
import WeaponBuyDialog from "../WeaponBuyDialog.vue";
|
||||||
export default {
|
export default {
|
||||||
props: ["isType", "nftList",'currencyTypeList'],
|
props: ["isType", "nftList", "currencyTypeList"],
|
||||||
components: {
|
components: {
|
||||||
PieceDialog,
|
PieceDialog,
|
||||||
TheSell,
|
TheSell,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user