@@ -329,7 +329,9 @@ import AccountCard from "./AccountCard.vue";
import ProgressCard from "./ProgressCard.vue";
import LuckyValue from "./LuckyValue.vue";
import MosaicChipDialog from "./MosaicChip.vue";
-
+import { AppModule } from "@/store/modules/app";
+import { CONTRACT_ADDRESS } from "@/configs/config_chain";
+import ChainManager from "@/chain/ChainManager";
export default {
props: ["dialogVisible", "hero", "isType"],
components: {
@@ -344,6 +346,8 @@ export default {
return {
isTabs: false,
type: "hero",
+ orderId: 1,
+ chainManager: new ChainManager(),
};
},
methods: {
@@ -355,6 +359,7 @@ export default {
this.$emit("on-open");
//如果需要传参的话,可以在"on-close"后面再加参数,然后在父组件的函数里接收就可以了。
},
+
closeTip() {},
showTip() {
this.isTabs = true;
@@ -380,14 +385,25 @@ export default {
this.$emit("showTip", true);
this.isTabs = true;
},
- handPutShow() {
- this.$emit("handPutShow");
+ handPutShow(data) {
+ this.$emit("handPutShow",data);
console.log("ppwowerw");
},
handBuyShow() {
this.$emit("handBuyShow");
console.log("handBuyShow");
},
+ async handremove() {
+ try {
+ const nftres = await this.chainManager.bc.beginCancelOrder(
+ this.orderId,
+ CONTRACT_ADDRESS[AppModule.chainId].marketDddress
+ );
+ console.log(nftres, "beginSell");
+ } catch (err) {
+ console.log("query order status error", err);
+ }
+ },
},
};
diff --git a/src/components/market/TheSellDialog.vue b/src/components/market/TheSellDialog.vue
index aab6e86..8d871f4 100644
--- a/src/components/market/TheSellDialog.vue
+++ b/src/components/market/TheSellDialog.vue
@@ -142,43 +142,56 @@ export default {
this.$emit("handPutHide");
},
async handMessage() {
- 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.price,
- marketAddress: CONTRACT_ADDRESS[AppModule.chainId].address,
- };
- console.log(shellData, "shellData");
- 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.price,
- CONTRACT_ADDRESS[AppModule.chainId].marketDddress
- );
- console.log(nftres, "beginSell");
- } catch (err) {
- console.log("query order status error", err);
+ if (this.data.selling ? this.data.selling > 0 : this.price.selling > 0) {
+ try {
+ const nftres = await this.chainManager.bc.beginUpdatePrice(
+ this.orderId,
+ this.price,
+ CONTRACT_ADDRESS[AppModule.chainId].marketDddress
+ );
+ console.log(nftres, "beginSell");
+ } catch (err) {
+ console.log("query order status error", err);
+ }
+ } else {
+ 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.price,
+ marketAddress: CONTRACT_ADDRESS[AppModule.chainId].address,
+ };
+ console.log(shellData, "shellData");
+ 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.price,
+ CONTRACT_ADDRESS[AppModule.chainId].marketDddress
+ );
+ console.log(nftres, "beginSell");
+ } catch (err) {
+ console.log("query order status error", err);
+ }
}
},
init(data) {
diff --git a/src/components/market/nft/HeroNft.vue b/src/components/market/nft/HeroNft.vue
index d7ccb60..b30b293 100644
--- a/src/components/market/nft/HeroNft.vue
+++ b/src/components/market/nft/HeroNft.vue
@@ -127,7 +127,9 @@ import { Component, Vue, Watch } from "vue-property-decorator";
import Herodialog from "../HeroDialog.vue";
import HeroBuyDialog from "../HeroBuyDialog.vue";
import TheSellDialog from "../TheSellDialog.vue";
-
+import { AppModule } from "@/store/modules/app";
+import { CONTRACT_ADDRESS } from "@/configs/config_chain";
+import ChainManager from "@/chain/ChainManager";
@Component({
name: "HeroNft",
components: {