index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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://fsy.shengsi.gov.cn/file/20240320/eb54f2488b4f45c9929d2fa78b104b80.png',
  23. inactiveImg: 'https://fsy.shengsi.gov.cn/file/20240106/29bd09ef7eb748f1820c335f86f74c61.png',
  24. text: '首页',
  25. paths: '/pagesHouse/home/index'
  26. },
  27. {
  28. activeImg: 'https://fsy.shengsi.gov.cn/file/20240320/df1512af95ff4f639e37b2fa905d7808.png',
  29. inactiveImg: 'https://fsy.shengsi.gov.cn/file/20240320/07590c34e1fc45e2af4786607418039b.png',
  30. text: '扫码核验',
  31. paths: '/pagesHouse/Verification/select'
  32. },
  33. {
  34. activeImg: 'https://fsy.shengsi.gov.cn/file/20240320/319f9665e40b40c7b056e1e50c8e1ce5.png',
  35. inactiveImg: 'https://fsy.shengsi.gov.cn/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. console.log(res)
  60. if(JSON.parse(res.result).merchantId!=uni.getStorageSync('merchantId')){
  61. uni.showToast({
  62. title:'您的核销码不是该商家的核销码',
  63. icon:'none',
  64. duration:1500
  65. })
  66. setTimeout(()=>{
  67. uni.reLaunch({
  68. url:'/pagesHouse/home/index'
  69. })
  70. },1500)
  71. }else{
  72. uni.navigateTo({
  73. url: "/pagesHouse/Verification/detailsewm?list=" + res.result
  74. })
  75. }
  76. },
  77. error: (res) => {
  78. uni.reLaunch({
  79. url:'/pagesHouse/home/index'
  80. })
  81. }
  82. })
  83. }
  84. else if (uni.getStorageSync('merchantType') == 12 ) {
  85. uni.reLaunch({
  86. url:'/pagesHouse/Verification/selectCoupon'
  87. })
  88. // Verification/ems
  89. // uni.navigateTo({
  90. // url: "/pagesHouse/Verification/ems"
  91. // });
  92. // uni.scanCode({
  93. // onlyFromCamera: true,
  94. // success: (res) => {
  95. // //
  96. // console.log(res)
  97. // uni.navigateTo({
  98. // url: "/pagesHouse/Verification/detailsewm?list=" + res.result
  99. // })
  100. // },
  101. // error: (res) => {
  102. // uni.reLaunch({
  103. // url:'/pagesHouse/home/index'
  104. // })
  105. // }
  106. // })
  107. }
  108. else {
  109. this.tabbarValues = i;
  110. uni.reLaunch({
  111. url: this.list[i].paths
  112. })
  113. }
  114. } else {
  115. this.tabbarValues = i;
  116. uni.reLaunch({
  117. url: this.list[i].paths
  118. })
  119. }
  120. // this.tabbarValues = i;
  121. // uni.reLaunch({
  122. // url: this.list[i].paths
  123. // })
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="less">
  129. /deep/.u-page__item__slot-icon {
  130. width: 48rpx;
  131. height: 48rpx;
  132. margin: 8rpx 0 4rpx;
  133. }
  134. /deep/.u-tabbar-item__text{
  135. color: #007A69;
  136. }
  137. /deep/.u-tabbar__content__item-wrapper{
  138. height: 120rpx !important;
  139. }
  140. /deep/.u-tabbar-item {
  141. &:nth-child(2){
  142. .u-page__item__slot-icon,image {
  143. width: 72rpx;
  144. height: 54rpx;
  145. }
  146. }
  147. }
  148. </style>