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