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 @@