index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="Tabbar" :style="'padding-bottom:' + bottomBlankHeignt + 'rpx;height:115rpx;'">
  3. <!-- <view class="tab-item" bindtap="goTimely">
  4. <image class="nav_icon21 image" src="/pages/images/{{channel==='sort' ? iconSrc + 'sort_h':'sort'}}.png"></image>
  5. <view class="{{channel==='store'?'active':''}}">及时达</view>
  6. </view> -->
  7. <view class="tab-item" @tap="goHome">
  8. <image class="nav_icon11 image" :src="'/static/pages/images/' + (channel==='home'? iconSrc + 'home_h':'home') + '.png'"></image>
  9. <view :class="channel==='home'?'active':''">积分商城</view>
  10. </view>
  11. <!-- <view class="tab-item" bindtap="goLive">
  12. <image class="nav_icon21 image" src="/pages/images/{{channel==='live'? iconSrc + 'live_h':'live'}}.png"></image>
  13. <view class="{{channel==='live'?'active':''}}">直播</view>
  14. </view> -->
  15. <view class="img4 tab-item" @tap="goCart">
  16. <image class="nav_icon41 image" :src="'/static/pages/images/' + (channel==='cart'? iconSrc + 'cart_h':'cart') + '.png'"></image>
  17. <view :class="channel==='cart'?'active':''">兑换清单
  18. <text class="dots" v-if="count > 0">{{count}}</text>
  19. </view>
  20. </view>
  21. <view class="tab-item" @tap="goOrder">
  22. <image class="nav_icon41 image" :src="'/static/pages/images/' + (channel==='order'? iconSrc + 'cart_h':'cart') + '.png'"></image>
  23. <view :class="channel==='order'?'active':''">积分订单</view>
  24. </view>
  25. <!-- <view class="img5 tab-item" bindtap="goUser">
  26. <image class="nav_icon51 image" src="/pages/images/{{channel==='user'? iconSrc + 'user_h':'user'}}.png"></image>
  27. <view class="{{channel==='user'?'active':''}}">我的</view>
  28. </view> -->
  29. </view>
  30. </template>
  31. <script>
  32. const app = getApp();
  33. const req = require("../../utils/request.js");
  34. import foot from "./index";
  35. export default {
  36. data() {
  37. return {
  38. // channel: 'home',
  39. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  40. iconSrc: req.public.iconSrc,
  41. about: {},
  42. count: ""
  43. };
  44. },
  45. components: {
  46. foot
  47. },
  48. props: {
  49. channel: {
  50. type: String,
  51. default: 'home'
  52. },
  53. isUpdate: {
  54. type: Boolean,
  55. default: false
  56. },
  57. productType: {
  58. type: Number,
  59. default: 0
  60. }
  61. },
  62. watch: {
  63. "isUpdate": function (isUpdate) {
  64. // console.log('需要更新消息', isUpdate);
  65. if (!this.isReady) return;
  66. this.getCount();
  67. }
  68. },
  69. mounted() {
  70. // console.log('ready');
  71. this.isReady = true;
  72. this.getCount();
  73. },
  74. methods: {
  75. getCount() {
  76. let from = {};
  77. if (this.productType == 2) {
  78. from.purchaseType = 2;
  79. } else {
  80. from.purchaseType = 1;
  81. }
  82. // req.getRequest('/api/purchase/count', from, res => {
  83. // this.setData({
  84. // count: res
  85. // });
  86. // });
  87. },
  88. /**
  89. * 跳转
  90. */
  91. goHome: function () {
  92. if (this.channel === "home") return;
  93. uni.redirectTo({
  94. url: '/integralshop/index/index'
  95. });
  96. },
  97. goTimely: function () {
  98. if (this.channel === "sort") return;
  99. app.globalData.switchTab('pages/timelyDelivery/index');
  100. },
  101. goLive: function () {
  102. if (this.channel === "live") return;
  103. app.globalData.switchTab('pages/live/live');
  104. },
  105. goCart: function () {
  106. if (this.channel === "cart") return;
  107. uni.redirectTo({
  108. url: '/integralshop/cart/cart'
  109. });
  110. },
  111. goUser: function () {
  112. if (this.channel === "user") return;
  113. app.globalData.switchTab('pages/user/user');
  114. },
  115. goOrder: function () {
  116. if (this.channel === "oredr") return;
  117. app.globalData.redirectTab('integralshop/order/order?orderType=11');
  118. }
  119. }
  120. };
  121. </script>
  122. <style>
  123. @import "./index.css";
  124. </style>