<template>
  <view>

  </view>
</template>

<script>
  import {
    strToParams
  } from '@/utils/tools';
  import {
    wxMnpLogin
  } from '@/utils/login'
  export default {
    data() {
      return {
        scene: null
      };
    },
    onLoad(e) {
      const scene = strToParams(decodeURIComponent(e.scene))
      this.scene = scene
      // 清空桌号
      uni.removeStorageSync('desk');
      // 优先存储 invite_code
      if (scene.i) {
        uni.setStorageSync('INVITE_CODE', scene.i)
      }
      // 产品详细页
      if (scene.p) {
        uni.reLaunch({
          url: '/pages/product_details/index?skuId=' + scene.product
        })
      }
      // 扫码下单
      else if (scene.o) {
        uni.reLaunch({
          url: '/pageB/select_product/com_order?id=' + scene.o
        })
      }
      // 扫码桌号
      else if (scene.d) {
        const desk = scene.d
        uni.setStorageSync('desk', desk);
        // 商品分类
        const id = scene.c
        // 店铺 id
        const mid = scene.s
        uni.reLaunch({
          url: `/pageB/select_product/search?mid=${mid}&cid=${id}`
        });
      }
      // 默认跳转首页
      else {
        uni.switchTab({
          url: '/pages/index/index'
        })
      }
    }
  }
</script>
