<template>
  <view>
    <yi-goods-detail :mid="mid" @createOrder="handleCreateOrder" @goToCart="gotoCart" />
  </view>
</template>

<script>
export default {
  name: 'goodsDemo',
  data() {
    return {
      mid: null,
    };
  },
  onLoad(query) {
    // console.log('%c [aaa]: ', 'color:#1989fa;', query);
    this.mid = query.mid;
  },
  methods: {
    handleCreateOrder(orderForm) {
      const createOrderUrl = `/demo/packageMall/newOrder?orderForm=${JSON.stringify(orderForm)}`;
      uni.navigateTo({
        url: createOrderUrl,
      });
    },
    gotoCart() {
      uni.navigateTo({
        url: '/demo/packageMall/cart',
      });
    },
  },
};
</script>

<style scoped></style>
