cart.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="container cart clearfix" :style="{paddingTop:CustomBar+'px'}">
  3. <custom :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :page='1'></custom>
  4. <cart ref="cart" :pathType='pathType'></cart>
  5. </view>
  6. </template>
  7. <script>
  8. import { mapState,mapMutations } from 'vuex';
  9. import custom from "./components/cm-navbar.vue" //顶部自定义胶囊'
  10. import cart from '@/components/cm-module/cm-cart-temp/index.vue'
  11. export default{
  12. components:{
  13. custom,
  14. cart
  15. },
  16. data(){
  17. return{
  18. nvabarData: {//顶部自定义导航
  19. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  20. showSearch: 0,
  21. title: '购物车', // 导航栏 中间的标题
  22. },
  23. headerBtnPosi:this.setHeaderBtnPosi(),//获取设备顶部胶囊高度
  24. systeminfo:this.setSysteminfo(), //获取设备信息
  25. CustomBar:this.CustomBar,// 顶部导航栏高度
  26. isIphoneX:this.$store.state.isIphoneX,
  27. isShowComponents:false,
  28. pathType:1
  29. }
  30. },
  31. onLoad(){
  32. this.isShowComponents = true;
  33. },
  34. computed: {
  35. ...mapState(['hasLogin','userInfo','isWxAuthorize'])
  36. },
  37. methods:{
  38. setHeaderBtnPosi(){
  39. // 获得胶囊按钮位置信息
  40. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  41. return headerBtnPosi
  42. },
  43. setSysteminfo(){
  44. let systeminfo;
  45. uni.getSystemInfo({ // 获取设备信息
  46. success: (res) => {
  47. systeminfo = res
  48. },
  49. })
  50. return systeminfo
  51. }
  52. },
  53. onPullDownRefresh() {//下拉刷新
  54. this.$refs.cart.initData()
  55. uni.stopPullDownRefresh()
  56. },
  57. onShow(){
  58. if(this.hasLogin){
  59. this.$refs.cart.initData()
  60. }else{
  61. this.$refs.cart.initLogin()
  62. }
  63. },
  64. }
  65. </script>
  66. <style lang="scss">
  67. </style>