fix
This commit is contained in:
parent
e1740362a0
commit
f3eccb8398
@ -454,35 +454,37 @@ export class Blockchain {
|
||||
.transfer(account, amountBN)
|
||||
.send({ gas: 1000000 })
|
||||
}
|
||||
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})
|
||||
const priceBN = this.web3.utils.toBN(this.web3.utils.toWei(price + ''))
|
||||
const marketInstance: any = await this.getContractInstance(marketAddress, MARKET_ABI)
|
||||
return marketInstance.methods
|
||||
.sell(nftToken, currency, tokenId,priceBN, amount)
|
||||
.send({ gas: 1000000 })
|
||||
}
|
||||
public async beginApproveSell( tokenId: string,marketAddress:string,nftToken: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})
|
||||
}
|
||||
// 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})
|
||||
// const priceBN = this.web3.utils.toBN(this.web3.utils.toWei(price + ''))
|
||||
// const marketInstance: any = await this.getContractInstance(marketAddress, MARKET_ABI)
|
||||
// return marketInstance.methods
|
||||
// .sell(nftToken, currency, tokenId,priceBN, amount)
|
||||
// .send({ gas: 1000000 })
|
||||
// }
|
||||
public async beginApproveBuy( currency: string,marketAddress:string,price:string){
|
||||
const coinInstance: any = await this.getContractInstance(currency)
|
||||
const res = await coinInstance.methods.increaseAllowance(marketAddress, price).send({ gas: 1000000 })
|
||||
public async beginApproveSell( tokenId: string,nftToken:string,nftType:boolean,marketAddress:string){
|
||||
const nftInstance = await this.getContractInstance(nftToken, ERC721ABI)
|
||||
if(nftType == true){
|
||||
return nftInstance.methods.setApprovalForAll(marketAddress, true).send({ gas: 1000000})}else {
|
||||
return nftInstance.methods.approve(marketAddress, tokenId).send({ gas: 1000000})
|
||||
}
|
||||
}
|
||||
public async beginBuy(orderId:string,price:number,currency:string,marketAddress:string){
|
||||
const coinInstance: any = await this.getContractInstance(currency)
|
||||
const res = await coinInstance.methods.increaseAllowance(marketAddress, price).send({ gas: 1000000 })
|
||||
public async beginNftSell(nftToken: string, currency: string, tokenId: string, amount: number, price: number,marketAddress:string ) {
|
||||
const priceBN = this.web3.utils.toBN(this.web3.utils.toWei(price + ''))
|
||||
const marketInstance: any = await this.getContractInstance(marketAddress, MARKET_ABI)
|
||||
return marketInstance.methods
|
||||
.sell(nftToken, currency, tokenId,priceBN, amount)
|
||||
.send({ gas: 1000000 })
|
||||
}
|
||||
public async beginApproveBuy( currency: string,price:string,marketAddress:string){
|
||||
const coinInstance: any = await this.getContractInstance(currency)
|
||||
return coinInstance.methods.increaseAllowance(marketAddress, price).send({ gas: 1000000 })
|
||||
}
|
||||
public async beginBuy(orderId:string,marketAddress:string){
|
||||
// const coinInstance: any = await this.getContractInstance(currency)
|
||||
// const res = await coinInstance.methods.increaseAllowance(marketAddress, price).send({ gas: 1000000 })
|
||||
const marketInstance: any = await this.getContractInstance(marketAddress, MARKET_ABI)
|
||||
return marketInstance.methods
|
||||
.buy(orderId)
|
||||
|
@ -40,7 +40,12 @@
|
||||
<div class="priece">
|
||||
<div class="priece-btn">
|
||||
<div class="priece-number">
|
||||
{{formatPriceShow(piece.s_price ? piece.s_price : data.s_price,18) }}
|
||||
{{
|
||||
formatPriceShow(
|
||||
piece.s_price ? piece.s_price : data.s_price,
|
||||
18
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -54,7 +59,14 @@
|
||||
</div>
|
||||
<div class="token-item">
|
||||
<div>Price</div>
|
||||
<div>{{formatPriceShow(piece.s_price ? piece.s_price : data.s_price,18) }}</div>
|
||||
<div>
|
||||
{{
|
||||
formatPriceShow(
|
||||
piece.s_price ? piece.s_price : data.s_price,
|
||||
18
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="token-item-balance">
|
||||
<div>Balance</div>
|
||||
@ -78,7 +90,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pending">
|
||||
<div class="pending-order" @click="haldBuy">PEBDING ORDER</div>
|
||||
<div class="pending-order" @click="haldBuy">
|
||||
{{ isApprove == true ? "CONFIRM" : "PEBDING ORDER" }}
|
||||
</div>
|
||||
<div class="confirm">CONFIRM</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -104,28 +118,39 @@ export default {
|
||||
return {
|
||||
piece: "",
|
||||
orderId: 1,
|
||||
isApprove:false,
|
||||
chainManager: new ChainManager(),
|
||||
dialogVisible: false,
|
||||
loadingInstance: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async haldBuy() {
|
||||
const data = {
|
||||
o_link: this.piece.o_link ? this.piece.o_link : this.data.o_link,
|
||||
const data = {
|
||||
currency: this.piece.s_currency
|
||||
? this.piece.s_currency
|
||||
: this.data.s_currency,
|
||||
price: this.piece.s_price ? this.piece.s_price : this.data.s_price,
|
||||
currency: this.piece.s_currency ? this.piece.s_currency : this.data.s_currency,
|
||||
marketDddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data,'data');
|
||||
console.log(data, "beginApproveBuy");
|
||||
try {
|
||||
const nftres = await this.chainManager.bc.beginBuy(
|
||||
this.piece.o_link ? this.piece.o_link : this.data.o_link,
|
||||
this.piece.s_price ? this.piece.s_price : this.data.s_price,
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginApproveBuy(
|
||||
this.piece.s_currency ? this.piece.s_currency : this.data.s_currency,
|
||||
this.piece.s_price ? this.piece.s_price : this.data.s_price,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
console.log(nftres, "beginApproveBuy");
|
||||
if (nftres.status == true) {
|
||||
this.isApprove = true;
|
||||
this.hideLoading();
|
||||
this.handBeginBuy();
|
||||
}
|
||||
} catch (err) {
|
||||
this.isApprove = false;
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
@ -133,9 +158,41 @@ export default {
|
||||
// 分发自定义事件(事件名: closeTip)
|
||||
this.$emit("handBuyHide", false);
|
||||
},
|
||||
async handBeginBuy() {
|
||||
const data = {
|
||||
o_link: this.piece.o_link ? this.piece.o_link : this.data.o_link,
|
||||
marketDddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data, "data");
|
||||
try {
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginBuy(
|
||||
this.piece.o_link ? this.piece.o_link : this.data.o_link,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
if (nftres.status == true) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 1);
|
||||
}
|
||||
console.log(nftres, "beginBuy");
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
formatPriceShow(price, decimals, fixed = 2) {
|
||||
return formatPrice(price, decimals, fixed);
|
||||
},
|
||||
showLoading() {
|
||||
this.loadingInstance = this.$loading({
|
||||
background: "rgba(0, 0, 0, 0.8)",
|
||||
});
|
||||
},
|
||||
|
||||
hideLoading() {
|
||||
this.loadingInstance?.close();
|
||||
},
|
||||
init(data) {
|
||||
this.piece = data;
|
||||
},
|
||||
@ -357,6 +414,7 @@ export default {
|
||||
.confirm {
|
||||
width: 426px;
|
||||
height: 76px;
|
||||
opacity: 0;
|
||||
text-align: center;
|
||||
line-height: 76px;
|
||||
cursor: pointer;
|
||||
|
@ -13,6 +13,16 @@
|
||||
"
|
||||
alt=""
|
||||
/>
|
||||
<img
|
||||
v-if="data.c_id"
|
||||
width="97px"
|
||||
:src="
|
||||
require('@/assets/market/chip/details/' +
|
||||
data.c_id +
|
||||
'_full.png')
|
||||
"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="name">{{ data.detail.chip_name }}</div>
|
||||
</div>
|
||||
|
@ -146,6 +146,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
chainManager: new ChainManager(),
|
||||
loadingInstance:null,
|
||||
chipArrid: {
|
||||
39: "Hp Pct",
|
||||
40: "Atk Pct",
|
||||
@ -198,15 +199,31 @@ export default {
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
try {
|
||||
this.showLoading()
|
||||
const nftres = await this.chainManager.bc.beginCancelOrder(
|
||||
this.data.o_link,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
this.$emit("handMessage", 1);
|
||||
this.hideLoading();
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("query order status error", err);
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 1);
|
||||
}
|
||||
},
|
||||
showLoading() {
|
||||
this.loadingInstance = this.$loading({
|
||||
background: "rgba(0, 0, 0, 0.8)",
|
||||
});
|
||||
},
|
||||
|
||||
hideLoading() {
|
||||
this.loadingInstance?.close();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -244,7 +244,7 @@
|
||||
<div class="maeket" v-else>
|
||||
<div class="price">
|
||||
<span class="price-number">{{
|
||||
formatPriceShow( data.s_price ? data.s_price : " ",18)
|
||||
formatPriceShow(data.s_price ? data.s_price : " ", 18)
|
||||
}}</span>
|
||||
</div>
|
||||
<div>
|
||||
@ -303,6 +303,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isTabs: false,
|
||||
loadingInstance: null,
|
||||
chainManager: new ChainManager(),
|
||||
};
|
||||
},
|
||||
@ -318,7 +319,7 @@ export default {
|
||||
this.$emit("on-open");
|
||||
//如果需要传参的话,可以在"on-close"后面再加参数,然后在父组件的函数里接收就可以了。
|
||||
},
|
||||
formatPriceShow(price, decimals, fixed = 2) {
|
||||
formatPriceShow(price, decimals, fixed = 2) {
|
||||
return formatPrice(price, decimals, fixed);
|
||||
},
|
||||
handHeroTab() {
|
||||
@ -339,15 +340,32 @@ export default {
|
||||
},
|
||||
async handRemove() {
|
||||
try {
|
||||
this.showLoading()
|
||||
const nftres = await this.chainManager.bc.beginCancelOrder(
|
||||
this.data.o_link,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
|
||||
this.$emit("handMessage", 1);
|
||||
this.hideLoading();
|
||||
}
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
showLoading() {
|
||||
this.loadingInstance = this.$loading({
|
||||
background: "rgba(0, 0, 0, 0.8)",
|
||||
});
|
||||
},
|
||||
|
||||
hideLoading() {
|
||||
this.loadingInstance?.close();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -37,7 +37,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pending">
|
||||
<div class="pending-order" @click="haldBuy">PEBDING ORDER</div>
|
||||
<div class="pending-order" @click="haldBuy">
|
||||
{{ isApprove == true ? "CONFIRM" : "PEBDING ORDER" }}
|
||||
</div>
|
||||
<div class="confirm">CONFIRM</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -65,6 +67,7 @@ export default {
|
||||
return {
|
||||
piece: "",
|
||||
orderId: 2,
|
||||
isApprove: false,
|
||||
loadingInstance: null,
|
||||
chainManager: new ChainManager(),
|
||||
dialogVisible: false,
|
||||
@ -73,19 +76,41 @@ export default {
|
||||
methods: {
|
||||
async haldBuy() {
|
||||
const data = {
|
||||
o_link: this.data.o_link,
|
||||
price: this.data.s_price,
|
||||
currency: this.data.s_currency,
|
||||
price: this.data.s_price,
|
||||
marketDddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data, "data");
|
||||
try {
|
||||
|
||||
this.showLoading()
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginApproveBuy(
|
||||
this.data.s_currency,
|
||||
this.data.s_price,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
this.isApprove = true;
|
||||
this.hideLoading();
|
||||
this.handBeginBuy();
|
||||
}
|
||||
} catch (err) {
|
||||
this.isApprove = false;
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
async handBeginBuy() {
|
||||
const data = {
|
||||
o_link: this.data.o_link,
|
||||
marketDddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data, "data");
|
||||
try {
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginBuy(
|
||||
this.data.o_link,
|
||||
this.data.s_price,
|
||||
this.data.s_currency,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
@ -337,6 +362,7 @@ export default {
|
||||
.confirm {
|
||||
width: 426px;
|
||||
height: 76px;
|
||||
opacity: 0;
|
||||
text-align: center;
|
||||
line-height: 76px;
|
||||
cursor: pointer;
|
||||
|
@ -9,6 +9,12 @@
|
||||
:src="require('@/assets/market/hero/' + data.item_id + '.png')"
|
||||
alt=""
|
||||
/>
|
||||
<img
|
||||
v-if="data.c_id"
|
||||
width="159px"
|
||||
:src="require('@/assets/market/hero/' + data.c_id + '.png')"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="gen" v-if="data.info.is_genesis">
|
||||
<img
|
||||
|
@ -405,9 +405,10 @@ export default {
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
this.hideLoading();
|
||||
if (nftres.status == true) {
|
||||
this.$emit("handMessage", 1);
|
||||
this.hideLoading();
|
||||
|
||||
}
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
|
@ -36,7 +36,7 @@
|
||||
<div class="conunt-number">{{ cunout }}</div>
|
||||
<div class="right" @click="handPlus"></div>
|
||||
</div>
|
||||
<div class="max">Max</div>
|
||||
<div class="max" @click="handMax">Max</div>
|
||||
</div>
|
||||
<div class="sellers">
|
||||
Sellers pay 5% fee to platform for completing the transaction.
|
||||
@ -72,6 +72,9 @@ export default {
|
||||
handPlus() {
|
||||
this.$emit("handPlus");
|
||||
},
|
||||
handMax(){
|
||||
this.$emit("handMax");
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -89,7 +89,7 @@
|
||||
<div class="maeket" v-else>
|
||||
<div class="price">
|
||||
<span class="price-number">{{
|
||||
formatPriceShow(piece.s_price ? piece.s_price : " ",18)
|
||||
formatPriceShow(piece.s_price ? piece.s_price : " ", 18)
|
||||
}}</span>
|
||||
</div>
|
||||
<div>
|
||||
@ -128,6 +128,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
piece: "",
|
||||
loadingInstance: null,
|
||||
dialogVisible: false,
|
||||
chainManager: new ChainManager(),
|
||||
};
|
||||
@ -176,18 +177,36 @@ export default {
|
||||
console.log("handBuyShow");
|
||||
},
|
||||
async handRemove() {
|
||||
console.log(this.piece.o_link,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress);
|
||||
console.log(
|
||||
this.piece.o_link,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
try {
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginCancelOrder(
|
||||
this.piece.o_link,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
this.$emit("handMessage", 1);
|
||||
this.hideLoading();
|
||||
}
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
showLoading() {
|
||||
this.loadingInstance = this.$loading({
|
||||
background: "rgba(0, 0, 0, 0.8)",
|
||||
});
|
||||
},
|
||||
|
||||
hideLoading() {
|
||||
this.loadingInstance?.close();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<PieceSellTop
|
||||
@handReduce="handReduce"
|
||||
@handPlus="handPlus"
|
||||
@handMax="handMax"
|
||||
:data="piece"
|
||||
:cunout="cunout"
|
||||
v-else
|
||||
@ -67,8 +68,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pending">
|
||||
<div class="pending-order" @click="handMessage">PEBDING ORDER</div>
|
||||
<div class="confirm" @click="handConfirm">CONFIRM</div>
|
||||
<div class="pending-order" @click="handConfirm">
|
||||
{{ isApprove == true ? "CONFIRM" : "PEBDING ORDER" }}
|
||||
</div>
|
||||
<div class="confirm">CONFIRM</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -79,7 +82,6 @@
|
||||
height="51px"
|
||||
alt=""
|
||||
/></span>
|
||||
<!-- <MessageBox ref="message"></MessageBox> -->
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -115,6 +117,7 @@ export default {
|
||||
orderId: 9,
|
||||
dialogVisible: false,
|
||||
isWeapon: false,
|
||||
isApprove: false,
|
||||
options: [],
|
||||
value: "",
|
||||
FormRules: {
|
||||
@ -135,11 +138,6 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// alert(/^[1-9]{1,3}([1-8])?(\.\d{1,2})?$|^(\d{6})$/.test("1888.99"));
|
||||
// /^[1-9][0-9]{0,5}.(\d){2}$/
|
||||
// alert(/^[1-9]{1,3}([1-8])?(\.\d{1,2})?$|^(\d{4})$/.test("9999.99"));
|
||||
|
||||
// alert(/^[1-9]{1,3}([1-8])?(\.\d{1,2})?$|^(\d{4})$/.test("9999"));
|
||||
console.log(
|
||||
/^0\.([1-9]|\d[1-9])$|^[1-9]\d{0,5}\.\d{0,2}$|^[1-9]\d{0,5}$/.test(
|
||||
"0.01"
|
||||
@ -161,11 +159,11 @@ export default {
|
||||
async handMessage() {
|
||||
// this.$emit('handMessage',0)
|
||||
this.$message({
|
||||
message: 'You just copied accountId',
|
||||
type: 'success',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
console.log("handMessage",1);
|
||||
message: "You just copied accountId",
|
||||
type: "success",
|
||||
duration: 5 * 1000,
|
||||
});
|
||||
console.log("handMessage", 1);
|
||||
// switch (this.type) {
|
||||
// case "hero":
|
||||
// this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].hero;
|
||||
@ -201,6 +199,7 @@ export default {
|
||||
this.type == "piece" ? this.piece.o_link > 0 : this.data.o_link > 0
|
||||
) {
|
||||
try {
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginUpdatePrice(
|
||||
this.type == "piece" ? this.piece.o_link : this.data.o_link,
|
||||
this.shell.price,
|
||||
@ -209,11 +208,11 @@ export default {
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
this.hideLoading();
|
||||
this.$emit('handMessage',1)
|
||||
this.$emit("handMessage", 1);
|
||||
}
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit('handMessage',0)
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
} else {
|
||||
@ -231,41 +230,38 @@ export default {
|
||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].piece;
|
||||
break;
|
||||
}
|
||||
const data = {
|
||||
tokenId: this.piece
|
||||
? this.piece.detail.token_id
|
||||
: this.data.detail.token_id,
|
||||
nftToken: this.nft_Token,
|
||||
nftType:
|
||||
this.type == "hero" || this.type == "weapon" ? false : true,
|
||||
marketAddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data, "dataap");
|
||||
try {
|
||||
const shellData = {
|
||||
nftToken: this.nft_Token,
|
||||
currency: this.value,
|
||||
tokenId: this.piece
|
||||
? this.piece.detail.token_id
|
||||
: this.data.detail.token_id,
|
||||
amount: this.piece ? this.cunout : 1,
|
||||
price: this.shell.price,
|
||||
marketAddress:
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
nfttype:
|
||||
this.type == "hero" || this.type == "weapon" ? false : true,
|
||||
};
|
||||
this.showLoading();
|
||||
console.log(shellData, "shellData", "999999990000000000000000");
|
||||
const nftres = await this.chainManager.bc.beginNftSell(
|
||||
this.nft_Token,
|
||||
this.value,
|
||||
const nftres = await this.chainManager.bc.beginApproveSell(
|
||||
this.piece
|
||||
? this.piece.detail.token_id
|
||||
: this.data.detail.token_id,
|
||||
this.piece ? this.cunout : 1,
|
||||
this.shell.price,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
this.type == "hero" || this.type == "weapon" ? false : true
|
||||
this.nft_Token,
|
||||
this.type == "hero" || this.type == "weapon" ? false : true,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginApproveSell");
|
||||
if (nftres.status == true) {
|
||||
this.isApprove = true;
|
||||
this.hideLoading();
|
||||
this.$emit('handMessage',1)
|
||||
// this.$emit("handMessage", 1);
|
||||
|
||||
this.handBeginNftSell();
|
||||
}
|
||||
console.log(nftres, "beginSell");
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit('handMessage',0)
|
||||
this.isApprove = false;
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
}
|
||||
@ -278,16 +274,72 @@ export default {
|
||||
// console.log(data, "dfgdg");
|
||||
// console.log(this.piece.detail.balance, "this.piece.detail.balance");
|
||||
},
|
||||
async handBeginNftSell() {
|
||||
this.$refs.deptForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
switch (this.type) {
|
||||
case "hero":
|
||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].hero;
|
||||
break;
|
||||
case "weapon":
|
||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].weapon;
|
||||
break;
|
||||
case "chip":
|
||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].chip;
|
||||
break;
|
||||
case "piece":
|
||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].piece;
|
||||
break;
|
||||
}
|
||||
try {
|
||||
const shellData = {
|
||||
nftToken: this.nft_Token,
|
||||
currency: this.value,
|
||||
tokenId: this.piece
|
||||
? this.piece.detail.token_id
|
||||
: this.data.detail.token_id,
|
||||
amount: this.piece ? this.cunout : 1,
|
||||
price: this.shell.price,
|
||||
marketAddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
this.showLoading();
|
||||
console.log(shellData, "shellData", "999999990000000000000000");
|
||||
const nftres = await this.chainManager.bc.beginNftSell(
|
||||
this.nft_Token,
|
||||
this.value,
|
||||
this.piece
|
||||
? this.piece.detail.token_id
|
||||
: this.data.detail.token_id,
|
||||
this.piece ? this.cunout : 1,
|
||||
this.shell.price,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
if (nftres.status == true) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 1);
|
||||
}
|
||||
console.log(nftres, "beginSell");
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handReduce() {
|
||||
if (this.cunout > 0) {
|
||||
if (this.cunout > 1) {
|
||||
this.cunout--;
|
||||
}
|
||||
},
|
||||
handPlus() {
|
||||
if (this.cunout <= this.piece.balance) {
|
||||
if (this.cunout < this.piece.balance) {
|
||||
this.cunout++;
|
||||
}
|
||||
},
|
||||
handMax() {
|
||||
this.cunout = this.piece.balance;
|
||||
},
|
||||
showLoading() {
|
||||
this.loadingInstance = this.$loading({
|
||||
background: "rgba(0, 0, 0, 0.8)",
|
||||
@ -479,6 +531,7 @@ $item-size: 22px;
|
||||
.confirm {
|
||||
width: 401px;
|
||||
height: 78px;
|
||||
opacity: 0;
|
||||
text-align: center;
|
||||
line-height: 78px;
|
||||
cursor: pointer;
|
||||
|
@ -68,7 +68,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pending">
|
||||
<div class="pending-order" @click="haldBuy">PEBDING ORDER</div>
|
||||
<div class="pending-order" @click="haldBuy">
|
||||
{{ isApprove == true ? "CONFIRM" : "PEBDING ORDER" }}
|
||||
</div>
|
||||
<div class="confirm">CONFIRM</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -95,6 +97,7 @@ export default {
|
||||
return {
|
||||
piece: "",
|
||||
orderId: "",
|
||||
isApprove: false,
|
||||
loadingInstance: null,
|
||||
chainManager: new ChainManager(),
|
||||
dialogVisible: false,
|
||||
@ -103,18 +106,41 @@ export default {
|
||||
methods: {
|
||||
async haldBuy() {
|
||||
const data = {
|
||||
o_link: this.data.o_link,
|
||||
price: this.data.s_price,
|
||||
currency: this.data.s_currency,
|
||||
price: this.data.s_price,
|
||||
marketDddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data, "data");
|
||||
try {
|
||||
this.showLoading()
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginApproveBuy(
|
||||
this.data.s_currency,
|
||||
this.data.s_price,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
if (nftres.status == true) {
|
||||
this.isApprove = true;
|
||||
this.hideLoading();
|
||||
this.handBeginBuy();
|
||||
}
|
||||
} catch (err) {
|
||||
this.isApprove = false;
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
async handBeginBuy() {
|
||||
const data = {
|
||||
o_link: this.data.o_link,
|
||||
marketDddress: CONTRACT_ADDRESS[AppModule.chainId].marketDddress,
|
||||
};
|
||||
console.log(data, "data");
|
||||
try {
|
||||
this.showLoading();
|
||||
const nftres = await this.chainManager.bc.beginBuy(
|
||||
this.data.o_link,
|
||||
this.data.s_price,
|
||||
this.data.s_currency,
|
||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||
);
|
||||
console.log(nftres, "beginSell");
|
||||
@ -124,7 +150,7 @@ export default {
|
||||
}
|
||||
} catch (err) {
|
||||
this.hideLoading();
|
||||
this.$emit("handMessage", 0);
|
||||
this.$emit("handMessage", 0);
|
||||
console.log("query order status error", err);
|
||||
}
|
||||
},
|
||||
@ -383,6 +409,8 @@ export default {
|
||||
.confirm {
|
||||
width: 426px;
|
||||
height: 76px;
|
||||
opacity: 0;
|
||||
opacity: 0;
|
||||
text-align: center;
|
||||
line-height: 76px;
|
||||
cursor: pointer;
|
||||
|
@ -10,6 +10,12 @@
|
||||
:src="require('@/assets/market/weapon/' + data.item_id + '.png')"
|
||||
alt=""
|
||||
/>
|
||||
<img
|
||||
v-if="data.c_id"
|
||||
width="168px"
|
||||
:src="require('@/assets/market/weapon/' + data.c_id + '.png')"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="weapon-name">
|
||||
{{ data.detail.gun_name }}
|
||||
|
@ -64,6 +64,7 @@
|
||||
@handPutHide="handPutHide"
|
||||
@handBuyShow="handBuyShow"
|
||||
@handBuyHide="handBuyHide"
|
||||
@handMessage="handMessage"
|
||||
:data="chip"
|
||||
:isType="isType"
|
||||
:isPiecePut="isPiecePut"
|
||||
|
@ -100,6 +100,7 @@
|
||||
:isBuy="isBuy"
|
||||
@handBuyShow="handBuyShow"
|
||||
@handBuyHide="handBuyHide"
|
||||
@handMessage="handMessage"
|
||||
@closeTip="closeTip"
|
||||
@showTip="showTip"
|
||||
@on-click="handDialog"
|
||||
|
@ -42,8 +42,7 @@
|
||||
<div class="rent" v-if="piece.o_link">
|
||||
{{ formatPriceShow(piece.s_price ? piece.s_price : " ", 18) }}
|
||||
</div>
|
||||
<div class="rent" v-else>
|
||||
</div>
|
||||
<div class="rent" v-else></div>
|
||||
<div class="sell">Sell</div>
|
||||
</div>
|
||||
<div class="price-content" v-else>
|
||||
@ -82,6 +81,7 @@
|
||||
@handBuyHide="handBuyHide"
|
||||
@handPutShow="handPutShow"
|
||||
@handPutHide="handPutHide"
|
||||
@handMessage="handMessage"
|
||||
></PieceDialog>
|
||||
<TheSell
|
||||
ref="selldialog"
|
||||
@ -97,7 +97,8 @@
|
||||
:type="type"
|
||||
ref="buydialog"
|
||||
:isBuy="isBuy"
|
||||
@handMessage="handMessage"
|
||||
v-if="isType !== 'mynft'"
|
||||
@handMessage="handMessage"
|
||||
@handBuyShow="handBuyShow"
|
||||
@handBuyHide="handBuyHide"
|
||||
></ChipBuyDialog>
|
||||
|
@ -83,6 +83,7 @@
|
||||
@handBuyHide="handBuyHide"
|
||||
@handPutShow="handPutShow"
|
||||
@handPutHide="handPutHide"
|
||||
@handMessage="handMessage"
|
||||
></DunDialog>
|
||||
<TheSellDialog
|
||||
:type="type"
|
||||
|
Loading…
x
Reference in New Issue
Block a user