From ce17cb4060e8f60dee7b203dc75331bfa9e2f38a Mon Sep 17 00:00:00 2001 From: cebgcontract <99630598+cebgcontract@users.noreply.github.com> Date: Thu, 7 Apr 2022 13:57:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E5=AE=98=E6=96=B9=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E7=9A=84=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/market/mall/OneBox.vue | 14 +++++- src/views/desktop/Mall.vue | 64 ++++----------------------- src/views/desktop/Presale.vue | 8 ++-- 3 files changed, 24 insertions(+), 62 deletions(-) diff --git a/src/components/market/mall/OneBox.vue b/src/components/market/mall/OneBox.vue index 2310d3f..48945d1 100644 --- a/src/components/market/mall/OneBox.vue +++ b/src/components/market/mall/OneBox.vue @@ -61,6 +61,9 @@ import { UserModule } from '@/store/modules/user' import ChainManager from '@/chain/ChainManager' import { EventBus, PRESALE_BEGIN, PRESALE_ERROR, PRESALE_ORDER_GET } from '@/utils/event-bus' import { buyBox } from '@/api/Mall' +import { buyShopBox } from '@/api/Market' + +export const TMP_SHOP_ORDER_ID = 'tmp_presale_order_id' export interface IBoxData{ level: string @@ -79,6 +82,8 @@ export interface IBoxData{ }) export default class OneBox extends Vue { @Prop() private boxData: IBoxData + @Prop() private preSale: boolean + chainManger = new ChainManager() formatPriceShow(price: number|string, decimals?: number, fixed = 2) { @@ -134,9 +139,14 @@ export default class OneBox extends Vue { signature } await this.chainManger.bc.increaseAllowance(priceData.contract_address, price) - const res: any = await buyBox(buyData) + let res: any + if (this.preSale) { + res = await buyBox(buyData) + } else { + res = await buyShopBox(buyData) + } const orderId = res.order_id - localStorage.setItem('tmp_presale_order_id', orderId) + localStorage.setItem(TMP_SHOP_ORDER_ID, orderId) EventBus.$emit(PRESALE_ORDER_GET, orderId) } catch (err) { console.log('buy error: ', err) diff --git a/src/views/desktop/Mall.vue b/src/views/desktop/Mall.vue index 6485c4c..e2cfb56 100644 --- a/src/views/desktop/Mall.vue +++ b/src/views/desktop/Mall.vue @@ -26,7 +26,7 @@