index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  3. <u-tabbar :value="tabbarValues" @change="name => tabbarValues = name" :fixed="true" :placeholder="true" activeColor="#007A69"
  4. :safeAreaInsetBottom="true" :border="false">
  5. <u-tabbar-item :text="item.text" v-for="(item,index) in list" :key="index"
  6. @click="changeTabbars(item,index)">
  7. <image class="u-page__item__slot-icon" slot="active-icon" :src="item.activeImg"></image>
  8. <image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.inactiveImg"></image>
  9. </u-tabbar-item>
  10. </u-tabbar>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. tabbarid: 0
  17. },
  18. data() {
  19. return {
  20. tabbarValues: 0,
  21. list: [{
  22. activeImg: 'https://i.ringzle.com/file/20240320/eb54f2488b4f45c9929d2fa78b104b80.png',
  23. inactiveImg: 'https://i.ringzle.com/file/20240106/29bd09ef7eb748f1820c335f86f74c61.png',
  24. text: '首页',
  25. paths: '/pagesHouse/home/index'
  26. },
  27. {
  28. activeImg: 'https://i.ringzle.com/file/20240320/df1512af95ff4f639e37b2fa905d7808.png',
  29. inactiveImg: 'https://i.ringzle.com/file/20240320/07590c34e1fc45e2af4786607418039b.png',
  30. text: '扫码核验',
  31. paths: '/pagesHouse/Verification/index'
  32. },
  33. {
  34. activeImg: 'https://i.ringzle.com/file/20240320/319f9665e40b40c7b056e1e50c8e1ce5.png',
  35. inactiveImg: 'https://i.ringzle.com/file/20240320/81146a88ac964a8ab1effff76f44c9d1.png',
  36. text: '我的',
  37. paths: '/pagesHouse/Mine/index'
  38. }
  39. ]
  40. }
  41. },
  42. mounted() {
  43. this.tabbarValues = this.tabbarid;
  44. },
  45. methods: {
  46. changeTabbars(e, i) {
  47. console.log(e, i, '000');
  48. if (i == 1) {
  49. console.log('111111111111111111', )
  50. if (uni.getStorageSync('merchantType') == 4) {
  51. // Verification/ems
  52. // uni.navigateTo({
  53. // url: "/pagesHouse/Verification/ems"
  54. // });
  55. uni.scanCode({
  56. onlyFromCamera: true,
  57. success: (res) => {
  58. //
  59. if(JSON.parse(res.result).merchantId!=uni.getStorageSync('merchantId')){
  60. uni.showToast({
  61. title:'您的核销码不是该商家的核销码',
  62. icon:'none',
  63. duration:1500
  64. })
  65. setTimeout(()=>{
  66. uni.reLaunch({
  67. url:'/pagesHouse/home/index'
  68. })
  69. },1500)
  70. }else{
  71. uni.navigateTo({
  72. url: "/pagesHouse/Verification/detailsewm?list=" + res.result
  73. })
  74. }
  75. },
  76. error: (res) => {
  77. uni.reLaunch({
  78. url:'/pagesHouse/home/index'
  79. })
  80. }
  81. })
  82. } else {
  83. this.tabbarValues = i;
  84. uni.reLaunch({
  85. url: this.list[i].paths
  86. })
  87. }
  88. } else {
  89. this.tabbarValues = i;
  90. uni.reLaunch({
  91. url: this.list[i].paths
  92. })
  93. }
  94. // this.tabbarValues = i;
  95. // uni.reLaunch({
  96. // url: this.list[i].paths
  97. // })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="less">
  103. /deep/.u-page__item__slot-icon {
  104. width: 38rpx;
  105. height: 38rpx;
  106. margin: 8rpx 0 4rpx;
  107. }
  108. /deep/.u-tabbar-item__text{
  109. color: #007A69;
  110. }
  111. /deep/.u-tabbar-item {
  112. &:nth-child(2){
  113. .u-page__item__slot-icon,image {
  114. width: 72rpx;
  115. height: 54rpx;
  116. }
  117. }
  118. }
  119. </style>