index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div class="fixed bottom-[25%] right-[3%] w-[66px] z-20 cursor-pointer box-shadow">
  3. <div class="p-[6px] bg-[#fff] rounded-[12px]">
  4. <div class="mt-[8px] pb-[10px] border-b-[1px] border-solid-[#F6F6F6]">
  5. <el-popover placement="left" :width="170" trigger="hover">
  6. <template #reference>
  7. <div>
  8. <div class="flex justify-center">
  9. <img src="@/assets/images/fiexd/mobile.png" class="w-[16px] h-[20px]" />
  10. </div>
  11. <div class="text-[12px] text-[#333] text-center mt-[10px]">手机购买</div>
  12. </div>
  13. </template>
  14. <div class="text-center flex items-center justify-center">
  15. <span class="mx-[10px]">打开微信扫码分享</span>
  16. </div>
  17. <div class="promote-img flex justify-center items-center bg-[#f8f8f8] w-[146px] h-[146px]">
  18. <el-image :src="wapImage" />
  19. </div>
  20. </el-popover>
  21. </div>
  22. <NuxtLink to="/goods/cart">
  23. <div class="mt-[14px] pb-[10px] border-b-[1px] border-solid-[#F6F6F6]">
  24. <div class="flex justify-center">
  25. <img src="@/assets/images/fiexd/cart.png" class="w-[20px] h-[20px]" />
  26. </div>
  27. <div class="text-[12px] text-[#333] text-center mt-[10px]">购物车</div>
  28. </div>
  29. </NuxtLink>
  30. <NuxtLink to="/order/list" v-if="getToken()">
  31. <div class="mt-[14px] pb-[10px] border-b-[1px] border-solid-[#F6F6F6]">
  32. <div class="flex justify-center ">
  33. <img src="@/assets/images/fiexd/member.png" class="w-[20px] h-[20px]" />
  34. </div>
  35. <div class="text-[12px] text-[#333] text-center mt-[10px]">我的订单</div>
  36. </div>
  37. </NuxtLink>
  38. <div class="mt-[14px] pb-[10px] border-b-[1px] border-solid-[#F6F6F6] cursor-pointer" v-else @click="toLogin">
  39. <div class="flex justify-center ">
  40. <img src="@/assets/images/fiexd/member.png" class="w-[20px] h-[20px]" />
  41. </div>
  42. <div class="text-[12px] text-[#333] text-center mt-[10px]">我的订单</div>
  43. </div>
  44. <div class="mt-[14px]" @click="scrollTop">
  45. <div class="flex justify-center"><img src="@/assets/images/fiexd/top.png" class="w-[18px] h-[16px]" />
  46. </div>
  47. <div class="text-[12px] text-[#333] text-center mt-[10px]">回到顶部</div>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script setup lang="ts">
  53. import QRCode from 'qrcode'
  54. import { ref } from 'vue'
  55. import { getToken } from '@/utils/common'
  56. import useMemberStore from '@/stores/member'
  57. import useConfigStore from '@/stores/config'
  58. const memberStore = useMemberStore()
  59. const configStore = useConfigStore()
  60. const scrollTop = () => {
  61. let main = document.getElementById("main");
  62. main.scrollTo({
  63. top: 0,
  64. behavior: "smooth"
  65. });
  66. }
  67. const wapPreview = ref('')
  68. const wapImage = ref('')
  69. const loadQrcode = () => {
  70. wapPreview.value = `${ location.origin }/wap/`
  71. // errorCorrectionLevel:密度容错率L(低)H(高)
  72. QRCode.toDataURL(wapPreview.value, { errorCorrectionLevel: 'L', margin: 0, width: 120 }).then(url => {
  73. wapImage.value = url
  74. })
  75. }
  76. loadQrcode()
  77. // // 未登录
  78. const toLogin = () =>{
  79. if(!getToken() && !configStore.login.is_username && !configStore.login.is_mobile && !configStore.login.is_bind_mobile){
  80. ElMessage.error('商家未开启普通账号登录注册')
  81. return false
  82. }
  83. memberStore.logOpen()
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .box-shadow {
  88. box-shadow: 0 3px 20px rgba(0, 0, 0, .06)
  89. }
  90. </style>