123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <view class="container cart clearfix" :style="{paddingTop:CustomBar+'px'}">
- <custom :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :page='1'></custom>
- <cart ref="cart" :pathType='pathType'></cart>
- </view>
- </template>
- <script>
- import { mapState,mapMutations } from 'vuex';
- import custom from "./components/cm-navbar.vue" //顶部自定义胶囊'
- import cart from '@/components/cm-module/cm-cart-temp/index.vue'
- export default{
- components:{
- custom,
- cart
- },
- data(){
- return{
- nvabarData: {//顶部自定义导航
- showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
- showSearch: 0,
- title: '购物车', // 导航栏 中间的标题
- },
- headerBtnPosi:this.setHeaderBtnPosi(),//获取设备顶部胶囊高度
- systeminfo:this.setSysteminfo(), //获取设备信息
- CustomBar:this.CustomBar,// 顶部导航栏高度
- isIphoneX:this.$store.state.isIphoneX,
- isShowComponents:false,
- pathType:1
- }
- },
- onLoad(){
- this.isShowComponents = true;
- },
- computed: {
- ...mapState(['hasLogin','userInfo','isWxAuthorize'])
- },
- methods:{
- setHeaderBtnPosi(){
- // 获得胶囊按钮位置信息
- let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
- return headerBtnPosi
- },
- setSysteminfo(){
- let systeminfo;
- uni.getSystemInfo({ // 获取设备信息
- success: (res) => {
- systeminfo = res
- },
- })
- return systeminfo
- }
- },
- onPullDownRefresh() {//下拉刷新
- this.$refs.cart.initData()
- uni.stopPullDownRefresh()
- },
- onShow(){
- if(this.hasLogin){
- this.$refs.cart.initData()
- }else{
- this.$refs.cart.initLogin()
- }
- },
- }
- </script>
- <style lang="scss">
- </style>
|